Skip to content

A collection of shell scripts that I currently/have used.

License

Notifications You must be signed in to change notification settings

IanFindlay/scripts

Repository files navigation

Scripts

A collection of shell scripts I use. Some are original, some are my version of other's scripts and others are exact copies. The non-original scripts have attribution (if I remember it)

checkmail

Counts the number of files in the mail folder before running mbsync. Then counts the number of files again and, if the numbers don't match indicating a new message, runs notmuch new and then neomutt.

dwm_restart

Taken from the Arch Wiki. Allows dwm to be restarted without logging out or closing application. Useful when testing a new script or alteration to dwm but something I don't really use.

dwm_status_bar

My bespoke dwm status bar with the following parts:

cmus - Displays Song, Artist, Album, Track Time and has an icon if Shuffle is on. Status updates ~every second when cmus is running, 20 seconds otherwise.

Mullvad VPN - Display a padlock icon when I am connected through Mullvad VPN.

Transmission-cli - Categorises torrents into Downloading, Uploading and Seeded (Ratio >= 1.0) and displays the number of torrents of each type and the accumulated speed of the Downloading and Uploading ones.

Volume - If speaker volume is less than 100% the volume is displayed with a different icon for when it is muted and when my headphones are plugged in.

Date - Displays the current date and time in the following format "Day Date Month HH:MM"

This script has been split into separate scripts for use with:

dwmblocks folder and blocks

Instead of using sleep - of different lengths depending on if cmus (music player) was running or not - I've started using dwmblocks. This allows me to update information on the status bar independently - for example, the volume portion of the bar only updates when it has been changed. The blocks (scripts responsible for each part of the status bar) are currently only slightly modified versions of those mentioned above in the dwm_status_bar section so I won't reiterate what they do here.

update_current_track, lyrics and show_lyrics

My three-part solution to being able to have the lyrics of the current song displayed and auto-updating. Uses cmus' status_display_program command to write the current track to a file (update_current_track) that is then monitored by entr (lyrics) and then show_lyrics displays the lyrics by reading a local file. Lyrics can be Edited, marked as Instrumental or Searched for at Genius using arguments to show_lyrics.

media_control

Allows me to map my media controls to both cmus (which takes priority) and mpv (which uses xdotool).

otpmenu

Essentially passmenu for pass-otp - allows me to use dmenu to copy otp codes stored in pass to the clipboard. Heavily based upon Alwyn Kik's modifications to passmenu as I simply adapted it to the specifics of my setup.

play_song

Given two arguments, artist and song title, it will attempt to 'find' a file that matches the criteria and play it with mpv. If multiple possibilities are found it will display them all and prompt for a selection.

podentr, poddown

Based on this Luke Smith video - Improves upon Newsboats podcast downloading by monitoring the queue file (podentr) and downloading podcasts automatically (poddown) without having to open podboat.

remseeded

Uses transmission-remote to remove any torrents that have seeded to or beyond a 1.0 ratio. If there are no torrents, or all torrents were seeded to 1.0 and have therefore been removed, it kills the transmission-daemon.

setbg

Another Luke Smith video inspired script, simply uses xwallpaper to set the desktop background either to an already set file, the file supplied as an argument or a random file in a directory passed as an argument.

song_search

Uses grep to search the directory with my lyrics files in (as mentioned in the update_current_track etc description above) for the word/words that I pass as the argument(s) and prints the matches in "Artist - Title" format. Can be given an argument -p(lay) which means it will, should it find a matching song, call the play_song script with the artist and title as arguments or, if multiple possibilities are found, will prompt for a selection between them prior to the call.

torrent_add

Adds a magnet link via transmission-remote. Starts transmission-daemon if required.

torrent_done

Sends a notification that a torrent has finished downloading through notify-send.

viddown

Basically poddown but for video. Uses youtube-dl to download videos from a url with a notification for both when the file is enqueued and completed.

volume_change

Detects if my headphones or speakers are currently in use and alters the volume of the appropriate device. Also kills and restarts dwm_status_bar so the volume displayed is up-to-date.

About

A collection of shell scripts that I currently/have used.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages