The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

How to redraw status line after a shortcut or any shortcut?

asked Oct 17 '14

UNera gravatar image

For example I bind +- keys for alsa volume.

I want see current voulume after a shortcut was pressed.

2 answers

Sort by » oldest newest most voted
0

answered Oct 17 '14

cee gravatar image

updated Oct 18 '14

I defined a variable $update in my config file that can be appended to any command that you would like to update the statusbar.

set $update && killall -SIGUSR1 i3status

For volume up, down and mute I have following commands:

bindsym XF86AudioLowerVolume    exec $psst pactl set-sink-volume @DEFAULT_SINK@ -- -5% && pactl set-sink-mute @DEFAULT_SINK@ 0 $update
bindsym XF86AudioRaiseVolume    exec $psst pactl set-sink-volume @DEFAULT_SINK@ -- +5% && pactl set-sink-mute @DEFAULT_SINK@ 0 $update
bindsym XF86AudioMute           exec $psst pactl set-sink-mute @DEFAULT_SINK@ toggle $update

where $psst is another variable that just disables any startup notification.

set $psst --no-startup-id

You can find my whole config file on github for reference.

Comments

`@DEFAULT_SINK@`! I've been looking for ages for a non-stupid way to tell pactl to use the *default sink*. Thank you! Which documentation did I overlook? (Just so that I can feel even more stupid...)

Adaephon gravatar imageAdaephon (Oct 17 '14)edit

Took me also a while and a good amount of "google-luck" to find it :-)

cee gravatar imagecee (Oct 17 '14)edit
1

Now I remember the source: `pactl --help`. But funnily `man pactl` does *NOT* reveal this secret.

cee gravatar imagecee (Oct 17 '14)edit

...! Ok, now I really *do* feel stupid. But then again, that one sentence really should be part of the manpage.

Adaephon gravatar imageAdaephon (Oct 17 '14)edit
0

answered Oct 17 '14

Adaephon gravatar image

updated Oct 17 '14

You can send the signal SIGUSR1 to i3status to force an update. To do this add ; killall -SIGUSR1 i3stats to the commands you use for volume control and make sure that the whole command (what is actually run, not the i3 configuration parts) is in quotes, else the ; will be interpreted by i3.

So something like this should work

bindsym SomeKey exec --no-startup-id "change-volume +5 ; killall -SIGUSR1 i3status"

Question Tools

Stats

Asked: Oct 17 '14

Seen: 146 times

Last updated: Oct 18 '14