summary refs log tree commit diff
path: root/bin/swq
diff options
context:
space:
mode:
Diffstat (limited to 'bin/swq')
-rwxr-xr-xbin/swq6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/swq b/bin/swq
index 39a594a..85f11a7 100755
--- a/bin/swq
+++ b/bin/swq
@@ -118,7 +118,7 @@ _current()
         con) swtree | jq '.. | select((.type? | test("con")?) and .focused?)' ;;
 
         ws) _current workspace ;;
-        workspace) swtree | jq '.. | select(.type?=="workspace") | . as $parent | $parent.nodes[]?, $parent.floating_nodes[]? | if .focused? then $parent else empty end' ;;
+        workspace) swtree | jq '.. | select(.type?=="workspace") | . as $parent | .. | select(.focused?==true) | $parent' ;;
         output) $0 current workspace | jq -r '.output'  ;;
         output-full) $0 list output | jq ".[] | select((.type?==\"output\") and (.name?==\"$($0 current output)\"))" ;;
         *)
@@ -136,7 +136,7 @@ case "$1" in
     focus-latest-con) sway [con_id="$(latest con | jq -r '.id')"] focus ;;
     moveto) shift; moveto $@ ;;
 
-    *)
+    -h|--help|help)
         printf 'usage: swq COMMAND\n'
         printf '\n'
         printf 'QUERY COMMANDS:\n'
@@ -151,4 +151,6 @@ case "$1" in
         printf ' moveto <appid> <ws>:  move container with <appid> to <ws>\n'
         printf '\n'
         exit 2 ;;
+
+    *) swtree ;;
 esac