swayidle: move to start script

This commit is contained in:
Konstantin Koslowski 2022-05-02 20:19:26 +02:00
parent 773bf1899a
commit 51e820c19e
2 changed files with 27 additions and 19 deletions

20
bin/start_swayidle.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
TERM_CMD="foot -T float"
LOCK_CMD="$HOME/.config/sway/bin/sway_lock"
SUS_CMD="$HOME/.config/sway/bin/sway_suspend"
### Idle configuration
# 10 min screen off
# 15 min lock
# 30 min suspend on battery
# 120 min suspend
pkill -x swayidle
swayidle -w \
timeout 1500 "$TERM_CMD bash -c 'notify-send -u critical display\ will\ turn\ off\ soon'" \
resume "$LOCK_CMD on" \
timeout 1800 "$LOCK_CMD off" \
timeout 2700 "$LOCK_CMD lockonly" \
timeout 3600 "$SUS_CMD suspend-battery" \
timeout 7200 "$SUS_CMD suspend" \
before-sleep "$LOCK_CMD lock"

26
config
View file

@ -17,11 +17,11 @@ set $right l
set $term foot set $term foot
set $term_cmd foot -T float set $term_cmd foot -T float
set $background $HOME/Cloud/xkonni/Pictures/wallpaper/5k_bavarian_forest_bw.jpg set $background $HOME/Cloud/xkonni/Pictures/wallpaper/5k_bavarian_forest_bw.jpg
set $lock_cmd $HOME/.config/sway/bin/sway_lock
set $brightness_cmd $HOME/.config/sway/bin/sway_brightness set $brightness_cmd $HOME/.config/sway/bin/sway_brightness
set $output_cmd $HOME/.local/bin/swayout set $output_cmd $HOME/.local/bin/swayout
set $suspend_cmd $HOME/.config/sway/bin/sway_suspend
set $volume_cmd $HOME/.config/sway/bin/sway_volume set $volume_cmd $HOME/.config/sway/bin/sway_volume
set $idle_cmd $HOME/.config/sway/bin/start_swayidle.sh
set $waybar_cmd $HOME/.config/sway/bin/start_waybar.sh
set $move_cmd $HOME/.config/sway/bin/sway_move set $move_cmd $HOME/.config/sway/bin/sway_move
set $font Cascadia Code PL Regular 10 set $font Cascadia Code PL Regular 10
@ -56,24 +56,9 @@ gaps right 0
### Output configuration ### Output configuration
output * bg $background fill
# Example configuration:
# output HDMI-A-1 resolution 1920x1080 position 1920,0
# You can get the names of your outputs by running: swaymsg -t get_outputs # You can get the names of your outputs by running: swaymsg -t get_outputs
output * bg $background fill
### Idle configuration
# 10 min screen off
# 15 min lock
# 30 min suspend on battery
# 120 min suspend
exec swayidle -w \
timeout 1800 '$lock_cmd off' \
resume '$lock_cmd on' \
timeout 2700 '$lock_cmd lockonly' \
timeout 3600 '$suspend_cmd suspend-battery' \
timeout 7200 '$suspend_cmd suspend' \
before-sleep '$lock_cmd lock'
bindsym $mod+Ctrl+Escape exec '$lock_cmd lock'
### Input configuration ### Input configuration
# You can get the names of your inputs by running: swaymsg -t get_inputs # You can get the names of your inputs by running: swaymsg -t get_inputs
@ -341,7 +326,9 @@ no_focus [class="MATLAB R2021a" instance="sun-awt-X11-XDialogPeer"]
# #
# Status Bar: # Status Bar:
# #
exec_always $HOME/.config/sway/bin/start_waybar.sh exec_always $waybar_cmd
exec_always $idle_cmd
# #
# Autostart # Autostart
# #
@ -349,5 +336,6 @@ exec "bash -c 'sleep 10; nextcloud --background'"
exec --no-startup-id dunst exec --no-startup-id dunst
exec --no-startup-id nm-applet --indicator exec --no-startup-id nm-applet --indicator
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id $swayidle_cmd
include /etc/sway/config.d/* include /etc/sway/config.d/*