From a02d2ef34c852a7d4d3f610c1f2986e0d21bf746 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 5 Nov 2020 21:46:55 +0000 Subject: [PATCH 1/3] improve monitorin --- monitor_windows.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 monitor_windows.sh diff --git a/monitor_windows.sh b/monitor_windows.sh new file mode 100755 index 0000000..087d625 --- /dev/null +++ b/monitor_windows.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +bspc subscribe node_focus desktop_focus | while read -a msg ; do + clear + _focused_node_id="$(bspc query -N -n .focused)" + bspc query -D -d .occupied | while read _desktop_id ; do + _desktop_name="$(bspc query -D -d $_desktop_id --names):" + + bspc query -N -d "$_desktop_id" -n .window | while read _node_id ; do + _node_id="$(bspc query -N -n $_node_id)" + _title="$(xtitle $_node_id)" + _wm_class="$(xprop -id $_node_id | grep WM_CLASS | cut -d\" -f2)" + printf "%-6s %-15s " "$_desktop_name" "$_wm_class" + if [ "$_focused_node_id" = "$_node_id" ] ; then + printf "\033[0;31m" + fi + printf "%.55s\033[0m\n" "$_title" + _desktop_name='' + done + echo "" + done +done From e5adf7179fc7e582791aee0ae9ee35320253e229 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 5 Nov 2020 21:49:56 +0000 Subject: [PATCH 2/3] improve output --- show_windows.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/show_windows.sh b/show_windows.sh index 175ed3d..f47534b 100755 --- a/show_windows.sh +++ b/show_windows.sh @@ -1,5 +1,6 @@ #!/bin/sh +_focused_node_id="$(bspc query -N -n .focused)" bspc query -D -d .occupied | while read _desktop_id ; do _desktop_name="$(bspc query -D -d $_desktop_id --names):" @@ -7,8 +8,13 @@ bspc query -D -d .occupied | while read _desktop_id ; do _node_id="$(bspc query -N -n $_node_id)" _title="$(xtitle $_node_id)" _wm_class="$(xprop -id $_node_id | grep WM_CLASS | cut -d\" -f2)" - printf "%-6s %-15s %.55s\n" "$_desktop_name" "$_wm_class" "$_title" + printf "%-6s %-15s " "$_desktop_name" "$_wm_class" + if [ "$_focused_node_id" = "$_node_id" ] ; then + printf "\033[0;31m" + fi + printf "%.55s\033[0m\n" "$_title" _desktop_name='' done echo "" + done From 9051da11993e4ac032c79fa30d2f3779332cfb0f Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 5 Nov 2020 21:52:25 +0000 Subject: [PATCH 3/3] update monitor script --- monitor_windows.sh | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/monitor_windows.sh b/monitor_windows.sh index 087d625..4c0d998 100755 --- a/monitor_windows.sh +++ b/monitor_windows.sh @@ -1,22 +1,7 @@ #!/bin/sh bspc subscribe node_focus desktop_focus | while read -a msg ; do + _output="$(show-windows)" clear - _focused_node_id="$(bspc query -N -n .focused)" - bspc query -D -d .occupied | while read _desktop_id ; do - _desktop_name="$(bspc query -D -d $_desktop_id --names):" - - bspc query -N -d "$_desktop_id" -n .window | while read _node_id ; do - _node_id="$(bspc query -N -n $_node_id)" - _title="$(xtitle $_node_id)" - _wm_class="$(xprop -id $_node_id | grep WM_CLASS | cut -d\" -f2)" - printf "%-6s %-15s " "$_desktop_name" "$_wm_class" - if [ "$_focused_node_id" = "$_node_id" ] ; then - printf "\033[0;31m" - fi - printf "%.55s\033[0m\n" "$_title" - _desktop_name='' - done - echo "" - done + echo "$_output" done