1
0
Fork 0
cleanup
This commit is contained in:
Luca Bilke 2023-04-12 11:37:10 +02:00 committed by Luca Bilke
commit dd5b31efae
48 changed files with 418 additions and 392 deletions

View file

@ -1,4 +1,4 @@
# vim:set ft=sh
# vim:set ft=sh:
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] &&
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] &&

View file

@ -1,3 +1,3 @@
# vim:set ft=sh
# vim:set ft=sh:
xrdb -merge $USRRESOURCES

View file

@ -1,4 +1,4 @@
# vim:set ft=sh
# vim:set ft=sh:
add_module() {
case :$GTK_MODULES: in

View file

@ -1,4 +1,4 @@
# vim:set ft=sh
# vim:set ft=sh:
export QT_ACCESSIBILITY=1

View file

@ -1,7 +1,8 @@
# vim:set ft=sh
# vim:set ft=sh:
if [ "${SSH_AUTH_SOCK:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
sock="$(gpgconf --list-dirs agent-ssh-socket)"
export SSH_AUTH_SOCK=$sock
fi
export GPG_TTY="$(tty)"
export GPG_TTY="$TTY"
gpg-connect-agent updatestartuptty /bye >/dev/null

View file

@ -1,11 +1,12 @@
# vim:set ft=sh
# vim:set ft=sh:
start() {
pidof -s $1 || $@ >/dev/null 2>&1 &
pidof -sx $1 || $@ &
}
xwallpaper --zoom "${XDG_DATA_HOME:-$HOME/.local/share}/bg" &
killall remaps; remaps &
killall remaps
remaps &
checkup &
start playerctld daemon
@ -16,4 +17,3 @@ start pipewire
start wireplumber
start dwmblocks
start remapd

View file

@ -1,4 +1,4 @@
# vim:set ft=sh
# vim:set ft=sh:
export XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b"
export XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5"

View file

@ -1,3 +1,3 @@
# vim:set ft=sh
# vim:set ft=sh:
# Any host specific configuration goes here
# This file is excluded from the dotsync script

View file

@ -1,2 +1,2 @@
#!/usr/bin/env bash
#!/bir/sh
kitty +kitten icat --clear --silent --stdin no --transfer-mode memory >/dev/tty

View file

@ -1,5 +1,3 @@
# vim:ft=conf
# file types
ln  # LINK
or  # ORPHAN

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
image() {
f=$1
w=$2
@ -7,7 +7,7 @@ image() {
y=$5
kitty +kitten icat --clear --stdin no --silent --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$f" >/dev/tty && exit 1
chafa "$f" -f symbols -s "$((w-2))x$h" && exit 1
echo -e "\e[31mImage previewer not installed\e[0m"
printf "%b" "\e[31mImage previewer failed\e[0m"
return 1
}
@ -17,7 +17,7 @@ video() {
h=$3
x=$4
y=$5
thumb="$(vidthumb "$f")" || ( echo -e "\e[31mvidthumb script not in path\e[0m" && return 1 )
thumb="$(vidthumb "$f")" || ( printf "%b" "\e[31mvidthumb script not in path\e[0m"; return 1 )
image "$thumb" "$w" "$h" "$x" "$y"
return 1
}
@ -33,25 +33,25 @@ batorcat() {
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
case "$(xdg-mime query filetype "$1")" in
*/x-bzip-compressed-tar|*/x-compressed-tar|*/x-xz-compressed-tar) als -- "$1" && exit 0 || echo -e "\e[31matools not installed\e[0m" && exit 1;;
*/x-7z-compressed|*/vnd.rar|*/x-tar|*/zip|*/x-java-archive|*/x-xz) 7z l "$1" | sed 1,11d && exit 0 || echo -e "\e[31m7zip not installed\e[0m" && exit 1;;
*/x-cd-image) iso-info --no-header -l "$1" && exit 0 || echo -e "\e[31mlibcdio not installed\e[0m" && exit 1;;
*/x-bittorrent) transmission-show "$1" && exit 0 || echo -e "\e[31mtransmission-cli not installed\e[0m" && exit 1;;
*/vnd.sun.xml.writer) odt2txt "$1" && exit 0 || echo -e "\e[31modt2txt not installed\e[0m" && exit 1;;
*/msword) catdoc "$1" && exit 0 || echo -e "\e[31mcatdoc not installed\e[0m" && exit 1;;
*/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt < "$1" && exit 0 || echo -e "\e[31mdocx2txt not installed\e[0m" && exit 1;;
*/vnd.ms-excel) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || echo -e "\e[31mgnumeric not installed\e[0m" && exit 1;;
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || echo -e "\e[31mgnumeric not installed\e[0m" && exit 1;;
*/epub+zip) [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" && exit 0 || echo -e "\e[31mepubthumbnailer not installed (https://github.com/marianosimone/epub-thumbnailer)\e[0m" && exit 1;;
*/pgp-encrypted) gpg -d -- "$1" && exit 0 || echo -e "\e[31mgpg not installed\e[0m" && exit 1;;
*/pkix-cert) openssl x509 -text -noout -in "$1" && exit 0 || echo -e "\e[31mopenssl not installed\e[0m" && exit 1;;
*/x-bzip-compressed-tar|*/x-compressed-tar|*/x-xz-compressed-tar) als -- "$1" && exit 0 || printf "%b" "\e[31matools failed\e[0m" && exit 1;;
*/x-7z-compressed|*/vnd.rar|*/x-tar|*/zip|*/x-java-archive|*/x-xz) 7z l "$1" | sed 1,11d && exit 0 || printf "%b" "\e[31m7zip failed\e[0m" && exit 1;;
*/x-cd-image) iso-info --no-header -l "$1" && exit 0 || printf "%b" "\e[31mlibcdio failed\e[0m" && exit 1;;
*/x-bittorrent) transmission-show "$1" && exit 0 || printf "%b" "\e[31mtransmission-cli failed\e[0m" && exit 1;;
*/vnd.sun.xml.writer) odt2txt "$1" && exit 0 || printf "%b" "\e[31modt2txt failed\e[0m" && exit 1;;
*/msword) catdoc "$1" && exit 0 || printf "%b" "\e[31mcatdoc failed\e[0m" && exit 1;;
*/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt < "$1" && exit 0 || printf "%b" "\e[31mdocx2txt failed\e[0m" && exit 1;;
*/vnd.ms-excel) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || printf "%b" "\e[31mgnumeric failed\e[0m" && exit 1;;
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || printf "%b" "\e[31mgnumeric failed\e[0m" && exit 1;;
*/epub+zip) [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" && exit 0 || printf "%b" "\e[31mepubthumbnailer failed (https://github.com/marianosimone/epub-thumbnailer)\e[0m" && exit 1;;
*/pgp-encrypted) gpg -d -- "$1" && exit 0 || printf "%b" "\e[31mgpg failed\e[0m" && exit 1;;
*/pkix-cert) openssl x509 -text -noout -in "$1" && exit 0 || printf "%b" "\e[31mopenssl failed\e[0m" && exit 1;;
image/*) image "$1" "$2" "$3" "$4" "$5" ;;
video/*) video "$1" "$2" "$3" "$4" "$5" ;;
*opendocument*) odt2txt "$1" && exit 0 || echo -e "\e[31modt2txt not installed\e[0m" && exit 1;;
*/markdown) lowdown -Tterm "$1" && exit 0 || echo -e "\e[31mlowdown not installed \e[0m" && exit 1;;
*/html) lynx -dump "$1" && exit 0 || w3m -dump "$1" && exit 0 || echo -e "\e[31neither lynx nor w3m installed\e[0m" && exit 1;;
*opendocument*) odt2txt "$1" && exit 0 || printf "%b" "\e[31modt2txt failed\e[0m" && exit 1;;
*/markdown) lowdown -Tterm "$1" && exit 0 || printf "%b" "\e[31mlowdown failed \e[0m" && exit 1;;
*/html) lynx -dump "$1" && exit 0 || w3m -dump "$1" && exit 0 || printf "%b" "\e[31neither lynx nor w3m installed\e[0m" && exit 1;;
text/*|*/json|*/xml) batorcat "$1" "$2" ;;
*/pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" && exit 0 || echo -e "\e[31mpoppler-utils/poppler not installed\e[0m" && exit 1;;
*/pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" && exit 0 || printf "%b" "\e[31mpoppler-utils/poppler failed\e[0m" && exit 1;;
esac
case "$(file -bL --mime-type "$1")" in
text/*) batorcat "$1" "$2" ;;

View file

@ -38,7 +38,7 @@ h) sudo make install ;;
# findup is a script available here: https://unix.stackexchange.com/a/35265
java)
loc=$(findup . -name gradlew)
[ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)"
[ "$loc" != "" ] && exec "$loc" run -q -p "$(dirname "$loc")"
;;
m) octave "$file" ;;
md) if [ -x "$(command -v pandoc)" ]; then

View file

@ -1,4 +1,4 @@
#!/bin/sh
while :; do
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
( mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks ) || break
done

View file

@ -54,7 +54,7 @@ multimon() { # Multi-monitor handler.
}
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.

View file

@ -2,7 +2,7 @@
# Feed this script a link and it will give dmenu
# some choice programs to use to open it.
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
feed="${1:-$(true | dmenu -p 'Paste URL or file path')}"
case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in
"copy url") echo "$feed" | xclip -selection clipboard ;;
@ -16,8 +16,8 @@ PDF) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathu
sxiv) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
vim) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
setbg)
curl -L "$feed" >$XDG_CACHE_HOME/pic
xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1
curl -L "$feed" >"$XDG_CACHE_HOME/pic"
xwallpaper --zoom "$XDG_CACHE_HOME/pic" >/dev/null 2>&1
;;
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
lynx) lynx "$feed" >/dev/null 2>&1 ;;

View file

@ -23,7 +23,7 @@ mountusb() {
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
if 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)" ;;
*)
@ -32,8 +32,12 @@ mountusb() {
ug="$(groups | awk '{print $1}')"
sudo -A chown "$user":"$ug" "$mp"
;;
esac && notify-send "禍 USB mounting" "$chosen mounted to $mp." ||
esac
then
notify-send "禍 USB mounting" "$chosen mounted to $mp."
else
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
fi
}
mountandroid() {
@ -41,9 +45,11 @@ mountandroid() {
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." ||
if simple-mtpfs --device "$chosen" "$mp"; then
notify-send " Android Mounting" "Android device mounted to $mp."
else
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
fi
}
asktype() {

View file

@ -11,7 +11,7 @@ drives="$(
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
case "$chosen" in
if case "$chosen" in
*)
chosen="${chosen#📱 }"
sudo -A umount -l "$chosen"
@ -20,8 +20,12 @@ case "$chosen" in
chosen="${chosen% (*}"
sudo -A umount -l "$chosen"
;;
esac && notify-send "禍 Drive unmounted." "$chosen successfully unmounted." ||
esac
then
notify-send "禍 Drive unmounted." "$chosen successfully unmounted."
else
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
fi
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."

View file

@ -1,9 +1,9 @@
#!/bin/sh
GREEN='\033[1;32m'
BLUE='\033[1;34m'
RED='\033[1;30m'
NC='\033[0m'
GREEN='\e[1;32m'
BLUE='\e[1;34m'
RED='\e[1;30m'
NC='\e[0m'
dotfiles="${1:-$HOME/.dotfiles}"
printf "%bChanging directory to %s %b\n" "$BLUE" "$dotfiles" "$NC"

View file

@ -1,16 +1,16 @@
#!/bin/sh
RED=$(printf "\033[1;31m")
NORMAL=$(printf "\033[0m")
RED=$(printf "\e[1;31m")
NORMAL=$(printf "\e[0m")
colors1() {
for i in 0 1 2 3 4 5 6 7; do
printf "\033[4${i}m \033[0m"
printf "%b" "\e[4${i}m \e[0m"
done
}
colors2() {
for i in 0 1 2 3 4 5 6 7; do
printf "\033[10${i}m \033[0m"
printf "%b" "\e[10${i}m \e[0m"
done
}

View file

@ -5,6 +5,6 @@
# every single one of them with one command! This is bound to super + shift + p
# (with other things) by default and is used in some other places.
for i in $(ls /tmp/mpvSockets/*); do
for i in /tmp/mpvSockets/*/*; do
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
done

View file

@ -9,4 +9,4 @@
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
base="$(basename "$1")"
ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
find "$PWD" -maxdepth 1 | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'

View file

@ -1,10 +1,10 @@
#!/bin/sh
red="\033[31m"
orange="\033[33m"
cyan="\033[36m"
green="\033[32m"
white="\033[37m"
reset="\033[0m"
red="\e[31m"
orange="\e[33m"
cyan="\e[36m"
green="\e[32m"
white="\e[37m"
reset="\e[0m"
for battery in /sys/class/power_supply/BAT?*; do
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
[ -n "${capacity+x}" ] && printf " "

View file

@ -15,5 +15,5 @@
# "11") icon="" ;;
# "12") icon="" ;;
# esac
# printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
# printf "%s \e[11m%s\e[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
date "+%H:%M %d.%m.%Y"

View file

@ -1,3 +1,3 @@
#!/bin/sh
# TODO: Add color
sensors | awk '/Core 0/ {print "\033[11m🌡\033[10m" $3}'
sensors | awk '/Core 0/ {print "\e[11m🌡\e[10m" $3}'

View file

@ -3,7 +3,7 @@ cache=/tmp/cpubarscache
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
[ ! -f $cache ] && echo "$stats" >"$cache"
old=$(cat "$cache")
printf "\033[11m﬙\033[10m "
printf "\e[11m﬙\e[10m "
echo "$stats" | while read -r row; do
id=${row%% *}
rest=${row#* }
@ -12,15 +12,15 @@ echo "$stats" | while read -r row; do
case "$(echo "$old" | awk '{if ($1 == id)
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
id="$id" total="$total" idle="$idle")" in
"0") printf "\033[32m▁" ;;
"1") printf "\033[32m▂" ;;
"2") printf "\033[32m▃" ;;
"3") printf "\033[33m▄" ;;
"4") printf "\033[33m▅" ;;
"5") printf "\033[33m▆" ;;
"6" | "7" | "8") printf "\033[31m▇" ;;
"0") printf "\e[32m▁" ;;
"1") printf "\e[32m▂" ;;
"2") printf "\e[32m▃" ;;
"3") printf "\e[33m▄" ;;
"4") printf "\e[33m▅" ;;
"5") printf "\e[33m▆" ;;
"6" | "7" | "8") printf "\e[31m▇" ;;
esac
done
printf "\033[0m\n"
printf "\e[0m\n"
echo "$stats" >"$cache"

View file

@ -2,4 +2,4 @@
# $1 should be drive mountpoint, otherwise assumed /.
location=${1:-/}
[ -d "$location" ] || exit
printf "\033[11m\033[10m %s\n" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
printf "\e[11m\e[10m %s\n" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"

View file

@ -24,7 +24,7 @@ readfile() {
}
output() {
readfile
printf "\033[12m%s\033[10m %s \033[34;11m\033[0m %s° \033[31;11m\033[0m %s°\n" "$emoji" "$precipitation" $highlow
printf "\e[12m%s\e[10m %s \e[34;11m\e[0m %s° \e[31;11m\e[0m %s°\n" "$emoji" "$precipitation" $highlow
}
if fresh; then

View file

@ -5,7 +5,7 @@ if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
for w in /sys/class/net/w*/; do
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w/operstate)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
grep -vxq '0x1003' "$w/flags" && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/;s/dormant/睊/" $w/operstate | tr -d "[:space:]")"
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
printf "$shift\e[11m%s\e[10m %s" "$wifi_icon" "$percent"
shift=" "
done
fi
@ -13,14 +13,14 @@ fi
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
for e in /sys/class/net/e*/operstate; do
if_icon="$(sed "s/down//;s/up//" $e)"
printf "$shift\033[11m%s\033[10m" "$if_icon"
printf "$shift\e[11m%s\e[10m" "$if_icon"
shift=" "
done
fi
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
for _ in /sys/class/net/tun*/operstate; do
printf "$shift\033[11m%s\033[10m" "嬨"
printf "$shift\e[11m%s\e[10m" "嬨"
shift=" "
done
fi

