From 6fca9f7de29cff97b4e7f4846f8325aac58b8ef4 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Sat, 29 Feb 2020 00:41:05 -0600 Subject: [PATCH] screen now turns off when i3lock is called and the system is not suspended. also added background image restoring. Not setting bg image setting, so that bg image can be different on different machines. Use feh to set background. --- .gitignore | 3 ++- i3/.config/i3/config | 13 +++++++++---- scripts/screen_off | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100755 scripts/screen_off diff --git a/.gitignore b/.gitignore index 1c80e3a..8d9d215 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.swp *.directory .netrwhist -vifminfo *.log +vifminfo +vifm-help.txt diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 0cd70a0..886674a 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -17,6 +17,10 @@ #modifier key. mod 4 is the logo key on most keyboards. set $mod Mod4 +#helper scripts directory +#for some reason, setting this does not work! +#set $scripts "~/dotfiles/scripts + # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. font pango:monospace 8 @@ -171,9 +175,10 @@ font pango:DejaVu Sans Mono 8 bindsym $mod+r mode "resize" - # lock the screen with mod+x, and lock+sleep computer with mod+shift+x + # lock and turn off the screen with mod+x, and lock+sleep computer with mod+shift+x set $lock_command i3lock - bindsym $mod+x exec --no-startup-id "$lock_command" + set $lock_command_nof i3lock -n #versuon of $lock_command that does not fork. + bindsym $mod+x exec --no-startup-id "~/dotfiles/scripts/screen_off $lock_command_nof" bindsym $mod+shift+x exec --no-startup-id "$lock_command"; exec "systemctl suspend" #screenshot everything with mod+s, current window with mod+shift+x @@ -206,5 +211,5 @@ bar { #geoclue exec --no-startup-id /usr/lib/geoclue-2.0/demos/agent - #redshift - exec --no-startup-id redshift-gtk + #resetting the wallpaper. We are not setting it here, so we can have different wallpapers on different machines. use feh --bg-fill FILE to set it. it will write a .fehbg file. + ~/.fehbg diff --git a/scripts/screen_off b/scripts/screen_off new file mode 100755 index 0000000..b2942d8 --- /dev/null +++ b/scripts/screen_off @@ -0,0 +1,19 @@ +#! /bin/bash + +#warning! $locker MUST NOT FORK! It must wait to exit until after the screen has been unlocked. + +#arguments + +locker=$@ + +#make sure we set screen back to defaults if we force close the script +cleanup() { + xset dpms 0 0 60 #&& echo "cleaned up!" + exit +} + +trap "cleanup" EXIT + +#runs the locker, than makes the screen time out after 1 sec of inactivity +xset dpms 0 0 1 +$locker