1
0
Fork 0

.local/bin: update

main
urosm 2024-05-05 17:35:59 +02:00
parent 18b028f412
commit c24d5ef226
3 changed files with 26 additions and 56 deletions

View File

@ -1,10 +0,0 @@
#!/bin/sh
nmcli device wifi list
ssid="$(nmcli -g SSID device wifi list --rescan no |
fzy -p "nmcli device wifi connect ")"
[ -z "$ssid" ] && return
if ! nmcli device wifi connect "$ssid"; then
nmcli -a device wifi connect "$ssid"
fi
sleep 1

View File

@ -5,11 +5,7 @@ printf "[\n"
if ! command -v jq >/dev/null; then if ! command -v jq >/dev/null; then
while true; do while true; do
printf '[{ printf '[{ "full_text":"jq: command not found", "urgent":true },],'
"full_text":" jq: command not found ",
"urgent":true,
"separator_block_width":0
},],'
sleep 1 sleep 1
done done
fi fi
@ -17,47 +13,39 @@ fi
while true; do while true; do
printf "[" printf "["
# keyboard layout # keyboard layout
swaymsg -t get_inputs | jq -Mcj ' swaymsg -t get_inputs | jq -Mcj '[.[] | select(.type=="keyboard")][0] |
[.[] | select(.type=="keyboard")][0] {
| { "full_text":.xkb_active_layout_name,
"full_text":([" ",.xkb_active_layout_name," "]|join("")),
"urgent":.xkb_active_layout_index, "urgent":.xkb_active_layout_index,
"separator_block_width":0
}, ","' }, ","'
# battery # battery
# shellcheck disable=SC2002 # shellcheck disable=SC2002
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj ' cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '
if .<20 then { if .<20 then
"full_text":([" ",.," % "]|join("")), {
"full_text":([.," %"]|join("")),
"urgent":true, "urgent":true,
"separator_block_width":0 }
} else { else
"full_text":([" ",.," % "]|join("")), {
"separator_block_width":0 "full_text":([.," %"]|join("")),
} end, ","' }
end, ","'
# date # date
date +%c | jq -RMcj '{ date +%c | jq -RMcj '{ "full_text":., }, ","'
"full_text":([" ",.," "]|join("")),
"separator_block_width":0
}, ","'
# scratchpad # scratchpad
swaymsg -t get_tree | jq -Mcj ' swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] |
.nodes[] select(.name=="__i3_scratch").floating_nodes |
| select(.name=="__i3").nodes[] {
| select(.name=="__i3_scratch").floating_nodes "full_text":length,
| if length>0 then { "urgent":length,
"full_text":([" ",length," "]|join("")), }, ","'
"urgent":true,
"separator_block_width":0
}, "," else "" end'
# notifications # notifications
makoctl list | jq -Mcj ' makoctl list | jq -Mcj '.data[][0] |
.data[] {
| if length>0 then { "full_text":.summary.data,
"full_text":([" (",length,") ",.[0].summary.data," "]|join("")), "urgent":(.urgency.data==2),
"urgent":(.[0].urgency.data==2), }, ","'
"separator_block_width":0
}, "," else "" end'
printf "]," printf "],"
# timeout # timeout
timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null

View File

@ -1,8 +0,0 @@
#!/bin/sh
lsblk
lsblk -lpno"name,type,mountpoint" \
| awk '($1~/.dev.sd/&&$2=="part"){printf($3=="")?"mount -b %s\n":"unmount -b %s\n",$1}' \
| fzy -p "udisksctl " \
| xargs -r udisksctl
sleep 1