i3 shortcuts for session options

This commit is contained in:
Pim Kunis 2023-02-26 14:00:36 +01:00
parent 68a19a552a
commit f9feabc2d2
4 changed files with 22 additions and 3 deletions

View file

@ -17,7 +17,7 @@ exec --no-startup-id dex --autostart --environment i3
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the # xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen. # screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork exec --no-startup-id xss-lock --transfer-sleep-lock -- ~/.config/i3/scripts/lock.sh
# NetworkManager is the most popular way to manage wireless networks on Linux, # NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it. # and nm-applet is a desktop environment-independent system tray GUI for it.
@ -142,8 +142,7 @@ bar {
focus_follows_mouse no focus_follows_mouse no
bindsym $mod+Escape exec i3lock # Screen picker
set $mode_screen Screen layout: [h]ome [m]obile set $mode_screen Screen layout: [h]ome [m]obile
bindsym $mod+s mode "$mode_screen" bindsym $mod+s mode "$mode_screen"
mode "$mode_screen" { mode "$mode_screen" {
@ -153,3 +152,16 @@ mode "$mode_screen" {
bindsym Escape mode "default" bindsym Escape mode "default"
bindsym Return mode "default" bindsym Return mode "default"
} }
# Session options
set $mode_session Session option: [l]ock [r]eboot [s]uspend [p]oweroff
bindsym $mod+Escape mode "$mode_session"
mode "$mode_session" {
bindsym l exec --no-startup-id "loginctl lock-session", mode "default"
bindsym r exec --no-startup-id "systemctl reboot", mode "default"
bindsym s exec --no-startup-id "systemctl suspend", mode "default"
bindsym p exec --no-startup-id "systemctl poweroff", mode "default"
bindsym Escape mode "default"
bindsym Return mode "default"
}

5
roles/i3/files/scripts/lock.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
SCREEN_RESOLUTION="$(xdpyinfo | grep dimensions | cut -d' ' -f7)"
BGCOLOR="000000"
convert "/home/pim/Pictures/wallpapers/orphans.png" -gravity Center -background \#$BGCOLOR -resize "$SCREEN_RESOLUTION" RGB:- | i3lock --raw "$SCREEN_RESOLUTION":rgb -c $BGCOLOR -i /dev/stdin --nofork

View file

@ -7,6 +7,7 @@
- i3lock - i3lock
- rofi - rofi
- nitrogen - nitrogen
- xss-lock
- name: Create i3 config directory - name: Create i3 config directory
file: file:
path: ~/.config/i3 path: ~/.config/i3

View file

@ -15,6 +15,7 @@
- wireshark - wireshark
- units - units
- unrar - unrar
- vim
- name: Install .gitconfig - name: Install .gitconfig
template: template:
src: "{{ role_path }}/templates/.gitconfig.j2" src: "{{ role_path }}/templates/.gitconfig.j2"