Man, am I the greatest

This commit is contained in:
λmolinae 2025-06-07 06:27:03 +00:00
parent 696dcd1d27
commit 0b4e7f9185
13 changed files with 163 additions and 163 deletions

77
.local/bin/abman Executable file
View file

@ -0,0 +1,77 @@
#!/bin/sh -x
scandevices() {
# https://github.com/bluez/bluez/issues/826
notify-send "abman" "Scanning for devices"
if [ "$(bluetoothctl show | grep "Powered: no")" ]; then
bluetoothctl power on
fi
devices="$(bluetoothctl --timeout 5 scan on | \
awk '/Device/ {if (NF > 3) {for (i=4; i<=NF; i++) printf $i " "; print ""} else print $3}')"
if [ -z "$devices" ]; then
notify-send "abman" "Error: No devices were found"
exit 1
fi
selection="$(printf "%s\n" "$devices" | fuzzel -d -p "Available devices: ")"
if [ -n "$selection" ]; then
mac=$(bluetoothctl devices | grep "$selection" | awk '{print $2}')
bluetoothctl connect "$mac" & notify-send "abman" "Connecting to $selection"
fi
}
pc_device(){
devices="$(bluetoothctl devices | awk '{$1=$2=""; print substr($0,3)}')"
if [ -z "$devices" ]; then
notify-send "abman" "No previously connected devices"
exit 0;
fi
selection="$(printf "%s\n" "$devices" | fuzzel -d -p "Device list: ")"
if [ -n "$selection" ]; then
if [ "$(bluetoothctl show | grep "Powered: no")" ]; then
bluetoothctl power on
fi
mac=$(bluetoothctl devices | grep "$selection" | awk '{print $2}')
bluetoothctl connect "$mac" & notify-send "abman" "Reconnecting to $selection"
fi
}
toggledisc() {
if [ "$(bluetoothctl show | grep "Discoverable: yes")" ]; then
bluetoothctl discoverable off
notify-send "abman" "Discoverable off"
else
bluetoothctl discoverable on
notify-send "abman" "Set device as discoverable for 3 minutes"
fi
}
togglepair() {
if [ "$(bluetoothctl show | grep "Pairable: yes")" ]; then
bluetoothctl pairable off
notify-send "abman" "Pairable off"
else
bluetoothctl pairable on
notify-send "abman" "Device is now pairable"
fi
}
switchstate() {
if [ "$(bluetoothctl show | grep "Powered: yes")" ]; then
bluetoothctl power off
notify-send "abman" "Bluetooth is disabled"
elif [ "$(bluetoothctl show | grep "Powered: no")" ]; then
bluetoothctl power on
notify-send "abman" "Bluetooth is enabled"
fi
}
case $(printf "%s\n" "󰂯 Connect Device" "󰦢 Reconnect device" "󰂱 Toggle discoverable" "󰂰 Toggle Pairable" "󰂳 Change State" | fuzzel -d -l 5) in
"󰂯 Connect Device") scandevices ;;
"󰦢 Reconnect device") pc_device ;;
"󰂱 Toggle discoverable") toggledisc ;;
"󰂰 Toggle Pairable") togglepair ;;
"󰂳 Change State") switchstate ;;
*) exit ;;
esac

View file

@ -1,9 +1,5 @@
#!/bin/sh
#
# Show icon in slstatus:
# Video [ REC 󰑊 ]
# Audio [ REC 󰍬 ]
#
# amolinae's recording tool
screencast(){
case $(printf "%s\n" "󰍬 Mic ON" "󰍭 Mic OFF" | fuzzel -d -l 3) in

View file

@ -9,6 +9,6 @@ img="$HOME/Pictures/$(date +"%d_%m_%y-%H_%M_%S").png"
case "$1" in
-f) grim "$img" && wl-copy -t image/png < "$img" && notify ;;
-r) grim -g "$(slurp)" "$img" && wl-copy -t image/png < "$img" && notify ;;
-r) grim -g "$(slurp </dev/null)" "$img" && wl-copy -t image/png < "$img" && notify ;;
-h|*) echo "usage: aws [-f] [-r]" >&2; exit 1; ;;
esac

View file

