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" ] &&
|
||||
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] &&
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# vim:set ft=sh
|
||||
# vim:set ft=sh:
|
||||
|
||||
xrdb -merge $USRRESOURCES
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# vim:set ft=sh
|
||||
# vim:set ft=sh:
|
||||
|
||||
add_module() {
|
||||
case :$GTK_MODULES: in
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# vim:set ft=sh
|
||||
# vim:set ft=sh:
|
||||
|
||||
export QT_ACCESSIBILITY=1
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# vim:set ft=sh
|
||||
# vim:set ft=sh:
|
||||
|
||||
if [ "${SSH_AUTH_SOCK:-0}" -ne $$ ]; then
|
||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
sock="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
export SSH_AUTH_SOCK=$sock
|
||||
fi
|
||||
export GPG_TTY="$(tty)"
|
||||
export GPG_TTY="$TTY"
|
||||
gpg-connect-agent updatestartuptty /bye >/dev/null
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# vim:set ft=sh
|
||||
# vim:set ft=sh:
|
||||
|
||||
start() {
|
||||
pidof -s $1 || $@ >/dev/null 2>&1 &
|
||||
pidof -sx $1 || $@ &
|
||||
}
|
||||
|
||||
xwallpaper --zoom "${XDG_DATA_HOME:-$HOME/.local/share}/bg" &
|
||||
killall remaps; remaps &
|
||||
killall remaps
|
||||
remaps &
|
||||
checkup &
|
||||
|
||||
start playerctld daemon
|
||||
|
@ -16,4 +17,3 @@ start pipewire
|
|||
start wireplumber
|
||||
start dwmblocks
|
||||
start remapd
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# vim:set ft=sh
|
||||
# vim:set ft=sh:
|
||||
|
||||
export XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b"
|
||||
export XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5"
|
|
@ -1,3 +1,3 @@
|
|||
# vim:set ft=sh
|
||||
# vim:set ft=sh:
|
||||
# Any host specific configuration goes here
|
||||
# This file is excluded from the dotsync script
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bir/sh
|
||||
kitty +kitten icat --clear --silent --stdin no --transfer-mode memory >/dev/tty
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# vim:ft=conf
|
||||
|
||||
# file types
|
||||
ln # LINK
|
||||
or # ORPHAN
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
image() {
|
||||
f=$1
|
||||
w=$2
|
||||
|
@ -7,7 +7,7 @@ image() {
|
|||
y=$5
|
||||
kitty +kitten icat --clear --stdin no --silent --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$f" >/dev/tty && exit 1
|
||||
chafa "$f" -f symbols -s "$((w-2))x$h" && exit 1
|
||||
echo -e "\e[31mImage previewer not installed\e[0m"
|
||||
printf "%b" "\e[31mImage previewer failed\e[0m"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ video() {
|
|||
h=$3
|
||||
x=$4
|
||||
y=$5
|
||||
thumb="$(vidthumb "$f")" || ( echo -e "\e[31mvidthumb script not in path\e[0m" && return 1 )
|
||||
thumb="$(vidthumb "$f")" || ( printf "%b" "\e[31mvidthumb script not in path\e[0m"; return 1 )
|
||||
image "$thumb" "$w" "$h" "$x" "$y"
|
||||
return 1
|
||||
}
|
||||
|
@ -33,25 +33,25 @@ batorcat() {
|
|||
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
|
||||
|
||||
case "$(xdg-mime query filetype "$1")" in
|
||||
*/x-bzip-compressed-tar|*/x-compressed-tar|*/x-xz-compressed-tar) als -- "$1" && exit 0 || echo -e "\e[31matools not installed\e[0m" && exit 1;;
|
||||
*/x-7z-compressed|*/vnd.rar|*/x-tar|*/zip|*/x-java-archive|*/x-xz) 7z l "$1" | sed 1,11d && exit 0 || echo -e "\e[31m7zip not installed\e[0m" && exit 1;;
|
||||
*/x-cd-image) iso-info --no-header -l "$1" && exit 0 || echo -e "\e[31mlibcdio not installed\e[0m" && exit 1;;
|
||||
*/x-bittorrent) transmission-show "$1" && exit 0 || echo -e "\e[31mtransmission-cli not installed\e[0m" && exit 1;;
|
||||
*/vnd.sun.xml.writer) odt2txt "$1" && exit 0 || echo -e "\e[31modt2txt not installed\e[0m" && exit 1;;
|
||||
*/msword) catdoc "$1" && exit 0 || echo -e "\e[31mcatdoc not installed\e[0m" && exit 1;;
|
||||
*/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt < "$1" && exit 0 || echo -e "\e[31mdocx2txt not installed\e[0m" && exit 1;;
|
||||
*/vnd.ms-excel) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || echo -e "\e[31mgnumeric not installed\e[0m" && exit 1;;
|
||||
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || echo -e "\e[31mgnumeric not installed\e[0m" && exit 1;;
|
||||
*/epub+zip) [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" && exit 0 || echo -e "\e[31mepubthumbnailer not installed (https://github.com/marianosimone/epub-thumbnailer)\e[0m" && exit 1;;
|
||||
*/pgp-encrypted) gpg -d -- "$1" && exit 0 || echo -e "\e[31mgpg not installed\e[0m" && exit 1;;
|
||||
*/pkix-cert) openssl x509 -text -noout -in "$1" && exit 0 || echo -e "\e[31mopenssl not installed\e[0m" && exit 1;;
|
||||
*/x-bzip-compressed-tar|*/x-compressed-tar|*/x-xz-compressed-tar) als -- "$1" && exit 0 || printf "%b" "\e[31matools failed\e[0m" && exit 1;;
|
||||
*/x-7z-compressed|*/vnd.rar|*/x-tar|*/zip|*/x-java-archive|*/x-xz) 7z l "$1" | sed 1,11d && exit 0 || printf "%b" "\e[31m7zip failed\e[0m" && exit 1;;
|
||||
*/x-cd-image) iso-info --no-header -l "$1" && exit 0 || printf "%b" "\e[31mlibcdio failed\e[0m" && exit 1;;
|
||||
*/x-bittorrent) transmission-show "$1" && exit 0 || printf "%b" "\e[31mtransmission-cli failed\e[0m" && exit 1;;
|
||||
*/vnd.sun.xml.writer) odt2txt "$1" && exit 0 || printf "%b" "\e[31modt2txt failed\e[0m" && exit 1;;
|
||||
*/msword) catdoc "$1" && exit 0 || printf "%b" "\e[31mcatdoc failed\e[0m" && exit 1;;
|
||||
*/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt < "$1" && exit 0 || printf "%b" "\e[31mdocx2txt failed\e[0m" && exit 1;;
|
||||
*/vnd.ms-excel) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || printf "%b" "\e[31mgnumeric failed\e[0m" && exit 1;;
|
||||
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv && exit 0 || printf "%b" "\e[31mgnumeric failed\e[0m" && exit 1;;
|
||||
*/epub+zip) [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" && exit 0 || printf "%b" "\e[31mepubthumbnailer failed (https://github.com/marianosimone/epub-thumbnailer)\e[0m" && exit 1;;
|
||||
*/pgp-encrypted) gpg -d -- "$1" && exit 0 || printf "%b" "\e[31mgpg failed\e[0m" && exit 1;;
|
||||
*/pkix-cert) openssl x509 -text -noout -in "$1" && exit 0 || printf "%b" "\e[31mopenssl failed\e[0m" && exit 1;;
|
||||
image/*) image "$1" "$2" "$3" "$4" "$5" ;;
|
||||
video/*) video "$1" "$2" "$3" "$4" "$5" ;;
|
||||
*opendocument*) odt2txt "$1" && exit 0 || echo -e "\e[31modt2txt not installed\e[0m" && exit 1;;
|
||||
*/markdown) lowdown -Tterm "$1" && exit 0 || echo -e "\e[31mlowdown not installed \e[0m" && exit 1;;
|
||||
*/html) lynx -dump "$1" && exit 0 || w3m -dump "$1" && exit 0 || echo -e "\e[31neither lynx nor w3m installed\e[0m" && exit 1;;
|
||||
*opendocument*) odt2txt "$1" && exit 0 || printf "%b" "\e[31modt2txt failed\e[0m" && exit 1;;
|
||||
*/markdown) lowdown -Tterm "$1" && exit 0 || printf "%b" "\e[31mlowdown failed \e[0m" && exit 1;;
|
||||
*/html) lynx -dump "$1" && exit 0 || w3m -dump "$1" && exit 0 || printf "%b" "\e[31neither lynx nor w3m installed\e[0m" && exit 1;;
|
||||
text/*|*/json|*/xml) batorcat "$1" "$2" ;;
|
||||
*/pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" && exit 0 || echo -e "\e[31mpoppler-utils/poppler not installed\e[0m" && exit 1;;
|
||||
*/pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" && exit 0 || printf "%b" "\e[31mpoppler-utils/poppler failed\e[0m" && exit 1;;
|
||||
esac
|
||||
case "$(file -bL --mime-type "$1")" in
|
||||
text/*) batorcat "$1" "$2" ;;
|
||||
|
|
|
@ -3,7 +3,7 @@ msgTag="brightness" # Arbitrary but unique message tag
|
|||
highlight="#7aa2f7"
|
||||
|
||||
round() {
|
||||
awk "BEGIN {printf \"%.0f\", $*}"
|
||||
awk "BEGIN {printf \"%.0f\", $*}"
|
||||
}
|
||||
|
||||
oldbrightness="$(cat /sys/class/backlight/*/brightness)"
|
||||
|
@ -12,22 +12,22 @@ newpercent="$(round "$oldpercent + $1")"
|
|||
newbrightness="$(round "$newpercent * (255/100)")"
|
||||
|
||||
if [ "$newpercent" -gt "100" ]; then
|
||||
icon="gpm-brightness-lcd"
|
||||
newpercent=100
|
||||
newbrightness=255
|
||||
icon="gpm-brightness-lcd"
|
||||
newpercent=100
|
||||
newbrightness=255
|
||||
elif [ "$newpercent" -gt "50" ]; then
|
||||
icon="gpm-brightness-lcd"
|
||||
icon="gpm-brightness-lcd"
|
||||
elif [ "$newpercent" -gt "0" ]; then
|
||||
icon="gpm-brightness-lcd-disabled"
|
||||
icon="gpm-brightness-lcd-disabled"
|
||||
else
|
||||
icon="gpm-brightness-lcd-disabled"
|
||||
newpercent=0
|
||||
newbrightness=0
|
||||
icon="gpm-brightness-lcd-disabled"
|
||||
newpercent=0
|
||||
newbrightness=0
|
||||
fi
|
||||
|
||||
round $newbrightness | tee /sys/class/backlight/*/brightness
|
||||
|
||||
notify-send -a "changeBrightness" -i "$icon" -u low "Brightness: ${newpercent}%" \
|
||||
-h string:x-dunst-stack-tag:$msgTag \
|
||||
-h int:value:$newpercent \
|
||||
-h string:hlcolor:$highlight
|
||||
-h string:x-dunst-stack-tag:$msgTag \
|
||||
-h int:value:$newpercent \
|
||||
-h string:hlcolor:$highlight
|
||||
|
|
|
@ -16,15 +16,15 @@ ext="${file##*.}"
|
|||
cd "$dir" || exit 1
|
||||
|
||||
textype() {
|
||||
command="pdflatex"
|
||||
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"
|
||||
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
grep -qi addbibresource "$file" &&
|
||||
biber --input-directory "$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base"
|
||||
command="pdflatex"
|
||||
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"
|
||||
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
grep -qi addbibresource "$file" &&
|
||||
biber --input-directory "$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base"
|
||||
}
|
||||
|
||||
case "$ext" in
|
||||
|
@ -35,18 +35,18 @@ cpp) g++ "$file" -o "$base" && "$base" ;;
|
|||
cs) mcs "$file" && mono "$base".exe ;;
|
||||
go) go run "$file" ;;
|
||||
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)
|
||||
loc=$(findup . -name gradlew)
|
||||
[ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)"
|
||||
;;
|
||||
loc=$(findup . -name gradlew)
|
||||
[ "$loc" != "" ] && exec "$loc" run -q -p "$(dirname "$loc")"
|
||||
;;
|
||||
m) octave "$file" ;;
|
||||
md) if [ -x "$(command -v pandoc)" ]; then
|
||||
pandoc -t latex -s -o "$base".pdf "$file"
|
||||
elif [ -x "$(command -v groffdown)" ]; then
|
||||
groffdown -i "$file" | groff -T pdf >"$base.pdf"
|
||||
groffdown -i "$file" | groff -T pdf >"$base.pdf"
|
||||
else
|
||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||
fi ;;
|
||||
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf >"$base".pdf ;;
|
||||
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;;
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
# battery status file is sent in as an argument from sb-battery
|
||||
|
||||
upower --monitor-detail -i "$1" | while read -r _; do
|
||||
pkill -RTMIN+3 dwmblocks
|
||||
timeout 5 cat > /dev/null
|
||||
pkill -RTMIN+3 dwmblocks
|
||||
timeout 5 cat >/dev/null
|
||||
done
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
while :; do
|
||||
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
|
||||
( mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks ) || break
|
||||
done
|
||||
|
|
|
@ -6,64 +6,64 @@
|
|||
|
||||
twoscreen() { # If multi-monitor is selected and there are two screens.
|
||||
|
||||
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
||||
# Mirror displays using native resolution of external display and a scaled
|
||||
# version for the internal display
|
||||
if [ "$mirror" = "yes" ]; then
|
||||
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
||||
internal=$(echo "$screens" | grep -v "$external")
|
||||
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
||||
# Mirror displays using native resolution of external display and a scaled
|
||||
# version for the internal display
|
||||
if [ "$mirror" = "yes" ]; then
|
||||
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
||||
internal=$(echo "$screens" | grep -v "$external")
|
||||
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
|
||||
res_ext_x=$(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_y=$(echo "$res_internal" | sed 's/.*x//')
|
||||
res_ext_x=$(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_y=$(echo "$res_internal" | sed 's/.*x//')
|
||||
|
||||
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
||||
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
||||
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
||||
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
||||
|
||||
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
||||
--output "$internal" --auto --same-as "$external" \
|
||||
--scale "$scale_x"x"$scale_y"
|
||||
else
|
||||
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
||||
--output "$internal" --auto --same-as "$external" \
|
||||
--scale "$scale_x"x"$scale_y"
|
||||
else
|
||||
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||
fi
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||
fi
|
||||
}
|
||||
|
||||
morescreen() { # If multi-monitor is selected and there are more than two screens.
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
|
||||
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
|
||||
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
|
||||
}
|
||||
|
||||
multimon() { # Multi-monitor handler.
|
||||
case "$(echo "$screens" | wc -l)" in
|
||||
2) twoscreen ;;
|
||||
*) morescreen ;;
|
||||
esac
|
||||
case "$(echo "$screens" | wc -l)" in
|
||||
2) twoscreen ;;
|
||||
*) morescreen ;;
|
||||
esac
|
||||
}
|
||||
|
||||
onescreen() { # If only one output available or chosen.
|
||||
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)""
|
||||
xrandr --output "$1" --auto --scale 1.0x1.0 "$(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)"
|
||||
}
|
||||
|
||||
postrun() { # Stuff to run to clean up.
|
||||
setbg # Fix background if screen size/arangement has changed.
|
||||
remaps # Re-remap keys if keyboard added (for laptop bases)
|
||||
{
|
||||
killall dunst
|
||||
setsid -f dunst
|
||||
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||
setbg # Fix background if screen size/arangement has changed.
|
||||
remaps # Re-remap keys if keyboard added (for laptop bases)
|
||||
{
|
||||
killall dunst
|
||||
setsid -f dunst
|
||||
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||
}
|
||||
|
||||
# Get all possible displays
|
||||
|
@ -74,22 +74,22 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
|||
|
||||
# If there's only one screen
|
||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
||||
{
|
||||
onescreen "$screens"
|
||||
postrun
|
||||
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
|
||||
exit
|
||||
}
|
||||
{
|
||||
onescreen "$screens"
|
||||
postrun
|
||||
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
|
||||
exit
|
||||
}
|
||||
|
||||
# Get user choice including multi-monitor and manual selection:
|
||||
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
||||
case "$chosen" in
|
||||
"manual selection")
|
||||
arandr
|
||||
exit
|
||||
;;
|
||||
"multi-monitor") multimon ;;
|
||||
*) onescreen "$chosen" ;;
|
||||
esac
|
||||
case "$chosen" in
|
||||
"manual selection")
|
||||
arandr
|
||||
exit
|
||||
;;
|
||||
"multi-monitor") multimon ;;
|
||||
*) onescreen "$chosen" ;;
|
||||
esac
|
||||
|
||||
postrun
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
# this script provides a menu of screenshot options, using flameshot
|
||||
|
||||
geom() {
|
||||
case $1 in
|
||||
"active") eval "$(xdotool getactivewindow getwindowgeometry --shell)" ;;
|
||||
"select") eval "$(xdotool selectwindow getwindowgeometry --shell)" ;;
|
||||
case $1 in
|
||||
"active") eval "$(xdotool getactivewindow getwindowgeometry --shell)" ;;
|
||||
"select") eval "$(xdotool selectwindow getwindowgeometry --shell)" ;;
|
||||
esac
|
||||
echo "${WIDTH}x${HEIGHT}+${X}+${Y}"
|
||||
}
|
||||
|
@ -13,12 +13,12 @@ geom() {
|
|||
# variables
|
||||
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
|
||||
"selected area") flameshot gui -p "$output" ;;
|
||||
"current window") flameshot gui -p "$output" --region "$(geom active)";;
|
||||
"selected window") flameshot gui -p "$output" --region "$(geom select)";;
|
||||
"full screen") flameshot full -p "$output" ;;
|
||||
"selected area (copy)") flameshot gui -c ;;
|
||||
"current window (copy)") flameshot gui -p "$output" -c --region "$(geom active)";;
|
||||
"selected window (copy)") flameshot gui -p "$output" -c --region "$(geom select)";;
|
||||
"full screen (copy)") flameshot full -c ;;
|
||||
"selected area") flameshot gui -p "$output" ;;
|
||||
"current window") flameshot gui -p "$output" --region "$(geom active)" ;;
|
||||
"selected window") flameshot gui -p "$output" --region "$(geom select)" ;;
|
||||
"full screen") flameshot full -p "$output" ;;
|
||||
"selected area (copy)") flameshot gui -c ;;
|
||||
"current window (copy)") flameshot gui -p "$output" -c --region "$(geom active)" ;;
|
||||
"selected window (copy)") flameshot gui -p "$output" -c --region "$(geom select)" ;;
|
||||
"full screen (copy)") flameshot full -c ;;
|
||||
esac
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Feed this script a link and it will give dmenu
|
||||
# some choice programs to use to open it.
|
||||
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
|
||||
feed="${1:-$(true | dmenu -p 'Paste URL or file path')}"
|
||||
|
||||
case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in
|
||||
"copy url") echo "$feed" | xclip -selection clipboard ;;
|
||||
|
@ -16,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 ;;
|
||||
vim) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
setbg)
|
||||
curl -L "$feed" >$XDG_CACHE_HOME/pic
|
||||
xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1
|
||||
;;
|
||||
curl -L "$feed" >"$XDG_CACHE_HOME/pic"
|
||||
xwallpaper --zoom "$XDG_CACHE_HOME/pic" >/dev/null 2>&1
|
||||
;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
|
||||
lynx) lynx "$feed" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
|
|
|
@ -6,67 +6,73 @@
|
|||
# input a novel directory, it will prompt you to create that directory.
|
||||
|
||||
getmount() {
|
||||
[ -z "$chosen" ] && exit 1
|
||||
# shellcheck disable=SC2086
|
||||
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||
test -z "$mp" && exit 1
|
||||
if [ ! -d "$mp" ]; then
|
||||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
|
||||
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||
fi
|
||||
[ -z "$chosen" ] && exit 1
|
||||
# shellcheck disable=SC2086
|
||||
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||
test -z "$mp" && exit 1
|
||||
if [ ! -d "$mp" ]; then
|
||||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
|
||||
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||
fi
|
||||
}
|
||||
|
||||
mountusb() {
|
||||
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
sudo -A mount "$chosen" 2>/dev/null && notify-send "禍 USB mounting" "$chosen mounted." && exit 0
|
||||
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
|
||||
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
|
||||
partitiontype="$(lsblk -no "fstype" "$chosen")"
|
||||
case "$partitiontype" in
|
||||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
|
||||
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
|
||||
*)
|
||||
sudo -A mount "$chosen" "$mp"
|
||||
user="$(whoami)"
|
||||
ug="$(groups | awk '{print $1}')"
|
||||
sudo -A chown "$user":"$ug" "$mp"
|
||||
;;
|
||||
esac && notify-send "禍 USB mounting" "$chosen mounted to $mp." ||
|
||||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
||||
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
sudo -A mount "$chosen" 2>/dev/null && notify-send "禍 USB mounting" "$chosen mounted." && exit 0
|
||||
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
|
||||
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
|
||||
partitiontype="$(lsblk -no "fstype" "$chosen")"
|
||||
if case "$partitiontype" in
|
||||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
|
||||
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
|
||||
*)
|
||||
sudo -A mount "$chosen" "$mp"
|
||||
user="$(whoami)"
|
||||
ug="$(groups | awk '{print $1}')"
|
||||
sudo -A chown "$user":"$ug" "$mp"
|
||||
;;
|
||||
esac
|
||||
then
|
||||
notify-send "禍 USB mounting" "$chosen mounted to $mp."
|
||||
else
|
||||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
||||
fi
|
||||
}
|
||||
|
||||
mountandroid() {
|
||||
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
||||
getmount "$HOME -maxdepth 3 -type d"
|
||||
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
|
||||
simple-mtpfs --device "$chosen" "$mp" &&
|
||||
notify-send " Android Mounting" "Android device mounted to $mp." ||
|
||||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
||||
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
||||
getmount "$HOME -maxdepth 3 -type d"
|
||||
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
|
||||
if simple-mtpfs --device "$chosen" "$mp"; then
|
||||
notify-send " Android Mounting" "Android device mounted to $mp."
|
||||
else
|
||||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
||||
fi
|
||||
}
|
||||
|
||||
asktype() {
|
||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||
case $choice in
|
||||
USB) mountusb ;;
|
||||
Android) mountandroid ;;
|
||||
esac
|
||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||
case $choice in
|
||||
USB) mountusb ;;
|
||||
Android) mountandroid ;;
|
||||
esac
|
||||
}
|
||||
|
||||
anddrives=$(simple-mtpfs -l 2>/dev/null)
|
||||
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
|
||||
|
||||
if [ -z "$usbdrives" ]; then
|
||||
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
|
||||
echo "Android device(s) detected."
|
||||
mountandroid
|
||||
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
|
||||
echo "Android device(s) detected."
|
||||
mountandroid
|
||||
else
|
||||
if [ -z "$anddrives" ]; then
|
||||
echo "USB drive(s) detected."
|
||||
mountusb
|
||||
else
|
||||
echo "Mountable USB drive(s) and Android device(s) detected."
|
||||
asktype
|
||||
fi
|
||||
if [ -z "$anddrives" ]; then
|
||||
echo "USB drive(s) detected."
|
||||
mountusb
|
||||
else
|
||||
echo "Mountable USB drive(s) and Android device(s) detected."
|
||||
asktype
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -11,10 +11,10 @@ share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p
|
|||
share2mnt=//"$srvname".local/"$share"
|
||||
|
||||
sharemount() {
|
||||
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
|
||||
notify-send "Netshare $share already mounted"
|
||||
exit 1
|
||||
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
|
||||
notify-send "Netshare $share already mounted"
|
||||
exit 1
|
||||
}
|
||||
|
||||
sharemount
|
||||
|
|
|
@ -10,108 +10,108 @@
|
|||
# If there is already a running instance, user will be prompted to end it.
|
||||
|
||||
updateicon() {
|
||||
echo "$1" >/tmp/recordingicon
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
echo "$1" >/tmp/recordingicon
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
}
|
||||
|
||||
killrecording() {
|
||||
recpid="$(cat /tmp/recordingpid)"
|
||||
# kill with SIGTERM, allowing finishing touches.
|
||||
kill -15 "$recpid"
|
||||
rm -f /tmp/recordingpid
|
||||
updateicon ""
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
|
||||
sleep 3
|
||||
kill -9 "$recpid"
|
||||
exit
|
||||
recpid="$(cat /tmp/recordingpid)"
|
||||
# kill with SIGTERM, allowing finishing touches.
|
||||
kill -15 "$recpid"
|
||||
rm -f /tmp/recordingpid
|
||||
updateicon ""
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
|
||||
sleep 3
|
||||
kill -9 "$recpid"
|
||||
exit
|
||||
}
|
||||
|
||||
screencast() {
|
||||
ffmpeg -y \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-f alsa -i default \
|
||||
-r 30 \
|
||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲠ"
|
||||
ffmpeg -y \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-f alsa -i default \
|
||||
-r 30 \
|
||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲠ"
|
||||
}
|
||||
|
||||
video() {
|
||||
ffmpeg \
|
||||
-f x11grab \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲣ"
|
||||
ffmpeg \
|
||||
-f x11grab \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲣ"
|
||||
}
|
||||
|
||||
webcamhidef() {
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 1920x1080 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 1920x1080 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
webcam() {
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 640x480 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 640x480 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
audio() {
|
||||
ffmpeg \
|
||||
-f alsa -i default \
|
||||
-c:a flac \
|
||||
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
ffmpeg \
|
||||
-f alsa -i default \
|
||||
-c:a flac \
|
||||
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
askrecording() {
|
||||
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||
case "$choice" in
|
||||
screencast) screencast ;;
|
||||
audio) audio ;;
|
||||
video) video ;;
|
||||
*selected) videoselected ;;
|
||||
webcam) webcam ;;
|
||||
"webcam (hi-def)") webcamhidef ;;
|
||||
esac
|
||||
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||
case "$choice" in
|
||||
screencast) screencast ;;
|
||||
audio) audio ;;
|
||||
video) video ;;
|
||||
*selected) videoselected ;;
|
||||
webcam) webcam ;;
|
||||
"webcam (hi-def)") webcamhidef ;;
|
||||
esac
|
||||
}
|
||||
|
||||
asktoend() {
|
||||
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
||||
[ "$response" = "Yes" ] && killrecording
|
||||
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
||||
[ "$response" = "Yes" ] && killrecording
|
||||
}
|
||||
|
||||
videoselected() {
|
||||
slop -f "%x %y %w %h" >/tmp/slop
|
||||
read -r X Y W H </tmp/slop
|
||||
rm /tmp/slop
|
||||
slop -f "%x %y %w %h" >/tmp/slop
|
||||
read -r X Y W H </tmp/slop
|
||||
rm /tmp/slop
|
||||
|
||||
ffmpeg \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-video_size "$W"x"$H" \
|
||||
-i :0.0+"$X,$Y" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲣ"
|
||||
ffmpeg \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-video_size "$W"x"$H" \
|
||||
-i :0.0+"$X,$Y" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲣ"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
|
|
@ -5,23 +5,27 @@
|
|||
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||
|
||||
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}'
|
||||
awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab
|
||||
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
|
||||
)"
|
||||
|
||||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||
|
||||
case "$chosen" in
|
||||
*)
|
||||
chosen="${chosen#📱 }"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
*)
|
||||
chosen="${chosen% (*}"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
esac && notify-send "禍 Drive unmounted." "$chosen successfully unmounted." ||
|
||||
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
|
||||
if case "$chosen" in
|
||||
*)
|
||||
chosen="${chosen#📱 }"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
*)
|
||||
chosen="${chosen% (*}"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
esac
|
||||
then
|
||||
notify-send "禍 Drive unmounted." "$chosen successfully unmounted."
|
||||
else
|
||||
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
|
||||
fi
|
||||
|
||||
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."
|
||||
|
||||
|
|
|
@ -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
|
||||
# character. Otherwise, show a message that the emoji has been copied.
|
||||
if [ -n "$1" ]; then
|
||||
xdotool type "$chosen"
|
||||
xdotool type "$chosen"
|
||||
else
|
||||
printf "%s" "$chosen" | xclip -selection clipboard
|
||||
notify-send "'$chosen' copied to clipboard." &
|
||||
printf "%s" "$chosen" | xclip -selection clipboard
|
||||
notify-send "'$chosen' copied to clipboard." &
|
||||
fi
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
GREEN='\033[1;32m'
|
||||
BLUE='\033[1;34m'
|
||||
RED='\033[1;30m'
|
||||
NC='\033[0m'
|
||||
GREEN='\e[1;32m'
|
||||
BLUE='\e[1;34m'
|
||||
RED='\e[1;30m'
|
||||
NC='\e[0m'
|
||||
dotfiles="${1:-$HOME/.dotfiles}"
|
||||
|
||||
printf "%bChanging directory to %s %b\n" "$BLUE" "$dotfiles" "$NC"
|
||||
if ! cd "$dotfiles"; then
|
||||
printf "%bCould not CD into %s%b\n" "$RED" "$dotfiles" "$NC"
|
||||
exit
|
||||
printf "%bCould not CD into %s%b\n" "$RED" "$dotfiles" "$NC"
|
||||
exit
|
||||
fi
|
||||
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")
|
||||
needs_pop=1
|
||||
if [ "$stash_result" = "No local changes to save" ]; then
|
||||
needs_pop=0
|
||||
needs_pop=0
|
||||
fi
|
||||
printf "\n"
|
||||
|
||||
|
@ -27,18 +27,18 @@ git submodule update --remote --recursive --init
|
|||
printf "\n"
|
||||
|
||||
if [ $needs_pop -eq 1 ]; then
|
||||
printf "%bPopping stashed changes...%b\n" "$BLUE" "$NC"
|
||||
git stash pop
|
||||
printf "%bPopping stashed changes...%b\n" "$BLUE" "$NC"
|
||||
git stash pop
|
||||
fi
|
||||
printf "\n"
|
||||
|
||||
unmerged_files=$(git diff --name-only --diff-filter=U)
|
||||
if [ -n "$unmerged_files" ]; then
|
||||
printf "%bThe following files have merge conflicts after popping the stash:%b\n" "$RED" "$NC"
|
||||
printf "\n"
|
||||
printf %"s\n" "$unmerged_files\n"
|
||||
printf "%bThe following files have merge conflicts after popping the stash:%b\n" "$RED" "$NC"
|
||||
printf "\n"
|
||||
printf %"s\n" "$unmerged_files\n"
|
||||
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
|
||||
|
||||
printf "%bGenerating librewolf profiles...%b\n" "$BLUE" "$NC"
|
||||
|
@ -48,11 +48,11 @@ printf "\n"
|
|||
printf "Recompile/Install src files? [y/N] \n"
|
||||
read -r ans
|
||||
[ "$ans" = "y" ] && for f in "$dotfiles"/.local/src/*; do
|
||||
if ! cd "$f"; then
|
||||
printf "%bCould not CD into %s%b\n" "$RED" "$f" "$NC"
|
||||
exit
|
||||
fi
|
||||
sudo make install
|
||||
if ! cd "$f"; then
|
||||
printf "%bCould not CD into %s%b\n" "$RED" "$f" "$NC"
|
||||
exit
|
||||
fi
|
||||
sudo make install
|
||||
make clean
|
||||
done
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ set -e
|
|||
path="$1"
|
||||
shift 1
|
||||
while [[ $path != / ]]; do
|
||||
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
||||
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
||||
path="$(readlink -f "$path"/..)"
|
||||
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
||||
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
||||
path="$(readlink -f "$path"/..)"
|
||||
done
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Reads file names from stdin and selects them in lf.
|
||||
|
||||
while read -r file; do
|
||||
[ -z "$file" ] && continue
|
||||
lf -remote "send select \"$file\""
|
||||
lf -remote "send toggle"
|
||||
[ -z "$file" ] && continue
|
||||
lf -remote "send select \"$file\""
|
||||
lf -remote "send toggle"
|
||||
done
|
||||
|
|
|
@ -7,25 +7,25 @@
|
|||
# otherwise it opens link in browser.
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
url="$(xclip -o)"
|
||||
url="$(xclip -o)"
|
||||
else
|
||||
url="$1"
|
||||
url="$1"
|
||||
fi
|
||||
|
||||
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*)
|
||||
setsid -f mpv -quiet "$url" >/dev/null 2>&1
|
||||
;;
|
||||
setsid -f mpv -quiet "$url" >/dev/null 2>&1
|
||||
;;
|
||||
*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)
|
||||
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*)
|
||||
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
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#!/bin/sh
|
||||
RED=$(printf "\033[1;31m")
|
||||
NORMAL=$(printf "\033[0m")
|
||||
RED=$(printf "\e[1;31m")
|
||||
NORMAL=$(printf "\e[0m")
|
||||
|
||||
colors1() {
|
||||
for i in 0 1 2 3 4 5 6 7; do
|
||||
printf "\033[4${i}m \033[0m"
|
||||
printf "%b" "\e[4${i}m \e[0m"
|
||||
done
|
||||
}
|
||||
|
||||
colors2() {
|
||||
for i in 0 1 2 3 4 5 6 7; do
|
||||
printf "\033[10${i}m \033[0m"
|
||||
printf "%b" "\e[10${i}m \e[0m"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
@ -7,22 +7,22 @@ volume="$(pamixer --get-volume)"
|
|||
mute="$(pamixer --get-mute)"
|
||||
|
||||
[ "$volume" -gt "100" ] &&
|
||||
highlight="#ff768e" ||
|
||||
highlight="#7aa2f7"
|
||||
highlight="#ff768e" ||
|
||||
highlight="#7aa2f7"
|
||||
|
||||
if [ "$mute" = "true" ]; then
|
||||
icon="audio-volume-muted"
|
||||
icon="audio-volume-muted"
|
||||
elif [ "$volume" -gt "70" ]; then
|
||||
icon="audio-volume-high"
|
||||
icon="audio-volume-high"
|
||||
elif [ "$volume" -gt "30" ]; then
|
||||
icon="audio-volume-medium"
|
||||
icon="audio-volume-medium"
|
||||
elif [ "$volume" -ge "0" ]; then
|
||||
icon="audio-volume-low"
|
||||
icon="audio-volume-low"
|
||||
fi
|
||||
|
||||
notify-send -a "changeVolume" -i "$icon" -u low "Volume: ${volume}%" \
|
||||
-h string:x-dunst-stack-tag:$msgTag \
|
||||
-h int:value:$volume \
|
||||
-h string:hlcolor:$highlight
|
||||
-h string:x-dunst-stack-tag:$msgTag \
|
||||
-h int:value:$volume \
|
||||
-h string:hlcolor:$highlight
|
||||
|
||||
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
|
||||
# (with other things) by default and is used in some other places.
|
||||
|
||||
for i in $(ls /tmp/mpvSockets/*); do
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
|
||||
for i in /tmp/mpvSockets/*/*; do
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
|
||||
done
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
|
||||
|
||||
while read -r line; do
|
||||
[ -z "$line" ] && continue
|
||||
url="${line%%[ ]*}"
|
||||
qndl "$url" "curl -LO"
|
||||
[ -z "$line" ] && continue
|
||||
url="${line%%[ ]*}"
|
||||
qndl "$url" "curl -LO"
|
||||
done <"$queuefile"
|
||||
|
||||
echo >"$queuefile"
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
|
||||
base="$(basename "$1")"
|
||||
ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
|
||||
find "$PWD" -maxdepth 1 | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/sh
|
||||
red="\033[31m"
|
||||
orange="\033[33m"
|
||||
cyan="\033[36m"
|
||||
green="\033[32m"
|
||||
white="\033[37m"
|
||||
reset="\033[0m"
|
||||
red="\e[31m"
|
||||
orange="\e[33m"
|
||||
cyan="\e[36m"
|
||||
green="\e[32m"
|
||||
white="\e[37m"
|
||||
reset="\e[0m"
|
||||
for battery in /sys/class/power_supply/BAT?*; do
|
||||
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
|
||||
[ -n "${capacity+x}" ] && printf " "
|
||||
|
|
|
@ -15,5 +15,5 @@
|
|||
# "11") icon="" ;;
|
||||
# "12") icon="" ;;
|
||||
# esac
|
||||
# printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
|
||||
# printf "%s \e[11m%s\e[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
|
||||
date "+%H:%M %d.%m.%Y"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
# TODO: Add color
|
||||
sensors | awk '/Core 0/ {print "\033[11m🌡\033[10m" $3}'
|
||||
sensors | awk '/Core 0/ {print "\e[11m🌡\e[10m" $3}'
|
||||
|
|
|
@ -3,7 +3,7 @@ cache=/tmp/cpubarscache
|
|||
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
|
||||
[ ! -f $cache ] && echo "$stats" >"$cache"
|
||||
old=$(cat "$cache")
|
||||
printf "\033[11m\033[10m "
|
||||
printf "\e[11m\e[10m "
|
||||
echo "$stats" | while read -r row; do
|
||||
id=${row%% *}
|
||||
rest=${row#* }
|
||||
|
@ -12,15 +12,15 @@ echo "$stats" | while read -r row; do
|
|||
case "$(echo "$old" | awk '{if ($1 == id)
|
||||
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
|
||||
id="$id" total="$total" idle="$idle")" in
|
||||
"0") printf "\033[32m▁" ;;
|
||||
"1") printf "\033[32m▂" ;;
|
||||
"2") printf "\033[32m▃" ;;
|
||||
"3") printf "\033[33m▄" ;;
|
||||
"4") printf "\033[33m▅" ;;
|
||||
"5") printf "\033[33m▆" ;;
|
||||
"6" | "7" | "8") printf "\033[31m▇" ;;
|
||||
"0") printf "\e[32m▁" ;;
|
||||
"1") printf "\e[32m▂" ;;
|
||||
"2") printf "\e[32m▃" ;;
|
||||
"3") printf "\e[33m▄" ;;
|
||||
"4") printf "\e[33m▅" ;;
|
||||
"5") printf "\e[33m▆" ;;
|
||||
"6" | "7" | "8") printf "\e[31m▇" ;;
|
||||
|
||||
esac
|
||||
done
|
||||
printf "\033[0m\n"
|
||||
printf "\e[0m\n"
|
||||
echo "$stats" >"$cache"
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
# $1 should be drive mountpoint, otherwise assumed /.
|
||||
location=${1:-/}
|
||||
[ -d "$location" ] || exit
|
||||
printf "\033[11m\033[10m %s\n" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
|
||||
printf "\e[11m\e[10m %s\n" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
|
||||
|
|
|
@ -24,7 +24,7 @@ readfile() {
|
|||
}
|
||||
output() {
|
||||
readfile
|
||||
printf "\033[12m%s\033[10m %s \033[34;11m\033[0m %s° \033[31;11m\033[0m %s°\n" "$emoji" "$precipitation" $highlow
|
||||
printf "\e[12m%s\e[10m %s \e[34;11m\e[0m %s° \e[31;11m\e[0m %s°\n" "$emoji" "$precipitation" $highlow
|
||||
}
|
||||
|
||||
if fresh; then
|
||||
|
|
|
@ -5,7 +5,7 @@ if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
|
|||
for w in /sys/class/net/w*/; do
|
||||
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w/operstate)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
|
||||
grep -vxq '0x1003' "$w/flags" && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/;s/dormant/睊/" $w/operstate | tr -d "[:space:]")"
|
||||
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
|
||||
printf "$shift\e[11m%s\e[10m %s" "$wifi_icon" "$percent"
|
||||
shift=" "
|
||||
done
|
||||
fi
|
||||
|
@ -13,14 +13,14 @@ fi
|
|||
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
|
||||
for e in /sys/class/net/e*/operstate; do
|
||||
if_icon="$(sed "s/down//;s/up//" $e)"
|
||||
printf "$shift\033[11m%s\033[10m" "$if_icon"
|
||||
printf "$shift\e[11m%s\e[10m" "$if_icon"
|
||||
shift=" "
|
||||
done
|
||||
fi
|
||||
|
||||
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
|
||||
for _ in /sys/class/net/tun*/operstate; do
|
||||
printf "$shift\033[11m%s\033[10m" "嬨"
|
||||
printf "$shift\e[11m%s\e[10m" "嬨"
|
||||
shift=" "
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
free --mebi | sed -n '2{p;q}' | awk '{printf ("\033[11m\033[10m %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
|
||||
free --mebi | sed -n '2{p;q}' | awk '{printf ("\e[11m\e[10m %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
big="\033[11m"
|
||||
reset="\033[10m"
|
||||
big="\e[11m"
|
||||
reset="\e[10m"
|
||||
|
||||
update() {
|
||||
sum=0
|
||||
|
@ -16,4 +16,4 @@ update() {
|
|||
}
|
||||
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
||||
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
|
||||
printf "$big$reset%5sB $big$reset%5sB\\n" $(numfmt --to=iec $rx $tx)
|
||||
printf "$big$reset%5sB $big$reset%5sB\\n" $(numfmt --to=iec "$rx" "$tx")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
icon="\033[11m\033[10m"
|
||||
icon="\e[11m\e[10m"
|
||||
|
||||
if command -v pacman 1>/dev/null 2>&1; then
|
||||
printf "%b" "$(pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/$icon /;s/^$icon 0$//g")"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
big="\033[11m"
|
||||
reset="\033[10m"
|
||||
big="\e[11m"
|
||||
reset="\e[10m"
|
||||
|
||||
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 &
|
||||
[ "$(playerctl status 2>&1)" = "No players found" ] && printf "$bigﱙ$reset" && exit 1
|
||||
[ "$(playerctl status 2>&1)" = "No players found" ] && printf "%bﱙ%b" "$big" "$reset" && exit 1
|
||||
# song="$(playerctl metadata xesam:artist) - $(playerctl metadata xesam:title)"
|
||||
song="$(playerctl metadata xesam:title) - $(playerctl metadata xesam:artist)"
|
||||
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
|
||||
|
||||
icon="$(playerctl status | sed "s/Playing//;s/Paused//;s/Stopped/ﱙ/;")"
|
||||
printf "$big$icon$reset $song"
|
||||
printf "%b" "$big$icon$reset $song"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Prints the current volume or ﱝ if muted.
|
||||
[ "$(pamixer --get-mute)" = true ] && echo "\033[11mﱝ\033[10m" && exit
|
||||
[ "$(pamixer --get-mute)" = true ] && echo "\e[11mﱝ\e[10m" && exit
|
||||
vol="$(pamixer --get-volume)"
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
|
@ -12,6 +12,6 @@ elif [ "$vol" -gt "0" ]; then
|
|||
elif [ "$vol" -eq "0" ]; then
|
||||
icon=""
|
||||
else
|
||||
printf "\033[11m\033[10m " && exit
|
||||
printf "\e[11m\e[10m " && exit
|
||||
fi
|
||||
printf "\033[11m%s\033[10m %s\n" "$icon" "$vol"
|
||||
printf "\e[11m%s\e[10m %s\n" "$icon" "$vol"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#/bin/sh
|
||||
#!/bin/sh
|
||||
# pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
|
||||
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
printf "\e[11m\e[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
|
|
|
@ -4,36 +4,36 @@
|
|||
groups="us:dvorak de:nodeadkeys"
|
||||
|
||||
index() {
|
||||
echo "$groups" | cut -d ' ' -f "$1"
|
||||
echo "$groups" | cut -d ' ' -f "$1"
|
||||
}
|
||||
|
||||
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
|
||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
i=1
|
||||
while [ ! "$found" ]; do
|
||||
group=$(index $i)
|
||||
if [ "$group" = "$current" ]; then
|
||||
newgroup=$(index $((i + 1)))
|
||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||
found=true
|
||||
elif [ -z "$group" ]; then
|
||||
newgroup=$(index 1)
|
||||
found=true
|
||||
fi
|
||||
i=$((i + 1))
|
||||
done
|
||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
i=1
|
||||
while [ ! "$found" ]; do
|
||||
group=$(index $i)
|
||||
if [ "$group" = "$current" ]; then
|
||||
newgroup=$(index $((i + 1)))
|
||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||
found=true
|
||||
elif [ -z "$group" ]; then
|
||||
newgroup=$(index 1)
|
||||
found=true
|
||||
fi
|
||||
i=$((i + 1))
|
||||
done
|
||||
else
|
||||
newgroup="$1"
|
||||
newgroup="$1"
|
||||
fi
|
||||
|
||||
setxkbmap \
|
||||
-layout "$(echo "$newgroup" | cut -d ':' -f1)" \
|
||||
-variant "$(echo "$newgroup" | cut -d ':' -f2)" \
|
||||
-option caps:super \
|
||||
1>/dev/null 2>&1 ||
|
||||
echo "Unkown keyboard layout" >&2
|
||||
-layout "$(echo "$newgroup" | cut -d ':' -f1)" \
|
||||
-variant "$(echo "$newgroup" | cut -d ':' -f2)" \
|
||||
-option caps:super \
|
||||
1>/dev/null 2>&1 ||
|
||||
echo "Unkown keyboard layout" >&2
|
||||
|
||||
xset r rate 300 50
|
||||
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:
|
||||
# pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||
#
|
||||
|
||||
# apt
|
||||
# create the file /etc/apt/apt.conf.d/80statusbar containing the following
|
||||
|
||||
# DPkg::Post-Invoke {"/usr/bin/pkill -RTMIN+8 dwmblocks";};
|
||||
# TODO: provide example for pacman hook
|
||||
|
||||
|
||||
|
||||
# pacman
|
||||
# create the file /usr/share/libalpm/hooks/statusbar.hook containing the following
|
||||
|
||||
# [Trigger]
|
||||
# Operation = Upgrade
|
||||
# Type = Package
|
||||
# Target = *
|
||||
# [Action]
|
||||
# Description = Updating statusbar...
|
||||
# When = PostTransaction
|
||||
# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks
|
||||
|
||||
printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
|
||||
read -r _
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 371591a7b6f0f3c9501c52a7b566addbfd804d09
|
Loading…
Reference in New Issue