dotfiles/config/sway/definitions
2025-10-12 20:48:18 +04:00

109 lines
3.7 KiB
Plaintext

# shellcheck disable=SC2148,SC2086,SC2154,SC2046,SC2016
### Variables
#
# Logo key. Use Mod1 for Alt and Mod4 for Super.
set $mod Mod4
set $alt_mod Alt
# Alternative direction keys
set $left h
set $down j
set $up k
set $right l
# Default generated background
set $background $HOME/.local/share/wallpapers/20250607_192951_D4E78119.jpg
# Add --to-code to bindsym, support for non-latin layouts
set $bindsym bindsym --to-code
# For user's convenience, the same for unbindsym
set $unbindsym unbindsym --to-code
# Script paths
set $script_path $HOME/.local/share/sway/scripts
# Terminal emulator
set $term footclient
set $term_cwd $term -D "$(swaycwd 2>/dev/null || echo $HOME)"
set $term_float footclient --app-id floating_shell --window-size-chars 82x25
# Task manager
set $task_manager $script_path/once.sh $term_float btop
# Onscreen bar
set $onscreen_bar $script_path/wob.sh "$accent-color" "$background-color"
# Brightness control
set $brightness $script_path/brightness.sh
set $brightness_up $brightness up | $onscreen_bar
set $brightness_down $brightness down | $onscreen_bar
# Scaling
set $scale_up $script_path/scale.sh up
set $scale_down $script_path/scale.sh down
set $scale_default $script_path/scale.sh default
# 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")
# Clipboard history
set $clipboard cliphist list | rofi -dmenu -p "Select item to copy" -lines 10 | cliphist decode | wl-copy
set $clipboard-del cliphist list | rofi -dmenu -p "Select item to delete" -lines 10 | cliphist delete
# Application launcher
set $menu rofi -show combi -combi-modi "drun,run" -terminal "$term" -ssh-command "{terminal} {ssh-client} {host} [-p {port}]" -run-shell-command "{terminal} {cmd}" -show-icons -lines 10
# Lockscreen configuration
set $locking $script_path/lock.sh
# Bluetooth menu
set $bluetooth $script_path/once.sh $term_float bluetuith
# Hide cursor after 5 seconds of inactivty
seat seat0 hide_cursor 20000
seat seat0 xcursor_theme gentoo-silver 24
# Pulseaudio command
set $pulseaudio $script_path/once.sh $term_float pulsemixer
# Help command
set $help $script_path/help.sh --toggle
# Calendar application
set $calendar $script_path/once.sh $term_float ikhal
# 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 commands
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
# Emoji picker
set $emoji_picker emoji-picker