From 402020f22875cc10d8539a7c11102e089726a417 Mon Sep 17 00:00:00 2001 From: Dario Ernst Date: Sun, 19 Mar 2017 11:46:34 +0100 Subject: [PATCH] add suspend to i3 --- i3/config | 7 ++++++- lock.sh | 2 +- susp.sh | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 susp.sh diff --git a/i3/config b/i3/config index 4e474b4..809f8d1 100644 --- a/i3/config +++ b/i3/config @@ -45,7 +45,7 @@ font pango:monospace 8 floating_modifier $mod # start a terminal -bindsym $mod+Return exec i3-sensible-terminal +bindsym $mod+Return exec xfce4-terminal # start chromium bindsym $mod+BackSpace exec chromium @@ -56,6 +56,10 @@ bindsym $mod+Delete exec scrot -s # kill focused window bindsym $mod+Shift+x kill +bindsym Print exec pactl set-sink-volume 0 -5% ; exec pactl set-sink-volume 1 -5% +bindsym Scroll_Lock exec pactl set-sink-volume 0 +5% ; exec pactl set-sink-volume 1 +5% +bindsym Pause exec pactl set-sink-mute 0 toggle ; exec pactl set-sink-mute 1 toggle + # start dmenu (a program launcher) #bindsym $mod+a exec dmenu_run # There also is the (new) i3-dmenu-desktop which only displays applications @@ -156,6 +160,7 @@ bindsym $mod+Shift+l exec "i3-nagbar -t warning -m 'You pressed the exit shortcu bindsym $mod+Tab exec rofi -show window bindsym $mod+a exec rofi -show drun bindsym $mod+F2 exec sh ~/config/lock.sh +bindsym $mod+F4 exec sh ~/config/susp.sh bindsym $mod+F12 exec xfce4-terminal --drop-down #for_window [class="(?i)xfce4-terminal"] floating enable #for_window [class="(?i)xfce4-terminal"] border none diff --git a/lock.sh b/lock.sh index c646ada..49d42ac 100755 --- a/lock.sh +++ b/lock.sh @@ -8,7 +8,7 @@ trap revert HUP INT TERM xset dpms 25 25 25 scrot /tmp/screen.png -convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png +convert /tmp/screen.png -scale 5% -scale 2000% /tmp/screen.png i3lock -n -f -p win -i /tmp/screen.png revert diff --git a/susp.sh b/susp.sh new file mode 100755 index 0000000..923edd3 --- /dev/null +++ b/susp.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +revert() { + xset dpms 0 0 0 +} +trap revert HUP INT TERM + +xset dpms 25 25 25 + +scrot /tmp/screen.png +convert /tmp/screen.png -scale 5% -scale 2000% /tmp/screen.png +i3lock -f -p win -i /tmp/screen.png +PID=$! + +systemctl suspend + +wait $PID + +revert +