tileos-settings-sway/etc/sway/variables

144 lines
5.4 KiB
Text

### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term alacritty
set $term_cwd $term --working-directory "$(/usr/share/sway/scripts/swaycwd.sh 2>/dev/null || echo $HOME)"
set $term_float alacritty --class floating_shell -e
# Rofi theme
set $rofi_theme "* {lightbg: $base; background: $base; lightfg: $blue; foreground: $text; border-color: $blue;} window {border: 2;}"
# Your preferred 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 -font "$gui-font"
# Add --to-code to bindsym, support for non-latin layouts
set $bindsym bindsym --to-code
# Bluetooth menu
set $bluetooth $term_float bluetuith
# Volume notification
set $volume_bar /usr/share/sway/scripts/volume-notify.sh
# Brightness notification
set $brightness_bar /usr/share/sway/scripts/brightness-notify.sh
# Brightness control
set $brightness_step bash -c 'echo $(( $(light -Mr) / 100 * 5 < 1 ? 1 : $(( $(light -Mr) / 100 * 5 )) ))'
set $brightness_up light -r -A $($brightness_step) && $brightness_bar
set $brightness_down light -r -U $($brightness_step) && $brightness_bar
# Volume control
set $volume_down pulsemixer --change-volume -5 && $volume_bar
set $volume_up pulsemixer --change-volume +5 && $volume_bar
set $volume_mute pulsemixer --toggle-mute && $volume_bar
# Clipboard history
set $clipboard cliphist list | rofi -dmenu -font "$gui-font" -p "Select item to copy:" -lines 10 -width 35 | cliphist decode | wl-copy
set $clipboard-del cliphist list | rofi -dmenu -font "$gui-font" -p "Select item to delete:" -lines 10 -width 35 | cliphist delete
# Pulseaudo command
set $pulseaudio $term_float pulsemixer
# Calendar application
set $calendar $term_float calcurse
# Help overlay
set $help_menu '[ -x "$(command -v nwg-wrapper)" ] && [ -f $HOME/.config/nwg-wrapper/help.sh ] && /usr/share/sway/scripts/help.sh'
# Help overlay command
set $help /usr/share/sway/scripts/help.sh --toggle
### 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 $lock ~/.config/swaylock/lock.sh
set $idle_timeout 240
set $locking_timeout 300
set $screen_timeout 600
set $idle swayidle -w \
timeout $idle_timeout 'light -G > /tmp/brightness && light -S 10' resume 'light -S $([ -f /tmp/brightness ] && cat /tmp/brightness || echo 100%)' \
timeout $locking_timeout $lock \
timeout $screen_timeout 'swaymsg "output * power off"' \
resume 'swaymsg "output * power on"' \
before-sleep 'playerctl pause' \
before-sleep $lock \
lock $lock &
# 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 /usr/bin/grimshot
set $pipe_output $grimshot save output -
set $pipe_selection $grimshot save window -
set $pipe_active $grimshot save active -
set $notify_paste bash -c '[[ $(wl-paste -l) == "image/png" ]] && notify-send "Screenshot copied to clipboard"'
set $swappy swappy -f -
set $screenshot_screen $pipe_output | $swappy && $notify_paste
set $screenshot_selection $pipe_selection | $swappy && $notify_paste
set $screenshot_active $pipe_active | $swappy && $notify_paste
# PolicyKit agent
set $polkit_agent /usr/bin/mate-polkit &
# Night Light
set $wlsunset '[ -x "$(command -v wlsunset)" ] && /usr/share/sway/scripts/sunset.sh "on"'
# Autotiling script
set $autotiling '[ -x "$(command -v autotiling)" ] && autotiling -w 1 3 5 7 9'
# Automatic workspace names
set $autoname_workspaces '[ -f /usr/share/sway/scripts/autoname-workspaces.py ] && /usr/share/sway/scripts/autoname-workspaces.py'
# restart kanshi https://github.com/emersion/kanshi/issues/43#issuecomment-531679213
set $kanshi '[ -x "$(command -v kanshi)" ] && pkill kanshi; exec kanshi'
# Workaround for applying GTK theme
set $import_gsettings '[ -f /usr/share/sway/scripts/import-gsettings.sh ] && /usr/share/sway/scripts/import-gsettings.sh'
# Start PCmanFM-Qt as a daemon
set $pcmanfm_daemon '[ -x "$(command -v pcmanfm)" ] && pcmanfm-qt -d'
# Clipboard manager
set $cliphist_store '[ -x "$(command -v wl-paste)" ] && [ -x "$(command -v cliphist)" ] && wl-paste --watch cliphist store'
set $cliphist_watch '[ -x "$(command -v wl-paste)" ] && [ -x "$(command -v cliphist)" ] && wl-paste --watch pkill -RTMIN+9 waybar'
# Start nwg-drawer as a daemon
set $nwg_drawer_daemon '[ -x "$(command -v nwg-drawer)" ] && nwg-drawer -r'
# SPICE agent
set $spice_vdagent '[ -x "$(command -v spice-vdagent)" ] && spice-vdagent'
# Start playerctl as daemon
set $watch_playerctl '[ -x "$(command -v playerctl)" ] && pkill playerctl; playerctl -a metadata --format \'{{status}} {{title}}\' --follow | while read line; do pkill -RTMIN+5 waybar; done'
# Update Rofi theme based on $rofi_theme colors
set $update_rofi_theme mkdir -p $HOME/.config/rofi/ && echo $rofi_theme > $HOME/.config/rofi/config.rasi
# Start Calcurse calendar as a daemon
set $calendar_daemon 'calcurse --daemon'
# Notifications from Swappy
set $swappy_notify '[ -x "$(command -v swappy)" ] && /usr/share/sway/scripts/screenshot-notify.sh'