Skip to content

roosta/scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scripts

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.

Branches

Branch Description
main Most current up to date scripts I use on the daily.
deprecated Deprecated scripts not in use

Script descriptions

Short descriptions for each script, attribution & licensing where applicable.

Creates a menu using rofi-menu.sh

Requirements:

See requirements for each respective script used in the menu

Usage:

Called as a mode in rofi like this

configuration {
  modes: "actions:~/scripts/action-menu.sh";
}

Config for this menu looks like this:

items:
  - script: ~/scripts/colorpicker.sh
    description: Pick a color
    icon: applications-graphics
    args: ["--format", "hex"]
# ...

License MIT

Will create a plugin file for lazy.nvim at ~/.config/nvim/lua/plugins from a repo identifier: repo/name 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 https://lazy.folke.io/usage/structuring

Usage

./add-vim-plugin.sh "roosta/fzf-folds.vim"

License MIT

Starts an ags dev session, passing optional debug flat to also open inspector

Requirements:

Usage: ./ags-dev.sh [OPTIONS]

OPTIONS:
  -d, --debug      open debug inspector

License MIT

Creates a menu using rofi-menu.sh

Requirements:

Usage: Called as a mode in rofi like this

configuration {
  modes: "audio:~/scripts/audio-menu.sh";
}

Config for this menu looks like this:

items:
  - script: ~/scripts/switch-audio.sh
    description: Switch to Speakers
    icon: audio-speakers
    args: ["speakers"]
# ...

License MIT

Quickly backup and timestamp a file mirroring its location in a target backup directory

Usage: bakc [OPTION] SOURCE

OPTIONS:
   -w         Save source file in working directory with .bak extension
   -R         Remove file after backup
   -h         Display this message

Examples

./bakc.sh ~/src/bakc/bakc.sh
# backed up /home/[user]/src/bakc/bakc.sh to /home/[user]/backup/home/[user]/src/bakc/bakc.sh~2017-02-12@21:20:12

Includes the option of placing it in working dir and only appending a .bak file extension

./bakc.sh -w file.txt
# Created test.txt.bak here (pwd)

Also included is the option to remove source file after backup:

./bakc.sh -wR file.txt
# Created file.txt.bak here (/home/[user]/[path]) removed 'file.txt'

It takes a relative path, and/or multiple files and follow symlinks:

~/bakc.sh ~/.zprofile ~/.zshenv
# backed up /home/[user]/.zshenv to /home/[user]/backup/home/[user]/.zshenv\~2017-02-12@22:01:40
# backed up /home/[user]/.zprofile to /home/[user]/backup/home/[user]/.zprofile\~2017-02-12@22:01:40
~/bakc.sh -w ~/.zshenv ~/.zprofile
# created /home/[user]/.zshenv.bak here (/home/[user]/src/bakc)
# Created /home/[user]/.zprofile.bak here (/home/[user]/src/bakc)

License GPL-3.0

Starts a colorpicker and saves result to clipboard

Requirements:

Usage

./colorpicker.sh

License MIT

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.

Requirements:

Usage: ./cryptsetup.sh [CMD]

commands:
  open:             open device by passing these args [DEVICE] [NAME]
  close:            close device by passing [NAME]

Example:
  crypthelper open /dev/sdh1 my-encrypted-device-name # gets mountet in ~/mnt/[name]
  crypthelper close my-encrypted-device-name

License MIT

Creates a menu using rofi-menu.sh

Requirements:

Usage: Called as a mode in rofi like this

configuration {
  modes: "display:~/scripts/display-menu.sh";
}

Config for this menu looks like this:

items:
  - script: ~/scripts/switch-display.sh
    description: Switch to Desk Displays
    icon: input-keyboard
    args: ["desk"]
# ...

License MIT

Scaffold various shell utils needed for storing dotfiles like described here https://wiki.archlinux.org/title/Dotfiles.

Warning

Work in progress

License MIT

Script to display all toilet/figlet fonts with sample text in $PAGER

Requirements:

Usage

./figlet-list.sh

Script will try /usr/share/figlet and $HOME/lib/figlet-fonts. I got extra fonts installed in the latter.

License MIT

Flush credentials and secrets.

Warning

Work in progress

License MIT

Quicky find and edit files using fzf and fd

Requirements:

Usage:

./fzf-edit.sh              # Fuzzy find files in current directory and open in $EDITOR
./fzf-edit <file> ..       # Open specified file(s) in $EDITOR
./fzf-edit <multiple args> # Pass all arguments to $EDITOR

Tip

Using zsh I symlink this to $fpath, add it as a zle widget, and bind it to a shortcut, as well as have it autoloaded.

License GPL-3.0

Generates this readme, by extracting docs between comment markers. Support additional filetypes by adding to comment_markers

Usage:

./generate-readme.sh

License MIT

