1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

i3: improve automatic/timeout/suspend locking

This commit is contained in:
Joe Groocock 2018-11-28 20:01:50 -08:00
parent 809f27b576
commit 59ac129a85
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
6 changed files with 19 additions and 14 deletions

View File

@ -137,7 +137,7 @@ bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Ctrl+Return exec i3-sensible-terminal -r floating-term bindsym $mod+Ctrl+Return exec i3-sensible-terminal -r floating-term
bindsym $mod+Shift+Return exec i3-sensible-terminal -d "`xcwd`" bindsym $mod+Shift+Return exec i3-sensible-terminal -d "`xcwd`"
bindsym $mod+Ctrl+Shift+Return exec i3-sensible-terminal -r floating-term -d "`xcwd`" bindsym $mod+Ctrl+Shift+Return exec i3-sensible-terminal -r floating-term -d "`xcwd`"
bindsym $mod+l exec ~/.config/i3/lock.sh bindsym $mod+l exec dm-tool switch-to-greeter
bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window" bindsym $mod+space exec "pkill rofi; rofi -show run -sidebar-mode -terminal i3-sensible-terminal -normal-window"
bindsym $mod+Shift+p exec rofi-pass bindsym $mod+Shift+p exec rofi-pass
bindsym $mod+Shift+e exec rofi-emoji bindsym $mod+Shift+e exec rofi-emoji
@ -164,7 +164,8 @@ bindsym XF86MonBrightnessDown exec xbacklight -dec 5 && pkill -RTMIN+12 i3bloc
# app launch shortcuts # app launch shortcuts
exec --no-startup-id ~/.config/i3/disable-standby-fs.py exec --no-startup-id ~/.config/i3/disable-standby-fs.py
exec --no-startup-id feh --no-fehbg --no-xinerama --bg-fill ~/pictures/lakesidesunrise.jpg exec --no-startup-id feh --no-fehbg --no-xinerama --bg-fill ~/pictures/lakesidesunrise.jpg
exec --no-startup-id xautolock -time 5 -locker 'dm-tool lock' -nocloseout -nocloseerr exec --no-startup-id xautolock -time 5 -locker 'dm-tool switch-to-greeter' -nocloseout -nocloseerr
exec --no-startup-id xss-lock dm-tool switch-to-greeter
# startup programs # startup programs
exec --no-startup-id nextcloud exec --no-startup-id nextcloud

View File

@ -3,7 +3,7 @@
option=$(echo "lock|logout|sleep|hibernate|power off|reboot|windows" | rofi -sep "|" -dmenu -i -p "" -auto-select -hide-scrollbar -monitor 0 -width 8 -lines 7 -location 3 -tokenize false -matching normal | xargs) option=$(echo "lock|logout|sleep|hibernate|power off|reboot|windows" | rofi -sep "|" -dmenu -i -p "" -auto-select -hide-scrollbar -monitor 0 -width 8 -lines 7 -location 3 -tokenize false -matching normal | xargs)
case $option in case $option in
lock) ./lock.sh;; lock) dm-tool switch-to-greeter;;
logout) i3-msg exit;; logout) i3-msg exit;;
sleep) systemctl suspend;; sleep) systemctl suspend;;
hibernate) systemctl hibernate;; hibernate) systemctl hibernate;;

View File

@ -1,10 +0,0 @@
[Unit]
Description=Lock X session using i3lock
[Service]
User=%i
Environment=DISPLAY=:0
ExecStart=sh -c '~/.config/i3/lock.sh'
[Install]
WantedBy=sleep.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=Lock X LightDM session before sleeping
Before=sleep.target
[Service]
Type=oneshot
ExecStart=/usr/bin/dm-tool switch-to-greeter
# Ensure enough time for the session to lock before sleeping
ExecStartPost=/usr/bin/sleep 1
[Install]
WantedBy=sleep.target

View File

@ -0,0 +1 @@
../sleep-lock-lightdm.service

View File

@ -76,6 +76,7 @@ fi
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && exists dbus-launch; then if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && exists dbus-launch; then
eval $(dbus-launch --sh-syntax --exit-with-session) eval $(dbus-launch --sh-syntax --exit-with-session)
dbus-update-activation-environment --systemd \ dbus-update-activation-environment --systemd \
DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY \
XDG_SEAT_PATH
fi fi