cleanup
This commit is contained in:
parent
2355c80005
commit
485b69eca6
|
@ -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)" ] &&
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh:
|
||||||
|
|
||||||
xrdb -merge $USRRESOURCES
|
xrdb -merge $USRRESOURCES
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh:
|
||||||
|
|
||||||
add_module() {
|
add_module() {
|
||||||
case :$GTK_MODULES: in
|
case :$GTK_MODULES: in
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh:
|
||||||
|
|
||||||
export QT_ACCESSIBILITY=1
|
export QT_ACCESSIBILITY=1
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# vim:ft=conf
|
|
||||||
|
|
||||||
# file types
|
# file types
|
||||||
ln # LINK
|
ln # LINK
|
||||||
or # ORPHAN
|
or # ORPHAN
|
||||||
|
|
|
@ -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" ;;
|
||||||
|
|
|
@ -3,7 +3,7 @@ msgTag="brightness" # Arbitrary but unique message tag
|
||||||
highlight="#7aa2f7"
|
highlight="#7aa2f7"
|
||||||
|
|
||||||
round() {
|
round() {
|
||||||
awk "BEGIN {printf \"%.0f\", $*}"
|
awk "BEGIN {printf \"%.0f\", $*}"
|
||||||
}
|
}
|
||||||
|
|
||||||
oldbrightness="$(cat /sys/class/backlight/*/brightness)"
|
oldbrightness="$(cat /sys/class/backlight/*/brightness)"
|
||||||
|
@ -12,22 +12,22 @@ newpercent="$(round "$oldpercent + $1")"
|
||||||
newbrightness="$(round "$newpercent * (255/100)")"
|
newbrightness="$(round "$newpercent * (255/100)")"
|
||||||
|
|
||||||
if [ "$newpercent" -gt "100" ]; then
|
if [ "$newpercent" -gt "100" ]; then
|
||||||
icon="gpm-brightness-lcd"
|
icon="gpm-brightness-lcd"
|
||||||
newpercent=100
|
newpercent=100
|
||||||
newbrightness=255
|
newbrightness=255
|
||||||
elif [ "$newpercent" -gt "50" ]; then
|
elif [ "$newpercent" -gt "50" ]; then
|
||||||
icon="gpm-brightness-lcd"
|
icon="gpm-brightness-lcd"
|
||||||
elif [ "$newpercent" -gt "0" ]; then
|
elif [ "$newpercent" -gt "0" ]; then
|
||||||
icon="gpm-brightness-lcd-disabled"
|
icon="gpm-brightness-lcd-disabled"
|
||||||
else
|
else
|
||||||
icon="gpm-brightness-lcd-disabled"
|
icon="gpm-brightness-lcd-disabled"
|
||||||
newpercent=0
|
newpercent=0
|
||||||
newbrightness=0
|
newbrightness=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
round $newbrightness | tee /sys/class/backlight/*/brightness
|
round $newbrightness | tee /sys/class/backlight/*/brightness
|
||||||
|
|
||||||
notify-send -a "changeBrightness" -i "$icon" -u low "Brightness: ${newpercent}%" \
|
notify-send -a "changeBrightness" -i "$icon" -u low "Brightness: ${newpercent}%" \
|
||||||
-h string:x-dunst-stack-tag:$msgTag \
|
-h string:x-dunst-stack-tag:$msgTag \
|
||||||
-h int:value:$newpercent \
|
-h int:value:$newpercent \
|
||||||
-h string:hlcolor:$highlight
|
-h string:hlcolor:$highlight
|
||||||
|
|
|
@ -16,15 +16,15 @@ ext="${file##*.}"
|
||||||
cd "$dir" || exit 1
|
cd "$dir" || exit 1
|
||||||
|
|
||||||
textype() {
|
textype() {
|
||||||
command="pdflatex"
|
command="pdflatex"
|
||||||
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
|
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
|
||||||
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
|
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
|
||||||
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
|
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
|
||||||
$command --output-directory="$dir" "$base" &&
|
$command --output-directory="$dir" "$base" &&
|
||||||
grep -qi addbibresource "$file" &&
|
grep -qi addbibresource "$file" &&
|
||||||
biber --input-directory "$dir" "$base" &&
|
biber --input-directory "$dir" "$base" &&
|
||||||
$command --output-directory="$dir" "$base" &&
|
$command --output-directory="$dir" "$base" &&
|
||||||
$command --output-directory="$dir" "$base"
|
$command --output-directory="$dir" "$base"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$ext" in
|
case "$ext" in
|
||||||
|
@ -35,18 +35,18 @@ cpp) g++ "$file" -o "$base" && "$base" ;;
|
||||||
cs) mcs "$file" && mono "$base".exe ;;
|
cs) mcs "$file" && mono "$base".exe ;;
|
||||||
go) go run "$file" ;;
|
go) go run "$file" ;;
|
||||||
h) sudo make install ;;
|
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
|
||||||
pandoc -t latex -s -o "$base".pdf "$file"
|
pandoc -t latex -s -o "$base".pdf "$file"
|
||||||
elif [ -x "$(command -v groffdown)" ]; then
|
elif [ -x "$(command -v groffdown)" ]; then
|
||||||
groffdown -i "$file" | groff -T pdf >"$base.pdf"
|
groffdown -i "$file" | groff -T pdf >"$base.pdf"
|
||||||
else
|
else
|
||||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||||
fi ;;
|
fi ;;
|
||||||
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf >"$base".pdf ;;
|
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 ;;
|
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;;
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
# battery status file is sent in as an argument from sb-battery
|
# battery status file is sent in as an argument from sb-battery
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -6,64 +6,64 @@
|
||||||
|
|
||||||
twoscreen() { # If multi-monitor is selected and there are two screens.
|
twoscreen() { # If multi-monitor is selected and there are two screens.
|
||||||
|
|
||||||
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
||||||
# Mirror displays using native resolution of external display and a scaled
|
# Mirror displays using native resolution of external display and a scaled
|
||||||
# version for the internal display
|
# version for the internal display
|
||||||
if [ "$mirror" = "yes" ]; then
|
if [ "$mirror" = "yes" ]; then
|
||||||
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
||||||
internal=$(echo "$screens" | grep -v "$external")
|
internal=$(echo "$screens" | grep -v "$external")
|
||||||
|
|
||||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
|
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
|
||||||
tail -n 1 | awk '{print $1}')
|
tail -n 1 | awk '{print $1}')
|
||||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
|
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
|
||||||
tail -n 1 | awk '{print $1}')
|
tail -n 1 | awk '{print $1}')
|
||||||
|
|
||||||
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
||||||
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
|
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
|
||||||
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
|
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
|
||||||
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
|
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
|
||||||
|
|
||||||
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
||||||
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
||||||
|
|
||||||
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
||||||
--output "$internal" --auto --same-as "$external" \
|
--output "$internal" --auto --same-as "$external" \
|
||||||
--scale "$scale_x"x"$scale_y"
|
--scale "$scale_x"x"$scale_y"
|
||||||
else
|
else
|
||||||
|
|
||||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||||
secondary=$(echo "$screens" | grep -v "$primary")
|
secondary=$(echo "$screens" | grep -v "$primary")
|
||||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
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
|
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
morescreen() { # If multi-monitor is selected and there are more than two screens.
|
morescreen() { # If multi-monitor is selected and there are more than two screens.
|
||||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||||
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary 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?")
|
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:")
|
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
|
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.
|
multimon() { # Multi-monitor handler.
|
||||||
case "$(echo "$screens" | wc -l)" in
|
case "$(echo "$screens" | wc -l)" in
|
||||||
2) twoscreen ;;
|
2) twoscreen ;;
|
||||||
*) morescreen ;;
|
*) morescreen ;;
|
||||||
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.
|
||||||
setbg # Fix background if screen size/arangement has changed.
|
setbg # Fix background if screen size/arangement has changed.
|
||||||
remaps # Re-remap keys if keyboard added (for laptop bases)
|
remaps # Re-remap keys if keyboard added (for laptop bases)
|
||||||
{
|
{
|
||||||
killall dunst
|
killall dunst
|
||||||
setsid -f dunst
|
setsid -f dunst
|
||||||
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get all possible displays
|
# Get all possible displays
|
||||||
|
@ -74,22 +74,22 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
||||||
|
|
||||||
# If there's only one screen
|
# If there's only one screen
|
||||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
||||||
{
|
{
|
||||||
onescreen "$screens"
|
onescreen "$screens"
|
||||||
postrun
|
postrun
|
||||||
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
|
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get user choice including multi-monitor and manual selection:
|
# Get user choice including multi-monitor and manual selection:
|
||||||
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
||||||
case "$chosen" in
|
case "$chosen" in
|
||||||
"manual selection")
|
"manual selection")
|
||||||
arandr
|
arandr
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
"multi-monitor") multimon ;;
|
"multi-monitor") multimon ;;
|
||||||
*) onescreen "$chosen" ;;
|
*) onescreen "$chosen" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
postrun
|
postrun
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
# this script provides a menu of screenshot options, using flameshot
|
# this script provides a menu of screenshot options, using flameshot
|
||||||
|
|
||||||
geom() {
|
geom() {
|
||||||
case $1 in
|
case $1 in
|
||||||
"active") eval "$(xdotool getactivewindow getwindowgeometry --shell)" ;;
|
"active") eval "$(xdotool getactivewindow getwindowgeometry --shell)" ;;
|
||||||
"select") eval "$(xdotool selectwindow getwindowgeometry --shell)" ;;
|
"select") eval "$(xdotool selectwindow getwindowgeometry --shell)" ;;
|
||||||
esac
|
esac
|
||||||
echo "${WIDTH}x${HEIGHT}+${X}+${Y}"
|
echo "${WIDTH}x${HEIGHT}+${X}+${Y}"
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
|
@ -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,9 +16,9 @@ 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 ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -6,67 +6,73 @@
|
||||||
# input a novel directory, it will prompt you to create that directory.
|
# input a novel directory, it will prompt you to create that directory.
|
||||||
|
|
||||||
getmount() {
|
getmount() {
|
||||||
[ -z "$chosen" ] && exit 1
|
[ -z "$chosen" ] && exit 1
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||||
test -z "$mp" && exit 1
|
test -z "$mp" && exit 1
|
||||||
if [ ! -d "$mp" ]; then
|
if [ ! -d "$mp" ]; then
|
||||||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
|
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")
|
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
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")"
|
||||||
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)" ;;
|
||||||
*)
|
*)
|
||||||
sudo -A mount "$chosen" "$mp"
|
sudo -A mount "$chosen" "$mp"
|
||||||
user="$(whoami)"
|
user="$(whoami)"
|
||||||
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
|
||||||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
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() {
|
mountandroid() {
|
||||||
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||||
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."
|
||||||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
else
|
||||||
|
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
asktype() {
|
asktype() {
|
||||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||||
case $choice in
|
case $choice in
|
||||||
USB) mountusb ;;
|
USB) mountusb ;;
|
||||||
Android) mountandroid ;;
|
Android) mountandroid ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
anddrives=$(simple-mtpfs -l 2>/dev/null)
|
anddrives=$(simple-mtpfs -l 2>/dev/null)
|
||||||
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
|
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
|
||||||
|
|
||||||
if [ -z "$usbdrives" ]; then
|
if [ -z "$usbdrives" ]; then
|
||||||
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
|
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
|
||||||
echo "Android device(s) detected."
|
echo "Android device(s) detected."
|
||||||
mountandroid
|
mountandroid
|
||||||
else
|
else
|
||||||
if [ -z "$anddrives" ]; then
|
if [ -z "$anddrives" ]; then
|
||||||
echo "USB drive(s) detected."
|
echo "USB drive(s) detected."
|
||||||
mountusb
|
mountusb
|
||||||
else
|
else
|
||||||
echo "Mountable USB drive(s) and Android device(s) detected."
|
echo "Mountable USB drive(s) and Android device(s) detected."
|
||||||
asktype
|
asktype
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -11,10 +11,10 @@ share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p
|
||||||
share2mnt=//"$srvname".local/"$share"
|
share2mnt=//"$srvname".local/"$share"
|
||||||
|
|
||||||
sharemount() {
|
sharemount() {
|
||||||
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
|
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
|
||||||
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
|
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
|
||||||
notify-send "Netshare $share already mounted"
|
notify-send "Netshare $share already mounted"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
sharemount
|
sharemount
|
||||||
|
|
|
@ -10,108 +10,108 @@
|
||||||
# If there is already a running instance, user will be prompted to end it.
|
# If there is already a running instance, user will be prompted to end it.
|
||||||
|
|
||||||
updateicon() {
|
updateicon() {
|
||||||
echo "$1" >/tmp/recordingicon
|
echo "$1" >/tmp/recordingicon
|
||||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||||
}
|
}
|
||||||
|
|
||||||
killrecording() {
|
killrecording() {
|
||||||
recpid="$(cat /tmp/recordingpid)"
|
recpid="$(cat /tmp/recordingpid)"
|
||||||
# kill with SIGTERM, allowing finishing touches.
|
# kill with SIGTERM, allowing finishing touches.
|
||||||
kill -15 "$recpid"
|
kill -15 "$recpid"
|
||||||
rm -f /tmp/recordingpid
|
rm -f /tmp/recordingpid
|
||||||
updateicon ""
|
updateicon ""
|
||||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||||
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
|
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
|
||||||
sleep 3
|
sleep 3
|
||||||
kill -9 "$recpid"
|
kill -9 "$recpid"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
screencast() {
|
screencast() {
|
||||||
ffmpeg -y \
|
ffmpeg -y \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-framerate 60 \
|
-framerate 60 \
|
||||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||||
-i "$DISPLAY" \
|
-i "$DISPLAY" \
|
||||||
-f alsa -i default \
|
-f alsa -i default \
|
||||||
-r 30 \
|
-r 30 \
|
||||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||||
echo $! >/tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon "ﲠ"
|
updateicon "ﲠ"
|
||||||
}
|
}
|
||||||
|
|
||||||
video() {
|
video() {
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||||
-i "$DISPLAY" \
|
-i "$DISPLAY" \
|
||||||
-c:v libx264 -qp 0 -r 30 \
|
-c:v libx264 -qp 0 -r 30 \
|
||||||
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
|
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||||
echo $! >/tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon "ﲣ"
|
updateicon "ﲣ"
|
||||||
}
|
}
|
||||||
|
|
||||||
webcamhidef() {
|
webcamhidef() {
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f v4l2 \
|
-f v4l2 \
|
||||||
-i /dev/video0 \
|
-i /dev/video0 \
|
||||||
-video_size 1920x1080 \
|
-video_size 1920x1080 \
|
||||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||||
echo $! >/tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon ""
|
updateicon ""
|
||||||
}
|
}
|
||||||
|
|
||||||
webcam() {
|
webcam() {
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f v4l2 \
|
-f v4l2 \
|
||||||
-i /dev/video0 \
|
-i /dev/video0 \
|
||||||
-video_size 640x480 \
|
-video_size 640x480 \
|
||||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||||
echo $! >/tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon ""
|
updateicon ""
|
||||||
}
|
}
|
||||||
|
|
||||||
audio() {
|
audio() {
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f alsa -i default \
|
-f alsa -i default \
|
||||||
-c:a flac \
|
-c:a flac \
|
||||||
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
|
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
|
||||||
echo $! >/tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon ""
|
updateicon ""
|
||||||
}
|
}
|
||||||
|
|
||||||
askrecording() {
|
askrecording() {
|
||||||
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
screencast) screencast ;;
|
screencast) screencast ;;
|
||||||
audio) audio ;;
|
audio) audio ;;
|
||||||
video) video ;;
|
video) video ;;
|
||||||
*selected) videoselected ;;
|
*selected) videoselected ;;
|
||||||
webcam) webcam ;;
|
webcam) webcam ;;
|
||||||
"webcam (hi-def)") webcamhidef ;;
|
"webcam (hi-def)") webcamhidef ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
asktoend() {
|
asktoend() {
|
||||||
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
||||||
[ "$response" = "Yes" ] && killrecording
|
[ "$response" = "Yes" ] && killrecording
|
||||||
}
|
}
|
||||||
|
|
||||||
videoselected() {
|
videoselected() {
|
||||||
slop -f "%x %y %w %h" >/tmp/slop
|
slop -f "%x %y %w %h" >/tmp/slop
|
||||||
read -r X Y W H </tmp/slop
|
read -r X Y W H </tmp/slop
|
||||||
rm /tmp/slop
|
rm /tmp/slop
|
||||||
|
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-framerate 60 \
|
-framerate 60 \
|
||||||
-video_size "$W"x"$H" \
|
-video_size "$W"x"$H" \
|
||||||
-i :0.0+"$X,$Y" \
|
-i :0.0+"$X,$Y" \
|
||||||
-c:v libx264 -qp 0 -r 30 \
|
-c:v libx264 -qp 0 -r 30 \
|
||||||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||||
echo $! >/tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon "ﲣ"
|
updateicon "ﲣ"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
|
@ -5,23 +5,27 @@
|
||||||
# Drives mounted at /, /boot and /home will not be options to unmount.
|
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||||
|
|
||||||
drives="$(
|
drives="$(
|
||||||
lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'
|
lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'
|
||||||
awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab
|
awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab
|
||||||
)"
|
)"
|
||||||
|
|
||||||
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
|
||||||
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
|
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."
|
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -i -l 30 | sed "s/ .*//")
|
||||||
# If you run this command with an argument, it will automatically insert the
|
# If you run this command with an argument, it will automatically insert the
|
||||||
# character. Otherwise, show a message that the emoji has been copied.
|
# character. Otherwise, show a message that the emoji has been copied.
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
xdotool type "$chosen"
|
xdotool type "$chosen"
|
||||||
else
|
else
|
||||||
printf "%s" "$chosen" | xclip -selection clipboard
|
printf "%s" "$chosen" | xclip -selection clipboard
|
||||||
notify-send "'$chosen' copied to clipboard." &
|
notify-send "'$chosen' copied to clipboard." &
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/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"
|
||||||
if ! cd "$dotfiles"; then
|
if ! cd "$dotfiles"; then
|
||||||
printf "%bCould not CD into %s%b\n" "$RED" "$dotfiles" "$NC"
|
printf "%bCould not CD into %s%b\n" "$RED" "$dotfiles" "$NC"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ printf "%bStashing existing changes...%b\n" "$BLUE" "$NC"
|
||||||
stash_result=$(git stash push -m "sync-dotfiles: Before syncing dotfiles")
|
stash_result=$(git stash push -m "sync-dotfiles: Before syncing dotfiles")
|
||||||
needs_pop=1
|
needs_pop=1
|
||||||
if [ "$stash_result" = "No local changes to save" ]; then
|
if [ "$stash_result" = "No local changes to save" ]; then
|
||||||
needs_pop=0
|
needs_pop=0
|
||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
|
@ -27,18 +27,18 @@ git submodule update --remote --recursive --init
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
if [ $needs_pop -eq 1 ]; then
|
if [ $needs_pop -eq 1 ]; then
|
||||||
printf "%bPopping stashed changes...%b\n" "$BLUE" "$NC"
|
printf "%bPopping stashed changes...%b\n" "$BLUE" "$NC"
|
||||||
git stash pop
|
git stash pop
|
||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
unmerged_files=$(git diff --name-only --diff-filter=U)
|
unmerged_files=$(git diff --name-only --diff-filter=U)
|
||||||
if [ -n "$unmerged_files" ]; then
|
if [ -n "$unmerged_files" ]; then
|
||||||
printf "%bThe following files have merge conflicts after popping the stash:%b\n" "$RED" "$NC"
|
printf "%bThe following files have merge conflicts after popping the stash:%b\n" "$RED" "$NC"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf %"s\n" "$unmerged_files\n"
|
printf %"s\n" "$unmerged_files\n"
|
||||||
else
|
else
|
||||||
stow -t "$HOME" . || printf "%bStow uninstalled or not in path!%b\n" "$RED" "$NC"
|
stow -t "$HOME" . || printf "%bStow uninstalled or not in path!%b\n" "$RED" "$NC"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%bGenerating librewolf profiles...%b\n" "$BLUE" "$NC"
|
printf "%bGenerating librewolf profiles...%b\n" "$BLUE" "$NC"
|
||||||
|
@ -48,11 +48,11 @@ printf "\n"
|
||||||
printf "Recompile/Install src files? [y/N] \n"
|
printf "Recompile/Install src files? [y/N] \n"
|
||||||
read -r ans
|
read -r ans
|
||||||
[ "$ans" = "y" ] && for f in "$dotfiles"/.local/src/*; do
|
[ "$ans" = "y" ] && for f in "$dotfiles"/.local/src/*; do
|
||||||
if ! cd "$f"; then
|
if ! cd "$f"; then
|
||||||
printf "%bCould not CD into %s%b\n" "$RED" "$f" "$NC"
|
printf "%bCould not CD into %s%b\n" "$RED" "$f" "$NC"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
sudo make install
|
sudo make install
|
||||||
make clean
|
make clean
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -e
|
||||||
path="$1"
|
path="$1"
|
||||||
shift 1
|
shift 1
|
||||||
while [[ $path != / ]]; do
|
while [[ $path != / ]]; do
|
||||||
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
||||||
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
||||||
path="$(readlink -f "$path"/..)"
|
path="$(readlink -f "$path"/..)"
|
||||||
done
|
done
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Reads file names from stdin and selects them in lf.
|
# Reads file names from stdin and selects them in lf.
|
||||||
|
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
[ -z "$file" ] && continue
|
[ -z "$file" ] && continue
|
||||||
lf -remote "send select \"$file\""
|
lf -remote "send select \"$file\""
|
||||||
lf -remote "send toggle"
|
lf -remote "send toggle"
|
||||||
done
|
done
|
||||||
|
|
|
@ -7,25 +7,25 @@
|
||||||
# otherwise it opens link in browser.
|
# otherwise it opens link in browser.
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
url="$(xclip -o)"
|
url="$(xclip -o)"
|
||||||
else
|
else
|
||||||
url="$1"
|
url="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$url" in
|
case "$url" in
|
||||||
*mkv | *webm | *mp4 | *youtube.com/watch* | *youtube.com/playlist* | *youtube.com/shorts* | *youtu.be* | *hooktube.com* | *bitchute.com* | *videos.lukesmith.xyz* | *odysee.com*)
|
*mkv | *webm | *mp4 | *youtube.com/watch* | *youtube.com/playlist* | *youtube.com/shorts* | *youtu.be* | *hooktube.com* | *bitchute.com* | *videos.lukesmith.xyz* | *odysee.com*)
|
||||||
setsid -f mpv -quiet "$url" >/dev/null 2>&1
|
setsid -f mpv -quiet "$url" >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
*png | *jpg | *jpe | *jpeg | *gif)
|
*png | *jpg | *jpe | *jpeg | *gif)
|
||||||
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||||
;;
|
;;
|
||||||
*pdf | *cbz | *cbr)
|
*pdf | *cbz | *cbr)
|
||||||
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||||
;;
|
;;
|
||||||
*mp3 | *flac | *opus | *mp3?source*)
|
*mp3 | *flac | *opus | *mp3?source*)
|
||||||
qndl "$url" 'curl -LO' >/dev/null 2>&1
|
qndl "$url" 'curl -LO' >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
|
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,22 +7,22 @@ volume="$(pamixer --get-volume)"
|
||||||
mute="$(pamixer --get-mute)"
|
mute="$(pamixer --get-mute)"
|
||||||
|
|
||||||
[ "$volume" -gt "100" ] &&
|
[ "$volume" -gt "100" ] &&
|
||||||
highlight="#ff768e" ||
|
highlight="#ff768e" ||
|
||||||
highlight="#7aa2f7"
|
highlight="#7aa2f7"
|
||||||
|
|
||||||
if [ "$mute" = "true" ]; then
|
if [ "$mute" = "true" ]; then
|
||||||
icon="audio-volume-muted"
|
icon="audio-volume-muted"
|
||||||
elif [ "$volume" -gt "70" ]; then
|
elif [ "$volume" -gt "70" ]; then
|
||||||
icon="audio-volume-high"
|
icon="audio-volume-high"
|
||||||
elif [ "$volume" -gt "30" ]; then
|
elif [ "$volume" -gt "30" ]; then
|
||||||
icon="audio-volume-medium"
|
icon="audio-volume-medium"
|
||||||
elif [ "$volume" -ge "0" ]; then
|
elif [ "$volume" -ge "0" ]; then
|
||||||
icon="audio-volume-low"
|
icon="audio-volume-low"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
notify-send -a "changeVolume" -i "$icon" -u low "Volume: ${volume}%" \
|
notify-send -a "changeVolume" -i "$icon" -u low "Volume: ${volume}%" \
|
||||||
-h string:x-dunst-stack-tag:$msgTag \
|
-h string:x-dunst-stack-tag:$msgTag \
|
||||||
-h int:value:$volume \
|
-h int:value:$volume \
|
||||||
-h string:hlcolor:$highlight
|
-h string:hlcolor:$highlight
|
||||||
|
|
||||||
canberra-gtk-play -i audio-volume-change -d "changeVolume"
|
canberra-gtk-play -i audio-volume-change -d "changeVolume"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
|
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
|
||||||
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
[ -z "$line" ] && continue
|
[ -z "$line" ] && continue
|
||||||
url="${line%%[ ]*}"
|
url="${line%%[ ]*}"
|
||||||
qndl "$url" "curl -LO"
|
qndl "$url" "curl -LO"
|
||||||
done <"$queuefile"
|
done <"$queuefile"
|
||||||
|
|
||||||
echo >"$queuefile"
|
echo >"$queuefile"
|
||||||
|
|
|
@ -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; }'
|
||||||
|
|
|
@ -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 " "
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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}'
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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}')"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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))}'
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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")"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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/:/')"
|
||||||
|
|
|
@ -4,36 +4,36 @@
|
||||||
groups="us:dvorak de:nodeadkeys"
|
groups="us:dvorak de:nodeadkeys"
|
||||||
|
|
||||||
index() {
|
index() {
|
||||||
echo "$groups" | cut -d ' ' -f "$1"
|
echo "$groups" | cut -d ' ' -f "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "-n" ]; then
|
if [ "$1" = "-n" ]; then
|
||||||
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||||
elif [ "$1" = "" ]; then
|
elif [ "$1" = "" ]; then
|
||||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||||
i=1
|
i=1
|
||||||
while [ ! "$found" ]; do
|
while [ ! "$found" ]; do
|
||||||
group=$(index $i)
|
group=$(index $i)
|
||||||
if [ "$group" = "$current" ]; then
|
if [ "$group" = "$current" ]; then
|
||||||
newgroup=$(index $((i + 1)))
|
newgroup=$(index $((i + 1)))
|
||||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||||
found=true
|
found=true
|
||||||
elif [ -z "$group" ]; then
|
elif [ -z "$group" ]; then
|
||||||
newgroup=$(index 1)
|
newgroup=$(index 1)
|
||||||
found=true
|
found=true
|
||||||
fi
|
fi
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
newgroup="$1"
|
newgroup="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setxkbmap \
|
setxkbmap \
|
||||||
-layout "$(echo "$newgroup" | cut -d ':' -f1)" \
|
-layout "$(echo "$newgroup" | cut -d ':' -f1)" \
|
||||||
-variant "$(echo "$newgroup" | cut -d ':' -f2)" \
|
-variant "$(echo "$newgroup" | cut -d ':' -f2)" \
|
||||||
-option caps:super \
|
-option caps:super \
|
||||||
1>/dev/null 2>&1 ||
|
1>/dev/null 2>&1 ||
|
||||||
echo "Unkown keyboard layout" >&2
|
echo "Unkown keyboard layout" >&2
|
||||||
|
|
||||||
xset r rate 300 50
|
xset r rate 300 50
|
||||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue