These are utility scripts I use on my systems that isn't a package, or is simple enough to warrant a script file. These files are in flux, due to changing requirements and environments.
Going forward most of these scripts target Wayland, Xorg scripts kept here for
backward compatibility so I can launch an i3 session for whatever reason. For a
full list of phased out scripts checkout
the deprecated
branch.
- Companion repo for for my dotfiles
Branch | Description |
---|---|
main | Most current up to date scripts I use on the daily. |
deprecated | Deprecated scripts not in use |
Short descriptions for each script, not always up to date. Attribution where possible.
Scripts used in custom power menus, mostly using systemctl, but also uses zenity as a confirm dialog, cause I sometimes hit the wrong menu item.
A Rofi menu with common actions I used to script or save as cmd one liners.
When transitioning to Wayland, several desktop related tools stopped working,
like flameshot
, or gpick
. So I needed some alternatives for Wayland. I set it
up as a Rofi menu with generic scripts, so that it can be swapped out on
need.
Using with you could put something like this in your WM/compositor config:
bindsym $mod+grave exec rofi -show menu -modes "menu:~/scripts/rofi-menu.sh" -show-icons
Will create a lua file from a github repo identifier: username/repo
. This was created to
speed up migration from vimrc
to init.lua
Requirements:
Also asumes lazy.nvim is being used with a structured file layout.
Usage:
./add-vim-plugin.sh "roosta/fzf-folds.vim"
Resulting file:
-- ┬─┐┌─┐┬─┐ ┬─┐┌─┐┬ ┬─┐┐─┐ ┐ ┬o┌┌┐
-- ├─ ┌─┘├─ ──├─ │ ││ │ │└─┐ │┌┘││││
-- ┆ └─┘┆ ┆ ┘─┘┆─┘┆─┘──┘o└┘ ┆┘ ┆
-- ─────────────────────────────────────────────────────────────────────────
return {
"roosta/fzf-folds.vim",
}
Node script to grab bookmarks from chrome/firefox in a folder on the toolbar
called capture
. Converts the bookmarks to markdown links.
Script to simplify opening and mounting dm-crypt encrypted partitions. Really not terribly useful I just kept forgetting how to do it, so I wrote this.
It is used like so:
./crypthelper.sh open /dev/sdh1 my-encrypted-device-name # gets mounted in ~/mnt/[name]
./crypthelper.sh close my-encrypted-device-name
Script to display all toilet/figlet fonts with sample text. It will try
/usr/share/figlet
and /usr/share/figlet/fonts
. I got extra fonts installed
in the latter.
Requirements:
Could be modified to use figlet
Optionally:
Refs:
WIP script to flush credentials and secrets.
See which files in a git repo history takes up the most space. Useful if pruning assets or similar from a repo.
List all IOMMU groups for system. Used this when setting up PCI passthrough to a virtual machine. More info here.
DEPECATED: Xorg is getting phased out for wayland, kept for backward compatibility temporarily
Echo keyboard layout code/caps lock and formatting for polybar
I like my indicator to have a red background on Norwegian layout and caps-lock since it always trips me up when this is activated. Only works for Norwegian and US layouts. Could easily be modified though.
How to use: In polybar setup a module using IPC:
[module/keyboard-layout]
type = custom/ipc
format-foreground = ${colors.brightwhite}
format = <output>
hook-0 = ~/scripts/keyboard-layout.sh
initial = 1
Then in i3 setup something like this:
bindsym --release Caps_Lock exec polybar-msg hook keyboard-layout 1
This triggers an ipc message when releasing caps lock, which I have setup via xorg to toggle between layouts.
Remember to enable ipc for your bar:
[bar/primary]
enable-ipc = true
Original source: http://unix.stackexchange.com/a/27688
DEPECATED: Xorg is getting phased out for wayland, kept for backward compatibility temporarily
Called on i3 startup to launch whatever polybar layout hostname
requires.
exec_always --no-startup-id $HOME/scripts/launch-polybar.sh
I have multiple monitors, so I launch several bars depending on hostname, since the number of screens vary, so does the configs.
Script used to troubleshoot true color in terminal, will print a rainbow and how it looks depends on what colors are supported by your terminal.
More on that here.
Attach to an existing session, or create a new. Useful if you want tmux to always be started with terminal emulator. Source either in shell rc file, or in window manager on terminal emulator startup. Believe I got from here.
I run this manually to start a default tmux session layout. Check for existing named session, attach, or create a new named session called main. Opted for this solution rather than using a session manager, even though there are several nice ones.
Use libnotify to notify when a tmux window receives a bell. Used with
tmux-update-window.sh
.
Example:
set-hook -g alert-silence 'run ". ~/utils/tmux-notify.sh; return 0"'
Starts a new session called ssh
that launches ngrok, I
use this sometimes if I need to access a computer over ssh that doesn't have a
static ip.
Takes TCP PORT as argument to ngrok.
Create an update window if main
session exist. Set this window to monitor
silence. When I start an update, and then do something else I'd like to be
alerted on silence since that indicates that its either finished or requires
input.
Requirements:
pulseaudio
/pipewire-pulse
Toggles between two sinks using pactl, takes two arguments, which are the
sinks you wish to toggle between. Using on pipewire, pipewire-pulse. To list
sinks use pactl list sinks short
.
./toggle-sinks.sh [SINK1] [SINK2]
I have two outputs I toggle between often: headset and speakers. I've added this script to Waybar, and activate it by clicking on the volume module.
Extract rar
archives on torrent completion, used in transmission
- TODO: Fix for wayland
Toggles touchpad on or off.
Used in i3wm config like so:
bindsym XF86TouchpadToggle exec --no-startup-id ~/utils/touchpad-toggle.sh
DEPECATED: Xorg is getting phased out for wayland, kept for backward compatibility temporarily.
Will output formatted text for Polybar, checking Arch Linux pacman
updates, as
well as AUR updates.
Requirements:
Uses entr
to watch for changes in my Waybar config files, and will restart
Waybar on save. I use this when I develop themes and customization, you can
pass -d
to open a GTK debugger window as well, to get CSS selectors used for
styling Waybar.
Requirements:
swaymsg
jq
slurp
awk
Works similarly to xprop
in xorg. Running this will start a window selection,
and output the relevant node from the Sway tree.