Quckly grab a package description and put in clipboard

Requirements:

Usage:

./get-package-description.sh [PACKAGE]

For example, here's a nvim command that will get description for whats in the " register:

:lua vim.cmd('! ~/scripts/get-package-description.sh ' .. vim.fn.shellescape(vim.fn.getreg('"')))

License MIT

See which files in a git repo history takes up the most space. Useful if pruning assets or similar from a repo.

The following function is adapted from a Stack Overflow answer by MatrixManAtYrService

Licensed under CC BY-SA 4.0

Script to walk a list of repositories and either pull or clone, depending on state. It is done in parallel, and takes a destination and a flat text file with git repo urls to sync separated by newlines. Used in my dotfiles, when I need to keep repos up to date with a job.

Requirements:

Usage: git-update.sh DEST REPO_FILE.txt

./git-update.sh ~/src mydependencies.txt

License MIT

Generic hibernate script, normally called via a graphical menu. Uses zenity for a confirm dialog. Locks screen before hibernating.

Requirements:

Usage:

./hibernate.sh

License MIT

Install packages from YAML configuration using paru. Will look for ~/.dependencies.yml unless [config.yml] is provided.

Requirements:

Usage:

./install-packages.sh [config.yml]

Example configuration:

packages:
  # Core system utilities
  core:
    - name: cryptsetup
      description: Userspace setup tool for transparent encryption of block devices using dm-crypt
      aur: false
    - name: git
      description: The fast distributed version control system
      aur: false
  # ...

For a full example of config refer to my dotfile dependencies

Warning

Work in progress

License MIT

Lists system iommu groups used for PCI passthrough via OVMF. This was copied from the arch wiki in 2016, I would probably go check the latest wiki revision to get up to date scripts.

Usage:

./iommu-groups.sh

License GFDL-1.3

Generic locker script, normally called via a graphical menu. Uses zenity for a confirm dialog.

Requirements:

Usage:

./locker.sh

License MIT

Generic lock script, normally called via a graphical menu. Uses zenity for a confirm dialog.

Requirements:

Usage:

./lock.sh

License MIT

Generic logout script, normally called via a graphical menu. Uses zenity for a confirm dialog. Session needs to be started with uwsm.

Requirements:

Usage:

./logout.sh

License MIT

Open firefox with a custom (media) profile and app_id (firefox-media)

Requirements:

Usage:

./media-browser.sh

License MIT

Usage: ./media-clean.sh [OPTIONS] [DIRECTORY] Clean up RAR files from directories that contain extracted video files

OPTIONS:
  -d, --dry-run    Show what would be deleted without actually deleting
  -h, --help       Show this help message

DIRECTORY: Target directory to clean (default: current directory)

Warning

without passing dryrun this script WILL delete files, use at own risk.

License MIT

Creates a menu using rofi-menu.sh

Requirements:

See requirements for each respective script used in the menu Usage:

Called as a mode in rofi like this

configuration {
  modes: "actions:~/scripts/power-menu.sh";
}

Config for this menu looks like this:

items:
  - script: ~/scripts/shutdown.sh
    description: Shutdown
    icon: system-shutdown
# ...

License MIT

Generic reboot script, normally called via a graphical menu. Uses zenity for a confirm dialog.

Requirements:

Usage:

./reboot.sh

License MIT

Script to create rofi menus based on a provided YAML config file (ROFI_MENU_CONFIG)

Requirements:

Resources:

Config Format (YAML):

  items:
    - script: ~/path/to/my/script.sh
      description: Item description
      icon: icon_name
      args: ["optional", "arguments"]

Usage: To create a menu create a script like this

export ROFI_MENU_CONFIG="${XDG_CONFIG_HOME}/rofi-menu/config.yaml"
exec "${HOME}/scripts/rofi-menu.sh" "$@"

Then in rofi you'add your new script to a mode

modes: "run,mymode:~/scripts/script.sh";

Note

It's a bit slow, tried to reduce the queries passed to yq, but depending on the complexity of menu will take longer than I'd like.

License MIT

Capture screenshot of wayland region selected by slurp, anotate with satty/swappy

Requirements:

Usage

./screenshot.sh

License MIT

Generic shutdown script, normally called via a graphical menu. Uses zenity for a confirm dialog.

Requirements:

Usage:

./shutdown.sh

License MIT

Generic suspend script, normally called via a graphical menu. Uses zenity for a confirm dialog.

Requirements:

Usage:

./suspend.sh

License MIT

source: https://gist.github.com/crispyricepc/f313386043395ff06570e02af2d9a8e0#file-wlprop-sh

Starts a window picker (slurp) and print selected window information. Similar to xprop. This is for sway, in Hyprland you can just use hyprctl clients + some grep pattern will get you far.

Requirements:

License MIT

Switches between audio sink (output) presets using pactl. Normally used with a graphical menu. See menu scripts in this repo for an example.

