i3: Add 'power' mode binding

This adds a seperate mode binding for controlling power state (suspend,
reboot and poweroff)
This commit is contained in:
Jens Sauer 2020-12-03 13:38:07 +01:00
parent f5c4e837df
commit 6fe90417bd

View File

@ -208,12 +208,28 @@ bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
# Lock and power settings # power settings
set $mode_power Power: [s]uspend [r]eboot [p]oweroff
mode "$mode_power" {
# These bindings trigger as soon as you enter the power mode
# Pressing r will reboot
# Pressing p will poweroff
# Pressing s will leave power binding mode and suspend
bindsym r exec --no-startup-id systemctl reboot
bindsym p exec --no-startup-id systemctl poweroff
bindsym s exec --no-startup-id i3-msg mode "default" && systemctl suspend
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+p mode "$mode_power"
# lock settings
exec --no-startup-id light-locker --lock-on-suspend exec --no-startup-id light-locker --lock-on-suspend
bindsym $mod+u exec --no-startup-id light-locker-command -l bindsym $mod+u exec --no-startup-id light-locker-command -l
bindsym $mod+i exec --no-startup-id systemctl suspend
bindsym $mod+p exec --no-startup-id systemctl poweroff
bindsym $mod+z exec --no-startup-id systemctl reboot
# Brightness # Brightness
bindsym XF86MonBrightnessDown exec --no-startup-id brightness decrease 50 bindsym XF86MonBrightnessDown exec --no-startup-id brightness decrease 50