remove unneeded scripts
This commit is contained in:
parent
481a724937
commit
3b65dc5b35
18 changed files with 7 additions and 335 deletions
|
@ -29,16 +29,12 @@ setmap() {
|
||||||
cd "$MAP_DIR" || return 1
|
cd "$MAP_DIR" || return 1
|
||||||
notifier="notify-send"
|
notifier="notify-send"
|
||||||
|
|
||||||
while
|
while getopts "qdls:" opt; do
|
||||||
case "$1" in
|
case $opt in
|
||||||
q) notifier=":" ;;
|
q) notifier=":" ;;
|
||||||
d) setmap; return ;;
|
d) setmap ;;
|
||||||
s) setmap "$2"; return ;;
|
s) setmap "$OPTARG" ;;
|
||||||
l) ls "$MAP_DIR" | grep -i keymap ;;
|
l) find . -type f -printf "%f\n"; exit ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
shift
|
done
|
||||||
do :; done
|
|
||||||
|
|
||||||
rotate
|
|
||||||
setmap
|
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A UI for detecting and selecting all displays. Probes xrandr for connected
|
|
||||||
# displays and lets user select one to use. User may also select "manual
|
|
||||||
# selection" which opens arandr.
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
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//')
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
multimon() { # Multi-monitor handler.
|
|
||||||
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 ' ' -)"
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get all possible displays
|
|
||||||
allposs=$(xrandr -q | grep "connected")
|
|
||||||
|
|
||||||
# Get all connected screens.
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
postrun
|
|
|
@ -1,24 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# 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)" ;;
|
|
||||||
esac
|
|
||||||
echo "${WIDTH}x${HEIGHT}+${X}+${Y}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# 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 ;;
|
|
||||||
esac
|
|
|
@ -1,31 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Feed script a url or file location.
|
|
||||||
# If an image, it will view in sxiv,
|
|
||||||
# if a video or gif, it will view in mpv
|
|
||||||
# if a music file or pdf, it will download,
|
|
||||||
# otherwise it opens link in browser.
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
url="$(xclip -o)"
|
|
||||||
else
|
|
||||||
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
|
|
||||||
;;
|
|
||||||
*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 &
|
|
||||||
;;
|
|
||||||
*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 &
|
|
||||||
;;
|
|
||||||
*mp3 | *flac | *opus | *mp3?source*)
|
|
||||||
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
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# opout: "open output": A general handler for opening a file's intended output,
|
|
||||||
# usually the pdf of a compiled document. I find this useful especially
|
|
||||||
# running from vim.
|
|
||||||
|
|
||||||
basename="${1%.*}"
|
|
||||||
|
|
||||||
case "${*}" in
|
|
||||||
*.tex | *.m[dse] | *.[rR]md | *.mom | *.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
|
|
||||||
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
|
|
||||||
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
|
|
||||||
esac
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# You might notice all mpv commands are aliased to have this input-ipc-server
|
|
||||||
# thing. That's just for this particular command, which allows us to pause
|
|
||||||
# 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 /tmp/mpvSockets/*/*; do
|
|
||||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
|
|
||||||
done
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# entr command to run `queueandnotify` when newsboat queue is changed
|
|
||||||
|
|
||||||
[ "$(pgrep -x "$(basename "$0")" | wc -l)" -gt 2 ] && exit
|
|
||||||
|
|
||||||
echo "${XDG_DATA_HOME:-$HOME/.local/share}"/newsboat/queue | entr -p queueandnotify 2>/dev/null
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# $1 is a url; $2 is a command
|
|
||||||
[ -z "$1" ] && exit
|
|
||||||
base="$(basename "$1")"
|
|
||||||
notify-send "羽Queuing $base..."
|
|
||||||
cmd="$2"
|
|
||||||
[ -z "$cmd" ] && cmd="yt-dlp --embed-metadata -ic"
|
|
||||||
idnum="$(tsp $cmd "$1")"
|
|
||||||
realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
|
|
||||||
tsp -D "$idnum" mv "$base" "$realname"
|
|
||||||
tsp -D "$idnum" notify-send " $realname done."
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Podboat sucks. This script replaces it.
|
|
||||||
# It reads the newsboat queue, queuing downloads with taskspooler.
|
|
||||||
# It also removes the junk from extensions.
|
|
||||||
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
|
|
||||||
|
|
||||||
while read -r line; do
|
|
||||||
[ -z "$line" ] && continue
|
|
||||||
url="${line%%[ ]*}"
|
|
||||||
qndl "$url" "curl -LO"
|
|
||||||
done <"$queuefile"
|
|
||||||
|
|
||||||
echo >"$queuefile"
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# When I open an image from the file manager in sxiv (the image viewer), I want
|
|
||||||
# to be able to press the next/previous keys to key through the rest of the
|
|
||||||
# images in the same directory. This script "rotates" the content of a
|
|
||||||
# directory based on the first chosen file, so that if I open the 15th image,
|
|
||||||
# if I press next, it will go to the 16th etc. Autistic, I know, but this is
|
|
||||||
# one of the reasons that sxiv is great for being able to read standard input.
|
|
||||||
|
|
||||||
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
|
|
||||||
base="$(basename "$1")"
|
|
||||||
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,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
unread="$(find "${XDG_DATA_HOME:-$HOME/.config}"/claws-mail/imapcache/imap.gmail.com/luca.bilke/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
|
|
||||||
pidof mbsync >/dev/null 2>&1 && icon="痢"
|
|
||||||
[ "$unread" = "0" ] && [ "$icon" = "" ] || echo " $unread$icon"
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print " " $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Requires tsp
|
|
||||||
num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}')
|
|
||||||
[ "$num" != "0(0)" ] &&
|
|
||||||
echo " $num"
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
transmission-remote $@ -l -N "$XDG_CONFIG_HOME/netrc" | grep % |
|
|
||||||
# The letters are for sorting and will not appear. \
|
|
||||||
sed "
|
|
||||||
s/.*Stopped.*/A /;
|
|
||||||
s/.*Seeding.*/Z /;
|
|
||||||
s/.*100%.*/N /;
|
|
||||||
s/.*Idle.*/B ﭦ/;
|
|
||||||
s/.*Uploading.*/L /;
|
|
||||||
s/.*%.*/M /
|
|
||||||
" | sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' -
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
big="\033[11m"
|
|
||||||
reset="\033[0m"
|
|
||||||
|
|
||||||
# Prints the current volume or ﱝ if muted.
|
|
||||||
[ "$(pamixer --get-mute)" = true ] && echo "\e[11mﱝ\e[10m" && exit
|
|
||||||
vol="$(pamixer --get-volume)"
|
|
||||||
|
|
||||||
if [ "$vol" -gt "70" ]; then
|
|
||||||
icon=""
|
|
||||||
elif [ "$vol" -gt "30" ]; then
|
|
||||||
icon=""
|
|
||||||
elif [ "$vol" -gt "0" ]; then
|
|
||||||
icon=""
|
|
||||||
elif [ "$vol" -eq "0" ]; then
|
|
||||||
icon=""
|
|
||||||
else
|
|
||||||
printf "%b%b " "\e[11m" "\e[0m" && exit
|
|
||||||
fi
|
|
||||||
printf "%b" "$big$icon$reset $vol\n"
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
|
|
||||||
big="\033[11m"
|
|
||||||
reset="\033[0m"
|
|
||||||
printf "%b" "$big$reset $(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')\n"
|
|
|
@ -1,27 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
getfsroot() {
|
|
||||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
|
||||||
}
|
|
||||||
|
|
||||||
filepath="$(realpath -s "$1")"
|
|
||||||
filename="$(basename "$1")"
|
|
||||||
fsroot="$(getfsroot "$1")"
|
|
||||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
|
||||||
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
|
||||||
basedir="${fsroot}/.Trash"
|
|
||||||
infodir="$basedir/info"
|
|
||||||
filedir="$basedir/files"
|
|
||||||
|
|
||||||
mkdir -p "$infodir" 1>/dev/null 2>&1
|
|
||||||
mkdir -p "$filedir" 1>/dev/null 2>&1
|
|
||||||
find "$filedir" -regex ".*$filename.*" | grep -oP '(?<=.\.~)\d+(?=~$)' | sort -n | tail -1 | (
|
|
||||||
ext=$(($(cat /dev/stdin) + 1))
|
|
||||||
filedest="$filedir/$filename.~$ext~"
|
|
||||||
command mv -f "$filepath" "$filedest"
|
|
||||||
cat <<EOF >"$infodir/$(basename "$filedest")"
|
|
||||||
[Trash Info]
|
|
||||||
Path=$filepath
|
|
||||||
DeletionDate=$(date -u +%Y%m%dUTC%T)
|
|
||||||
EOF
|
|
||||||
)
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
getfsroot() {
|
|
||||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
|
||||||
}
|
|
||||||
list() {
|
|
||||||
# 1st arg is trash files directory
|
|
||||||
# 2nd arg is directory to match trash files for
|
|
||||||
[ ! "$(command ls -A "$1")" ] && exit 1
|
|
||||||
while read -r file; do
|
|
||||||
filepath=$(grep Path "$file" | cut -d '=' -f2) || continue
|
|
||||||
echo "$filepath" | grep -qP "^$2/[^/]+$" || continue
|
|
||||||
printf "%s %s %s\n" "$(basename "$file")" "$filepath" "$(date -d "$(grep DeletionDate "$file" | cut -d '=' -f2)" +'%x %X')"
|
|
||||||
done <<EOF
|
|
||||||
$(grep -l '[Trash Info]' "$1"/* "$1"/.* 2>/dev/null)
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
fsroot="$(getfsroot "$PWD")"
|
|
||||||
|
|
||||||
if [ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ]; then
|
|
||||||
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash"
|
|
||||||
else
|
|
||||||
basedir="${fsroot}/.Trash"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sel="$(list "$basedir/info" "$PWD" | fzf)"
|
|
||||||
file="$basedir/files/$(echo "$sel" | cut -d '' -f1)"
|
|
||||||
dest="$(echo "$sel" | cut -d '' -f3)"
|
|
||||||
mv -ib "$file" "$dest"
|
|
||||||
rm "$basedir/info/$(echo "$sel" | cut -d '' -f1)"
|
|
Loading…
Add table
Add a link
Reference in a new issue