diff --git a/.config/i3/layers/config.main b/.config/i3/layers/config.main index 9754ca7..0bd2b3e 100644 --- a/.config/i3/layers/config.main +++ b/.config/i3/layers/config.main @@ -171,58 +171,15 @@ bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" +# Exit control +bindsym $mod+Shift+e exec --no-startup-id dmenuexit +# Resize window bindsym $mod+y resize shrink width 5 px or 5 ppt bindsym $mod+u resize grow height 5 px or 5 ppt bindsym $mod+i resize shrink height 5 px or 5 ppt bindsym $mod+o resize grow width 5 px or 5 ppt -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym h resize shrink width 5 px or 5 ppt - bindsym j resize grow height 5 px or 5 ppt - bindsym k resize shrink height 5 px or 5 ppt - bindsym l resize grow width 5 px or 5 ppt - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 5 px or 5 ppt - bindsym Down resize grow height 5 px or 5 ppt - bindsym Up resize shrink height 5 px or 5 ppt - bindsym Right resize grow width 5 px or 5 ppt - - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" -} - -bindsym $mod+r mode "resize" - -mode "system" { - bindsym l exec --no-startup-id i3exit lock, mode "default" - bindsym s exec --no-startup-id i3exit suspend, mode "default" - bindsym h exec --no-startup-id i3exit hibernate, mode "default" - bindsym u exec --no-startup-id i3exit switch_user, mode "default" - bindsym Shift+l exec "i3-nagbar -t warning -m 'Are you sure you want to log out?' -B 'Yes' 'i3exit logout'" - bindsym p exec "i3-nagbar -t warning -m 'Are you sure you want to power off?' -B 'Yes' 'poweroff'" - bindsym r exec "i3-nagbar -t warning -m 'Are you sure you want to reboot?' -B 'Yes' 'reboot'" - - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+Shift+s mode "default" -} - -bindsym $mod+Shift+s mode "system" - # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) bar { diff --git a/.config/i3/layers/config.post-main-90-laptop b/.config/i3/layers/config.post-main-90-laptop index 8c0df8d..364168f 100644 --- a/.config/i3/layers/config.post-main-90-laptop +++ b/.config/i3/layers/config.post-main-90-laptop @@ -1,8 +1,6 @@ -mode "system" { - # brightness control - bindsym j exec --no-startup-id sudo brightnessctl set -q 5%- - bindsym k exec --no-startup-id sudo brightnessctl set -q +5% -} +# brightness control +bindsym $mod+Ctrl+j exec sudo brightnessctl set -q 5%- +bindsym $mod+Ctrl+k exec sudo brightnessctl set -q +5% # Battery manager -exec_always --no-startup-id killall battmon; ~/.config/i3/scripts/battmon +exec_always --no-startup-id killall battmon; battmon diff --git a/.local/bin/dmenuexit b/.local/bin/dmenuexit new file mode 100755 index 0000000..e04a683 --- /dev/null +++ b/.local/bin/dmenuexit @@ -0,0 +1,34 @@ +#!/bin/bash + +ACTION="$(xargs -n 1 <<<"Lock Suspend Hibernate 'Exit i3' Shutdown Reboot" | dmenu -i -p "exitctl")" +[ -z "$ACTION" ] && exit 1 +echo "INFO: Selected action $ACTION." + +CONFIRMATION="$(xargs -n 1 <<<"No Yes" | dmenu -i -p "Are you sure you want to ${ACTION,,}?")" +{ [ -z "$CONFIRMATION" ] || [[ "$CONFIRMATION" != "Yes" ]]; } && exit 1 + +echo "INFO: Action confirmed." + +case "${ACTION,,}" in +lock) + loginctl lock-session + ;; +suspend) + systemctl suspend + ;; +hibernate) + systemctl hibernate + ;; +'exit i3') + i3-msg exit + ;; +shutdown) + poweroff + ;; +reboot) + reboot + ;; +*) + echo "ERROR: Invalid action '${ACTION,,}'." 1>&2 + ;; +esac