1
0
Fork 0
This commit is contained in:
Luca Bilke 2023-04-12 11:37:10 +02:00 committed by Luca Bilke
parent 2355c80005
commit 485b69eca6
48 changed files with 416 additions and 391 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" ] && if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] &&
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] && [ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] &&

View File

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

View File

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

View File

@ -1,4 +1,4 @@
# vim:set ft=sh # vim:set ft=sh:
export QT_ACCESSIBILITY=1 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 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 fi
export GPG_TTY="$(tty)" export GPG_TTY="$TTY"
gpg-connect-agent updatestartuptty /bye >/dev/null gpg-connect-agent updatestartuptty /bye >/dev/null

View File

@ -1,11 +1,12 @@
# vim:set ft=sh # vim:set ft=sh:
start() { start() {
pidof -s $1 || $@ >/dev/null 2>&1 & pidof -sx $1 || $@ &
} }
xwallpaper --zoom "${XDG_DATA_HOME:-$HOME/.local/share}/bg" & xwallpaper --zoom "${XDG_DATA_HOME:-$HOME/.local/share}/bg" &
killall remaps; remaps & killall remaps
remaps &
checkup & checkup &
start playerctld daemon start playerctld daemon
@ -16,4 +17,3 @@ start pipewire
start wireplumber start wireplumber
start dwmblocks start dwmblocks
start remapd 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_BACKGROUND_COLOR="#24283b"
export XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5" 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 # Any host specific configuration goes here
# This file is excluded from the dotsync script # 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 kitty +kitten icat --clear --silent --stdin no --transfer-mode memory >/dev/tty

