Skip to content

Instantly share code, notes, and snippets.

@akheron
Created May 26, 2017 10:51
Show Gist options
  • Save akheron/566ebaa02e35d86e687ef6e513a852e7 to your computer and use it in GitHub Desktop.
Save akheron/566ebaa02e35d86e687ef6e513a852e7 to your computer and use it in GitHub Desktop.
i3 workspace/output helpers
#!/bin/sh
usage() {
echo "usage: get-workspaces.sh OUTPUT"
echo ""
echo "Print the names of workspaces on the given output"
echo ""
exit 2
}
[ -z "$1" ] && usage
output=$(map-output.sh "$1")
i3-msg -t get_workspaces | python -c 'import json, sys; output = sys.argv[1]; print(" ".join(str(x["num"]) for x in json.load(sys.stdin) if x["output"] == output))' "$output"
#!/bin/sh
#
# Give descriptive names to your outputs
#
if [ "$1" == "dongle" ]; then echo DP1
elif [ "$1" == "dock" ]; then echo DP1-3
elif [ "$1" == "laptop" ]; then echo eDP1
else echo "$1"
fi
#!/bin/sh
set -e
usage() {
echo "usage: move-workspaces.sh OUTPUT WORKSPACE [WORKSPACE...]"
echo ""
echo "Moves workspaces with the given numbers to the given output"
echo ""
exit 2
}
[ -z "$1" ] && usage
output=$(map-output.sh "$1")
shift
[ -z "$1" ] && usage
while [ -n "$1" ]; do
i3-msg workspace "$1"
i3-msg move workspace to output "$output"
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment