updated scripts to pass shellcheck, mostly

This commit is contained in:
Solomon Laing 2023-02-14 12:31:39 +10:30
parent cf18461c24
commit 7bc48e0a0d
47 changed files with 327 additions and 431 deletions

View File

@ -26,7 +26,7 @@ return {
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
opts = { opts = {
-- Animation style (see below for details) -- Animation style (see below for details)
stages = "fade_in_slide_out", stages = "static",
-- Render function for notifications. See notify-render() -- Render function for notifications. See notify-render()
render = "default", render = "default",

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/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/ *//') 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/ *//') state=$(upower -i "$(upower -e | grep 'BAT')" | grep -E "state" | sed 's/.*://' | sed 's/ *//')
if [[ "$state" == "not charging" ]]; then if [[ "$state" == "not charging" ]]; then
state="full" state="full"

View File

@ -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

View File

@ -9,7 +9,7 @@ if [[ -z $selected ]]; then
exit 0 exit 0
fi fi
read -p "Enter Query: " query read -rp "Enter Query: " query
if grep -qs "$selected" "$languages"; then if grep -qs "$selected" "$languages"; then
query=$(echo "$query" | tr ' ' '+') query=$(echo "$query" | tr ' ' '+')

View File

@ -2,16 +2,15 @@
# Syncs repositories and downloads updates, meant to be run as a cronjob. # 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. 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." 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\]" if pacman -Qu | grep -v "\[ignored\]"
then 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 else
notify-send "📦 Repository Sync" "Sync complete. No new packages for update." notify-send "Repository Sync" "Sync complete. No new packages for update."
fi fi

View File

@ -3,4 +3,4 @@
# Toggles all cronjobs off/on. # Toggles all cronjobs off/on.
# Stores disabled crontabs in ~/.config/cronsaved until restored. # 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.")

View File

@ -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.")

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
default_loc=/tmp/pactl-default-sink default_loc="$HOME/.cache/pactl-default-sink"
if [ ! -f "$default_loc" ] ; then if [ ! -f "$default_loc" ] ; then
set-default-sink set-default-sink
fi fi
default=$(cat $default_loc) default="$(<"$default_loc")"
pactl set-sink-volume $default -5% pactl set-sink-volume "$default" -5%

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
default_loc=/tmp/pactl-default-source default_loc="$HOME/.cache/pactl-default-source"
if [ ! -f "$default_loc" ] ; then if [ ! -f "$default_loc" ] ; then
set-default-source set-default-source
fi fi
default=$(cat $default_loc) default="$(<"$default_loc")"
pactl set-source-volume $default -5% pactl set-source-volume "$default" -5%

View File

@ -53,7 +53,7 @@ multimon() { # Multi-monitor handler.
esac ;} esac ;}
onescreen() { # If only one output available or chosen. 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. postrun() { # Stuff to run to clean up.

View File

@ -19,7 +19,7 @@ getmount() { \
mountusb() { \ mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')" chosen="$(echo "$chosen" | awk '{print $1}')"
sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 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}') 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" getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")" partitiontype="$(lsblk -no "fstype" "$chosen")"
@ -27,8 +27,8 @@ mountusb() { \
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;; "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)" ;; "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" ;; *) 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." || esac && notify-send "USB mounting" "$chosen mounted to $mp." ||
notify-send "💻 Drive failed to mount." "Probably a permissions issue or drive is already mounted." notify-send "Drive failed to mount." "Probably a permissions issue or drive is already mounted."
} }
mountandroid() { \ mountandroid() { \
@ -37,8 +37,8 @@ mountandroid() { \
getmount "$HOME -maxdepth 3 -type d" 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 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" && simple-mtpfs --device "$chosen" "$mp" &&
notify-send "🤖 Android Mounting" "Android device mounted to $mp." || notify-send "Android Mounting" "Android device mounted to $mp." ||
notify-send "🤖 Android failed mounting." "Probably a permissions issue or phone is already mounted." notify-send "Android failed mounting." "Probably a permissions issue or phone is already mounted."
} }
asktype() { \ asktype() { \

View File

@ -8,14 +8,14 @@
# Taken shamelessly from Luke Smith # Taken shamelessly from Luke Smith
if [ -n "$3" ] if [[ -n "$3" ]]
then then
choice=$(echo -e "Yes\nNo" | dmenu -bw 0 -i -p "$1") choice=$(echo -e "Yes\nNo" | dmenu -bw 0 -i -p "$1")
else else
choice=$(echo -e "No\nYes" | dmenu -bw 0 -i -p "$1") choice=$(echo -e "No\nYes" | dmenu -bw 0 -i -p "$1")
fi fi
if [ $choice = "Yes" ] if [[ "$choice" = "Yes" ]]
then then
$2 $2
fi fi

View File

@ -17,5 +17,5 @@ case "$chosen" in
chosen="${chosen% (*}" chosen="${chosen% (*}"
sudo -A umount -l "$chosen" sudo -A umount -l "$chosen"
;; ;;
esac && notify-send "🖥️ Drive unmounted." "$chosen successfully unmounted." || esac && notify-send "Drive unmounted." "$chosen successfully unmounted." ||
notify-send "🖥️ Drive failed to unmount." "Possibly a permissions or I/O issue." notify-send "Drive failed to unmount." "Possibly a permissions or I/O issue."

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
default_loc=/tmp/pactl-default-sink default_loc="$HOME/.cache/pactl-default-sink"
if [ ! -f "$default_loc" ] ; then if [ ! -f "$default_loc" ] ; then
set-default-sink set-default-sink
fi fi
default=$(cat $default_loc) default=$(<"$default_loc")
pactl set-sink-volume $default +5% pactl set-sink-volume "$default" +5%

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
default_loc=/tmp/pactl-default-source default_loc="$HOME/.cache/pactl-default-source"
if [ ! -f "$default_loc" ] ; then if [ ! -f "$default_loc" ] ; then
set-default-source set-default-source
fi fi
default=$(cat $default_loc) default=$(<"$default_loc")
pactl set-source-volume $default +5% pactl set-source-volume "$default" +5%

View File

@ -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;

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
fn="/tmp/kbswitcher.status" fn="$HOME/.cache/kbswitcher-status"
layout="" layout=""

View File

@ -2,18 +2,18 @@
if command -v brillo &> /dev/null; then if command -v brillo &> /dev/null; then
function send_notification() { function send_notification() {
brightness=$(printf "%.0f\n" $(brillo -G)) brightness=$(printf "%.0f\n" "$(brillo -G)")
dunstify -a "changebrightness" -u low -r 9991 -h int:value:"$brightness" -i "brightness-$1" "Brightness: $brightness%" -t 2000 dunstify -a "changebrightness" -u low -r 9991 -h int:value:"$brightness" -i "brightness-$1" "Brightness: $brightness%" -t 2000
} }
case $1 in case $1 in
up) up)
brillo -A 5 -q -u 150000 brillo -A 5 -q -u 150000
send_notification $1 send_notification "$1"
;; ;;
down) down)
brillo -U 5 -q -u 150000 brillo -U 5 -q -u 150000
send_notification $1 send_notification "$1"
;; ;;
esac esac
fi fi

View File

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/bash
if [[ -x "$1" ]]; then if [[ ! -x "$1" ]]; then
$1
else
echo "$1 does not exist or couldn't be executed." echo "$1 does not exist or couldn't be executed."
exit 1
fi fi
$1

View File

@ -1,16 +1,17 @@
#!/bin/bash #!/bin/bash
layouts=($(ls "$HOME/.screenlayout/")) layouts=("$(ls "$HOME/.screenlayout/")")
add="add layout..." add="add layout..."
layouts+=("$add") 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" ] if [ "$choice" = "$add" ]
then then
arandr & arandr &
else exit 0
exec "$HOME/.screenlayout/$choice"
fi fi
exec "$HOME/.screenlayout/$choice"

View File

@ -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" FILENAME="$HOME/$SCRIPTNAME-$(date +'%Y-%m-%d-%H-%M-%S').png"
case ${1:-} in case ${1:-} in
@ -9,5 +9,5 @@ case ${1:-} in
esac esac
maim --format=png $SEL "$FILENAME" 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")" notify-send "Screenshot" "$(echo -e "Screen shot saved\n$FILENAME")"

View File

@ -6,8 +6,9 @@ if [ -z "$choice" ] ; then
exit 0; exit 0;
fi fi
default_loc="$HOME/.cache/pactl-default-sink"
rm /tmp/pactl-default-sink --force # to ignore if it isn't there rm "$default_loc" --force # to ignore if it isn't there
touch /tmp/pactl-default-sink touch "$default_loc"
echo "$choice" > /tmp/pactl-default-sink echo "$choice" > "$default_loc"
pactl set-default-sink $choice # make sure that the chosen sink is the pactl set-default-sink "$choice" # make sure that the chosen sink is the

View File

@ -6,8 +6,9 @@ if [ -z "$choice" ] ; then
exit 0; exit 0;
fi fi
default_loc="$HOME/.cache/pactl-default-source"
rm /tmp/pactl-default-source --force # to ignore if it isn't there rm "$default_loc" --force # to ignore if it isn't there
touch /tmp/pactl-default-source touch "$default_loc"
echo "$choice" > /tmp/pactl-default-source echo "$choice" > "$default_loc"
pactl set-default-source $choice # make sure that the chosen sink is the pactl set-default-source "$choice" # make sure that the chosen sink is the

View File

@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
default_loc=/tmp/pactl-default-sink default_loc="$HOME/.cache/pactl-default-sink"
if [ ! -f "$default_loc" ] ; then if [ ! -f "$default_loc" ] ; then
set-default-sink set-default-sink
fi 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%"

View File

@ -2,14 +2,15 @@
icon="" icon=""
status=$(bash-status-bat) IFS=" " read -ra parts <<< "$(bash-status-bat)"
parts=($status)
current=$(echo "${parts[0]}" | sed 's/\%//') parts_0=${parts[0]}
current=${parts_0//\%/}
state=${parts[1]} state=${parts[1]}
status="$current%" status="$current%"
if [[ "$state" == "discharging" ]]; then if [[ "$state" == "discharging" ]]; then
case $(((current/20)+1)) in case $((current/20+1)) in
1) 1)
icon=" " icon=" "
;; ;;
@ -28,17 +29,17 @@ if [[ "$state" == "discharging" ]]; then
esac esac
fi fi
if [[ "$state" == "not-charging" ]]; then case $state in
not-charging)
icon=" " icon=" "
fi ;;
fully-charged)
if [[ "$state" == "fully-charged" ]]; then
icon=" " icon=" "
status="Full" status="Full"
fi ;;
charging)
if [[ "$state" == "charging" ]]; then
icon=" " icon=" "
fi ;;
esac
echo "$icon $status" echo "$icon $status"

View File

@ -3,8 +3,8 @@
freemb=$(df -h -B 1048576 | grep "/$" | awk -F ' ' '{ print $4 }') freemb=$(df -h -B 1048576 | grep "/$" | awk -F ' ' '{ print $4 }')
freegb=$(df -h -B 1048576 | grep "/$" | awk -F ' ' '{ print $4/1024 }') freegb=$(df -h -B 1048576 | grep "/$" | awk -F ' ' '{ print $4/1024 }')
if [ $freemb -lt 1024 ]; then if [ "$freemb" -lt 1024 ]; then
printf " %0.2fMb" $freemb printf " %0.2fMb" "$freemb"
else else
printf " %0.2fGb" $freegb printf " %0.2fGb" "$freegb"
fi fi

View File

@ -1,35 +1,15 @@
#!/bin/sh #!/bin/bash
dev_wifi=$(cat "$HOME"/.config/net-cfg/dev_wifi) dev_wifi=$(<"$HOME"/.config/net-cfg/dev_wifi)
dev_eth=$(cat "$HOME"/.config/net-cfg/dev_eth) dev_eth=$(<"$HOME"/.config/net-cfg/dev_eth)
dev_vpn=$(cat "$HOME"/.config/net-cfg/dev_vpn) 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=" " wifi_icon=" "
color=$std_color;
eth="$(ip -o address | grep -i "$dev_eth *inet ")" eth="$(ip -o address | grep -i "$dev_eth *inet ")"
if [ -n "$eth" ] if [ -n "$eth" ]
then then
speed="$(cat /sys/class/net/$dev_eth/speed)" speed="$(cat "/sys/class/net/$dev_eth/speed")"
case $speed in case $speed in
10) speed="10Base-T" ;; 10) speed="10Base-T" ;;
100) speed="100Base-T" ;; 100) speed="100Base-T" ;;
@ -39,7 +19,7 @@ then
eth_status="  $speed" eth_status="  $speed"
fi fi
ssid="$(iw dev $dev_wifi link | grep -i SSID)" ssid="$(iw dev "$dev_wifi" link | grep -i SSID)"
if [ -n "$ssid" ] if [ -n "$ssid" ]
then then
signal="$(awk '/^\s*w/ { print int($3 * 100 / 70) "%" }' /proc/net/wireless)" 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" ] if [ -n "$vpn" ]
then then
vpn_status="" vpn_status=""
color=$green
else else
vpn_status="" vpn_status=""
fi fi
echo "${vpn_status} $wifi_status$eth_status" echo "${vpn_status} $wifi_status$eth_status"
# vim: ft=sh:expandtab:ts=4:shiftwidth=4

