summary refs log tree commit diff
path: root/bin/swx
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2020-07-21 13:15:21 +0200
committerRobert Günzler <r@gnzler.io>2020-07-21 13:15:21 +0200
commite7cfd58af25de9fe7e2a991baf57dfad4d1a0c10 (patch)
tree361fa19bcbe32cb02fd06299a01512f0556e828d /bin/swx
parentc66b664c987efd14ef256ed1a9b87f888f2defd2 (diff)
bin/centercon: Remove special case for centering
Diffstat (limited to 'bin/swx')
-rwxr-xr-xbin/swx17
1 files changed, 9 insertions, 8 deletions
diff --git a/bin/swx b/bin/swx
index c9ca172..693c1da 100755
--- a/bin/swx
+++ b/bin/swx
@@ -57,9 +57,9 @@ while getopts b:w:o:g:I:r:stfF:aSh name; do
 		printf "  -g GEOMETRY \tresize/position window\n"
 		printf "  -r ROTATION \trotate the container, requires cage(1)\n"
 		printf "  -s \t\tmake COMMAND a sticky window, appearing on all workspaces\n"
-		printf "  -f \t\tmake COMMAND a floating window\n\tsee centercon(1) for possible values\n"
-		printf "  -F [PERC [MODE]]\tmake COMMAND a floating window\n\tsee centercon(1) for possible values\n"
-		printf "  -a \t\tauto-tiling; always open COMMAND on the shorter edge\n\t\tof the current container\n"
+		printf "  -f \t\tmake COMMAND a floating window\n"
+		printf "  -F OPTIONS\tmake COMMAND a floating window\n\t\tsee centercon(1) for possible options\n"
+		printf "  -a \t\tauto-tiling; always open COMMAND on the shorter edge of\n\t\tthe current container\n"
 		printf "  -S \t\tmove the container into the scratchpad\n"
 		printf "\n"
 		printf "See sway(5) for possible options for BORDER, WORKSPACE, OUTPUT and GEOMETRY.\n"
@@ -78,10 +78,10 @@ shift
 # spawn a $TERM instance and exec that
 if [ -n "${termify}" ]; then
 	case ${TERM} in
-	alacritty)	args="--title=${arg0} --class=${arg0} --command" ;;
-	*) 		args="" ;;
+	alacritty)	term_args="--title=${arg0} --class=${arg0} --command" ;;
+	*) 		term_args="" ;;
 	esac
-	command="${TERM} ${args} ${arg0} ${*}"
+	command="${TERM} ${term_args} ${arg0} ${*}"
 else
 	command="${arg0} ${*}"
 fi
@@ -115,14 +115,15 @@ if [ -n "${autotile}" ]; then
 	esac
 fi
 
-swaymsg exec "${command}" >/dev/null
+swaymsg exec -- "${command}" >/dev/null
+[ $? ] || exit 1
 con_id="$(swaymsg -t subscribe '["window"]' | jq -s -r '.[]|select(.change=="new")|.container.id')"
 
 sway_props_done=
 while [ -z "${sway_props_done}" ]; do
 	if [ -n "${floating}" ]; then
 		swaymsg [con_id="${con_id}"] floating enable
-		[ ! "${floating}" = "1" ] && centercon "${floating}"
+		[ "${floating}" = "1" ] || centercon ${floating}
 	fi
 	if [ -n "${into_scratchpad}" ]; then
 		swaymsg [con_id="${con_id}"] move to scratchpad