View file

@ -1,2 +1,2 @@
#!/bin/sh
free --mebi | sed -n '2{p;q}' | awk '{printf ("\033[11m\033[10m %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
free --mebi | sed -n '2{p;q}' | awk '{printf ("\e[11m\e[10m %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'

View file

@ -1,7 +1,7 @@
#!/bin/sh
big="\033[11m"
reset="\033[10m"
big="\e[11m"
reset="\e[10m"
update() {
sum=0
@ -16,4 +16,4 @@ update() {
}
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
printf "$big$reset%5sB $big$reset%5sB\\n" $(numfmt --to=iec $rx $tx)
printf "$big$reset%5sB $big$reset%5sB\\n" $(numfmt --to=iec "$rx" "$tx")

View file

@ -1,9 +1,10 @@
#!/bin/sh
icon="\033[11m\033[10m"
icon="\e[11m\e[10m"
if command -v pacman 1>/dev/null 2>&1; then
printf "%b" "$(pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/$icon /;s/^$icon 0$//g")"
num="$(pacman -Qu | grep -Fcv "[ignored]")"
[ "$num" -gt 0 ] && printf "%b %i" "$icon" "$num"
fi
if command -v apt 1>/dev/null 2>&1; then

View file

@ -1,13 +1,13 @@
#!/bin/sh
big="\033[11m"
reset="\033[10m"
big="\e[11m"
reset="\e[10m"
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 &
[ "$(playerctl status 2>&1)" = "No players found" ] && printf "$bigﱙ$reset" && exit 1
[ "$(playerctl status 2>&1)" = "No players found" ] && printf "%bﱙ%b" "$big" "$reset" && exit 1
# song="$(playerctl metadata xesam:artist) - $(playerctl metadata xesam:title)"
song="$(playerctl metadata xesam:title) - $(playerctl metadata xesam:artist)"
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
icon="$(playerctl status | sed "s/Playing//;s/Paused//;s/Stopped/ﱙ/;")"
printf "$big$icon$reset $song"
printf "%b" "$big$icon$reset $song"

