dotfiles/.config/sway/definitions
2024-07-05 15:13:33 -05:00

127 lines
4.6 KiB
Text

# shellcheck disable=SC2148,SC2086,SC2154,SC2046,SC2016
### Variables
#
set $theme "$sway-config-dir/themes/dynamic"
include $theme/theme.conf
# Logo key. Use Mod1 for Alt and Mod4 for Super.
set $mod Mod4
set $alt_mod Mod1
# Direction keys
set $left Left
set $down Down
set $up Up
set $right Right
# Alternative direction keys
set $left_alt h
set $down_alt j
set $up_alt k
set $right_alt l
# Support non-latin layouts
set $bindsym bindsym --to-code
set $unbindsym unbindsym --to-code
# Your preferred terminal emulator
set $term kitty
set $term_cwd $term -D "$(swaycwd 2>/dev/null || echo $HOME)"
set $term_popup $term
# onscreen bar
set $onscreen_bar $sway-scripts-dir/wob.sh "$accent-color" "$background-color"
# brightness control
set $brightness $sway-scripts-dir/brightness.sh
set $brightness_up $brightness up | $onscreen_bar
set $brightness_down $brightness down | $onscreen_bar
# scaling
set $scale_up $sway-scripts-dir/scale.sh up
set $scale_down $sway-scripts-dir/scale.sh down
# audio control
set $sink_volume pactl get-sink-volume @DEFAULT_SINK@ | grep '^Volume:' | cut -d / -f 2 | tr -d ' ' | sed 's/%//'
set $source_volume pactl get-source-volume @DEFAULT_SOURCE@ | grep '^Volume:' | cut -d / -f 2 | tr -d ' ' | sed 's/%//'
set $volume_down $onscreen_bar $(pactl set-sink-volume @DEFAULT_SINK@ -5% && $sink_volume)
set $volume_up $onscreen_bar $(pactl set-sink-volume @DEFAULT_SINK@ +5% && $sink_volume)
set $volume_mute $onscreen_bar $(pactl set-sink-mute @DEFAULT_SINK@ toggle && pactl get-sink-mute @DEFAULT_SINK@ | sed -En "/no/ s/.*/$($sink_volume)/p; /yes/ s/.*/0/p")
set $mic_mute $onscreen_bar $(pactl set-source-mute @DEFAULT_SOURCE@ toggle && pactl get-source-mute @DEFAULT_SOURCE@ | sed -En "/no/ s/.*/$($source_volume)/p; /yes/ s/.*/0/p")
# rofi theme
set $rofi_theme "* {\nlightbg: $background-color;\nbackground: $background-color;\nlightfg: $accent-color;\nforeground: $text-color;\n}\nwindow {\nwidth: 25em;\n}\n"
# clipboard history
set $clipboard cliphist list | rofi -dmenu -font "$gui-font" -p "Select item to copy" -lines 10 | cliphist decode | wl-copy
set $clipboard-del cliphist list | rofi -dmenu -font "$gui-font" -p "Select item to delete" -lines 10 | cliphist delete
# zeit tracking
set $zeit_list zeit list --only-projects-and-tasks --append-project-id-to-task | rofi -dmenu -font "$gui-font" -p "Select task to track" -lines 10 | /usr/share/sway/scripts/zeit.sh track && waybar-signal zeit
# Your preferred application launcher
set $menu wofi --show drun --color $HOME/.cache/wal/colors --allow-images
### Lockscreen configuration
set $locking swaylock --daemonize --color "$selection-color" --inside-color "$selection-color" --inside-clear-color "$text-color" --ring-color "$color2" --ring-clear-color "$color11" --ring-ver-color "$color13" --show-failed-attempts --fade-in 0.2 --grace 2 --effect-vignette 0.5:0.5 --effect-blur 7x5 --ignore-empty-password --screenshots --clock
# bluetooth menu
set $bluetooth $once $term_float bluetuith
# Screen capture methods
set $screenshot_selection $HOME/bin/screengrab
### Idle configuration
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
#
set $idle_timeout 240
set $locking_timeout 300
set $screen_timeout 600
set $sleep_timeout_bat 900
set $sleep_timeout_ac 3600
set $sleep_delay 2
### Autostart applications definition. Can be removed soon-ish as it is being imported in userspace.
#include /etc/sway/autostart
# hide cursor after 5 seconds of inactivty
seat seat0 hide_cursor 5000
# pulseaudio command
set $pulseaudio pavucontrol
# help command
set $help /usr/share/sway/scripts/help.sh --toggle
# calendar application
set $calendar $once $term_float calcurse
# workspace names
set $ws1 number 1
set $ws2 number 2
set $ws3 number 3
set $ws4 number 4
set $ws5 number 5
set $ws6 number 6
set $ws7 number 7
set $ws8 number 8
set $ws9 number 9
set $ws10 number 10
# screenshot
set $grimshot grimshot
set $pipe_output $grimshot save output -
set $pipe_selection $grimshot save area -
set $notify_paste [[ $(wl-paste -l) == "image/png" ]] && notify-send "Screenshot copied to clipboard"
set $swappy swappy -f -
set $upload_pipe curl -s -F "file=@-;filename=.png" https://x0.at/ | tee >(wl-copy) >(xargs notify-send)
set $screenshot_screen $pipe_output | $swappy && $notify_paste
set $screenshot_screen_upload $pipe_output | $upload_pipe
set $screenshot_selection $pipe_selection | $swappy && $notify_paste
set $screenshot_selection_upload $pipe_selection | $upload_pipe
set $update-manager '/usr/share/sway/scripts/checkupdates.sh upgrade'