⬆️ switch from jq
to jaq
This commit is contained in:
parent
c0c2a18d78
commit
06f9283378
|
@ -11,7 +11,7 @@
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
swaybg # wayland background
|
swaybg # wayland background
|
||||||
socat # socket cat
|
socat # socket cat
|
||||||
jq # json utils
|
jaq # (fast) json utils
|
||||||
borgbackup # backup
|
borgbackup # backup
|
||||||
dconf # required by home-manager
|
dconf # required by home-manager
|
||||||
duf # replacement for df
|
duf # replacement for df
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# print current active workspace id
|
# print current active workspace id
|
||||||
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
|
hyprctl monitors -j | jaq '.[] | select(.focused) | .activeWorkspace.id'
|
||||||
|
|
||||||
# print current active workspace id on workspace changes
|
# print current active workspace id on workspace changes
|
||||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
|
||||||
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
|
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
EMPTY=$(seq 1 10 | jaq -nRc '[inputs | (. | tostring)] | {(.[]): 0}')
|
||||||
|
|
||||||
# function to get workspaces infos and their window count
|
# function to get workspaces infos and their window count
|
||||||
spaces (){
|
spaces (){
|
||||||
WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries')
|
ACTIVES=$(hyprctl workspaces -j | jaq -c 'map({key: .id | tostring, value: .windows}) | from_entries')
|
||||||
seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
|
echo $EMPTY $ACTIVES | jaq -src 'add | to_entries | map({id: (.key | tostring), windows: .value})'
|
||||||
}
|
}
|
||||||
|
|
||||||
# print workspaces infos
|
# print workspaces infos
|
||||||
spaces
|
spaces
|
||||||
|
|
||||||
# print info on workspace changes
|
# print info on workspace changes
|
||||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||||
spaces
|
spaces
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue