One thing that I’ve found that I like is having my waybar not normally visible. When I need to glance at the bar, I can just hold the Sway modifier key to make it temporarily show up.
in ~/.config/sway/config:
bar { swaybar_command waybar mode hide }More screen space for whatever I’m actually doing. If something is so critical that it needs to grab my attention (e.g. battery low on a laptop) then I have it set up to send a message to the notification manager.
I’m assuming this is sway-specific, so just wanted to add that waybar itself also supports toggling hide/show bar by sending it a signal:
kill -SIGUSR1 $(pgrep waybar)
Share your scripts! We want to see what fun stuff people are doing here
wait till you find out quickshell
Examples? I feel like I could probably script more window manager-related things in my current setup, but I don’t really have any ideas what to script.
Depends pretty wildly on what you like.
Some things that I do:
I never want automatic locking — I always lock my machine manually when leaving it, with Super-\ (Super normally being the Windows key). I also want my monitor to power off after a few seconds in that mode, and then wake back up if I start typing. I also want to use a black screen rather than swaylock’s default white.
in my ~/.config/sway/config:
set $mod Mod4 # Handle session-locking triggered by stuff like loginctl lock-session exec_always swayidle -w \ lock 'myscreensaver.sh' # Bind Super-backslash to trigger a session lock bindsym $mod+backslash exec "loginctl lock-session""in ~/bin/myscreensaver.sh:
#!/bin/bash # Script that handles things necessary to "lock" the system when I'm away # Pause any music that mpd is playing mpc pause swayidle \ timeout 5 'swaymsg "output * dpms off"' \ resume 'swaymsg "output * dpms on"' & swaylock -c 000000 kill %1By default, X11 (and Wayland, apparently, though I’ve spent less time looking at Wayland’s APIs) don’t “store” clipboard state – they just facilitate transferring copied data from one application to another application where it’s being pasted. This means that if one copies data in one application and then closes that application, the clipboard contents go away. I don’t really like this behavior. One way to avoid it is to use a “clipboard manager” — a piece of software that saves a copy of the data itself. If you install
clipmanandwl-clipboard, you can do this:In ~/.config/sway/config:
# Make clipboard persist after application termination exec_always flock -n $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY-wl-paste wl-paste --watch clipman storeI want to get notifications when my laptop battery is low. Install
poweralertd, and then in ~/.config/sway/config:# Power notification support exec_always flock -n $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY-poweralertd poweralertdI don’t use it that much, but Sway has a “scratchpad”, where one can stuff a window that one is working with. With this, I send the current window there with Super-Shift-minus then make it pop back up as a floating window with Super-minus:
# Scratchpad bindsym $mod+shift+minus move window to scratchpad bindsym $mod+minus scratchpad showI have a mute button on my laptop’s keyboard. I make that mute the default PipeWire sound sink. In ~/.config/sway/config:
bindsym XF86AudioMute exec "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"I swap Caps Lock and left Control. This is how traditional Unix keyboards worked, and is generally more-friendly if you are using the Control key a lot more than Caps Lock. I’d consider this almost a precondition to use emacs without making your left pinky miserable. In ~/.config/sway/config:
input "type:keyboard" { xkb_options ctrl:swapcaps,compose:menu,compose:ralt }That also sets my menu key (on my desktop) and right Alt key (on my laptop, which doesn’t have a menu key) to be Compose. That way I can do things like type “ö” by hitting Compose o and then the double-quote key, or an em-dash (“—”) with Compose hyphen hyphen hyphen.
I don’t like keeping my mouse pointer visible unless I’m actually moving it. In my ~/.config/sway/config, this will hide it after three seconds:
# Hide mouse cursor after a period of inactivity. seat seat0 hide_cursor 3000I like to have a way to, using the keyboard, hide the latest notification shown by swaync, the default Sway notification manager. In ~/.config/sway/config:
bindsym $mod+grave exec "swaync-client --hide-latest"Then Super-backtick will hide the most recent notification to show up.
Neat, thanks!
Thanks for sharing.





