diff --git a/.config/nvim/lua/lazyvim/plugins/utility.lua b/.config/nvim/lua/lazyvim/plugins/utility.lua index f4c155e..98d0a32 100644 --- a/.config/nvim/lua/lazyvim/plugins/utility.lua +++ b/.config/nvim/lua/lazyvim/plugins/utility.lua @@ -26,7 +26,7 @@ return { "rcarriga/nvim-notify", opts = { -- Animation style (see below for details) - stages = "fade_in_slide_out", + stages = "static", -- Render function for notifications. See notify-render() render = "default", diff --git a/.local/bin/bash-status-bat b/.local/bin/bash-status-bat index 5990f92..bccdb19 100755 --- a/.local/bin/bash-status-bat +++ b/.local/bin/bash-status-bat @@ -1,12 +1,12 @@ #!/bin/bash -[[ "$(upower -i $(upower -e | grep 'BAT'))" == "" ]] && exit +[[ "$(upower -i "$(upower -e | grep 'BAT')")" == "" ]] && exit -current=$(upower -i $(upower -e | grep 'BAT') | grep -E "percentage" | sed 's/.*://' | sed 's/ *//') -state=$(upower -i $(upower -e | grep 'BAT') | grep -E "state" | sed 's/.*://' | sed 's/ *//') +current=$(upower -i "$(upower -e | grep 'BAT')" | grep -E "percentage" | sed 's/.*://' | sed 's/ *//') +state=$(upower -i "$(upower -e | grep 'BAT')" | grep -E "state" | sed 's/.*://' | sed 's/ *//') if [[ "$state" == "not charging" ]]; then - state="full" + state="full" fi echo "$current $state" diff --git a/.local/bin/bash-status-git b/.local/bin/bash-status-git index 68350f3..9d297a3 100755 --- a/.local/bin/bash-status-git +++ b/.local/bin/bash-status-git @@ -1,22 +1,22 @@ #!/bin/bash if git status &>/dev/null; then - branch=$(git branch --show-current) + branch=$(git branch --show-current) - if [ -z "$branch" ]; then - echo "(detached)" - exit 0 - fi + if [ -z "$branch" ]; then + echo "(detached)" + exit 0 + fi - read -ra counts <<< "$(git rev-list --left-right --count "$branch"...origin/"$branch")" - to_push=${counts[0]} - to_pull=${counts[1]} + read -ra counts <<< "$(git rev-list --left-right --count "$branch"...origin/"$branch")" + to_push=${counts[0]} + to_pull=${counts[1]} - extras=$([[ ${counts[0]} -eq 0 && ${counts[1]} -eq 0 ]] || echo " $to_push↑ $to_pull↓") + extras=$([[ ${counts[0]} -eq 0 && ${counts[1]} -eq 0 ]] || echo " $to_push↑ $to_pull↓") - if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then - echo "($branch*$extras)" - else - echo "($branch~$extras)" - fi + if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then + echo "($branch*$extras)" + else + echo "($branch~$extras)" + fi fi diff --git a/.local/bin/checkup b/.local/bin/checkup deleted file mode 100755 index bd3c634..0000000 --- a/.local/bin/checkup +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Syncs repositories and downloads updates, meant to be run as a cronjob. - -notify-send "📦 Repository Sync" "Checking for package updates..." - -sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. - -Check your internet connection, if pacman is already running, or run update manually to see errors." -pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" - -if pacman -Qu | grep -v "\[ignored\]" -then - notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update." -else - notify-send "📦 Repository Sync" "Sync complete. No new packages for update." -fi diff --git a/.local/bin/cht.sh b/.local/bin/cht.sh index d7b4532..2a7f7fb 100755 --- a/.local/bin/cht.sh +++ b/.local/bin/cht.sh @@ -9,7 +9,7 @@ if [[ -z $selected ]]; then exit 0 fi -read -p "Enter Query: " query +read -rp "Enter Query: " query if grep -qs "$selected" "$languages"; then query=$(echo "$query" | tr ' ' '+') diff --git a/.local/bin/compiler b/.local/bin/compiler index 8420e25..1bad671 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -17,43 +17,43 @@ ext="${file##*.}" cd "$dir" || exit 1 textype() { \ - textarget="$(getcomproot "$file" || echo "$file")" - echo "$textarget" - command="pdflatex" - ( head -n5 "$textarget" | grep -qi 'xelatex' ) && command="xelatex" - $command --output-directory="${textarget%/*}" "${textarget%.*}" - grep -qi addbibresource "$textarget" && - biber --input-directory "${textarget%/*}" "${textarget%.*}" && - $command --output-directory="${textarget%/*}" "${textarget%.*}" && - $command --output-directory="${textarget%/*}" "${textarget%.*}" + textarget="$(getcomproot "$file" || echo "$file")" + echo "$textarget" + command="pdflatex" + ( head -n5 "$textarget" | grep -qi 'xelatex' ) && command="xelatex" + $command --output-directory="${textarget%/*}" "${textarget%.*}" + grep -qi addbibresource "$textarget" && + biber --input-directory "${textarget%/*}" "${textarget%.*}" && + $command --output-directory="${textarget%/*}" "${textarget%.*}" && + $command --output-directory="${textarget%/*}" "${textarget%.*}" } case "$ext" in - # Try to keep these cases in alphabetical order. - [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; - c) cc "$file" -o "$base" && "$base" ;; - cpp) g++ "$file" -o "$base" && "$base" ;; - cs) mcs "$file" && mono "$base".exe ;; - go) go run "$file" ;; - h) sudo make install ;; - java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; - m) octave "$file" ;; - md) if [ -x "$(command -v lowdown)" ]; then - lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf - elif [ -x "$(command -v groffdown)" ]; then - groffdown -i "$file" | groff -T pdf > "$base".pdf - else - pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" - fi ; ;; - mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; - ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; - org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;; - py) python "$file" ;; - [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; - rs) cargo build ;; - sass) sassc -a "$file" "$base".css ;; - scad) openscad -o "$base".stl "$file" ;; - sent) setsid -f sent "$file" 2>/dev/null ;; - tex) textype "$file" ;; - *) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;; + # Try to keep these cases in alphabetical order. + [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; + c) cc "$file" -o "$base" && "$base" ;; + cpp) g++ "$file" -o "$base" && "$base" ;; + cs) mcs "$file" && mono "$base".exe ;; + go) go run "$file" ;; + h) sudo make install ;; + java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; + m) octave "$file" ;; + md) if [ -x "$(command -v lowdown)" ]; then + lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf + elif [ -x "$(command -v groffdown)" ]; then + groffdown -i "$file" | groff -T pdf > "$base".pdf + else + pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" + fi ; ;; + mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; + ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; + org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;; + py) python "$file" ;; + [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; + rs) cargo build ;; + sass) sassc -a "$file" "$base".css ;; + scad) openscad -o "$base".stl "$file" ;; + sent) setsid -f sent "$file" 2>/dev/null ;; + tex) textype "$file" ;; + *) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;; esac diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup index bd3c634..ea0f6d0 100755 --- a/.local/bin/cron/checkup +++ b/.local/bin/cron/checkup @@ -2,16 +2,15 @@ # Syncs repositories and downloads updates, meant to be run as a cronjob. -notify-send "📦 Repository Sync" "Checking for package updates..." +notify-send "Repository Sync" "Checking for package updates..." sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. Check your internet connection, if pacman is already running, or run update manually to see errors." -pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" if pacman -Qu | grep -v "\[ignored\]" then - notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update." + notify-send "Repository Sync" "Sync comelete. You have updates $(pacman -Qu | grep -vc "\[ignored\]") available." else - notify-send "📦 Repository Sync" "Sync complete. No new packages for update." + notify-send "Repository Sync" "Sync complete. No new packages for update." fi diff --git a/.local/bin/cron/crontog b/.local/bin/cron/crontog index c9a640f..2da5d8c 100755 --- a/.local/bin/cron/crontog +++ b/.local/bin/cron/crontog @@ -3,4 +3,4 @@ # Toggles all cronjobs off/on. # Stores disabled crontabs in ~/.config/cronsaved until restored. -([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") +([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "Cronjobs saved and disabled.") diff --git a/.local/bin/crontog b/.local/bin/crontog deleted file mode 100755 index c9a640f..0000000 --- a/.local/bin/crontog +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Toggles all cronjobs off/on. -# Stores disabled crontabs in ~/.config/cronsaved until restored. - -([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") diff --git a/.local/bin/dec-sink-volume b/.local/bin/dec-sink-volume index 27a60d9..5ceb54a 100755 --- a/.local/bin/dec-sink-volume +++ b/.local/bin/dec-sink-volume @@ -1,11 +1,11 @@ #!/bin/bash -default_loc=/tmp/pactl-default-sink +default_loc="$HOME/.cache/pactl-default-sink" if [ ! -f "$default_loc" ] ; then set-default-sink fi -default=$(cat $default_loc) +default="$(<"$default_loc")" -pactl set-sink-volume $default -5% +pactl set-sink-volume "$default" -5% diff --git a/.local/bin/dec-source-volume b/.local/bin/dec-source-volume index e984688..cf1aa40 100755 --- a/.local/bin/dec-source-volume +++ b/.local/bin/dec-source-volume @@ -1,11 +1,11 @@ #!/bin/bash -default_loc=/tmp/pactl-default-source +default_loc="$HOME/.cache/pactl-default-source" if [ ! -f "$default_loc" ] ; then set-default-source fi -default=$(cat $default_loc) +default="$(<"$default_loc")" -pactl set-source-volume $default -5% +pactl set-source-volume "$default" -5% diff --git a/.local/bin/displayselect b/.local/bin/displayselect index f9e8062..f6f16d4 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -36,31 +36,31 @@ twoscreen() { # If multi-monitor is selected and there are two screens. direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0 fi - } +} morescreen() { # If multi-monitor is selected and there are more than two screens. - primary=$(echo "$screens" | dmenu -i -p "Select primary display:") - secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:") - direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") - tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:") - xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto - } + primary=$(echo "$screens" | dmenu -i -p "Select primary display:") + secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:") + direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") + tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:") + xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto +} multimon() { # Multi-monitor handler. - case "$(echo "$screens" | wc -l)" in - 2) twoscreen ;; - *) morescreen ;; - esac ;} + case "$(echo "$screens" | wc -l)" in + 2) twoscreen ;; + *) morescreen ;; +esac ;} onescreen() { # If only one output available or chosen. - xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -) - } + xrandr --output "$1" --auto --scale 1.0x1.0 "$(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)" +} postrun() { # Stuff to run to clean up. - setbg # Fix background if screen size/arangement has changed. - remaps # Re-remap keys if keyboard added (for laptop bases) - { killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen - } + setbg # Fix background if screen size/arangement has changed. + remaps # Re-remap keys if keyboard added (for laptop bases) + { killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen +} # Get all possible displays allposs=$(xrandr -q | grep "connected") @@ -70,14 +70,14 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}') # If there's only one screen [ "$(echo "$screens" | wc -l)" -lt 2 ] && - { onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;} +{ onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;} # Get user choice including multi-monitor and manual selection: chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && case "$chosen" in - "manual selection") arandr ; exit ;; - "multi-monitor") multimon ;; - *) onescreen "$chosen" ;; + "manual selection") arandr ; exit ;; + "multi-monitor") multimon ;; + *) onescreen "$chosen" ;; esac postrun diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount index 8cf4a6b..a887b6b 100755 --- a/.local/bin/dmenumount +++ b/.local/bin/dmenumount @@ -6,62 +6,62 @@ # input a novel directory, it will prompt you to create that directory. getmount() { \ - [ -z "$chosen" ] && exit 1 - # shellcheck disable=SC2086 - mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 - test -z "$mp" && exit 1 - if [ ! -d "$mp" ]; then - mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 - [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") - fi - } + [ -z "$chosen" ] && exit 1 + # shellcheck disable=SC2086 + mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 + test -z "$mp" && exit 1 + if [ ! -d "$mp" ]; then + mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") + fi +} mountusb() { \ - chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 - chosen="$(echo "$chosen" | awk '{print $1}')" - sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 - alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') - getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" - partitiontype="$(lsblk -no "fstype" "$chosen")" - case "$partitiontype" in - "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; - "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; - *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; - esac && notify-send "💻 USB mounting" "$chosen mounted to $mp." || - notify-send "💻 Drive failed to mount." "Probably a permissions issue or drive is already mounted." - } + chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 + chosen="$(echo "$chosen" | awk '{print $1}')" + sudo -A mount "$chosen" 2>/dev/null && notify-send "USB mounting" "$chosen mounted." && exit 0 + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') + getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" + partitiontype="$(lsblk -no "fstype" "$chosen")" + case "$partitiontype" in + "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;; + "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;; + *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp" ;; + esac && notify-send "USB mounting" "$chosen mounted to $mp." || + notify-send "Drive failed to mount." "Probably a permissions issue or drive is already mounted." +} mountandroid() { \ - chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 - chosen="$(echo "$chosen" | cut -d : -f 1)" - getmount "$HOME -maxdepth 3 -type d" - echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 - simple-mtpfs --device "$chosen" "$mp" && - notify-send "🤖 Android Mounting" "Android device mounted to $mp." || - notify-send "🤖 Android failed mounting." "Probably a permissions issue or phone is already mounted." - } + chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 + chosen="$(echo "$chosen" | cut -d : -f 1)" + getmount "$HOME -maxdepth 3 -type d" + echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 + simple-mtpfs --device "$chosen" "$mp" && + notify-send "Android Mounting" "Android device mounted to $mp." || + notify-send "Android failed mounting." "Probably a permissions issue or phone is already mounted." +} asktype() { \ - choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 - case $choice in - USB) mountusb ;; - Android) mountandroid ;; - esac - } + choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 + case $choice in + USB) mountusb ;; + Android) mountandroid ;; + esac +} anddrives=$(simple-mtpfs -l 2>/dev/null) usbdrives="$(lsblk -rpo "name,type,size,label,mountpoint,fstype" | grep -v crypto_LUKS | grep 'part\|rom' | sed 's/ /:/g' | awk -F':' '$5==""{printf "%s (%s) %s\n",$1,$3,$4}')" if [ -z "$usbdrives" ]; then - [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit - echo "Android device(s) detected." - mountandroid + [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit + echo "Android device(s) detected." + mountandroid else - if [ -z "$anddrives" ]; then - echo "USB drive(s) detected." - mountusb - else - echo "Mountable USB drive(s) and Android device(s) detected." - asktype - fi + if [ -z "$anddrives" ]; then + echo "USB drive(s) detected." + mountusb + else + echo "Mountable USB drive(s) and Android device(s) detected." + asktype + fi fi diff --git a/.local/bin/dmenuprompt b/.local/bin/dmenuprompt index afb24a4..67c471d 100755 --- a/.local/bin/dmenuprompt +++ b/.local/bin/dmenuprompt @@ -8,14 +8,14 @@ # Taken shamelessly from Luke Smith -if [ -n "$3" ] +if [[ -n "$3" ]] then choice=$(echo -e "Yes\nNo" | dmenu -bw 0 -i -p "$1") else choice=$(echo -e "No\nYes" | dmenu -bw 0 -i -p "$1") fi -if [ $choice = "Yes" ] +if [[ "$choice" = "Yes" ]] then $2 fi diff --git a/.local/bin/dmenusearch b/.local/bin/dmenusearch index 015e37c..71caf77 100755 --- a/.local/bin/dmenusearch +++ b/.local/bin/dmenusearch @@ -4,7 +4,7 @@ # Description: Search various search engines (inspired by surfraw). # Dependencies: dmenu and a web browser # Usage: dmenusearch -# where engine is amazon, duckduckgo, etc. +# where engine is amazon, duckduckgo, etc. # without engine all options will be listed # Pilfered from Derek Taylor @ https://www.gitlab.com/dwt1/dmscripts @@ -88,4 +88,4 @@ while [ -z "$query" ]; do done # Display search results in web browser -$DMBROWSER "$url""$query" +$DMBROWSER "$url" "$query" diff --git a/.local/bin/dmenuumount b/.local/bin/dmenuumount index 656d1f1..9ddf605 100755 --- a/.local/bin/dmenuumount +++ b/.local/bin/dmenuumount @@ -9,13 +9,13 @@ drives="$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /," chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 case "$chosen" in - 📱*) - chosen="${chosen#📱 }" - sudo -A umount -l "$chosen" - ;; - *) - chosen="${chosen% (*}" - sudo -A umount -l "$chosen" - ;; -esac && notify-send "🖥️ Drive unmounted." "$chosen successfully unmounted." || - notify-send "🖥️ Drive failed to unmount." "Possibly a permissions or I/O issue." + 📱*) + chosen="${chosen#📱 }" + sudo -A umount -l "$chosen" + ;; + *) + chosen="${chosen% (*}" + sudo -A umount -l "$chosen" + ;; +esac && notify-send "Drive unmounted." "$chosen successfully unmounted." || +notify-send "Drive failed to unmount." "Possibly a permissions or I/O issue." diff --git a/.local/bin/ext b/.local/bin/ext index 927fb5b..a621ae0 100755 --- a/.local/bin/ext +++ b/.local/bin/ext @@ -7,39 +7,39 @@ # Behavior with `-c` option: Extract contents into current directory while getopts "hc" o; do case "${o}" in - c) extracthere="True" ;; - *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;; + c) extracthere="True" ;; + *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;; esac done if [ -z "$extracthere" ]; then - archive="$(readlink -f "$*")" && - directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && - mkdir -p "$directory" && - cd "$directory" || exit 1 + archive="$(readlink -f "$*")" && + directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && + mkdir -p "$directory" && + cd "$directory" || exit 1 else - archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)" + archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)" fi [ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1 if [ -f "$archive" ] ; then - case "$archive" in - *.tar.bz2|*.tbz2) tar xvjf "$archive" ;; - *.tar.xz) tar -xf "$archive" ;; - *.tar.gz|*.tgz) tar xvzf "$archive" ;; - *.tar.zst) tar -I zstd -xf "$archive" ;; - *.lzma) unlzma "$archive" ;; - *.bz2) bunzip2 "$archive" ;; - *.rar) unrar x -ad "$archive" ;; - *.gz) gunzip "$archive" ;; - *.tar) tar xvf "$archive" ;; - *.zip) unzip "$archive" ;; - *.Z) uncompress "$archive" ;; - *.7z) 7z x "$archive" ;; - *.xz) unxz "$archive" ;; - *.exe) cabextract "$archive" ;; - *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; - esac + case "$archive" in + *.tar.bz2|*.tbz2) tar xvjf "$archive" ;; + *.tar.xz) tar -xf "$archive" ;; + *.tar.gz|*.tgz) tar xvzf "$archive" ;; + *.tar.zst) tar -I zstd -xf "$archive" ;; + *.lzma) unlzma "$archive" ;; + *.bz2) bunzip2 "$archive" ;; + *.rar) unrar x -ad "$archive" ;; + *.gz) gunzip "$archive" ;; + *.tar) tar xvf "$archive" ;; + *.zip) unzip "$archive" ;; + *.Z) uncompress "$archive" ;; + *.7z) 7z x "$archive" ;; + *.xz) unxz "$archive" ;; + *.exe) cabextract "$archive" ;; + *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; + esac else - printf "File \"%s\" not found.\\n" "$archive" + printf "File \"%s\" not found.\\n" "$archive" fi diff --git a/.local/bin/inc-sink-volume b/.local/bin/inc-sink-volume index 229273a..b5d072e 100755 --- a/.local/bin/inc-sink-volume +++ b/.local/bin/inc-sink-volume @@ -1,11 +1,11 @@ #!/bin/bash -default_loc=/tmp/pactl-default-sink +default_loc="$HOME/.cache/pactl-default-sink" if [ ! -f "$default_loc" ] ; then set-default-sink fi -default=$(cat $default_loc) +default=$(<"$default_loc") -pactl set-sink-volume $default +5% +pactl set-sink-volume "$default" +5% diff --git a/.local/bin/inc-source-volume b/.local/bin/inc-source-volume index a0a086d..91431db 100755 --- a/.local/bin/inc-source-volume +++ b/.local/bin/inc-source-volume @@ -1,11 +1,11 @@ #!/bin/bash -default_loc=/tmp/pactl-default-source +default_loc="$HOME/.cache/pactl-default-source" if [ ! -f "$default_loc" ] ; then set-default-source fi -default=$(cat $default_loc) +default=$(<"$default_loc") -pactl set-source-volume $default +5% +pactl set-source-volume "$default" +5% diff --git a/.local/bin/iommu.sh b/.local/bin/iommu.sh deleted file mode 100755 index 556d5aa..0000000 --- a/.local/bin/iommu.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -shopt -s nullglob -for g in /sys/kernel/iommu_groups/*; do - echo "IOMMU Group ${g##*/}:" - for d in $g/devices/*; do - echo -e "\t$(lspci -nns ${d##*/})" - done; -done; diff --git a/.local/bin/kbswitcher b/.local/bin/kbswitcher index 94bca7a..c4ad3a4 100755 --- a/.local/bin/kbswitcher +++ b/.local/bin/kbswitcher @@ -1,6 +1,6 @@ #!/usr/bin/env bash -fn="/tmp/kbswitcher.status" +fn="$HOME/.cache/kbswitcher-status" layout="" @@ -13,11 +13,11 @@ else us) echo "dvorak" > "$fn" layout="dvorak" - ;; + ;; dvorak) echo "us" > "$fn" layout="us" - ;; + ;; esac fi diff --git a/.local/bin/mod_backlight b/.local/bin/mod_backlight index aca3460..c4adac9 100755 --- a/.local/bin/mod_backlight +++ b/.local/bin/mod_backlight @@ -1,19 +1,19 @@ #!/bin/bash if command -v brillo &> /dev/null; then - function send_notification() { - brightness=$(printf "%.0f\n" $(brillo -G)) - dunstify -a "changebrightness" -u low -r 9991 -h int:value:"$brightness" -i "brightness-$1" "Brightness: $brightness%" -t 2000 -} + function send_notification() { + brightness=$(printf "%.0f\n" "$(brillo -G)") + dunstify -a "changebrightness" -u low -r 9991 -h int:value:"$brightness" -i "brightness-$1" "Brightness: $brightness%" -t 2000 + } - case $1 in - up) - brillo -A 5 -q -u 150000 - send_notification $1 - ;; - down) - brillo -U 5 -q -u 150000 - send_notification $1 - ;; - esac + case $1 in + up) + brillo -A 5 -q -u 150000 + send_notification "$1" + ;; + down) + brillo -U 5 -q -u 150000 + send_notification "$1" + ;; + esac fi diff --git a/.local/bin/runif b/.local/bin/runif index 9c168da..458fcb7 100755 --- a/.local/bin/runif +++ b/.local/bin/runif @@ -1,7 +1,8 @@ -#!/bin/sh +#!/bin/bash -if [[ -x "$1" ]]; then - $1 -else - echo "$1 does not exist or couldn't be executed." +if [[ ! -x "$1" ]]; then + echo "$1 does not exist or couldn't be executed." + exit 1 fi + +$1 diff --git a/.local/bin/screenlayout b/.local/bin/screenlayout index ebd6760..6c5d2dc 100755 --- a/.local/bin/screenlayout +++ b/.local/bin/screenlayout @@ -1,16 +1,17 @@ #!/bin/bash -layouts=($(ls "$HOME/.screenlayout/")) +layouts=("$(ls "$HOME/.screenlayout/")") add="add layout..." layouts+=("$add") -choice=$( printf '%s\n' "${layouts[@]}" | dmenu -i -p 'Choose a screenlayout:') "$@" || exit +choice=$(printf '%s\n' "${layouts[@]}" | dmenu -i -p 'Choose a screenlayout:') || exit 0 if [ "$choice" = "$add" ] then - arandr & -else - exec "$HOME/.screenlayout/$choice" + arandr & + exit 0 fi + +exec "$HOME/.screenlayout/$choice" diff --git a/.local/bin/screenshot b/.local/bin/screenshot index 7f2a66b..387fb99 100755 --- a/.local/bin/screenshot +++ b/.local/bin/screenshot @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash -SCRIPTNAME=$(basename $0) +SCRIPTNAME=$(basename "$0") FILENAME="$HOME/$SCRIPTNAME-$(date +'%Y-%m-%d-%H-%M-%S').png" case ${1:-} in @@ -9,5 +9,5 @@ case ${1:-} in esac maim --format=png $SEL "$FILENAME" -echo -n $FILENAME | xclip -selection clipbard +echo -n "$FILENAME" | xclip -selection clipbard notify-send "Screenshot" "$(echo -e "Screen shot saved\n$FILENAME")" diff --git a/.local/bin/set-default-sink b/.local/bin/set-default-sink index 212bae9..2046942 100755 --- a/.local/bin/set-default-sink +++ b/.local/bin/set-default-sink @@ -6,8 +6,9 @@ if [ -z "$choice" ] ; then exit 0; fi +default_loc="$HOME/.cache/pactl-default-sink" -rm /tmp/pactl-default-sink --force # to ignore if it isn't there -touch /tmp/pactl-default-sink -echo "$choice" > /tmp/pactl-default-sink -pactl set-default-sink $choice # make sure that the chosen sink is the \ No newline at end of file +rm "$default_loc" --force # to ignore if it isn't there +touch "$default_loc" +echo "$choice" > "$default_loc" +pactl set-default-sink "$choice" # make sure that the chosen sink is the diff --git a/.local/bin/set-default-source b/.local/bin/set-default-source index a5f6f62..4d4adcf 100755 --- a/.local/bin/set-default-source +++ b/.local/bin/set-default-source @@ -6,8 +6,9 @@ if [ -z "$choice" ] ; then exit 0; fi +default_loc="$HOME/.cache/pactl-default-source" -rm /tmp/pactl-default-source --force # to ignore if it isn't there -touch /tmp/pactl-default-source -echo "$choice" > /tmp/pactl-default-source -pactl set-default-source $choice # make sure that the chosen sink is the \ No newline at end of file +rm "$default_loc" --force # to ignore if it isn't there +touch "$default_loc" +echo "$choice" > "$default_loc" +pactl set-default-source "$choice" # make sure that the chosen sink is the diff --git a/.local/bin/setvol b/.local/bin/setvol index 2b6a000..a1fda14 100755 --- a/.local/bin/setvol +++ b/.local/bin/setvol @@ -1,13 +1,13 @@ #!/bin/bash -default_loc=/tmp/pactl-default-sink +default_loc="$HOME/.cache/pactl-default-sink" if [ ! -f "$default_loc" ] ; then set-default-sink fi -default=$(cat $default_loc) +default=$(<"$default_loc") -value=$(echo -e "" | dmenu -bw 0 -i -p "Set vol to what?") +value=${1-$(echo -e "" | dmenu -bw 0 -i -p "Set vol to what?")} -pactl set-sink-volume $default $value% +pactl set-sink-volume "$default" "$value%" diff --git a/.local/bin/status-bat b/.local/bin/status-bat index 73b3b8f..6a53cc5 100755 --- a/.local/bin/status-bat +++ b/.local/bin/status-bat @@ -2,43 +2,44 @@ icon="" -status=$(bash-status-bat) -parts=($status) -current=$(echo "${parts[0]}" | sed 's/\%//') +IFS=" " read -ra parts <<< "$(bash-status-bat)" + +parts_0=${parts[0]} +current=${parts_0//\%/} state=${parts[1]} status="$current%" if [[ "$state" == "discharging" ]]; then - case $(((current/20)+1)) in - 1) - icon=" " - ;; - 2) - icon=" " - ;; - 3) - icon=" " - ;; - 4) - icon=" " - ;; - 5) - icon=" " - ;; - esac + case $((current/20+1)) in + 1) + icon=" " + ;; + 2) + icon=" " + ;; + 3) + icon=" " + ;; + 4) + icon=" " + ;; + 5) + icon=" " + ;; + esac fi -if [[ "$state" == "not-charging" ]]; then - icon=" " -fi - -if [[ "$state" == "fully-charged" ]]; then - icon=" " - status="Full" -fi - -if [[ "$state" == "charging" ]]; then - icon=" " -fi +case $state in + not-charging) + icon=" " + ;; + fully-charged) + icon=" " + status="Full" + ;; + charging) + icon=" " + ;; +esac echo "$icon $status" diff --git a/.local/bin/status-disk b/.local/bin/status-disk index 8abd32a..32db85c 100755 --- a/.local/bin/status-disk +++ b/.local/bin/status-disk @@ -3,8 +3,8 @@ freemb=$(df -h -B 1048576 | grep "/$" | awk -F ' ' '{ print $4 }') freegb=$(df -h -B 1048576 | grep "/$" | awk -F ' ' '{ print $4/1024 }') -if [ $freemb -lt 1024 ]; then - printf " %0.2fMb" $freemb +if [ "$freemb" -lt 1024 ]; then + printf " %0.2fMb" "$freemb" else - printf " %0.2fGb" $freegb + printf " %0.2fGb" "$freegb" fi diff --git a/.local/bin/status-net b/.local/bin/status-net index abdcc7d..6605aba 100755 --- a/.local/bin/status-net +++ b/.local/bin/status-net @@ -1,35 +1,15 @@ -#!/bin/sh +#!/bin/bash -dev_wifi=$(cat "$HOME"/.config/net-cfg/dev_wifi) -dev_eth=$(cat "$HOME"/.config/net-cfg/dev_eth) -dev_vpn=$(cat "$HOME"/.config/net-cfg/dev_vpn) +dev_wifi=$(<"$HOME"/.config/net-cfg/dev_wifi) +dev_eth=$(<"$HOME"/.config/net-cfg/dev_eth) +dev_vpn=$(<"$HOME"/.config/net-cfg/dev_vpn) -base03=#002b36 -base02=#073642 -base01=#586e75 -base00=#657b83 -base0=#839496 -base1=#93a1a1 -base2=#eee8d5 -base3=#fdf6e3 -yellow=#b58900 -orange=#cb4b16 -red=#dc322f -magenta=#d33682 -violet=#6c71c4 -blue=#268bd2 -cyan=#2aa198 -green=#859900 - -std_color=$magenta wifi_icon=" " -color=$std_color; - eth="$(ip -o address | grep -i "$dev_eth *inet ")" if [ -n "$eth" ] then - speed="$(cat /sys/class/net/$dev_eth/speed)" + speed="$(cat "/sys/class/net/$dev_eth/speed")" case $speed in 10) speed="10Base-T" ;; 100) speed="100Base-T" ;; @@ -39,7 +19,7 @@ then eth_status="  $speed" fi -ssid="$(iw dev $dev_wifi link | grep -i SSID)" +ssid="$(iw dev "$dev_wifi" link | grep -i SSID)" if [ -n "$ssid" ] then signal="$(awk '/^\s*w/ { print int($3 * 100 / 70) "%" }' /proc/net/wireless)" @@ -50,12 +30,8 @@ vpn="$(ip -o address | grep -i "$dev_vpn *inet ")" if [ -n "$vpn" ] then vpn_status="" - color=$green else vpn_status="" fi echo "${vpn_status} $wifi_status$eth_status" - - -# vim: ft=sh:expandtab:ts=4:shiftwidth=4 diff --git a/.local/bin/status-vol b/.local/bin/status-vol index c972067..1288d4c 100755 --- a/.local/bin/status-vol +++ b/.local/bin/status-vol @@ -8,20 +8,21 @@ vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" [ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit vol="${vol#Volume: }" + split() { - # For ommiting the . without calling and external program. - IFS=$2 - set -- $1 - printf '%s' "$@" + # For ommiting the . without calling and external program. + IFS=$2 + set -- $1 + printf '%s' "$@" } vol="$(split "$vol" ".")" vol="${vol##0}" case 1 in - $((vol >= 70)) ) icon="" ;; - $((vol >= 30)) ) icon="" ;; - $((vol >= 1)) ) icon="" ;; - * ) echo  && exit ;; + $((vol >= 70)) ) icon="" ;; +$((vol >= 30)) ) icon="" ;; +$((vol >= 1)) ) icon="" ;; +* ) echo  && exit ;; esac echo "$icon $vol%" diff --git a/.local/bin/tmux-windowiser b/.local/bin/tmux-windowiser index 4a80fa1..80b1cba 100755 --- a/.local/bin/tmux-windowiser +++ b/.local/bin/tmux-windowiser @@ -1,13 +1,13 @@ #!/bin/bash -branch_name=$(basename $1) +branch_name=$(basename "$1") session_name=$(tmux display-message -p "#S") -clean_name=$(echo $branch_name | tr "./" "__") +clean_name=$(echo "$branch_name" | tr "./" "__") target="$session_name:$clean_name" -if ! tmux has-session -t $target 2> /dev/null; then - tmux neww -dn $clean_name +if ! tmux has-session -t "$target" 2> /dev/null; then + tmux neww -dn "$clean_name" fi shift -tmux send-keys -t $target "$*" Enter +tmux send-keys -t "$target" "$*" Enter diff --git a/.local/bin/tmux-worker b/.local/bin/tmux-worker index b755dd0..1e2b990 100755 --- a/.local/bin/tmux-worker +++ b/.local/bin/tmux-worker @@ -3,12 +3,9 @@ session="system" # Check if the session exists, discarding output -# We can check $? for the exit status (zero for success, non-zero for failure) -tmux has-session -t $session 2>/dev/null - -if [ $? != 0 ]; then - # Set up your session - tmux new-session -s "$session" +if command -v tmux has-session -t $session 2>/dev/null != 0; then + # Set up your session + tmux new-session -s "$session" fi # Attach to created session diff --git a/.local/bin/toggle-sink-mute b/.local/bin/toggle-sink-mute index 6103bb5..ce8d026 100755 --- a/.local/bin/toggle-sink-mute +++ b/.local/bin/toggle-sink-mute @@ -1,11 +1,11 @@ #!/bin/bash -default_loc=/tmp/pactl-default-sink +default_loc="$HOME/.cache/pactl-default-sink" if [ ! -f "$default_loc" ] ; then set-default-sink fi -default=$(cat $default_loc) +default=$(cat "$default_loc") -pactl set-sink-mute $default toggle +pactl set-sink-mute "$default" toggle diff --git a/.local/bin/toggle-source-mute b/.local/bin/toggle-source-mute index a1e8549..538d9f3 100755 --- a/.local/bin/toggle-source-mute +++ b/.local/bin/toggle-source-mute @@ -1,11 +1,11 @@ #!/bin/bash -default_loc=/tmp/pactl-default-source +default_loc="$HOME/.cache/pactl-default-source" if [ ! -f "$default_loc" ] ; then set-default-source fi -default=$(cat $default_loc) +default=$(cat "$default_loc") -pactl set-source-mute $default toggle +pactl set-source-mute "$default" toggle diff --git a/.local/bin/trayer-toggle b/.local/bin/trayer-toggle index 9c0e9ee..058952b 100755 --- a/.local/bin/trayer-toggle +++ b/.local/bin/trayer-toggle @@ -1,6 +1,6 @@ #!/usr/bin/env bash -test_path="/tmp/trayer.exists" +test_path="$HOME/.cache/trayer-exists" if [ -f "$test_path" ]; then echo "stopping trayer" diff --git a/.local/bin/vic b/.local/bin/vic index f5b24d5..9f596cc 100755 --- a/.local/bin/vic +++ b/.local/bin/vic @@ -1,4 +1,4 @@ #!/bin/sh -cmd=$(command -v $1) +cmd=$(command -v "$1") test -n "$cmd" && exec vi "$cmd" diff --git a/.local/bin/xmobar-status-bat b/.local/bin/xmobar-status-bat index 54ca4a8..ebe80de 100755 --- a/.local/bin/xmobar-status-bat +++ b/.local/bin/xmobar-status-bat @@ -1,9 +1,5 @@ #!/bin/bash # a simple wrapper for inserting xmobar stuff - -status=$(status-bat) - -parts=($status) - +IFS=" " read -r -a parts <<< "$(status-bat)" echo "${parts[0]} ${parts[1]}" diff --git a/.local/bin/xmobar-status-disk b/.local/bin/xmobar-status-disk index 183c771..aacbb93 100755 --- a/.local/bin/xmobar-status-disk +++ b/.local/bin/xmobar-status-disk @@ -1,7 +1,4 @@ #!/bin/bash -status=$(status-disk) - -parts=($status) - +IFS=" " read -r -a parts <<< "$(status-disk)" echo "${parts[0]} ${parts[1]}" diff --git a/.local/bin/xmobar-status-keyboard b/.local/bin/xmobar-status-keyboard index c02f52c..2a53e59 100755 --- a/.local/bin/xmobar-status-keyboard +++ b/.local/bin/xmobar-status-keyboard @@ -3,30 +3,14 @@ stdlayout=us # standard layout takes "default" color stdname=en-us # arbitrary, descriptive only -base03=#002b36 -base02=#073642 -base01=#586e75 -base00=#657b83 -base0=#839496 -base1=#93a1a1 -base2=#eee8d5 -base3=#fdf6e3 -yellow=#b58900 -orange=#cb4b16 -red=#dc322f magenta=#d33682 -violet=#6c71c4 -blue=#268bd2 -cyan=#2aa198 green=#859900 layout="$(xkb-switch)" case $layout in - ${stdlayout}) color=$green; icon=" "; name=$stdname ;; # f11c fa-keyboard-o + "${stdlayout}") color=$green; icon=" "; name=$stdname ;; # f11c fa-keyboard-o *) color=$magenta; icon=""; name="dvorak" ;; # f11c fa-keyboard-o esac echo "$icon ${name}" - -# vim: ft=sh:expandtab:ts=4:shiftwidth=4 diff --git a/.local/bin/xmobar-status-net b/.local/bin/xmobar-status-net index 3e07dbe..8c849b1 100755 --- a/.local/bin/xmobar-status-net +++ b/.local/bin/xmobar-status-net @@ -1,24 +1,12 @@ -#!/bin/sh +#!/bin/bash dev_wifi=$(cat "$HOME"/.config/xmobar/dev_wifi) dev_eth=$(cat "$HOME"/.config/xmobar/dev_eth) dev_vpn=$(cat "$HOME"/.config/xmobar/dev_vpn) -# base03=#002b36 -# base02=#073642 -# base01=#586e75 -# base00=#657b83 -# base0=#839496 -# base1=#93a1a1 -# base2=#eee8d5 -# base3=#fdf6e3 yellow=#b58900 -# orange=#cb4b16 red=#dc322f magenta=#d33682 -# violet=#6c71c4 -# blue=#268bd2 -# cyan=#2aa198 green=#859900 # connectivity status @@ -82,6 +70,3 @@ else fi echo "${vpn_status}$icon ${connectivity##*full}$wifi_status$eth_status" - - -# vim: ft=sh:expandtab:ts=4:shiftwidth=4 diff --git a/.local/bin/xmobar-status-updates b/.local/bin/xmobar-status-updates index 9a57d19..727d11f 100755 --- a/.local/bin/xmobar-status-updates +++ b/.local/bin/xmobar-status-updates @@ -1,6 +1,6 @@ #!/bin/sh -count=$(yay -Qu | wc -l) +count=$(pacman -Qu | wc -l) icon="" echo "$icon $count" diff --git a/.local/bin/xmobar-status-vol b/.local/bin/xmobar-status-vol index 18ff913..ecd631b 100755 --- a/.local/bin/xmobar-status-vol +++ b/.local/bin/xmobar-status-vol @@ -1,46 +1,33 @@ #!/bin/sh -base03=#002b36 -base02=#073642 -base01=#586e75 -base00=#657b83 -base0=#839496 -base1=#93a1a1 -base2=#eee8d5 -base3=#fdf6e3 -yellow=#b58900 orange=#cb4b16 red=#dc322f -magenta=#d33682 -violet=#6c71c4 -blue=#268bd2 cyan=#2aa198 -green=#859900 color=$cyan vol="$(pamixer --get-volume)" -if [ $(pamixer --get-mute) = true ]; then - vol=MUTE - color=$red - icon="" # fa-volume-off f026 +if [ "$(pamixer --get-mute)" = true ]; then + vol=MUTE + color=$red + icon="" # fa-volume-off f026 - echo "$icon $vol" + echo "$icon $vol" fi if [ "$vol" -gt "100" ]; then - icon="" - color=$orange + icon="" + color=$orange elif [ "$vol" -gt "70" ]; then - icon="" + icon="" elif [ "$vol" -gt "30" ]; then - icon="" + icon="" elif [ "$vol" -gt "0" ]; then - icon="" + icon="" else - vol=MUTE - color=$red - icon="" + vol=MUTE + color=$red + icon="" fi echo "$icon $vol" diff --git a/.local/bin/xmobar-status-weather b/.local/bin/xmobar-status-weather index 95e8dc5..4229a8f 100755 --- a/.local/bin/xmobar-status-weather +++ b/.local/bin/xmobar-status-weather @@ -1,15 +1,15 @@ -#!/bin/sh +#!/bin/bash # simple script to read weather from airport code and return it for display in xmobar -weather=$(weather-report $1 -m --no-cache -n | \ - grep -e '\[' \ - -e 'Temp' | \ - sed -e 's/\[using result //' \ - -e 's/,.*\]//' \ - -e 's/Temp.*: //' \ - -e 's/ C//' \ - -e 's/ //') +weather=$(weather-report "$1" -m --no-cache -n | \ + grep -e '\[' \ + -e 'Temp' | \ + sed -e 's/\[using result //' \ + -e 's/,.*\]//' \ + -e 's/Temp.*: //' \ + -e 's/ C//' \ + -e 's/ //') readarray -t y <<< "$weather" @@ -19,18 +19,18 @@ color="" if ((temp > 30)) then - color="#ff5555" + color="#ff5555" elif ((temp > 25)) then - color="#ffb86c" + color="#ffb86c" elif ((temp > 20)) then - color="#f1fa8c" + color="#f1fa8c" elif ((temp > 10)) then - color="#50fa7b" + color="#50fa7b" else - color="#8be9fd" + color="#8be9fd" fi echo -e "$loc $tempC" diff --git a/.local/bin/xmobar-trayer-padding-icon b/.local/bin/xmobar-trayer-padding-icon index adee04a..3cdc437 100755 --- a/.local/bin/xmobar-trayer-padding-icon +++ b/.local/bin/xmobar-trayer-padding-icon @@ -40,8 +40,8 @@ width=$(xprop -name panel | grep 'program specified minimum size' | cut -d ' ' - iconfile="/tmp/trayer-padding-${width}px.xpm" # If the desired icon does not exist create it -if [ ! -f $iconfile ]; then - create_xpm_icon $width $iconfile +if [ ! -f "$iconfile" ]; then + create_xpm_icon "$width" "$iconfile" fi # Output the icon tag for xmobar diff --git a/.local/bin/xmonad-keys-help b/.local/bin/xmonad-keys-help index 1916947..9575271 100755 --- a/.local/bin/xmonad-keys-help +++ b/.local/bin/xmonad-keys-help @@ -1,6 +1,6 @@ #!/bin/bash -sed -n '/--START_KEYS/,/--END_KEYS/p' $HOME/.xmonad/xmonad.hs | \ +sed -n '/--START_KEYS/,/--END_KEYS/p' "$HOME/.xmonad/xmonad.hs" | \ grep -e ', ("' \ -e '\[ ("' \ -e '--NOTE' | \ @@ -9,4 +9,4 @@ sed -n '/--START_KEYS/,/--END_KEYS/p' $HOME/.xmonad/xmonad.hs | \ -e 's/\[ (/(/' \ -e 's/--NOTE /\n/' \ -e 's/, / --> /' | \ - yad --text-info --back=#121e32 --fore=#dfdfef --geometry=1200x800 \ No newline at end of file + yad --text-info --back=#121e32 --fore=#dfdfef --geometry=1200x800