From 88f0243428c4cf39029c8ffc5a7e1634951158a0 Mon Sep 17 00:00:00 2001 From: filip <“filip.rabiega@gmail.com”> Date: Wed, 21 Jan 2026 10:36:12 +0100 Subject: add comments to some scripts --- batterylow | 1 + bmks | 13 +++++++------ brightness | 1 + de | 1 + deploy | 1 + dictloop | 23 +++++++++++++---------- dpass | 3 ++- dz | 1 + dz-feed | 1 + echovol | 1 + engadd | 1 + inpath | 1 + logrm | 1 + lsn | 2 +- maimpick | 1 - mansplain | 1 + mounter | 1 - newnote | 1 + newscript | 1 + newsup | 1 + notesplain | 1 + packsize | 1 + printpath | 1 + remaps | 1 + rmw | 3 ++- rssadd | 1 + scan | 2 +- todo | 1 - via-feed | 11 +++++++++-- via-open | 2 +- viaup | 2 +- 31 files changed, 56 insertions(+), 27 deletions(-) diff --git a/batterylow b/batterylow index cf081d1..2086cb2 100755 --- a/batterylow +++ b/batterylow @@ -1,4 +1,5 @@ #!/bin/sh +# This script sends notifications when battery is low. # those variables may be unnecessary export DISPLAY=:0 diff --git a/bmks b/bmks index 1239e7c..b0a9b4f 100755 --- a/bmks +++ b/bmks @@ -1,4 +1,5 @@ #!/bin/bash +# This script is for handling bookmarks. # set prefered launcher PREFERED_LAUNCHER="dmenu" @@ -69,10 +70,10 @@ bmks_check() { case "$1" in "help") show_usage ;; -"add") url=$2; bmks_add ;; -"del") bmks_del ;; -"ls") bmks_ls ;; -"dmenu") PREFERED_LAUNCHER=$1; bmks_display ;; -"fzf") PREFERED_LAUNCHER=$1; bmks_display ;; -*) bmks_display ;; + "add") url=$2; bmks_add ;; + "del") bmks_del ;; + "ls") bmks_ls ;; + "dmenu") PREFERED_LAUNCHER=$1; bmks_display ;; + "fzf") PREFERED_LAUNCHER=$1; bmks_display ;; + *) bmks_display ;; esac diff --git a/brightness b/brightness index fc152f3..b2c81c9 100755 --- a/brightness +++ b/brightness @@ -1,4 +1,5 @@ #!/bin/sh +# This script is for managing system brightness. It is envoked by dwm. case "$1" in up) sudo brightnessctl s "10%+" ;; diff --git a/de b/de index 3033aaa..bc5fe85 100755 --- a/de +++ b/de @@ -1,3 +1,4 @@ #!/bin/sh +# Garbage script for translating words into and from German. sdcv -u 'German - English' -u 'English - German' "$1" diff --git a/deploy b/deploy index face70a..12a8aa2 100755 --- a/deploy +++ b/deploy @@ -1,4 +1,5 @@ #!/bin/sh +# Helper script to deploy my website automatically. user="root" host="rabiega.xyz" diff --git a/dictloop b/dictloop index 738b3c0..1a239ea 100755 --- a/dictloop +++ b/dictloop @@ -1,16 +1,21 @@ -#!/usr/bin/zsh +#!/bin/sh +# Script for checking multiple definitions one after another -setopt aliases -source "$ZDOTDIR/aliasrc" +# Load aliases if available +if [ -n "$ZDOTDIR" ] && [ -f "$ZDOTDIR/aliasrc" ]; then + . "$ZDOTDIR/aliasrc" +fi -[ "$#" -ne 1 ] && { +# Argument check +if [ "$#" -ne 1 ]; then echo "Usage: dictloop " >&2 exit 1 -} -dict="$1" # a command-line dictionary +fi -while true; do - echo "Enter a word: " +dict=$1 + +while :; do + printf "Enter a word: " read -r word if [ -z "$word" ] || [ "$word" = "exit" ]; then @@ -20,5 +25,3 @@ while true; do "$dict" "$word" done - -exit 0 diff --git a/dpass b/dpass index 4458d59..60adce3 100755 --- a/dpass +++ b/dpass @@ -1,6 +1,7 @@ #!/bin/sh +# Select a password in dmenu and copy it dir="${PASSWORD_STORE_DIR:-$HOME/.password-store}" password=$(find "$dir" -type f -name '*.gpg' | -sed 's/.*\/\(.*\)\.gpg$/\1/' | dmenu -i -p "Pass:") + sed 's/.*\/\(.*\)\.gpg$/\1/' | dmenu -i -p "Pass:") [ -n "$password" ] && pass show -c "$password" diff --git a/dz b/dz index 8ca9972..71479da 100755 --- a/dz +++ b/dz @@ -1,3 +1,4 @@ #!/bin/bash +# Select a pdf file in dmenu and open it in zathura dz-feed | dmenu -p "dz" -i -l 15 | xargs -r zathura diff --git a/dz-feed b/dz-feed index 3e90102..85c7c54 100755 --- a/dz-feed +++ b/dz-feed @@ -1,4 +1,5 @@ #!/bin/sh +# Cache pdf files to be opened with dz cache="$HOME/.cache/dz" diff --git a/echovol b/echovol index 9845a55..8413c1b 100755 --- a/echovol +++ b/echovol @@ -1,4 +1,5 @@ #!/bin/sh +# Print current volume on standard output volume=$(pactl list sinks | grep -A 15 'Sink #0' | grep 'Volume:' | awk '{print $5}' | tr -d '%' | head -1) mute=$(pactl list sinks | grep -A 15 'Sink #0' | grep 'Mute' | awk '{print $2}') diff --git a/engadd b/engadd index 27d5fd1..1d91cf5 100755 --- a/engadd +++ b/engadd @@ -1,3 +1,4 @@ #!/bin/sh +# Garbage script to add obscure words to file echo "$1" >> "$HOME"/langs/english/obscure_words diff --git a/inpath b/inpath index 71bfeb9..177bb3b 100755 --- a/inpath +++ b/inpath @@ -1,4 +1,5 @@ #!/bin/sh +# Check if a command is in PATH in_path() { cmd=$1 path=$2 res=1 diff --git a/logrm b/logrm index e760bcc..4bc7d76 100755 --- a/logrm +++ b/logrm @@ -1,4 +1,5 @@ #!/bin/sh +# Remove a file and log the removal removelog="/var/log/remove.log" diff --git a/lsn b/lsn index 426d71b..f6effe0 100755 --- a/lsn +++ b/lsn @@ -1,7 +1,7 @@ #!/bin/sh - # New and better ls # TODO: fix simlinks, flags break them for some reason, maybe switch to eza + ls_new() { LC_ALL=C $(which ls) -lAFh --color=always "$1" | awk '{ name = $9; diff --git a/maimpick b/maimpick index 83effed..b8eb9b1 100755 --- a/maimpick +++ b/maimpick @@ -1,5 +1,4 @@ #!/bin/sh - # 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. diff --git a/mansplain b/mansplain index 6c7973b..aceefcb 100755 --- a/mansplain +++ b/mansplain @@ -1,4 +1,5 @@ #!/bin/sh +# Choose a man manual in dwm and open it in zathura arg="$( man -k . | dmenu -l 15 | awk '{print $1}')" [ -n "$arg" ] && man -Tpdf "$arg" | zathura - diff --git a/mounter b/mounter index 969412b..af1d23b 100755 --- a/mounter +++ b/mounter @@ -1,5 +1,4 @@ #!/bin/bash - # Mounts Android Phones and USB drives (encrypted or not). This script will # replace the older `dmenumount` which had extra steps and couldn't handle # encrypted drives. diff --git a/newnote b/newnote index 6e40235..e0bd2a3 100755 --- a/newnote +++ b/newnote @@ -1,4 +1,5 @@ #!/bin/sh +# Add a new note dir="$OBSIDIAN_HOME" diff --git a/newscript b/newscript index 154d2fb..87220ba 100755 --- a/newscript +++ b/newscript @@ -1,4 +1,5 @@ #!/bin/sh +# Add a new script newscript() { file="$HOME/.scripts/$1" diff --git a/newsup b/newsup index 42e90fd..3201e9b 100755 --- a/newsup +++ b/newsup @@ -1,4 +1,5 @@ #!/bin/sh +# Update newsboat and send a notification export DISPLAY=:0.0 export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus diff --git a/notesplain b/notesplain index 8136cec..80b057b 100755 --- a/notesplain +++ b/notesplain @@ -1,4 +1,5 @@ #!/bin/sh +# Open a markdown note in zathura dir="$OBSIDIAN_HOME" file="$(ls -1 "$dir" | sed 's/\.md$//' | dmenu -l 15 -p 'Select note:')" diff --git a/packsize b/packsize index 0aa3fdc..e725447 100755 --- a/packsize +++ b/packsize @@ -1,3 +1,4 @@ #!/bin/sh +# List all installed packages and list them by their size. dpkg-query -W --showformat='${Package} ${Installed-Size}\n' | sort -k2 -n -r diff --git a/printpath b/printpath index 1a1a605..396fd86 100755 --- a/printpath +++ b/printpath @@ -1,4 +1,5 @@ #!/bin/sh +# Print everythin in PATH echo "$PATH" | tr ':' '\n' | while IFS= read -r dir; do [ -d "$dir" ] || continue diff --git a/remaps b/remaps index 39e1018..983522a 100755 --- a/remaps +++ b/remaps @@ -1,4 +1,5 @@ #!/bin/sh +# Remap stuff # Increase key speed xset r rate 200 80 diff --git a/rmw b/rmw index f84689f..6bd558d 100755 --- a/rmw +++ b/rmw @@ -1,7 +1,8 @@ #!/bin/sh +# Remove whitespaces in all the files in a given directory if [ "$#" -gt 1 ]; then - echo "Usage: rm_whitespaces " >&2 + echo "Usage: rmw " >&2 exit 1 fi diff --git a/rssadd b/rssadd index 140774a..86087f0 100755 --- a/rssadd +++ b/rssadd @@ -1,4 +1,5 @@ #!/bin/sh +# Add a new RSS feed if echo "$1" | grep -q "https*://\S\+\.[A-Za-z]\+\S*"; then url="$1" diff --git a/scan b/scan index f06d5a4..c152090 100755 --- a/scan +++ b/scan @@ -1,7 +1,7 @@ #!/bin/sh # Find all files in subdirectories (excluding top-level files) -file=$(find . -mindepth 2 -type f 2>/dev/null | sed 's|^\./||' | sort | dmenu -i -p "Select a file:") +file=$(find . -mindepth 2 -type f 2>/dev/null | sed 's|^\./||' | sort | dmenu -l 15 -p "Select a file:") # If a file was selected if [ -n "$file" ]; then diff --git a/todo b/todo index ecabbc7..06fa01f 100755 --- a/todo +++ b/todo @@ -4,7 +4,6 @@ # # Select an existing entry to remove it from the file, or type a new entry to # add it. -# file="$HOME/.local/opt/todo" touch "$file" diff --git a/via-feed b/via-feed index ff9701d..d0d2544 100755 --- a/via-feed +++ b/via-feed @@ -5,8 +5,15 @@ cache="$HOME/.cache/via" if [[ "$1" == "-r" ]] || [[ ! -e "$cache" ]]; then cat "$HOME/.config/via/shortcuts" > "$cache" cat "$HOME/.config/via/websites" >> "$cache" - find "$HOME" -mindepth 1 \( -type d -name ".*" ! -path "$HOME/.scripts" -o -path "$HOME/cell" -o -path "$HOME/phone/*" \) -prune -o -print | sort >> "$cache" - # notify-send "via cache updated." + find "$HOME" -mindepth 1 \ + \( \ + -type d -name ".*" ! -path "$HOME/.scripts" \ + -o -path "$HOME/cell" \ + -o -path "$HOME/phone/*" \ + \) -prune \ + -o -print \ + | sort >> "$cache" + # notify-send "via cache updated." fi if [ "$CRON" = "1" ]; then diff --git a/via-open b/via-open index 0da2642..14bfb35 100755 --- a/via-open +++ b/via-open @@ -48,7 +48,7 @@ while read -r arg; do sxiv "$arg" & ;; *) - exit 1 + $TERMINAL $EDITOR "$arg" & ;; esac ;; diff --git a/viaup b/viaup index cd5642a..fd5761e 100755 --- a/viaup +++ b/viaup @@ -4,4 +4,4 @@ export HOME=/home/filipek via-feed -r > /dev/null -notify-send "via cache updated." +# notify-send "via cache updated." -- cgit v1.2.3