1
0
Fork 0

add scripts

padova
urosm 2024-02-04 16:24:33 +01:00
parent df0c235a42
commit 3ddc5c6b32
4 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#!/bin/sh
bssid="$(nmcli --colors=no -f BSSID,IN-USE,SSID,BARS device wifi list\
| tail -n+2\
| fuzzel -d -p "connect > "\
| cut -d" " -f1)"
[ -z "$bssid" ] && return
ssid="$(nmcli -g SSID device wifi list bssid "$bssid" --rescan no)"
if nmcli -t connection show "$ssid" >/dev/null 2>&1; then
if nmcli device wifi connect "$bssid" 2>&1; then
exec notify-send "Connected to $ssid."
else
exec notify-send "Could not connect to $ssid."
fi
else
security="$(nmcli -g SECURITY device wifi list bssid "$bssid" --rescan no)"
if [ "$security" = "WPA2" ] || [ "$security" = "WEP" ]; then
password="$(fuzzel -d --password -p "password > ")"
fi
if nmcli device wifi connect "$bssid" password "$password" 2>&1; then
exec notify-send "Connected to $ssid."
else
exec notify-send "Could not connect to $ssid."
fi
fi

View File

@ -0,0 +1,28 @@
#!/bin/sh
set -x
while getopts "he:" arg; do
case $arg in
e)
if [ -z "$excludes" ]; then
excludes="-path $OPTARG"
else
excludes="$excludes -o -path $OPTARG"
fi
;;
[h?])
printf "Usage: %s: [-e exclude path] [path]\n" $0
exit;;
esac
done
shift $(($OPTIND - 1))
file="$(find ${1:-$HOME} ! \( \( $excludes \) -prune \) -print0\
| fuzzel --dmenu0 -p "find > ")"
[ -z "$file" ] && exit
exec xdg-open "$file"

View File

@ -0,0 +1,16 @@
#!/bin/sh
name="$(lsblk -lpno"name,size,type,mountpoint"\
| grep "/dev\/sd.*part"\
| fuzzel -d -p "mount > "\
| cut -d" " -f1)"
[ -z "$name" ] && return
mountpoint="$(lsblk -lpno"mountpoint" "$name")"
if [ -z "$mountpoint" ]; then
exec udisksctl mount -b "$name" 2>&1 | xargs -I{} notify-send "{}"
else
exec udisksctl unmount -b "$name" 2>&1 | xargs -I{} notify-send "{}"
fi

View File

@ -0,0 +1,15 @@
#!/bin/sh
printf "{\"version\":1}\n"
printf "[\n"
while true
do
printf [
swaymsg -t get_inputs | jq -Mcj '[.[] | select(.type=="keyboard")][0] | {"full_text":.xkb_active_layout_name,"urgent":.xkb_active_layout_index}, ","'
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '{"full_text":.}, ","'
date +%c | jq -RMcj '{"full_text":.}, ","'
swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] | select(.name=="__i3_scratch").floating_nodes | {"full_text":length,"urgent":length}, ","'
makoctl list | jq -Mcj '.data[][0] | {"full_text":(.summary.data // 0),"urgent":((.urgency.data // 0) == 2)}, ","'
printf ],
timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null
done