A variety of simple automation scripts and enhancements to Sway and i3.
Go to file
John Mertz 93a185960f
Script to automatically update firefox since it's not great at doing
this on it's own
2022-10-31 18:32:45 -04:00
audio Intial commit of all current scripts 2022-10-31 18:32:44 -04:00
i3 Intial commit of all current scripts 2022-10-31 18:32:44 -04:00
rofi Intial commit of all current scripts 2022-10-31 18:32:44 -04:00
sway Intial commit of all current scripts 2022-10-31 18:32:44 -04:00
waybar Updated docs, removed unneeded or duplicates 2022-10-31 18:32:45 -04:00
.gitignore Intial commit of all current scripts 2022-10-31 18:32:44 -04:00
README.md Updated docs, removed unneeded or duplicates 2022-10-31 18:32:45 -04:00
apply-gruvbox.sh Intial commit of all current scripts 2022-10-31 18:32:44 -04:00
send-to-kodi.sh Intial commit of all current scripts 2022-10-31 18:32:44 -04:00
update-firefox.pl Script to automatically update firefox since it's not great at doing 2022-10-31 18:32:45 -04:00

README.md

Simple Scripts

Waybar

(Waybar)[https://github.com/Alexays/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.

waybar/waybar-cpu.sh

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

waybar/waybar-disk.sh

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

waybar/waybar-mem.sh

Notification with memory usage summaries.

waybar/waybar-nmtui.sh

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

Audio

audio/mute.sh

Just a simple script to toggle Pulseaudio mute.

audio/noise-cancel.sh

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

i3

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.

i3/i3move.sh

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.

i3/detached.sh

Xrandr config. Just the laptop display.

i3/work.sh

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.

i3/home.sh

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

Rofi

(Rofi)[https://github.com/davatorium/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.

rofi/drun.sh

Simple launcher.

rofi/rofi-openvpn.sh

Quick VPN switcher.

rofi/rofi-power-menu.sh

Lock, log out, restart Sway/i3, restart waybar, hibernate, reboot, shutdown.

rofi/rofi-send-to-kodi.sh

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

rofi/rofi-ssh-menu.sh

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

rofi/sway-alt-tab.sh

Show all currently running applications in Sway to locate window.

Sway

(Sway)[https://github.com/swaywm/sway] is an i3-compatible Wayland compositor and tiling window manager. See configs in 'dotfiles' repository.

sway/

Scripts exclusively for automating or enhancing Sway.

sway/displays.pl

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.

sway/gammastep.pl

Setup Gammastep based on current location. 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:

{"lat":"180.12345678","lon":"-180.12345678","timestamp":"1599831660"}

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

sway/popup-term.pl

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": "",
            ...
sway/swayidle.sh

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.

sway/swayidlecountdown.sh

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

Miscellaneous

send-to-kodi.sh

(This script)[https://github.com/allejok96/send-to-kodi] sends a URL or local file to a (Kodi)[https://github.com/xbmc] media player. Only modified to have my local media server IP.

apply-gruvbox.sh

A single theme version of the one provided (here)[https://raw.githubusercontent.com/Mayccoll/Gogh]. Applies the theme to a variety of terminals. Not really necessary after cloning the 'dotfiles' repository.