diff --git a/.local/bin/fuzzel_nmcli.sh b/.local/bin/fuzzel_nmcli.sh new file mode 100755 index 0000000..844edc7 --- /dev/null +++ b/.local/bin/fuzzel_nmcli.sh @@ -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 diff --git a/.local/bin/fuzzel_open.sh b/.local/bin/fuzzel_open.sh new file mode 100755 index 0000000..1fb53af --- /dev/null +++ b/.local/bin/fuzzel_open.sh @@ -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" diff --git a/.local/bin/fuzzel_udisksctl.sh b/.local/bin/fuzzel_udisksctl.sh new file mode 100755 index 0000000..3506658 --- /dev/null +++ b/.local/bin/fuzzel_udisksctl.sh @@ -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 diff --git a/.local/bin/status.sh b/.local/bin/status.sh new file mode 100755 index 0000000..1aff08e --- /dev/null +++ b/.local/bin/status.sh @@ -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