View File

@ -8,6 +8,7 @@ vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
[ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit [ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit
vol="${vol#Volume: }" vol="${vol#Volume: }"
split() { split() {
# For ommiting the . without calling and external program. # For ommiting the . without calling and external program.
IFS=$2 IFS=$2

View File

@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
branch_name=$(basename $1) branch_name=$(basename "$1")
session_name=$(tmux display-message -p "#S") session_name=$(tmux display-message -p "#S")
clean_name=$(echo $branch_name | tr "./" "__") clean_name=$(echo "$branch_name" | tr "./" "__")
target="$session_name:$clean_name" target="$session_name:$clean_name"
if ! tmux has-session -t $target 2> /dev/null; then if ! tmux has-session -t "$target" 2> /dev/null; then
tmux neww -dn $clean_name tmux neww -dn "$clean_name"
fi fi
shift shift
tmux send-keys -t $target "$*" Enter tmux send-keys -t "$target" "$*" Enter

View File

@ -3,10 +3,7 @@
session="system" session="system"
# Check if the session exists, discarding output # Check if the session exists, discarding output
# We can check $? for the exit status (zero for success, non-zero for failure) if command -v tmux has-session -t $session 2>/dev/null != 0; then
tmux has-session -t $session 2>/dev/null
if [ $? != 0 ]; then
# Set up your session # Set up your session
tmux new-session -s "$session" tmux new-session -s "$session"
fi fi

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
default_loc=/tmp/pactl-default-sink default_loc="$HOME/.cache/pactl-default-sink"
if [ ! -f "$default_loc" ] ; then if [ ! -f "$default_loc" ] ; then
set-default-sink set-default-sink
fi fi
default=$(cat $default_loc) default=$(cat "$default_loc")
pactl set-sink-mute $default toggle pactl set-sink-mute "$default" toggle

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
default_loc=/tmp/pactl-default-source default_loc="$HOME/.cache/pactl-default-source"
if [ ! -f "$default_loc" ] ; then if [ ! -f "$default_loc" ] ; then
set-default-source set-default-source
fi fi
default=$(cat $default_loc) default=$(cat "$default_loc")
pactl set-source-mute $default toggle pactl set-source-mute "$default" toggle

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
test_path="/tmp/trayer.exists" test_path="$HOME/.cache/trayer-exists"
if [ -f "$test_path" ]; then if [ -f "$test_path" ]; then
echo "stopping trayer" echo "stopping trayer"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
cmd=$(command -v $1) cmd=$(command -v "$1")
test -n "$cmd" && exec vi "$cmd" test -n "$cmd" && exec vi "$cmd"

View File

@ -1,9 +1,5 @@
#!/bin/bash #!/bin/bash
# a simple wrapper for inserting xmobar stuff # a simple wrapper for inserting xmobar stuff
IFS=" " read -r -a parts <<< "$(status-bat)"
status=$(status-bat)
parts=($status)
echo "<fn=1>${parts[0]} </fn> ${parts[1]}" echo "<fn=1>${parts[0]} </fn> ${parts[1]}"

View File

@ -1,7 +1,4 @@
#!/bin/bash #!/bin/bash
status=$(status-disk) IFS=" " read -r -a parts <<< "$(status-disk)"
parts=($status)
echo "<fn=1>${parts[0]} </fn> ${parts[1]}" echo "<fn=1>${parts[0]} </fn> ${parts[1]}"

View File

@ -3,30 +3,14 @@
stdlayout=us # standard layout takes "default" color stdlayout=us # standard layout takes "default" color
stdname=en-us # arbitrary, descriptive only 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 magenta=#d33682
violet=#6c71c4
blue=#268bd2
cyan=#2aa198
green=#859900 green=#859900
layout="$(xkb-switch)" layout="$(xkb-switch)"
case $layout in 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 *) color=$magenta; icon=""; name="dvorak" ;; # f11c fa-keyboard-o
esac esac
echo "<fc=$color><fn=1>$icon </fn> ${name}</fc>" echo "<fc=$color><fn=1>$icon </fn> ${name}</fc>"
# vim: ft=sh:expandtab:ts=4:shiftwidth=4

View File

@ -1,24 +1,12 @@
#!/bin/sh #!/bin/bash
dev_wifi=$(cat "$HOME"/.config/xmobar/dev_wifi) dev_wifi=$(cat "$HOME"/.config/xmobar/dev_wifi)
dev_eth=$(cat "$HOME"/.config/xmobar/dev_eth) dev_eth=$(cat "$HOME"/.config/xmobar/dev_eth)
dev_vpn=$(cat "$HOME"/.config/xmobar/dev_vpn) 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 yellow=#b58900
# orange=#cb4b16
red=#dc322f red=#dc322f
magenta=#d33682 magenta=#d33682
# violet=#6c71c4
# blue=#268bd2
# cyan=#2aa198
green=#859900 green=#859900
# connectivity status # connectivity status
@ -82,6 +70,3 @@ else
fi fi
echo "<fc=$color>${vpn_status}<fn=1>$icon </fn>${connectivity##*full}$wifi_status$eth_status</fc>" echo "<fc=$color>${vpn_status}<fn=1>$icon </fn>${connectivity##*full}$wifi_status$eth_status</fc>"
# vim: ft=sh:expandtab:ts=4:shiftwidth=4

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
count=$(yay -Qu | wc -l) count=$(pacman -Qu | wc -l)
icon="" icon=""
echo "<fn=1>$icon </fn> $count" echo "<fn=1>$icon </fn> $count"

View File

@ -1,26 +1,13 @@
#!/bin/sh #!/bin/sh
base03=#002b36
base02=#073642
base01=#586e75
base00=#657b83
base0=#839496
base1=#93a1a1
base2=#eee8d5
base3=#fdf6e3
yellow=#b58900
orange=#cb4b16 orange=#cb4b16
red=#dc322f red=#dc322f
magenta=#d33682
violet=#6c71c4
blue=#268bd2
cyan=#2aa198 cyan=#2aa198
green=#859900
color=$cyan color=$cyan
vol="$(pamixer --get-volume)" vol="$(pamixer --get-volume)"
if [ $(pamixer --get-mute) = true ]; then if [ "$(pamixer --get-mute)" = true ]; then
vol=MUTE vol=MUTE
color=$red color=$red
icon="" # fa-volume-off f026 icon="" # fa-volume-off f026

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/bash
# simple script to read weather from airport code and return it for display in xmobar # simple script to read weather from airport code and return it for display in xmobar
weather=$(weather-report $1 -m --no-cache -n | \ weather=$(weather-report "$1" -m --no-cache -n | \
grep -e '\[' \ grep -e '\[' \
-e 'Temp' | \ -e 'Temp' | \
sed -e 's/\[using result //' \ sed -e 's/\[using result //' \

View File

@ -40,8 +40,8 @@ width=$(xprop -name panel | grep 'program specified minimum size' | cut -d ' ' -
iconfile="/tmp/trayer-padding-${width}px.xpm" iconfile="/tmp/trayer-padding-${width}px.xpm"
# If the desired icon does not exist create it # If the desired icon does not exist create it
if [ ! -f $iconfile ]; then if [ ! -f "$iconfile" ]; then
create_xpm_icon $width $iconfile create_xpm_icon "$width" "$iconfile"
fi fi
# Output the icon tag for xmobar # Output the icon tag for xmobar

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/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 ', ("' \ grep -e ', ("' \
-e '\[ ("' \ -e '\[ ("' \
-e '--NOTE' | \ -e '--NOTE' | \