View File

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

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
image() { image() {
f=$1 f=$1
w=$2 w=$2
@ -7,7 +7,7 @@ image() {
y=$5 y=$5
kitty +kitten icat --clear --stdin no --silent --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$f" >/dev/tty && exit 1 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 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 return 1
} }
@ -17,7 +17,7 @@ video() {
h=$3 h=$3
x=$4 x=$4
y=$5 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" image "$thumb" "$w" "$h" "$x" "$y"
return 1 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}'))" 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 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-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 || echo -e "\e[31m7zip 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 || printf "%b" "\e[31m7zip failed\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-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 || echo -e "\e[31mtransmission-cli not installed\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 || echo -e "\e[31modt2txt not installed\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 || echo -e "\e[31mcatdoc not installed\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 || echo -e "\e[31mdocx2txt not installed\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 || echo -e "\e[31mgnumeric not installed\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 || 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 || 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 || echo -e "\e[31mepubthumbnailer not installed (https://github.com/marianosimone/epub-thumbnailer)\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 || echo -e "\e[31mgpg not installed\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 || echo -e "\e[31mopenssl not installed\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" ;; image/*) image "$1" "$2" "$3" "$4" "$5" ;;
video/*) video "$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;; *opendocument*) odt2txt "$1" && exit 0 || printf "%b" "\e[31modt2txt failed\e[0m" && exit 1;;
*/markdown) lowdown -Tterm "$1" && exit 0 || echo -e "\e[31mlowdown not installed \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 || echo -e "\e[31neither lynx nor w3m installed\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" ;; 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 esac
case "$(file -bL --mime-type "$1")" in case "$(file -bL --mime-type "$1")" in
text/*) batorcat "$1" "$2" ;; 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 # findup is a script available here: https://unix.stackexchange.com/a/35265
java) java)
loc=$(findup . -name gradlew) loc=$(findup . -name gradlew)
[ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)" [ "$loc" != "" ] && exec "$loc" run -q -p "$(dirname "$loc")"
;; ;;
m) octave "$file" ;; m) octave "$file" ;;
md) if [ -x "$(command -v pandoc)" ]; then md) if [ -x "$(command -v pandoc)" ]; then

View File

@ -3,5 +3,5 @@
upower --monitor-detail -i "$1" | while read -r _; do upower --monitor-detail -i "$1" | while read -r _; do
pkill -RTMIN+3 dwmblocks pkill -RTMIN+3 dwmblocks
timeout 5 cat > /dev/null timeout 5 cat >/dev/null
done done

View File

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

View File

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

@ -13,12 +13,12 @@ geom() {
# variables # variables
output="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots/$(date '+%y%m%d-%H%M-%S').png" output="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots/$(date '+%y%m%d-%H%M-%S').png"
case "$(printf "selected area\\ncurrent window\\nselected window\\nfull screen\\nselected area (copy)\\ncurrent window (copy)\\nselect window (copy)\\nfull screen (copy)" | dmenu -i -p "Screenshot which area?")" in case "$(printf "selected area\\ncurrent window\\nselected window\\nfull screen\\nselected area (copy)\\ncurrent window (copy)\\nselect window (copy)\\nfull screen (copy)" | dmenu -i -p "Screenshot which area?")" in
"selected area") flameshot gui -p "$output" ;; "selected area") flameshot gui -p "$output" ;;
"current window") flameshot gui -p "$output" --region "$(geom active)";; "current window") flameshot gui -p "$output" --region "$(geom active)" ;;
"selected window") flameshot gui -p "$output" --region "$(geom select)";; "selected window") flameshot gui -p "$output" --region "$(geom select)" ;;
"full screen") flameshot full -p "$output" ;; "full screen") flameshot full -p "$output" ;;
"selected area (copy)") flameshot gui -c ;; "selected area (copy)") flameshot gui -c ;;
"current window (copy)") flameshot gui -p "$output" -c --region "$(geom active)";; "current window (copy)") flameshot gui -p "$output" -c --region "$(geom active)" ;;
"selected window (copy)") flameshot gui -p "$output" -c --region "$(geom select)";; "selected window (copy)") flameshot gui -p "$output" -c --region "$(geom select)" ;;
"full screen (copy)") flameshot full -c ;; "full screen (copy)") flameshot full -c ;;
esac esac

View File

@ -2,7 +2,7 @@
# Feed this script a link and it will give dmenu # Feed this script a link and it will give dmenu
# some choice programs to use to open it. # 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 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 ;; "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 ;; 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 ;; 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) setbg)
curl -L "$feed" >$XDG_CACHE_HOME/pic curl -L "$feed" >"$XDG_CACHE_HOME/pic"
xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 xwallpaper --zoom "$XDG_CACHE_HOME/pic" >/dev/null 2>&1
;; ;;
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
lynx) lynx "$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}') 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")"
case "$partitiontype" in if case "$partitiontype" in
"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)" ;;
*) *)
@ -32,8 +32,12 @@ mountusb() {
ug="$(groups | awk '{print $1}')" ug="$(groups | awk '{print $1}')"
sudo -A chown "$user":"$ug" "$mp" 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." notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
fi
} }
mountandroid() { mountandroid() {
@ -41,9 +45,11 @@ mountandroid() {
chosen="$(echo "$chosen" | cut -d : -f 1)" chosen="$(echo "$chosen" | cut -d : -f 1)"
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" && if simple-mtpfs --device "$chosen" "$mp"; then
notify-send " Android Mounting" "Android device mounted to $mp." || notify-send " Android Mounting" "Android device mounted to $mp."
else
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"
fi
} }
asktype() { asktype() {

View File

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

View File

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

View File

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

View File

@ -5,6 +5,6 @@
# every single one of them with one command! This is bound to super + shift + p # 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. # (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" echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
done done

View File

@ -9,4 +9,4 @@
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 [ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
base="$(basename "$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 #!/bin/sh
red="\033[31m" red="\e[31m"
orange="\033[33m" orange="\e[33m"
cyan="\033[36m" cyan="\e[36m"
green="\033[32m" green="\e[32m"
white="\033[37m" white="\e[37m"
reset="\033[0m" reset="\e[0m"
for battery in /sys/class/power_supply/BAT?*; do for battery in /sys/class/power_supply/BAT?*; do
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 & pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
[ -n "${capacity+x}" ] && printf " " [ -n "${capacity+x}" ] && printf " "

View File

@ -15,5 +15,5 @@
# "11") icon="" ;; # "11") icon="" ;;
# "12") icon="" ;; # "12") icon="" ;;
# esac # 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" date "+%H:%M %d.%m.%Y"

View File

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

View File

@ -2,4 +2,4 @@
# $1 should be drive mountpoint, otherwise assumed /. # $1 should be drive mountpoint, otherwise assumed /.
location=${1:-/} location=${1:-/}
[ -d "$location" ] || exit [ -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() { output() {
readfile 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 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 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:]")" 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:]")" 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=" " shift=" "
done done
fi fi
@ -13,14 +13,14 @@ fi
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
for e in /sys/class/net/e*/operstate; do for e in /sys/class/net/e*/operstate; do
if_icon="$(sed "s/down//;s/up//" $e)" 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=" " shift=" "
done done
fi fi
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
for _ in /sys/class/net/tun*/operstate; do for _ in /sys/class/net/tun*/operstate; do
printf "$shift\033[11m%s\033[10m" "嬨" printf "$shift\e[11m%s\e[10m" "嬨"
shift=" " shift=" "
done done
fi fi

View File

@ -1,2 +1,2 @@
#!/bin/sh #!/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 #!/bin/sh
big="\033[11m" big="\e[11m"
reset="\033[10m" reset="\e[10m"
update() { update() {
sum=0 sum=0
@ -16,4 +16,4 @@ update() {
} }
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
tx=$(update /sys/class/net/[ew]*/statistics/tx_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,6 +1,6 @@
#!/bin/sh #!/bin/sh
icon="\033[11m\033[10m" icon="\e[11m\e[10m"
if command -v pacman 1>/dev/null 2>&1; then if command -v pacman 1>/dev/null 2>&1; then
printf "%b" "$(pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/$icon /;s/^$icon 0$//g")" printf "%b" "$(pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/$icon /;s/^$icon 0$//g")"

View File

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
big="\033[11m" big="\e[11m"
reset="\033[10m" reset="\e[10m"
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 & 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:artist) - $(playerctl metadata xesam:title)"
song="$(playerctl metadata xesam:title) - $(playerctl metadata xesam:artist)" song="$(playerctl metadata xesam:title) - $(playerctl metadata xesam:artist)"
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…" [ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
icon="$(playerctl status | sed "s/Playing//;s/Paused//;s/Stopped/ﱙ/;")" 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 #!/bin/sh
# Prints the current volume or ﱝ if muted. # 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)" vol="$(pamixer --get-volume)"
if [ "$vol" -gt "70" ]; then if [ "$vol" -gt "70" ]; then
@ -12,6 +12,6 @@ elif [ "$vol" -gt "0" ]; then
elif [ "$vol" -eq "0" ]; then elif [ "$vol" -eq "0" ]; then
icon="" icon=""
else else
printf "\033[11m\033[10m " && exit printf "\e[11m\e[10m " && exit
fi 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 & # 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: # This pkill is already handled by apt/pacman hooks:
# pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" # pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
#
# apt
# create the file /etc/apt/apt.conf.d/80statusbar containing the following # create the file /etc/apt/apt.conf.d/80statusbar containing the following
# DPkg::Post-Invoke {"/usr/bin/pkill -RTMIN+8 dwmblocks";}; # 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" printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
read -r _ read -r _

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