i3wm: added i3exit script.

This commit is contained in:
2018-12-10 19:38:19 -02:00
parent 546735aae5
commit 1ca92c9fbf
2 changed files with 79 additions and 10 deletions

View File

@@ -37,12 +37,6 @@ bindsym $mod+c exec konsole
# kill focused window # kill focused window
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
## ARROW ALTERNATE KEYS ## ## ARROW ALTERNATE KEYS ##
set $Left "j" set $Left "j"
@@ -142,7 +136,7 @@ bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session) # 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'" #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'"
# resize window (you can also use the mouse for that) # resize window (you can also use the mouse for that)
mode "resize" { mode "resize" {
@@ -189,14 +183,39 @@ set $lock import -window root -colorspace gray /tmp/i3lock.png; convert /tmp/i3l
### KEYBINDINGS ### ### KEYBINDINGS ###
## xmodmap -pke ## xmodmap -pke
bindsym $mod+z exec "$lock" bindsym $mod+z exec --no-startup-id i3exit lock
bindsym $mod+Shift+z exec "$lock && systemctl suspend" bindsym $mod+Shift+z mode "$mode_exit"
bindsym $mod+Shift+d exec --no-startup-id i3-dmenu-desktop bindsym $mod+Shift+e mode "$mode_exit"
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
bindsym $mod+backslash move scratchpad bindsym $mod+backslash move scratchpad
bindsym $mod+Shift+bar scratchpad show bindsym $mod+Shift+bar scratchpad show
bindsym $mod+comma move scratchpad bindsym $mod+comma move scratchpad
bindsym $mod+period scratchpad show bindsym $mod+period scratchpad show
# start dmenu (a program launcher)
bindsym $mod+Shift+d exec dmenu_run
# mode Exit - requires i3exit script
#
set $mode_exit System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_exit" {
bindsym l exec --no-startup-id /home/renato/src/sysadmin/i3wm/i3exit.sh lock, mode "default"
bindsym e exec --no-startup-id /home/renato/src/sysadmin/i3wm/i3exit.sh logout, mode "default"
bindsym s exec --no-startup-id /home/renato/src/sysadmin/i3wm/i3exit.sh suspend, mode "default"
bindsym h exec --no-startup-id /home/renato/src/sysadmin/i3wm/i3exit.sh hibernate, mode "default"
bindsym r exec --no-startup-id /home/renato/src/sysadmin/i3wm/i3exit.sh reboot, mode "default"
bindsym Shift+s exec --no-startup-id /home/renato/src/sysadmin/i3wm/i3exit.sh shutdown, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
# 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'"
# XKBOPTIONS compose key # XKBOPTIONS compose key
exec_always --no-startup-id setxkbmap -option "compose:menu" exec_always --no-startup-id setxkbmap -option "compose:menu"

50
i3wm/i3exit.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/sh
lock() {
import -window root -colorspace gray /tmp/i3lock.png;
convert /tmp/i3lock.png -blur 0x5 /tmp/i3lock-blur.png;
rm -f /tmp/i3lock.png;
i3lock -i /tmp/i3lock-blur.png -c 00001e -e -f -p win
#bindsym $mod+z exec "$lock"
#bindsym $mod+Shift+z exec "$lock && systemctl suspend"
#i3lock
}
case "$1" in
lock)
lock
;;
logout)
i3-msg exit
;;
suspend)
lock && systemctl suspend
;;
hibernate)
lock && systemctl hibernate
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0
### USAGE
#set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
#mode "$mode_system" {
# bindsym l exec --no-startup-id i3exit lock, mode "default"
# bindsym e exec --no-startup-id i3exit logout, mode "default"
# bindsym s exec --no-startup-id i3exit suspend, mode "default"
# bindsym h exec --no-startup-id i3exit hibernate, mode "default"
# bindsym r exec --no-startup-id i3exit reboot, mode "default"
# bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"
#
# # back to normal: Enter or Escape
# bindsym Return mode "default"
# bindsym Escape mode "default"
#}
#bindsym $mod+z mode "$mode_system"