Skip to content

Instantly share code, notes, and snippets.

@gcoda
Created October 4, 2015 04:55
Show Gist options
  • Save gcoda/5b553203ba708b76c550 to your computer and use it in GitHub Desktop.
Save gcoda/5b553203ba708b76c550 to your computer and use it in GitHub Desktop.
#!/bin/sh
DMENU="rofi -p LoadLayout: -bg #222222 -dmenu"
if ! command -v "jshon" >/dev/null 2>&1; then
printf "%s\\n" "you need to install 'jshon' to run this program" >&2
exit 1
fi
if ! command -v "rofi" >/dev/null 2>&1; then
printf "%s\\n" "you need to install 'rofi' to run this program" >&2
exit 1
fi
LNAME="$(ls ~/.i3/layouts | ${DMENU})"
if [ -z "$LNAME" ]; then
exit 1
else
WORKSPACE="$(i3-msg -t get_workspaces | jshon -a -e focused -u -p -e name -u | awk 'f{print;f=0} /true/{f=1}')"
i3-msg "workspace ${WORKSPACE}; append_layout ~/.i3/layouts/${LNAME}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment