Skip to content

Instantly share code, notes, and snippets.

@sainathadapa
Created March 29, 2016 05:21
Show Gist options
  • Save sainathadapa/abe2be60c4e12fedfa05 to your computer and use it in GitHub Desktop.
Save sainathadapa/abe2be60c4e12fedfa05 to your computer and use it in GitHub Desktop.
Workaround to have an empty workspace in I3 Window manager
{
"border": "pixel",
"floating": "auto_off",
"layout": "stacked",
"percent": 1,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 523,
"width": 802,
"x": 0,
"y": 0
},
"name": "",
"percent": null,
"swallows": [
{
"class": ".*"
}
],
"type": "con"
}
]
}
WKNAME=$1
echo workspace name given is $WKNAME
if i3-msg -t get_workspaces | jq ".[] | .name" | grep -q -w $WKNAME; then
i3-msg "workspace $WKNAME"
else
i3-msg "workspace $WKNAME; append_layout ~/.i3/empty_workspace.json"
fi
currentDesk=$(xdotool get_desktop)
awkArgs="'\$2 == \"$currentDesk\" {print \$3}'"
getNumWindows="wmctrl -l | awk ${awkArgs} | wc -l"
numWindows=`eval $getNumWindows`
echo $numWindows
if ((numWindows > 1)); then
i3-msg "kill"
else
i3-msg "kill; append_layout ~/.i3/empty_workspace.json"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment