A variety of simple automation scripts and enhancements to Sway and i3.
Go to file
John Mertz 0abcd17f22 Log current state to file (non-idle means that the state file does not exist)
Use existence of state file in new script to know whether to fade or unfade windows/notifications
2024-04-19 18:08:30 -06:00
audio ts4 2023-01-07 08:17:43 -05:00
distrobox Use XDG state directory instead of custom .spool 2024-03-08 12:11:04 -07:00
i3 tabs->spaces 2023-01-06 14:41:31 -05:00
rofi Fix bash syntax for string matching 2024-03-08 12:00:51 -07:00
sway Log current state to file (non-idle means that the state file does not exist) 2024-04-19 18:08:30 -06:00
thinkpad Use XDG state directory instead of custom .spool 2024-03-08 12:11:04 -07:00
tofi Use XDG state directory instead of custom .spool 2024-03-08 12:11:04 -07:00
waybar Use XDG state directory instead of custom .spool 2024-03-08 12:11:04 -07:00
wofi Fix merge conflicts 2023-01-07 13:32:14 -05:00
.gitignore Ignore waybar toggle binary 2022-10-31 18:32:53 -04:00
README.md ts4 2023-01-07 08:17:43 -05:00
apply-gruvbox.sh Kernel formatting 2022-10-31 18:32:47 -04:00
nvim.sh ts4 2023-01-07 08:17:43 -05:00
send-to-kodi.sh ts4 2023-01-07 08:17:43 -05:00
setup-wireguard.sh Allow usage in Distrobox 2023-10-05 18:36:53 +00:00
ssh-agent.sh Use XDG state directory instead of custom .spool 2024-03-08 12:11:04 -07:00
toolbox.sh Restore 'toolbox' command for default distrobox 2022-12-11 14:29:49 -05:00
update-firefox.pl tabs->spaces 2023-01-06 14:41:31 -05:00
update_gnome_profile.sh Script to update gnome settings 2023-07-20 16:03:20 -04:00


Simple Scripts



Just a simple script to toggle Alsa mute.


Add a noise-cancelled version of existing interfaces to Pulseaudio.


Commandline podcast streamer. Fetchs the feed for desired podcasts, find items published today, then plays them in order. Given arguments, it will use those as feeds, otherwise it will use the hash listed in the script.


I haven't used i3 in earnest for quite some time since moving to Sway, so it is very likely that some of these scripts are broken based on other config changes.


When any of the Xrandr scripts below is run, it will print it's name to a config file. This script will read that config file and then knows how the outputs are arranged. Once this is known, it allows hotkeys to know which output to move a workspace to.


Xrandr config. Just the laptop display.


Xrandr config. Not a layout I currently use. Home is now the "stacked" view from sway/displays.


Xrandr config. Vertical on the left, horizontal aligned to top of the vertical, and laptop directly below that. Left-to-right order is Vertical-Horizontal-Laptop.


Rofi is a neat graphical launcher and menu system. I use it for a bunch of stuff to supplement i3 and Sway to fill out same desktop niceties. See configs in 'dotfiles' repository.


Simple launcher.


Quick VPN switcher.


Lock, toggle displays, reload yubico authenticator, log out, restart Sway/i3, reload waybar, hibernate, reboot, shutdown.


Forward pasted link to ./send-to-kodi.sh.


Open a terminal to any SSH shortcut machine. (TODO: Integrate with 'sshs' to get machine list from there instead of a static list).


Show all currently running applications in Sway to locate window.


Sway is an i3-compatible Wayland compositor and tiling window manager. See configs in 'dotfiles' repository. Here are some scripts exclusively for automating or enhancing Sway.


Script to automatically configure wayland outputs using swaymsg. Also forks waybars for each display. Allows custom configurations. No argument will run the last used configuration (~/config/last_display). '-w' will run only waybar without changing displays.


Setup Gammastep based on current location. I don't have geolocation in my laptop, so this requires a URL that returns JSON, including a "lat" and "lon". My URL (restricted to my IPs) returns these as recorded by PhoneTrack on my phone similar to:


It forks to keep running if terminal is killed. If location fails to be fetched it will try again every 5 seconds.


A DIY version of the Tilde terminal. If terminal is not running, it opens on the current display. If it is running but not on current dislpay, it moves to current display. If it is already on current display, it is moved to a hidden display ('grave').

Note the relevant settings in dotfiles repository (sway/config) related to the 'grave' workspace, as well as UXTerm.

for_window [class="UXTerm"] floating enable, resize set height 600px, resize set width 800px, move position 1120px 460px
# Grave '`' key, DIY version of Tilde pop-up terminal
bindsym $mod+Grave exec /home/jpm/scripts/sway/popup-term.pl
# Visit the hidden grave workspace
bindsym $mod+Shift+Grave workspace grave

Also note that 'grave' has no label in waybar (waybar/config.template) to allow it to be hidden.

"sway/workspaces": {
    "format": "{icon}",
    "format-icons": {
        "0": "0 \uf073", // Example of workspace with a label
        "grave": "",


Work in progress. These scripts don't currently work the way I like.

Sway has an Idle detection daemon that can flexibly take different actions after certain periods of inactivity as well as prior to sleep and after wake.

This script is meant to unify all of the actions into one script by accepting an option.


Prior to locking a countdown should be provided. Currently testing how to manage a countdown with Dunst, which doesn't actually support dynamic notifications.



Overly complicated backlight brightness control script. Provides flexible control of backlight so that changes can be easily scripted or called from keyboard shortcuts. --help provides some usage docs.


Simple script to cycle keyboard backlight. Gets max brightness, current brightness and then changes then increments the current brightness. Uses mod of max+1 so that it will cycle back around to 0 (disabled) if it is already at max.


Overly complicated battery and power status fetcher script. Can output stats as JSON, Waybar-friendly percentage and icon, or a pretty table suitable for use with plain-text notifications via notify-send or similar.


SystemD unit file used to give ownership of necessary sys files to whichever user it is enabled for systemctl enable user-thinkpad-control@jpm. Without this, the user won't be able to write these files and thus cannot set brightness values.


Waybar is a very flexible and customizable taskbar for Sway (and other Wlroots-based wayland compositors). Waybar applets have hover and click functionality and have several scripts related to those. See the .config repository for the actual Waybar and Sway configs.


Launch htop in floating window (bottom-right). If already running, kill it.


Notification with disk usage summaries. Renders properly with Dunst, but not Mako.


Notification with memory usage summaries.


Launch nmtui in floating window (bottom-right). If already running, kill it.



A single theme version of the one provided here. Applies the theme to a variety of terminals. Not really necessary after cloning the 'dotfiles' repository.


This script sends a URL or local file to a Kodi media player. Only modified to have my local media server IP.


Script to install WireGuard and generate a config file. Requires modification with the server public IP, server public key, and change to first 3 octets if necessary. Will attempt to resolve dependencies and has a special case for Raspberry Pi (detected with uname -m as 'arm'.