Usage: ./switch-audio.sh [headphones|speakers|tv|mute-output|mute-input|toggle]
  headphones: Activate headphones
  speakers: Activate speakers
  tv: Activate tv speakers
  mute-output: Toggle mute default output sinks
  mute-input: Toggle mute default input source
  toggle: Toggle between speakers and headphones

Note

This is spesific for my personal setup, script needs modification to work for any setup.

License MIT

Hyprland display switcher using dynamic monitor configs, switch between monitor layouts.

This script is spesifific to my home setup. It uses symlinks to swap out config for ~/.config/hypr/monitors/current.conf. These conf files are just hyprland config files with settings spesific to that display layout. Remember to source the symlink in your main hyprland config:

source = ~/.config/hypr/monitors/current.conf

I've had a persistent problem where on monitor wakeup (varying wake times), hyprland won't respect my workspace monitor assignments, so this script will move windows to their "corrent" placement.

Usage: ./switch-display.sh <config> [options]

Configurations:
  [all desk mirror tv] Switch to specified display configuration

Example (Switch to desk configuration):
  ./switch-display.sh desk

Note: Make sure to create config files in $HOME/.config/hypr/monitors matching argument name, e.g., desk.conf

Warning

Work in progress

License MIT

System monitor

Requirements:

Usage:

./system-monitor.sh`

License MIT

Try to attach to existing tmux deattached session or start a new session

Requirements:

Usage:

./tmux-attach.sh`

Note

Pending deprecation, I don't generally use this, I instead use ./tmux-main.sh*

Note

I belive this was orignally copied from wiki.archlinux.org way back in 2015, so I'm keeping the license in accordance with the wiki.

License GFDL-1.3

Main session with default layout. 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, or just run manually.

Requirements:

Usage:

./tmain.sh

Resources:

  1. https://unix.stackexchange.com/questions/80473/how-do-i-run-a-shell-command-from-tmux-conf/80529#80529
  2. https://wiki.archlinux.org/title/Tmux#Autostart_tmux_with_default_tmux_layout

License GFDL-1.3

Use libnotify to notify when a tmux window receives a bell. Used with tmux-update-window.sh.

Requirements:

Usage:

set-hook -g alert-silence 'run ". ~/utils/tmux-notify.sh; return 0"'

License MIT

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.

Requirements:

Usage: Takes TCP PORT as argument to ngrok.

./tmux-ssh.sh [PORT]

License MIT

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:

Usage: Requires a running tmux session

./tmux-update-window.sh

License MIT

A simple script to extract a rar file inside a directory downloaded by Transmission. It uses environment variables passed by the transmission client to find and extract any rar files from a downloaded torrent into the folder they were found in.

Requirements:

Usage: Configure to run on torrent completion in your client. See ./media-clean.sh for a way to clean up after this script.

Note

I don't actually know where this snippet originated, its all over the web, in gists and other script repos. I've seen other variants of this licensed under MIT, so I'm assuming that's OK here to, but I'm not 100%. If anyone knows, please let me know so I can add proper credit

License MIT

Requirements:

Usage: This is normally used in a bar, in polybar for example

[module/updates-arch-combined]
 type = custom/script
 exec = ~/scripts/updates-arch-combined.sh
 interval = 600

Source: https://github.com/polybar/polybar-scripts

License UNLICENSE

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:

Usage:

./waybar-dev.sh [OPTIONS]

    OPTIONS:
      -d, --debug      open debug inspector

License MIT

Usage: qute-nuke-cookies.py [-h] [-n] [-w WHITELIST_FILE]

Nuke qutebrowser cookies except for whitelisted domains.

  options:
    -h, --help            show this help message and exit
    -n, --dry-run         Print actions, but do not modify the database
    -w, --whitelist-file WHITELIST_FILE
                    Whitelist file (default:
                    $XDG_CONFIG_HOME/qutebrowser/cookie_whitelist).

Cookie whitelist file: $XDG_CONFIG_HOME/qutebrowser/cookie_whitelist (use -w to use a different location) Config file is flat file with URLs, and supports simple comments (#)

# My whitelist
example.com
google.com

License MIT

Parse chrome bookmark json, it looks for a folder in the bookmark_bar that is called capture. It'll go through each outputting to stdout each bookmark as a markdown formatted string.

Rationale: I don't main google-chrome, I use it on some other machines, and sometimes I stuble on something interesting in chrome I'd like to put in my notes, so I put it in a folder called capture to be processed later. Using this script I can save script output in my notes (markdown)

Usage

node bookmarks-md.mjs

License MIT

Licences

See individual script headers, or attached licenses in LICENSES


This README was automatically generated by generate-readme.sh on 2025-08-19 22:45:44

About

Collection of my personal shell scripts

Topics

Resources

Stars

Watchers

Forks