The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

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

asked 2014-10-17 13:22:25 +0000

UNera gravatar image

For example I bind +- keys for alsa volume.

I want see current voulume after a shortcut was pressed.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-10-17 14:25:17 +0000

cee gravatar image

updated 2014-10-18 18:37:57 +0000

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.

edit flag offensive delete link more


`@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 ( 2014-10-17 14:34:14 +0000 )edit

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

cee gravatar imagecee ( 2014-10-17 14:38:04 +0000 )edit

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

cee gravatar imagecee ( 2014-10-17 14:41:12 +0000 )edit

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

Adaephon gravatar imageAdaephon ( 2014-10-17 15:04:03 +0000 )edit

answered 2014-10-17 14:24:39 +0000

Adaephon gravatar image

updated 2014-10-17 14:26:17 +0000

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"
edit flag offensive delete link more

Question Tools


Asked: 2014-10-17 13:22:25 +0000

Seen: 146 times

Last updated: Oct 18 '14