shfmt
shfmt
This commit is contained in:
parent
1f2fda79e8
commit
774f14f273
59 changed files with 797 additions and 721 deletions
.config
X11
nvim/lua/plugins/config
.local/bin
|
|
@ -66,14 +66,14 @@ serverargs=${serverargs}" -auth "${xserverauthfile}
|
||||||
# if '$displayname' already exists do not overwrite it as another
|
# if '$displayname' already exists do not overwrite it as another
|
||||||
# server may need it. Add them to the '$xserverauthfile' instead.
|
# server may need it. Add them to the '$xserverauthfile' instead.
|
||||||
for displayname in $authdisplay $hostname$authdisplay; do
|
for displayname in $authdisplay $hostname$authdisplay; do
|
||||||
authcookie=$(xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p") 2>/dev/null;
|
authcookie=$(xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p") 2>/dev/null
|
||||||
if [ -n "${authcookie+x}" ]; then
|
if [ -n "${authcookie+x}" ]; then
|
||||||
xauth -q <<EOF
|
xauth -q <<EOF
|
||||||
add $displayname . $mcookie
|
add $displayname . $mcookie
|
||||||
EOF
|
EOF
|
||||||
removelist="$displayname $removelist"
|
removelist="$displayname $removelist"
|
||||||
else
|
else
|
||||||
dummy=$((dummy+1));
|
dummy=$((dummy + 1))
|
||||||
xauth -q -f "$xserverauthfile" <<EOF
|
xauth -q -f "$xserverauthfile" <<EOF
|
||||||
add :$dummy . $authcookie
|
add :$dummy . $authcookie
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ message_nonl () {
|
||||||
# pretty-print messages of arbitrary length (no trailing newline); use
|
# pretty-print messages of arbitrary length (no trailing newline); use
|
||||||
# xmessage if it is available and $DISPLAY is set
|
# xmessage if it is available and $DISPLAY is set
|
||||||
MESSAGE="$PROGNAME: $*"
|
MESSAGE="$PROGNAME: $*"
|
||||||
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
|
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
|
||||||
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
||||||
# echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
# echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
||||||
# fi
|
# fi
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# 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)" ] &&
|
||||||
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
||||||
# We are under systemd-logind or something remarkably similar, and
|
# We are under systemd-logind or something remarkably similar, and
|
||||||
# a user-session socket has already been set up.
|
# a user-session socket has already been set up.
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh
|
||||||
|
|
||||||
add_module()
|
add_module() {
|
||||||
{
|
|
||||||
case :$GTK_MODULES: in
|
case :$GTK_MODULES: in
|
||||||
*:$1:*)
|
*:$1:*) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
if [ -z "$GTK_MODULES" ]
|
if [ -z "$GTK_MODULES" ]; then
|
||||||
then
|
|
||||||
GTK_MODULES=$1
|
GTK_MODULES=$1
|
||||||
else
|
else
|
||||||
GTK_MODULES=$GTK_MODULES:$1
|
GTK_MODULES=$GTK_MODULES:$1
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh
|
||||||
|
|
||||||
start()
|
start() {
|
||||||
{
|
|
||||||
pidof -s $1 || $@ >/dev/null 2>&1 &
|
pidof -s $1 || $@ >/dev/null 2>&1 &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ null_ls.setup {
|
||||||
debug = false,
|
debug = false,
|
||||||
sources = {
|
sources = {
|
||||||
formatting.black.with { extra_args = { "--fast" } },
|
formatting.black.with { extra_args = { "--fast" } },
|
||||||
|
formatting.shfmt,
|
||||||
-- formatting.stylua,
|
-- formatting.stylua,
|
||||||
-- diagnostics.flake8,
|
-- diagnostics.flake8,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ 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"
|
||||||
|
|
@ -36,7 +36,10 @@ case "$ext" in
|
||||||
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) loc=$(findup . -name gradlew); [ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)" ;;
|
java)
|
||||||
|
loc=$(findup . -name gradlew)
|
||||||
|
[ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)"
|
||||||
|
;;
|
||||||
m) octave "$file" ;;
|
m) octave "$file" ;;
|
||||||
md) if [ -x "$(command -v lowdown)" ]; then
|
md) if [ -x "$(command -v lowdown)" ]; then
|
||||||
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf >"$base".pdf
|
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf >"$base".pdf
|
||||||
|
|
@ -44,7 +47,7 @@ case "$ext" in
|
||||||
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 ;;
|
||||||
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,11 @@ These cronjobs have components that require information about your current displ
|
||||||
|
|
||||||
When you add them as cronjobs, I recommend you precede the command with commands as those below:
|
When you add them as cronjobs, I recommend you precede the command with commands as those below:
|
||||||
|
|
||||||
```
|
$()$(
|
||||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here
|
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus
|
||||||
```
|
export DISPLAY=:0
|
||||||
|
. $HOME/.zprofile
|
||||||
|
then_command_goes_here
|
||||||
|
)$()
|
||||||
|
|
||||||
This ensures that notifications will display, xdotool commands will function and environmental variables will work as well.
|
This ensures that notifications will display, xdotool commands will function and environmental variables will work as well.
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
|
||||||
Check your internet connection, if pacman is already running, or run update manually to see errors."
|
Check your internet connection, if pacman is already running, or run update manually to see errors."
|
||||||
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||||
|
|
||||||
if pacman -Qu | grep -v "\[ignored\]"
|
if pacman -Qu | grep -v "\[ignored\]"; then
|
||||||
then
|
|
||||||
notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
|
notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
|
||||||
else
|
else
|
||||||
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,15 @@
|
||||||
# Xorg and MacOS as well.
|
# Xorg and MacOS as well.
|
||||||
|
|
||||||
# Run only if user logged in (prevent cron errors)
|
# Run only if user logged in (prevent cron errors)
|
||||||
pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
|
pgrep -u "${USER:=$LOGNAME}" >/dev/null || {
|
||||||
|
echo "$USER not logged in; sync will not run."
|
||||||
|
exit
|
||||||
|
}
|
||||||
# Run only if not already running in other instance
|
# Run only if not already running in other instance
|
||||||
pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;}
|
pgrep mbsync >/dev/null && {
|
||||||
|
echo "mbsync is already running."
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
# First, we have to get the right variables for the mbsync file, the pass
|
# First, we have to get the right variables for the mbsync file, the pass
|
||||||
# archive, notmuch and the GPG home. This is done by searching common profile
|
# archive, notmuch and the GPG home. This is done by searching common profile
|
||||||
|
|
@ -56,8 +62,7 @@ esac
|
||||||
syncandnotify() {
|
syncandnotify() {
|
||||||
acc="$(echo "$account" | sed "s/.*\///")"
|
acc="$(echo "$account" | sed "s/.*\///")"
|
||||||
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
||||||
new=$(find\
|
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" \
|
||||||
"$HOME/.local/share/mail/$acc/INBOX/new/"\
|
|
||||||
"$HOME/.local/share/mail/$acc/Inbox/new/" \
|
"$HOME/.local/share/mail/$acc/Inbox/new/" \
|
||||||
"$HOME/.local/share/mail/$acc/inbox/new/" \
|
"$HOME/.local/share/mail/$acc/inbox/new/" \
|
||||||
"$HOME/.local/share/mail/$acc/INBOX/cur/" \
|
"$HOME/.local/share/mail/$acc/INBOX/cur/" \
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)
|
playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done)
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
|
||||||
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.*//')
|
||||||
|
|
@ -50,7 +50,8 @@ 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 ' ' -)""
|
||||||
|
|
@ -59,7 +60,10 @@ onescreen() { # If only one output available or chosen.
|
||||||
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 -n # Re-remap keys if keyboard added (for laptop bases)
|
remaps -n # 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
|
{
|
||||||
|
killall dunst
|
||||||
|
setsid -f dunst
|
||||||
|
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get all possible displays
|
# Get all possible displays
|
||||||
|
|
@ -70,12 +74,20 @@ 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"; 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:
|
# 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") arandr ; exit ;;
|
"manual selection")
|
||||||
|
arandr
|
||||||
|
exit
|
||||||
|
;;
|
||||||
"multi-monitor") multimon ;;
|
"multi-monitor") multimon ;;
|
||||||
*) onescreen "$chosen" ;;
|
*) onescreen "$chosen" ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv
|
||||||
PDF) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
PDF) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/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 ;;
|
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) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
|
setbg)
|
||||||
|
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 ;;
|
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
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
# be prompted to give a mountpoint from already existsing directories. If you
|
# be prompted to give a mountpoint from already existsing directories. If you
|
||||||
# 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
|
||||||
|
|
@ -16,7 +16,7 @@ getmount() { \
|
||||||
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
|
||||||
|
|
@ -26,12 +26,17 @@ mountusb() { \
|
||||||
case "$partitiontype" in
|
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"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
|
*)
|
||||||
|
sudo -A mount "$chosen" "$mp"
|
||||||
|
user="$(whoami)"
|
||||||
|
ug="$(groups | awk '{print $1}')"
|
||||||
|
sudo -A chown "$user":"$ug" "$mp"
|
||||||
|
;;
|
||||||
esac && notify-send "禍 USB mounting" "$chosen mounted to $mp." ||
|
esac && notify-send "禍 USB mounting" "$chosen mounted to $mp." ||
|
||||||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
||||||
}
|
}
|
||||||
|
|
||||||
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"
|
||||||
|
|
@ -41,7 +46,7 @@ mountandroid() { \
|
||||||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
||||||
}
|
}
|
||||||
|
|
||||||
asktype() { \
|
asktype() {
|
||||||
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 ;;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ 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"; exit 1
|
notify-send "Netshare $share already mounted"
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
sharemount
|
sharemount
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#
|
#
|
||||||
# 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}"
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ killrecording() {
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
screencast() { \
|
screencast() {
|
||||||
ffmpeg -y \
|
ffmpeg -y \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-framerate 60 \
|
-framerate 60 \
|
||||||
|
|
@ -41,7 +41,8 @@ screencast() { \
|
||||||
updateicon "ﲠ"
|
updateicon "ﲠ"
|
||||||
}
|
}
|
||||||
|
|
||||||
video() { ffmpeg \
|
video() {
|
||||||
|
ffmpeg \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||||
-i "$DISPLAY" \
|
-i "$DISPLAY" \
|
||||||
|
|
@ -51,7 +52,8 @@ video() { ffmpeg \
|
||||||
updateicon "ﲣ"
|
updateicon "ﲣ"
|
||||||
}
|
}
|
||||||
|
|
||||||
webcamhidef() { ffmpeg \
|
webcamhidef() {
|
||||||
|
ffmpeg \
|
||||||
-f v4l2 \
|
-f v4l2 \
|
||||||
-i /dev/video0 \
|
-i /dev/video0 \
|
||||||
-video_size 1920x1080 \
|
-video_size 1920x1080 \
|
||||||
|
|
@ -60,7 +62,8 @@ webcamhidef() { ffmpeg \
|
||||||
updateicon ""
|
updateicon ""
|
||||||
}
|
}
|
||||||
|
|
||||||
webcam() { ffmpeg \
|
webcam() {
|
||||||
|
ffmpeg \
|
||||||
-f v4l2 \
|
-f v4l2 \
|
||||||
-i /dev/video0 \
|
-i /dev/video0 \
|
||||||
-video_size 640x480 \
|
-video_size 640x480 \
|
||||||
|
|
@ -69,8 +72,7 @@ webcam() { ffmpeg \
|
||||||
updateicon ""
|
updateicon ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audio() {
|
||||||
audio() { \
|
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f alsa -i default \
|
-f alsa -i default \
|
||||||
-c:a flac \
|
-c:a flac \
|
||||||
|
|
@ -79,7 +81,7 @@ audio() { \
|
||||||
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 ;;
|
||||||
|
|
@ -91,13 +93,12 @@ askrecording() { \
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
# Provides you with mounted partitions, select one to unmount.
|
# Provides you with mounted partitions, select one to unmount.
|
||||||
# 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="$(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)"
|
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
|
||||||
|
)"
|
||||||
|
|
||||||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@
|
||||||
set -e
|
set -e
|
||||||
path="$1"
|
path="$1"
|
||||||
shift 1
|
shift 1
|
||||||
while [[ $path != / ]];
|
while [[ $path != / ]]; do
|
||||||
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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,18 @@ 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,3 @@ case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area
|
||||||
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
|
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
|
||||||
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
|
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@
|
||||||
# (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 $(ls /tmp/mpvSockets/*); do
|
||||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
|
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ index() {
|
||||||
|
|
||||||
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" = "" ];
|
elif [ "$1" = "" ]; then
|
||||||
then
|
|
||||||
groups="us:dvorak de:nodeadkeys"
|
groups="us:dvorak de:nodeadkeys"
|
||||||
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
|
||||||
|
|
@ -29,7 +28,8 @@ fi
|
||||||
|
|
||||||
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp 1>/dev/null 2>&1 || echo "Unkown keyboard layout"
|
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp 1>/dev/null 2>&1 || echo "Unkown keyboard layout"
|
||||||
xset r rate 300 50
|
xset r rate 300 50
|
||||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
killall xcape 2>/dev/null
|
||||||
|
xcape -e 'Super_L=Escape'
|
||||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||||
sleep 0.03
|
sleep 0.03
|
||||||
pkill -RTMIN+15 dwmblocks
|
pkill -RTMIN+15 dwmblocks
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s
|
||||||
|
|
||||||
setxkbmap -layout "$(echo "$current" | cut -d ':' -f1)" -variant "$(echo "$current" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
|
setxkbmap -layout "$(echo "$current" | cut -d ':' -f1)" -variant "$(echo "$current" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
|
||||||
xset r rate 300 50
|
xset r rate 300 50
|
||||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
killall xcape 2>/dev/null
|
||||||
|
xcape -e 'Super_L=Escape'
|
||||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||||
sleep 0.03
|
sleep 0.03
|
||||||
pkill -RTMIN+15 dwmblocks
|
pkill -RTMIN+15 dwmblocks
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@ trueloc="$(readlink -f "$1")" &&
|
||||||
case "$(file --mime-type -b "$trueloc")" in
|
case "$(file --mime-type -b "$trueloc")" in
|
||||||
image/*) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
image/*) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||||
inode/directory) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
inode/directory) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
||||||
*) notify-send "Error" "Not a valid image." ; exit 1;;
|
*)
|
||||||
|
notify-send "Error" "Not a valid image."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
xwallpaper --zoom "$bgloc"
|
xwallpaper --zoom "$bgloc"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
vals=$(aptitude full-upgrade --simulate --assume-yes |\
|
vals=$(aptitude full-upgrade --simulate --assume-yes |
|
||||||
grep -m1 '^[0-9]\+ packages upgraded,' |\
|
grep -m1 '^[0-9]\+ packages upgraded,' |
|
||||||
tr -cd '0-9 ' |\
|
tr -cd '0-9 ' |
|
||||||
tr ' ' '\n' |\
|
tr ' ' '\n' |
|
||||||
grep '[0-9]\+' |\
|
grep '[0-9]\+' |
|
||||||
xargs echo)
|
xargs echo)
|
||||||
|
|
||||||
print=" "
|
print=" "
|
||||||
|
|
|
||||||
|
|
@ -10,37 +10,60 @@ for battery in /sys/class/power_supply/BAT?*; do
|
||||||
[ -n "${capacity+x}" ] && printf " "
|
[ -n "${capacity+x}" ] && printf " "
|
||||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||||
case "$(cat "$battery/status" 2>&1)" in
|
case "$(cat "$battery/status" 2>&1)" in
|
||||||
"Full") icon=""; color="$green" ;;
|
"Full")
|
||||||
"Charging") icon=""; color="$cyan" ;;
|
icon=""
|
||||||
"Not charging") icon=""; color="$white" ;;
|
color="$green"
|
||||||
"Unknown") icon=""; color="$orange" ;;
|
;;
|
||||||
|
"Charging")
|
||||||
|
icon=""
|
||||||
|
color="$cyan"
|
||||||
|
;;
|
||||||
|
"Not charging")
|
||||||
|
icon=""
|
||||||
|
color="$white"
|
||||||
|
;;
|
||||||
|
"Unknown")
|
||||||
|
icon=""
|
||||||
|
color="$orange"
|
||||||
|
;;
|
||||||
"Discharging")
|
"Discharging")
|
||||||
if [ "$capacity" -le 10 ]; then
|
if [ "$capacity" -le 10 ]; then
|
||||||
icon=""; color="$red"
|
icon=""
|
||||||
|
color="$red"
|
||||||
elif [ "$capacity" -le 20 ]; then
|
elif [ "$capacity" -le 20 ]; then
|
||||||
icon=""; color="$red"
|
icon=""
|
||||||
|
color="$red"
|
||||||
elif [ "$capacity" -le 30 ]; then
|
elif [ "$capacity" -le 30 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
elif [ "$capacity" -le 40 ]; then
|
elif [ "$capacity" -le 40 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
elif [ "$capacity" -le 50 ]; then
|
elif [ "$capacity" -le 50 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
elif [ "$capacity" -le 60 ]; then
|
elif [ "$capacity" -le 60 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
elif [ "$capacity" -le 70 ]; then
|
elif [ "$capacity" -le 70 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
elif [ "$capacity" -le 80 ]; then
|
elif [ "$capacity" -le 80 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
elif [ "$capacity" -le 90 ]; then
|
elif [ "$capacity" -le 90 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
elif [ "$capacity" -le 95 ]; then
|
elif [ "$capacity" -le 95 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
else
|
else
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
|
color="$white"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
*) exit 1 ;;
|
*) exit 1 ;;
|
||||||
esac
|
esac
|
||||||
printf "$color%s$reset %d" "$icon" "$capacity";
|
printf "$color%s$reset %d" "$icon" "$capacity"
|
||||||
done && printf "\\n"
|
done && printf "\\n"
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,6 @@ echo "$stats" | while read -r row; do
|
||||||
"6" | "7" | "8") printf "\033[31m▇" ;;
|
"6" | "7" | "8") printf "\033[31m▇" ;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done; printf "\033[0m\n"
|
done
|
||||||
|
printf "\033[0m\n"
|
||||||
echo "$stats" >"$cache"
|
echo "$stats" >"$cache"
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ getforecast() { curl -sf "$url$opt" > "$weatherfile" && curl -sf "$url$emojiopt"
|
||||||
showweather() {
|
showweather() {
|
||||||
emoji="$(printf "\033[12m%s\033[10m" "$(cut -d ' ' -f 1 "$emojifile")")"
|
emoji="$(printf "\033[12m%s\033[10m" "$(cut -d ' ' -f 1 "$emojifile")")"
|
||||||
sed '16q;d' "$weatherfile" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/$emoji /g;1q" | tr -d '\n'
|
sed '16q;d' "$weatherfile" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/$emoji /g;1q" | tr -d '\n'
|
||||||
sed '13q;d' "$weatherfile" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " \033[34m\033[0m " $1 "°","\033[31m\033[0m " $2 "°"}';
|
sed '13q;d' "$weatherfile" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " \033[34m\033[0m " $1 "°","\033[31m\033[0m " $2 "°"}'
|
||||||
}
|
}
|
||||||
getforecast && convertemoji
|
getforecast && convertemoji
|
||||||
showweather
|
showweather
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ case "$(readlink -f /sbin/init)" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$(printf " lock\nﴚ leave dwm\n累 renew dwm\nﭦ hibernate\n sleep\nﰇ reboot\n襤 shutdown\n display off" | dmenu -i -p 'Action: ')" in
|
case "$(printf " lock\nﴚ leave dwm\n累 renew dwm\nﭦ hibernate\n sleep\nﰇ reboot\n襤 shutdown\n display off" | dmenu -i -p 'Action: ')" in
|
||||||
' lock') xset s activate & gpg-connect-agent --no-autostart reloadagent /bye;;
|
' lock')
|
||||||
|
xset s activate &
|
||||||
|
gpg-connect-agent --no-autostart reloadagent /bye
|
||||||
|
;;
|
||||||
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||||
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||||
# 'ﭦ hibernate') slock $ctl hibernate -i ;;
|
# 'ﭦ hibernate') slock $ctl hibernate -i ;;
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ getfsroot() {
|
||||||
filepath="$(realpath "$1")"
|
filepath="$(realpath "$1")"
|
||||||
filename="$(basename "$1")"
|
filename="$(basename "$1")"
|
||||||
fsroot="$(getfsroot "$1")"
|
fsroot="$(getfsroot "$1")"
|
||||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||||
|| basedir="${fsroot}/.Trash"
|
basedir="${fsroot}/.Trash"
|
||||||
infodir="$basedir/info"
|
infodir="$basedir/info"
|
||||||
filedir="$basedir/files"
|
filedir="$basedir/files"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ list() {
|
||||||
# 2nd arg is directory to match trash files for
|
# 2nd arg is directory to match trash files for
|
||||||
[ ! "$(ls -A "$1")" ] && exit 1
|
[ ! "$(ls -A "$1")" ] && exit 1
|
||||||
for file in "$1"/*; do
|
for file in "$1"/*; do
|
||||||
[ "$(head -1 "$file")" = "[Trash Info]" ] && \
|
[ "$(head -1 "$file")" = "[Trash Info]" ] &&
|
||||||
fpath=$(grep Path "$file" | cut -d '=' -f2) && \
|
fpath=$(grep Path "$file" | cut -d '=' -f2) &&
|
||||||
echo "$fpath" | grep -qP "^$2/[^/]+$" && \
|
echo "$fpath" | grep -qP "^$2/[^/]+$" &&
|
||||||
printf "%s %s %s\n" \
|
printf "%s %s %s\n" \
|
||||||
"$(basename "$file")" \
|
"$(basename "$file")" \
|
||||||
"$fpath" \
|
"$fpath" \
|
||||||
|
|
@ -20,9 +20,9 @@ list() {
|
||||||
|
|
||||||
[ -n "$1" ] && dir="$(realpath "$1")" || dir="$(getfsroot "$PWD")"
|
[ -n "$1" ] && dir="$(realpath "$1")" || dir="$(getfsroot "$PWD")"
|
||||||
fsroot="$(getfsroot "$dir")"
|
fsroot="$(getfsroot "$dir")"
|
||||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||||
|| basedir="${fsroot}/.Trash"
|
basedir="${fsroot}/.Trash"
|
||||||
|
|
||||||
sel="$(list "$basedir/info" "$dir" | fzf)"
|
sel="$(list "$basedir/info" "$dir" | fzf)"
|
||||||
file="$basedir/files/$(echo "$sel" | cut -d ' ' -f1)"
|
file="$basedir/files/$(echo "$sel" | cut -d ' ' -f1)"
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,14 @@
|
||||||
|
|
||||||
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
|
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
|
||||||
|
|
||||||
echo "Enter the album/book title:"; read -r booktitle
|
echo "Enter the album/book title:"
|
||||||
|
read -r booktitle
|
||||||
|
|
||||||
echo "Enter the artist/author:"; read -r author
|
echo "Enter the artist/author:"
|
||||||
|
read -r author
|
||||||
|
|
||||||
echo "Enter the publication year:"; read -r year
|
echo "Enter the publication year:"
|
||||||
|
read -r year
|
||||||
|
|
||||||
inputaudio="$1"
|
inputaudio="$1"
|
||||||
|
|
||||||
|
|
@ -24,8 +27,7 @@ ext="opus"
|
||||||
# Get the total number of tracks from the number of lines.
|
# Get the total number of tracks from the number of lines.
|
||||||
total="$(wc -l <"$2")"
|
total="$(wc -l <"$2")"
|
||||||
|
|
||||||
while read -r x;
|
while read -r x; do
|
||||||
do
|
|
||||||
end="$(echo "$x" | cut -d' ' -f1)"
|
end="$(echo "$x" | cut -d' ' -f1)"
|
||||||
|
|
||||||
[ -n "$start" ] &&
|
[ -n "$start" ] &&
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
# Try to get DOI from pdfinfo or pdftotext output.
|
# Try to get DOI from pdfinfo or pdftotext output.
|
||||||
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
||||||
doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
|
doi=$(pdftotext "$1" - 2>/dev/null | grep -io "doi:.*" -m 1) ||
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
doi="$1"
|
doi="$1"
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,30 @@
|
||||||
#!/usr/bin/sh
|
#!/usr/bin/sh
|
||||||
|
|
||||||
usage ()
|
usage() {
|
||||||
{
|
|
||||||
printf "Usage : noisereduce <input video file> <output video file>\n"
|
printf "Usage : noisereduce <input video file> <output video file>\n"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tests for requirements
|
# Tests for requirements
|
||||||
ifinstalled ffmpeg || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
ifinstalled ffmpeg || {
|
||||||
ifinstalled sox || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
ifinstalled sox || {
|
||||||
|
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]
|
if [ "$#" -ne 2 ]; then
|
||||||
then
|
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "$1" ]
|
if [ ! -e "$1" ]; then
|
||||||
then
|
|
||||||
printf "File not found: %s\n" "$1"
|
printf "File not found: %s\n" "$1"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$2" ]
|
if [ -e "$2" ]; then
|
||||||
then
|
|
||||||
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
||||||
read -r yn
|
read -r yn
|
||||||
case $yn in
|
case $yn in
|
||||||
|
|
@ -35,8 +37,7 @@ inBasename=$(basename "$1")
|
||||||
inExt="${inBasename##*.}"
|
inExt="${inBasename##*.}"
|
||||||
|
|
||||||
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
||||||
if [ -n "$isVideoStr" ]
|
if [ -n "$isVideoStr" ]; then
|
||||||
then
|
|
||||||
isVideo=1
|
isVideo=1
|
||||||
printf "Detected %s as a video file\n" "$inBasename"
|
printf "Detected %s as a video file\n" "$inBasename"
|
||||||
else
|
else
|
||||||
|
|
@ -54,7 +55,6 @@ printf "Noise reduction amount [0.21]: "
|
||||||
read -r sensitivity
|
read -r sensitivity
|
||||||
if [ -z "$sensitivity" ]; then sensitivity="0.21"; fi
|
if [ -z "$sensitivity" ]; then sensitivity="0.21"; fi
|
||||||
|
|
||||||
|
|
||||||
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
||||||
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
||||||
noiseAudFile="/tmp/noiseclean_noiseaud.wav"
|
noiseAudFile="/tmp/noiseclean_noiseaud.wav"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ ifinstalled pass pass-otp
|
||||||
|
|
||||||
dir="${PASSWORD_STORE_DIR}"
|
dir="${PASSWORD_STORE_DIR}"
|
||||||
|
|
||||||
choice="$({ echo "🆕add" ; echo "🕙sync-time" ; ls ${dir}/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
choice="$({
|
||||||
|
echo "🆕add"
|
||||||
|
echo "🕙sync-time"
|
||||||
|
ls ${dir}/*-otp.gpg
|
||||||
|
} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
🆕add)
|
🆕add)
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,18 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
||||||
r) redo="$OPTARG" ;;
|
r) redo="$OPTARG" ;;
|
||||||
s) ppt="$OPTARG" ;;
|
s) ppt="$OPTARG" ;;
|
||||||
e) endtime="$OPTARG" ;;
|
e) endtime="$OPTARG" ;;
|
||||||
x) res="$OPTARG"
|
x)
|
||||||
|
res="$OPTARG"
|
||||||
echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
|
echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
|
||||||
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
|
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
|
||||||
exit 1 ;;
|
exit 1
|
||||||
p) echo "Purge old build files in $cache? [y/N]"
|
;;
|
||||||
|
p)
|
||||||
|
echo "Purge old build files in $cache? [y/N]"
|
||||||
read -r confirm
|
read -r confirm
|
||||||
echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
|
echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
|
||||||
exit ;;
|
exit
|
||||||
|
;;
|
||||||
v) verbose=True ;;
|
v) verbose=True ;;
|
||||||
*) echo "$(basename "$0") usage:
|
*) echo "$(basename "$0") usage:
|
||||||
-i input timecode list (required)
|
-i input timecode list (required)
|
||||||
|
|
@ -42,7 +46,7 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
||||||
-d tmp directory
|
-d tmp directory
|
||||||
-r rerun imagemagick commands even if done previously (in case files or background has changed)
|
-r rerun imagemagick commands even if done previously (in case files or background has changed)
|
||||||
-p purge old build files instead of running
|
-p purge old build files instead of running
|
||||||
-v be verbose" && exit 1
|
-v be verbose" && exit 1 ;;
|
||||||
|
|
||||||
esac done
|
esac done
|
||||||
|
|
||||||
|
|
@ -64,7 +68,10 @@ if [ -n "${audio+x}" ]; then
|
||||||
# Check that the audio file looks like an actual audio file.
|
# Check that the audio file looks like an actual audio file.
|
||||||
case "$(file --dereference --brief --mime-type -- "$audio")" in
|
case "$(file --dereference --brief --mime-type -- "$audio")" in
|
||||||
audio/*) ;;
|
audio/*) ;;
|
||||||
*) echo "That doesn't look like an audio file."; exit 1 ;;
|
*)
|
||||||
|
echo "That doesn't look like an audio file."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
||||||
endtime="$((totseconds - seconds))"
|
endtime="$((totseconds - seconds))"
|
||||||
|
|
@ -78,8 +85,7 @@ prepfile="$prepdir/$file.prep"
|
||||||
mkdir -p "$prepdir"
|
mkdir -p "$prepdir"
|
||||||
|
|
||||||
{
|
{
|
||||||
while read -r x;
|
while read -r x; do
|
||||||
do
|
|
||||||
# Get the time from the first column.
|
# Get the time from the first column.
|
||||||
time="${x%% *}"
|
time="${x%% *}"
|
||||||
seconds="$(date '+%s' -d "$time")"
|
seconds="$(date '+%s' -d "$time")"
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,3 @@ json="$(jq -r --arg "$movie" "$thumbnail" ". + {\"$movie\": \"$thumbnail\"}" <"$
|
||||||
echo "$json" >"$index"
|
echo "$json" >"$index"
|
||||||
|
|
||||||
echo "$cache/$thumbnail"
|
echo "$cache/$thumbnail"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue