Skip to content

u/orestisf

In this archive from Jun 2014 to Jan 2019

3
posts
41
comments
0
media
259
score

Not talking about your terminal, set this in your i3 config. There is a difference between i3 syntax and bash (or zsh or whatever shell you have) syntax.

You need to have:

set $brillo pkexec /usr/bin/brillo -equ 1500
bindsym XF86MonBrightnessUp exec true $($brillo -A 5)
bindsym XF86MonBrightnessDown exec true $($brillo -U 5)

Or just try bindsym XF86MonBrightnessUp exec true $(pkexec /usr/bin/brillo -equ 1500 -U 5)

2 points

Where is that quote taken from?

In the description of the function, few lines above the linked code

Also I thought PID 1 adopted any parentless processes automatically

Yes, a single fork is not a parentless process: i3 would still be the parent but would never "reap" the process. With a double fork, i3 opens a process that forks and immediately exits. The new child doesn't have a parent in this case and PID1 adopts it.

1 points

Yes, i3 double forks: https://github.com/i3/i3/blob/dfe89cc4f1706a6fae0ae3816787d0fb22dadd7d/src/startup.c#L175-L199

You can also try: bindsym XF86MonBrightnessUp exec sh -c "pkexec ..."

This still fails for me. i3 already runs exec lines through sh -c. What I think is happening here is that sh -c will exec the commands, meaning that sh is not the parent but sh's parent is the parent (exec "replaces the current process image with a new process image").

If the parent is /sbin/init system then pkexec refuses to run: https://github.com/wingo/polkit/blob/4c9a813f3fc1ada4fcce508d286e95f965a3002a/src/programs/pkexec.c#L725-L732. But this is exactly what i3 achieves by double forking.

1 points

To configure i3 or Sway to use brillo, add the following to your config:

set $brillo exec pkexec /usr/bin/brillo -equ 1500
bindsym XF86MonBrightnessDown exec $brillo -U 5
bindsym XF86MonBrightnessUp exec $brillo -A 5

Don't know if sway does things differently but pkexec refuses to execute like this under i3 with an error: "Refusing to render service to dead parents."

A workaround is to use set $brillo pkexec /usr/bin/brillo -equ 1500, bindsym XF86MonBrightnessUp exec true $($brillo -U 5)

3 points

Did you mark everything as executable (chmod +x)? Do the scripts work outside of chromium? Running ~/bin/thunar-chromium/xdg-mime should output nautilus.desktop, running ~/bin/thunar-chromium/nautilus /path/to/some/file should open thunar and select the file. same thing with ~/bin/thunar-open-file.py /path/to/some/file.

1 points

I got it work actually: https://github.com/orestisf1993/dotfiles/commit/a655877cb4eeb4ce06f8bec282c192bffe3e6f51

You can organize it however you want, here's the concept:

  1. Create a folder, ~/bin/thunar-chromium/ for me.

  2. Put these 2 files in it: nautilus, xdg-mime. Filenames matter here.

  3. Put thunar-open-file.py in ~/bin (or wherever you like, just make sure to change ~/bin/thunar-chromium/nautilus accordingly.

  4. Prepend $HOME/bin/thunar-chromium: to your path before calling chromium. Multiple ways to do this. I personally added a file called chromium in a folder I keep some executables and made sure that it's called instead of /usr/bin/chromium. Eg:

     $ which chromium
     /home/orestis/bin/exes/chromium
    
1 points

Thunar can't actually select a file by default (if you pass the full path it tries to open it and there isn't a --select argument) but can probably be done with this.

The relevant bug pages seems to be this. and this. Chromium uses xdg-open and doesn't pass the filename, only the directory. There might be a workaround, mentioned in this comment.

If you manage to make it work please reply here since I am interested too. Otherwise I might take a look at it tomorrow (12+ hours, I have to watch GoT first :D).

5 points

I wrote this service:

[Unit]
Description=Update /etc/issue with neofetch
Before=getty@tty1.service getty@tty2.service getty@rrt3.service getty@tty4.service getty@tty5.service getty@tty6.service

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'neofetch > /etc/issue'

[Install]
WantedBy=multi-user.target

if anyone wants to use it. Don't know if there is a way to not run neofetch with superuser rights though.

EDIT: ExecStart=/bin/bash -c 'sudo -u nobody neofetch | tee /etc/issue' could avoid root neofetch.

3 points

I do this in my ~/.xinitrc:

# Auto-lock after some time.
xautolock -locker '~/bin/lock.sh' -time ${AUTOLOCK_TIME}&
# Auto-lock after suspend.
# https://wiki.archlinux.org/index.php/Power_management#xss-lock
xss-lock -- "$HOME/bin/lock.sh"&
3 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.