View file

@ -1,6 +1,6 @@
#!/bin/sh
# Prints the current volume or ﱝ if muted.
[ "$(pamixer --get-mute)" = true ] && echo "\033[11mﱝ\033[10m" && exit
[ "$(pamixer --get-mute)" = true ] && echo "\e[11mﱝ\e[10m" && exit
vol="$(pamixer --get-volume)"
if [ "$vol" -gt "70" ]; then
@ -12,6 +12,6 @@ elif [ "$vol" -gt "0" ]; then
elif [ "$vol" -eq "0" ]; then
icon=""
else
printf "\033[11m\033[10m " && exit
printf "\e[11m\e[10m " && exit
fi
printf "\033[11m%s\033[10m %s\n" "$icon" "$vol"
printf "\e[11m%s\e[10m %s\n" "$icon" "$vol"

View file

@ -1,3 +1,3 @@
#/bin/sh
#!/bin/sh
# pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
printf "\e[11m\e[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"

View file

@ -13,10 +13,25 @@ command -v apt 1>/dev/null 2>&1 && sudo apt upgrade
# This pkill is already handled by apt/pacman hooks:
# pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
#
# apt
# create the file /etc/apt/apt.conf.d/80statusbar containing the following
# DPkg::Post-Invoke {"/usr/bin/pkill -RTMIN+8 dwmblocks";};
# TODO: provide example for pacman hook
# pacman
# create the file /usr/share/libalpm/hooks/statusbar.hook containing the following
# [Trigger]
# Operation = Upgrade
# Type = Package
# Target = *
# [Action]
# Description = Updating statusbar...
# When = PostTransaction
# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks
printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
read -r _

@ -0,0 +1 @@
Subproject commit 371591a7b6f0f3c9501c52a7b566addbfd804d09