From 81e61cefd56f817b1c2fd9050eae07145ca17822 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 8 Nov 2020 20:36:03 +0000 Subject: [PATCH] improve formatting, hide cursor --- monitor_windows.sh | 5 +++++ show_windows.sh | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/monitor_windows.sh b/monitor_windows.sh index f600a2f..c2e1180 100755 --- a/monitor_windows.sh +++ b/monitor_windows.sh @@ -1,7 +1,12 @@ #!/bin/sh +tput civis +trap 'tput cnorm && exit' SIGINT + bspc subscribe node_focus desktop_focus | while read -a msg ; do _output="$(show-windows "$@")" clear echo "$_output" done + +tput cnorm diff --git a/show_windows.sh b/show_windows.sh index d00d989..ec76b1b 100755 --- a/show_windows.sh +++ b/show_windows.sh @@ -5,17 +5,18 @@ _ignore_desktop="$1" _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)" + echo "" if [ "$_ignore_desktop" != "$_desktop_name" ] ; then 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" + 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" + printf " %.55s\033[0m\n" "$_title" _desktop_name='' done echo ""