@ -1,71 +0,0 @@
#!/bin/sh -x
# Created by λmolinae
checkstate() {
if [ "$(bluetoothctl show | grep "Powered: yes")" ]; then
echo "󰂯 Bluetooth ON"
else
echo "󰂲 Bluetooth OFF"
fi
}
switchstate() {
case "$(checkstate | fuzzel -d)" in
"󰂯 ON")
bluetoothctl power off
notify-send "Bluetooth" "Bluetooth is disabled"
;;
"󰂲 OFF")
bluetoothctl power on
notify-send "Bluetooth" "Bluetooth is enabled"
;;
*) exit ;;
esac
}
scandevices() {
# https://github.com/bluez/bluez/issues/826
notify-send "Bluetooth" "Scanning for devices"
bluetoothctl --timeout 5 scan on
devices=$(bluetoothctl devices | awk '{$1=$2=""; print substr($0,3)}')
if [ -z "$devices" ]; then
notify-send "Bluetooth" "Error: No devices were found"
exit 1
fi
# TODO: Remove previously connected devices.
selection="$(printf "%s\n" "$devices" | fuzzel -d -p "Available devices: ")"
if [ -n "$selection" ]; then
mac=$(bluetoothctl devices | grep "$selection" | awk '{print $2}')
bluetoothctl connect "$mac"
notify-send "Bluetooth" "Connecting to $selection"
fi
}
toggledisc() {
if [ "$(bluetoothctl show | grep "Discoverable: yes")" ]; then
bluetoothctl discoverable off
notify-send "Bluetooth" "Discoverable off"
else
bluetoothctl discoverable on
notify-send "Bluetooth" "Set device as discoverable for 3 minutes"
fi
}
togglepair() {
if [ "$(bluetoothctl show | grep "Pairable: yes")" ]; then
bluetoothctl pairable off
notify-send "Bluetooth" "Pairable off"
else
bluetoothctl pairable on
notify-send "Bluetooth" "Device is now pairable"
fi
}
case $(printf "%s\n" "󰂯 Connect Device" "󰂱 Toggle discoverable" "󰂰 Toggle Pairable" "󰂳 Change State" | fuzzel -d) in
"󰂯 Connect Device") scandevices ;;
"󰂱 Toggle discoverable") toggledisc ;;
"󰂰 Toggle Pairable") togglepair ;;
"󰂳 Change State") switchstate ;;
*) exit ;;
esac

View file

@ -1,17 +1,18 @@
#!/bin/sh
ROOT=""$HOME"/Documents/Miscellaneous/alpchroot"
ROOT="${HOME:-/home/amolinae}/Documents/Miscellaneous/alpchroot"
case "$1" in
"") echo "usage: bwroot ARGUMENT" >&2; exit 1; ;;
case "$1" in
*)
bwrap \
--bind "$ROOT" / \
--bind /proc /proc \
--dev-bind /dev /dev \
--bind "$PWD" "$PWD" \
--bind "$HOME" "$HOME" \
--unshare-all \
--share-net \
"$@" ;;
esac
--bind "$ROOT" / \
--bind /proc /proc \
--bind /sys /sys \
--dev-bind /dev /dev \
--bind "$PWD" "$PWD" \
--bind "$HOME" "$HOME" \
--unshare-all \
--share-net \
"$@" ;;
"") echo "usage: bwroot ARGUMENT" >&2; exit 1; ;;
esac

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Get user selection via fuzzel from emoji file.
chosen="$(cut -d ';' -f1 ~/.local/share/misc/chars/* | fuzzel -d -l 16 -w 32 | sed "s/ .*//")"
chosen="$(cut -d ';' -f1 ~/.local/share/misc/chars/* | fuzzel -d | sed "s/ .*//")"
# Exit if none chosen.
[ -z "$chosen" ] && exit

7
.local/bin/rec Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
if [[ ! -z "$(pgrep wf-recorder)" ]]; then
printf " [ REC 󰑊 ] \n"
else
printf " \n"
fi

View file

@ -5,7 +5,11 @@ case $(printf "%s\n" " Lock session" "󰍃 Log out" "󱂬 Kill process" "
swaylock
;;
"󰍃 Log out")
kill "$(pidof dwl)"
if pidof dwl > /dev/null; then
kill "$(pidof dwl)"
elif pidof river > /dev/null; then
kill "$(pidof river)"
fi
;;
"󱂬 Kill process")
ps -o pid,comm,user | \