changes to script storage
This commit is contained in:
parent
367a22e644
commit
e8ea24149a
29 changed files with 20 additions and 30 deletions
|
@ -14,6 +14,6 @@ start picom
|
|||
start unclutter -noevents
|
||||
start dunst
|
||||
start dwmblocks
|
||||
start remapd
|
||||
start $HOME/.local/libexec/daemons/remapd
|
||||
start syncthingtray
|
||||
start system-config-printer-applet
|
||||
|
|
|
@ -31,8 +31,8 @@ image() {
|
|||
|
||||
video() {
|
||||
f=$1 w=$2 h=$3 x=$4 y=$5
|
||||
thumb="$(vidthumb "$f")" || (
|
||||
printf "%b" "\033[31mvidthumb script not in path\033[0m"
|
||||
thumb="$("$HOME/.config/lf/preview/vidthumb" "$f")" || (
|
||||
printf "%b" "${RED}vidthumb failed to execute${RESET}"
|
||||
return 1
|
||||
)
|
||||
image "$thumb" "$w" "$h" "$x" "$y"
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# A dmenu binary prompt script.
|
||||
# Gives a dmenu prompt labeled with $1 to perform command $2.
|
||||
# For example:
|
||||
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
|
||||
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray)" = "Yes" ] && $2
|
|
@ -5,14 +5,12 @@ bmdirs="$XDG_CONFIG_HOME/bookmarks/directories"
|
|||
bmfiles="$XDG_CONFIG_HOME/bookmarks/files"
|
||||
|
||||
# Outputs
|
||||
shell_shortcuts="$ZDOTDIR/configs/autogenerated/shortcuts"
|
||||
zsh_named_dirs="$ZDOTDIR/configs/autogenerated/hashes"
|
||||
lf_files="$XDG_DATA_HOME/lf/shortcut-files"
|
||||
lf_dirs="$XDG_DATA_HOME/lf/shortcut-dirs"
|
||||
lf_shortcuts="$XDG_CONFIG_HOME/lf/shortcutrc"
|
||||
|
||||
rm -f "$shell_shortcuts" "$lf_files" "$lf_dirs" "$lf_shortcuts" "$zsh_named_dirs" 2>/dev/null
|
||||
printf "# vim: filetype=sh\\nalias " >"$shell_shortcuts"
|
||||
rm -f "$lf_files" "$lf_dirs" "$lf_shortcuts" "$zsh_named_dirs" 2>/dev/null
|
||||
|
||||
eval "echo \"$(cat "$bmdirs")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
|
||||
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
|
||||
|
|
|
@ -12,13 +12,13 @@ IFS='
|
|||
escape() { echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g"; }
|
||||
|
||||
# Check for phones.
|
||||
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")"
|
||||
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/ /")"
|
||||
mountedphones="$(grep "simple-mtpfs" /etc/mtab)"
|
||||
# If there are already mounted phones, remove them from the list of mountables.
|
||||
[ -n "$mountedphones" ] && phones="$(for phone in $phones; do
|
||||
for mounted in $mountedphones; do
|
||||
escphone="$(escape "$phone")"
|
||||
[[ "$mounted" =~ "$escphone" ]] && break 1
|
||||
[[ "$mounted" =~ $escphone ]] && break 1
|
||||
done && continue 1
|
||||
echo "$phone"
|
||||
done)"
|
||||
|
@ -28,7 +28,7 @@ lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
|
|||
# Get all LUKS drives
|
||||
allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)"
|
||||
# Get a list of the LUKS drive UUIDs already decrypted.
|
||||
decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")"
|
||||
decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* 2>/dev/null | sed "s|.*LUKS2-||;s|-.*||")"
|
||||
# Functioning for formatting drives correctly for dmenu:
|
||||
filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}'; }
|
||||
|
||||
|
@ -39,11 +39,11 @@ unopenedluks="$(for drive in $allluks; do
|
|||
[ -n "$decrypted" ] && for open in $decrypted; do
|
||||
[ "$uuid" = "$open" ] && break 1
|
||||
done && continue 1
|
||||
echo "🔒 $drive"
|
||||
echo " $drive"
|
||||
done | filter)"
|
||||
|
||||
# Get all normal, non-encrypted or decrypted partitions that are not mounted.
|
||||
normalparts="$(echo "$lsblkoutput" | grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter)"
|
||||
normalparts="$(echo "$lsblkoutput" | grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/ /" | filter)"
|
||||
|
||||
# Add all to one variable. If no mountable drives found, exit.
|
||||
alldrives="$(echo "$phones
|
||||
|
@ -71,20 +71,20 @@ getmount() {
|
|||
attemptmount() {
|
||||
# Attempt to mount without a mountpoint, to see if drive is in fstab.
|
||||
sudo -A mount "$chosen" || return 1
|
||||
notify-send "💾Drive Mounted." "$chosen mounted."
|
||||
notify-send " Drive Mounted." "$chosen mounted."
|
||||
exit
|
||||
}
|
||||
|
||||
case "$chosen" in
|
||||
💾*)
|
||||
*)
|
||||
chosen="${chosen%% *}"
|
||||
chosen="${chosen:1}" # This is a bashism.
|
||||
attemptmount || getmount
|
||||
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
|
||||
notify-send "💾Drive Mounted." "$chosen mounted to $mp."
|
||||
notify-send " Drive Mounted." "$chosen mounted to $mp."
|
||||
;;
|
||||
|
||||
🔒*)
|
||||
*)
|
||||
chosen="${chosen%% *}"
|
||||
chosen="${chosen:1}" # This is a bashism.
|
||||
# Number the drive.
|
||||
|
@ -100,15 +100,15 @@ case "$chosen" in
|
|||
|
||||
attemptmount || getmount
|
||||
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
|
||||
notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
|
||||
notify-send " Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
|
||||
;;
|
||||
|
||||
📱*)
|
||||
*)
|
||||
notify-send "❗Note" "Remember to allow file access on your phone now."
|
||||
getmount
|
||||
number="${chosen%%:*}"
|
||||
number="${chosen:1}" # This is a bashism.
|
||||
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
|
||||
notify-send "🤖 Android Mounted." "Android device mounted to $mp."
|
||||
notify-send " Android Mounted." "Android device mounted to $mp."
|
||||
;;
|
||||
esac
|
|
@ -9,7 +9,7 @@ reset="\033[0m"
|
|||
[ -z "$(ls /sys/class/power_supply)" ] && exit 0
|
||||
|
||||
for battery in /sys/class/power_supply/BAT?*; do
|
||||
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
|
||||
pidof -x sbd-battery >/dev/null 2>&1 || "$HOME/.local/libexec/daemons/sbd-battery" "$battery" >/dev/null 2>&1 &
|
||||
[ -n "${capacity+x}" ] && printf " "
|
||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||
case "$(cat "$battery/status" 2>&1)" in
|
||||
|
|
|
@ -20,7 +20,7 @@ echo "$stats" | while read -r row; do
|
|||
total=${rest%% *}
|
||||
idle=${rest##* }
|
||||
case "$(echo "$old" | awk '{if ($1 == id)
|
||||
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
|
||||
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' 2>/dev/null\
|
||||
id="$id" total="$total" idle="$idle")" in
|
||||
"0") printf "%b" "$green▁" ;;
|
||||
"1") printf "%b" "$green▂" ;;
|
||||
|
|
|
@ -11,5 +11,5 @@ filter() {
|
|||
exit 1
|
||||
fi
|
||||
}
|
||||
pidof -x sbd-music >/dev/null 2>&1 || sbd-music >/dev/null 2>&1 &
|
||||
pidof -x sbd-music >/dev/null 2>&1 || "$HOME/.local/libexec/daemons/sbd-music" >/dev/null 2>&1 &
|
||||
filter
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
big="\033[11m"
|
||||
reset="\033[0m"
|
||||
|
||||
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 &
|
||||
pidof -x sbd-playerctl >/dev/null 2>&1 || "$HOME/.local/libexec/daemons/sbd-playerctl" >/dev/null 2>&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)"
|
||||
|
|
Loading…
Add table
Reference in a new issue