From 6b334b59fc9f681fd16fe437c363213bba80f640 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 31 May 2019 19:38:43 -0400 Subject: [PATCH] script documentation --- .local/bin/compiler | 6 +++--- .local/bin/ext | 4 +++- .local/bin/maimpick | 5 +++++ .local/bin/rotdir | 10 +++++++++- .local/bin/setbg | 7 ++++++- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.local/bin/compiler b/.local/bin/compiler index d44bb9a..dcf79f1 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -1,10 +1,10 @@ #!/bin/sh + # This script will compile or run another finishing operation on a document. I # have this script run via vim. # -# Compiles .tex. groff (.mom, .ms), .rmd, .md. -# Opens .sent files as sent presentations. -# Runs scripts based on extention or shebang +# Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent +# presentations. Runs scripts based on extention or shebang file=$(readlink -f "$1") dir=$(dirname "$file") diff --git a/.local/bin/ext b/.local/bin/ext index a63ab10..c2e0f5c 100755 --- a/.local/bin/ext +++ b/.local/bin/ext @@ -1,5 +1,7 @@ #!/bin/sh -# A general, all-purpose extraction script. + +# A general, all-purpose extraction script. Not all extraction programs here +# are installed by LARBS automatically. # # Default behavior: Extract archive into new directory # Behavior with `-c` option: Extract contents into current directory diff --git a/.local/bin/maimpick b/.local/bin/maimpick index 07d032f..7125e61 100755 --- a/.local/bin/maimpick +++ b/.local/bin/maimpick @@ -1,4 +1,9 @@ #!/bin/sh + +# This is bound to Shift+PrintScreen by default, requires maim. It lets you +# choose the kind of screenshot to take, including copying the image or even +# highlighting an area to copy. scrotcucks on suicidewatch right now. + case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in "a selected area") maim -s pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;; "current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; diff --git a/.local/bin/rotdir b/.local/bin/rotdir index e7103db..7313a42 100755 --- a/.local/bin/rotdir +++ b/.local/bin/rotdir @@ -1,4 +1,12 @@ #!/bin/sh + +# When I open an image from the file manager in sxiv (the image viewer), I want +# to be able to press the next/previous keys to key through the rest of the +# images in the same directory. This script "rotates" the content of a +# directory based on the first chosen file, so that if I open the 15th image, +# if I press next, it will go to the 16th etc. Autistic, I know, but this is +# one of the reasons that sxiv is great for being able to read standard input. + [ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 -base="$(basename $1)" +base="$(basename "$1")" ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }" diff --git a/.local/bin/setbg b/.local/bin/setbg index 950ae7c..6125654 100755 --- a/.local/bin/setbg +++ b/.local/bin/setbg @@ -1,4 +1,9 @@ #!/bin/sh -# Sets the background. If given an argument, will set file as background. + +# In LARBS, ~/.config/wall.png is the location of the system wallpaper. This +# script, if given an argument, moves it there. This script without an +# argument sets ~/.config/wall.png as the wallpaper, which is required on login +# if you don't want a blakc screen. + [ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." xwallpaper --zoom ~/.config/wall.png