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.
This commit is contained in:
Gabe Venberg 2020-02-29 00:41:05 -06:00
parent 214ffb5bc1
commit 6fca9f7de2
3 changed files with 30 additions and 5 deletions

3
.gitignore vendored
View file

@ -1,5 +1,6 @@
*.swp
*.directory
.netrwhist
vifminfo
*.log
vifminfo
vifm-help.txt

View file

@ -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

19
scripts/screen_off Executable file
View file

@ -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