Last active
November 21, 2024 06:00
-
-
Save emanuele6/31bec2a0e1b61d0ba8b0434409f13e38 to your computer and use it in GitHub Desktop.
Revisions
-
emanuele6 revised this gist
Nov 21, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/sh -- # \ exec jq -Crf -- "$0" "$@" def children: objects | -
emanuele6 revised this gist
Feb 4, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # Visualise the bspwm tree of the focused desktop in a floating window super + ctrl + t BSPSHOWTREE_FLOAT= bspshowtree -
emanuele6 revised this gist
Aug 31, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/sh -- # \ exec jq -Crf "$0" -- "$@" def children: objects | -
emanuele6 revised this gist
Aug 30, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/sh -- # \ exec jq -L '' -Crf "$0" -- "$@" def children: objects | -
emanuele6 revised this gist
Aug 30, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,14 @@ case $# in 0) : "${BSPTREEUPDATEDOT_OUTFILE:=/tmp/bsptree_$$.dot}" ;; 1) if [ -z "$1" ]; then printf 'Invalid empty argument.\n' >&2 exit 2 fi BSPTREEUPDATEDOT_OUTFILE=$1 ;; *) printf 'Too many arguments.\n' >&2 -
emanuele6 revised this gist
Aug 30, 2022 . 1 changed file with 11 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,17 +2,24 @@ case $# in 0) : "${BSPTREEUPDATEPNG_OUTFILE:=/tmp/bsptree_$$.dot}" ;; 1) if [ -z "$1" ]; then printf 'Invalid empty argument.\n' >&2 exit 2 fi BSPTREEUPDATEPNG_OUTFILE=$1 ;; *) printf 'Too many arguments.\n' >&2 exit 2 esac while tree=$(bspc query -T -d) && printf '%s\n' "$tree" | bspdeskjson2dot > "$BSPTREEUPDATEDOT_OUTFILE" && bspc subscribe -c 1 desktop node > /dev/null do : -
emanuele6 revised this gist
Aug 30, 2022 . 2 changed files with 23 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,6 @@ awk ' NR == 1 && "BSPSHOWTREE_FLOAT" in ENVIRON { system("bspc rule -a \\* -o state=floating") } { print | "bspdeskjson2dot | dot -Txlib" } END { exit NR == 0 } ' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/bin/sh -- case $# in 0) printf 'No arguments given.\n' >&2 exit 2 ;; [!1]) printf 'Too many arguments.\n' >&2 exit 2 esac while tree=$(bspc query -T -d) && printf '%s\n' "$tree" | bspdeskjson2dot > "$1" && bspc subscribe -c 1 desktop node > /dev/null do : done # Now, you can open the output file with `dot -Txlib' and see the tree # update live! :D -
emanuele6 revised this gist
Aug 29, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def node: end ):\(.splitRatio)" ), .id, ( select(isNonVacantLeaf).rectangle | objects | -
emanuele6 revised this gist
Aug 29, 2022 . 1 changed file with 6 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def node: "blue" # receptacle end )]", "[label=<\( [ pathString, ( @@ -51,7 +51,7 @@ def node: end ):\(.splitRatio)" ), "\(.id)", ( select(isNonVacantLeaf).rectangle | objects | @@ -60,13 +60,12 @@ def node: ( .client | objects | @json "\(.className):\(.instanceName)" ) | @html ] | join("<BR/>") )>]", "-> \(children.id | values)" );"; -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -73,7 +73,7 @@ def node: "digraph BSPTree {", ( objects.root | select(type == "object" and (.path | type | IN("string", "null"))) | recurse(children) | node ), -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,6 @@ def pathString: def node: "\t\(.id) \( "[color=\( if isInnerNode then numberOfBranchesWithNonVacantLeaves | if . == 0 then -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,7 @@ def isInnerNode: def isNonVacantLeaf: .vacant or isInnerNode | not; def numberOfBranchesWithNonVacantLeaves: [ children | select(any(recurse(children); isNonVacantLeaf)) ] | length; def pathString: "@\(.path // "/")"; -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -43,14 +43,16 @@ def node: "[label=\"\( [ pathString, ( select(numberOfBranchesWithNonVacantLeaves == 2) | "\( if .splitType == "vertical" then "V" else "H" end ):\(.splitRatio)" ), .id, ( select(isNonVacantLeaf).rectangle | -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 7 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -43,16 +43,14 @@ def node: "[label=\"\( [ pathString, "\( select(numberOfBranchesWithNonVacantLeaves == 2) | if .splitType == "vertical" then "V" else "H" end ):\(.splitRatio)", .id, ( select(isNonVacantLeaf).rectangle | -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,18 +26,18 @@ def node: if isInnerNode then numberOfBranchesWithNonVacantLeaves | if . == 0 then "gray" # fully vacant inner node elif . == 1 then "yellow" # non-splitting inner node else empty # splitting inner node end elif .vacant then "red" # vacant window elif .client != null then "green" # non-vacant window else "blue" # receptacle end )]", "[label=\"\( -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,14 +32,12 @@ def node: else empty # splitting inner node end elif .vacant then "red" # vacant window elif .client != null then "green" # non-vacant window else "blue" # receptacle end )]", "[label=\"\( -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 15 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,43 +12,41 @@ def isInnerNode: any(children; true); def isNonVacantLeaf: .vacant or isInnerNode | not; def numberOfBranchesWithNonVacantLeaves: [ children ] | map(select(any(recurse(children); isNonVacantLeaf))) | length; def pathString: "@\(.path // "/")"; def node: "\t\(.id) \( "[color=\( . as $node | if isInnerNode then numberOfBranchesWithNonVacantLeaves | if . == 0 then "gray" # fully vacant inner node elif . == 1 then "yellow" # non-splitting inner node else empty # splitting inner node end elif isNonVacantLeaf then if .client != null then "green" # non-vacant window else "blue" # receptacle end else "red" # vacant window end )]", "[label=\"\( [ pathString, ( select(numberOfBranchesWithNonVacantLeaves == 2) | "\( if .splitType == "vertical" then "V" -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def node: ( select( [ children ] | length >= 2 and all(any(recurse(children); isNonVacantLeaf)) ) | "\( -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def isInnerNode: def isNonVacantLeaf: .vacant or isInnerNode | not; def pathString: "@\(.path // "/")"; def node: "\t\(.id) \( -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def children: def isInnerNode: any(children; true); def isNonVacantLeaf: .vacant or isInnerNode | not; def pathString: "@" + (.path // "/"); -
emanuele6 revised this gist
Aug 28, 2022 . 1 changed file with 8 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,10 @@ def children: (.firstChild | objects | .path = $p + "/1"), (.secondChild | objects | .path = $p + "/2") | select(has("id")); def isInnerNode: any(children; true); def isNonVacantLeaf: .vacant or isInnerNode | not; def pathString: "@" + (.path // "/"); @@ -26,12 +28,13 @@ def node: "grey" # fully vacant inner node end elif . == 1 then $node | if .client != null then "green" # window elif isInnerNode then "yellow" # inner node with single non-vacant else "blue" # receptacle end else empty # normal inner node -
emanuele6 revised this gist
Aug 27, 2022 . 1 changed file with 10 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,15 @@ #!/bin/sh -- # \ exec jq -Crf "$0" -- "$@" def children: objects | .path as $p | (.firstChild | objects | .path = $p + "/1"), (.secondChild | objects | .path = $p + "/2") | select(has("id")); def isNonVacantLeaf: (.vacant | not) and isempty(children); def pathString: "@" + (.path // "/"); @@ -58,17 +56,14 @@ def node: ), .id, ( select(isNonVacantLeaf).rectangle | objects | "\(.width)x\(.height)+\(.x)+\(.y)" ), ( .client | objects | "\(.className):\(.instanceName)" ) | tostring | gsub("[\\\\\"]"; "\\" + .) -
emanuele6 revised this gist
Aug 27, 2022 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/sh -- # \ exec jq -rf "$0" -- "$@" def children: objects | @@ -58,14 +58,15 @@ def node: ), .id, ( select(isNonVacantLeaf) | ( .rectangle | objects | "\(.width)x\(.height)+\(.x)+\(.y)" ), ( .client | objects | "\(.className):\(.instanceName)" ) ) | -
emanuele6 revised this gist
Aug 27, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # Visualise the bspwm tree of the focused desktop in the floating window super + ctrl + t BSPSHOWTREE_FLOAT= bspshowtree -
emanuele6 revised this gist
Aug 27, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ case $# in esac while tree=$(bspc query -T -d) && printf '%s\n' "$tree" | bspdeskjson2dot | dot -Tpng -o "$BSPTREEUPDATEPNG_OUTFILE" && -
emanuele6 revised this gist
Aug 27, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,5 +26,5 @@ do : done # Now, you can open the output file in an image viewer and see the tree # update live! :D -
emanuele6 revised this gist
Aug 27, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ while printf '%s\n' "$tree" | bspdeskjson2dot | dot -Tpng -o "$BSPTREEUPDATEPNG_OUTFILE" && bspc subscribe -c 1 desktop node > /dev/null do : done -
emanuele6 revised this gist
Aug 27, 2022 . 2 changed files with 10 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/sh -- # \ exec jq -Crf "$0" -- "$@" def children: objects | This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,17 +16,15 @@ case $# in exit 2 esac while tree=$(bspc query -T -d ) && printf '%s\n' "$tree" | bspdeskjson2dot | dot -Tpng -o "$BSPTREEUPDATEPNG_OUTFILE" && bspc subscribe desktop node -c 1 > /dev/null do : done # Now, you can open the outputfile in an image viewer and see the tree # update live! :D -
emanuele6 revised this gist
Aug 27, 2022 . 2 changed files with 35 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/bin/sh -- case $# in 0) : "${BSPTREEUPDATEPNG_OUTFILE:=/tmp/bsptree_$$.png}" ;; 1) if [ -z "$1" ]; then printf 'Invalid empty argument.\n' >&2 exit 2 fi BSPTREEUPDATEPNG_OUTFILE=$1 ;; *) printf 'Too many arguments.\n' >&2 exit 2 esac bspc subscribe node | while IFS=' ' read -r event m desk r; do [ "$event" = node_stack ] && continue # incompatible format bspc query -T -d "$desk.focused" | awk ' { print | "bspdeskjson2dot | dot -Tpng" } ' | BSPTREEUPDATEPNG_OUTFILE=$BSPTREEUPDATEPNG_OUTFILE awk ' { print > ENVIRON["BSPUPDATEPNGTREE_OUTFILE"] } ' done # Now, you can open the outputfile in an image viewer and see the tree # update live! :D This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ # Visualise the bspwm tree of the focused desktop in the floating window super + ctrl + t BSPSHOWTREE_FLOAT= bspshowtree -
emanuele6 revised this gist
Aug 27, 2022 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -43,14 +43,10 @@ def node: [ pathString, ( select( [ children ] | length != 0 and all(any(recurse(children); isNonVacantLeaf)) ) | "\( if .splitType == "vertical" then
NewerOlder