Skip to main content

Sway

Ubuntu Sway Remix

Recording changes I make to the default configuration in Ubuntu Sway Remix

bind keys

# /etc/sway/modes/default.conf
$bindsym Ctrl+Alt+delete exec nwg-bar -x

brightness control

# from /etc/sway/variables
# brightness control - very fine grained control
set $brightness_step bash -c 'echo $(( $(light -Mr) / 100 * 1 < 100 ? 50 : $(( $(light -Mr) / 100 * 2 )) ))'
set $brightness_up light -r -A $($brightness_step) && $onscreen_bar $(light -G | cut -d'.' -f1)
set $brightness_down light -r -U $($brightness_step) && $onscreen_bar $(light -G | cut -d'.' -f1)

idle configuration

Set $idle_timeout to 300, $locking_timeout to 3600, and $screen_timeout to 600.

Update the timeout $idle_timeout action to set the idle light level to 1 instead of 10.

### 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 300
set $locking_timeout 3600
set $screen_timeout 600
set $idle swayidle -w \
    timeout $idle_timeout 'light -G > /tmp/brightness && light -S 1' resume 'light -S $([ -f /tmp/brightness ] && cat /tmp/brightness || echo 100%)' \
    timeout $locking_timeout $lock \
    timeout $screen_timeout 'swaymsg "output * dpms off"' \
    resume 'swaymsg "output * dpms on"' \
    before-sleep 'playerctl pause' \
    before-sleep $lock & \
    lock $lock &

power alert

Add the following to ~/.config/mako/config and then reload sway:

[app-name="poweralertd"]
invisible=1


background

#!/usr/bin/env bash
# file:~/.azotebg
pkill swaybg
#swaybg -o '*' -i "/usr/share/wallpapers/warty-final-ubuntusway.png" -m fill &
swaybg -o '*' -c \#003366

window positions

I put my placement and startup apps in ~/.config/sway/config.d/my-apps.conf

# file: ~/.config/sway/config.d/my-apps-placement.apps.conf

# man 5 sway
# Syntax: assign [match_criteria] workspace <workspace_name/number>

#######################
# application placement

# I want a foot client on workspace 2 when I login to sway
for_window [app_id="foot" title="foot startup"] move container to workspace 2

# I want the 1Password main window on workspace 10, but all other windows should pop on my current workspace
for_window [app_id="1password" title=".* — .* — 1Password"] move container to workspace 10

# Minecraft related
# ATLauncher and Minecraft game on workspace 3, everything else on workspace 9
for_window [title="win0" class="com-atlauncher-App"] move container to workspace 9
for_window [title="ATLauncher"] move container to workspace 43
for_window [title="ATLauncher Console"] move container to workspace 9
for_window [title="^Minecraft.*" class="^Minecraft.*"] move container to workspace 3


#####################
# statup applications
exec foot --title="foot startup"
exec google-chrome-stable
# 1Password crashes if you start it too early on login, not sure what its waiting on
exec "sleep 2 && 1password"

To see the hierarchy and properties of all current windows, use this command: 

swaymsg -t get_tree

To edit your custom config file (with vim b/c why would you use anything else!?):

vim ~/.config/sway/config.d/my-apps.conf

#end