Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
/ shell-scripts Public archive

a collection of useful scripts i've maintained over the years

Notifications You must be signed in to change notification settings

reeseovine/shell-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shell scripts

This repo was extracted from my dotfiles repo for better discoverability.

Symlinked as ~/scripts and included in $PATH

All of the scripts in this repo were either written by me or borrowed from someone else and modified for my use case. I don't want to reupload unmodified scripts, so for those, check out this section of my dotfiles readme.

battery-notify Language: Bash

by beatle on archlinux forums
Runs in the background and warns me when my laptop battery gets too low.

colors.py Language: Python3

Custom visualizations of terminal colors. I'm sure there are better implementations out there but this was fun to make.

davsync Language: Bash

Synchronizes calendars and contacts from my CalDAV/CardDAV server with vdirsyncer and updates khal.

kitty-popup Language: Bash

Create terminal script popup windows using kitty's remote control and i3-msg to manipulate the window.

lightswitch Language: Javascript

Tells certain programs to switch to light or dark mode depending on a command line argument.

lock Language: Bash

Runs i3lock-color using colors from wal to save lines of code elsewhere. It assumes there is a backdrop image located at /tmp/i3lock_bg.png, which should be generated by the pywal script.

minecraft Language: Javascript

Pings a Minecraft server to see who is online. Made to be used with Polybar.

mk-itch-shortcut Language: Bash

Creates an application shortcut given an itch.io game folder so you can access it from your app launcher or add it to Steam.

rgbctl.py Language: Python3

Sets the colors of physical devices with RGB in my setup. Right now it only sets the colors of the keyboard on my Razer Blade. It has the ability to set the Yeelight bulbs over my local network but I turned that off because it hurts my eyes 😵.

screech Language: Bash

Swiss army knife screenshotting tool. It wraps around maim (X11) and grim (wayland, untested) for taking the screenshots themselves, and a few other small programs for various tasks like selecting an area of the screen. It's designed to have concise and easy-to-remember commands.

screensaver Language: Bash

Terminal-based desktop screensaver program.

update Language: Bash

Update system-wide packages from different package managers in parallel. Uses rofi/askpass when not run from a terminal.

wal.py Language: Python3

Grabs a random wallpaper (or reads a path from argv), sets it and loads a color scheme with wal, then tells everything to update its color scheme (either directly or through lightswitch). Supports light and dark mode, and has an automatic option that uses the angle of the sun.

rofi

Scripts that use rofi as their UI.

askpass Language: Bash

by ivanbartsov
Gives scripts a way to prompt for passwords without a terminal. Prepend commands with SUDO_ASKPASS=/path/to/rofi/askpass sudo -A (or add the first part to .profile/.bashrc) to use.

displayout Language: Bash

Menu for switching between monitor setups. The xrandr commands were generated by ARandR

power Language: Bash

by tostiheld
Menu for shutting down, logging out, etc.

tweet Language: Bash

A wrapper around tweet.sh so I can post tweets without having to open Twitter (or a terminal).

usb Language: Bash

by luyves
USB device manager and client for udisks2.

wiktionary Language: Python3

Look up definitions from Wiktionary. You can set the language as well.

Backups

Disclaimer! The backup script is kind of a mess right now. Once I have a working backup workflow again I'll update it and remove this warning.

I made a few files for managing backups:

  • backup Language: Bash - The main script. It can start and stop backups, and it will keep running until it's done. It's basically just a wrapper for restic with special features like notifications, logging, and a single-instance lock.
  • backupctl Language: Bash - A rofi menu where you can start or stop a backup in the background and view the log file without having to do it manually in a terminal.
  • backup-status Language: Bash - An indicator for polybar that shows if a backup is running, finished, failed, or out of date. It might need some modification to work with other status bars. Here's an example config entry for polybar:
    [module/backup]
    type = custom/script
    exec = ~/.config/polybar/scripts/backup-status
    tail = true ; Only show last line of output
    click-left = ~/scripts/rofi/backupctl
  • backup/ - Contains a config file and a list of patterns to exclude. Make sure to edit these before running the script.

Why?

For a while I'd been looking for a simple backup solution for Linux that also felt seamless and integrated into the desktop but I couldn't find one which suited my needs. I originally made this script to work with rsync but I wanted snapshots, which restic can do. I love how simple it is but I got tired of typing the entire command each time (or scrolling through my term history for it) so I wrote these to make things easier for me.

Shortcomings

I didn't include the ability to create multiple backups or schedule them, but I don't think it would be hard to add those features. It's also highly tailored to my needs and setup which means you might need to convert some of the code if you use different programs than me.

Graveyard

Scripts I've stopped using in favor of solutions. Links go to the file at the last commit it existed in.

A wrapper around gcalcli which turns it into a REPL (read-eval-print loop) rather than having to enter the full command every time. This gets wrapped with kitty-popup by polybar when I click the date/time widget for easy access.

My original bash version of wal.py. Grabs a random wallpaper (or reads a path from argv), sets it and loads a color scheme with wal, then tells everything to update its color scheme (either directly or through another script). Supports light and dark mode, and has an automatic option that uses redshift to get the angle of the sun.

(Re)starts polybar. It detects primary and secondary displays and puts the correct bar on each.

Uses i3's append_layout feature to restore layouts and open programs upon login so I don't have to waste my time doing it manually. Layout files