summary refs log tree commit diff
path: root/bin/swx
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2020-07-07 18:09:15 +0200
committerRobert Günzler <r@gnzler.io>2020-07-07 18:09:15 +0200
commit6d5305234d96344cd6c9d6818f3a9571d1567fcd (patch)
tree56c2a3fc534b95f9071f70ec8400b7753791d30f /bin/swx
parentecfb84d06395d98bb30d248269774edc15feb728 (diff)
bin/swx: only autotile split-layout containers
Diffstat (limited to 'bin/swx')
-rwxr-xr-xbin/swx14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/swx b/bin/swx
index 1536ad0..87a98d5 100755
--- a/bin/swx
+++ b/bin/swx
@@ -99,11 +99,15 @@ if [ -n "${rotate}" ]; then
 fi
 
 if [ -n "${autotile}" ]; then
-	if [ "$(swq current con | jq '.rect | .width > .height')" = "true" ]; then
-		swaymsg splith
-	else
-		swaymsg splitv
-	fi
+	case "$(swq current workspace | jq -r '.layout')" in
+	split*)
+		if [ "$(swq current con | jq '.rect | .width > .height')" = "true" ]; then
+			swaymsg splith
+		else
+			swaymsg splitv
+		fi
+		;;
+	esac
 fi
 
 swaymsg exec "${command}" >/dev/null