Created
April 3, 2014 04:20
-
-
Save zerosign/9948222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
function usage() { | |
cat <<EOF | |
USAGE i3-xephyr start|stop|restart|run | |
start Start nested i3 in xephyr | |
stop Stop xephyr | |
restart reload i3 in xephyr | |
run run command in nested i3 | |
EOF | |
} | |
function i3_pid() { | |
/bin/pidof i3 | cut -d\ -f1 | |
} | |
function xephyr_pid() { | |
/bin/pidof Xephyr | cut -d\ -f1 | |
} | |
[ $# -lt 1 ] && usage | |
I3=`which i3` | |
XEPHYR=`which Xephyr` | |
test -x $I3 || {echo "i3 executable not found."} | |
test -x $XEPHYR || {echo "Xephyr executable not found."} | |
case "$1" in | |
start) | |
$XEPHYR -ac -br -noreset -screen 800x600 :1 & | |
sleep 1 | |
DISPLAY=:1.0 $I3 & | |
sleep 1 | |
echo I3 ready for tests. PID is $(i3_pid) | |
;; | |
stop) | |
echo -n "Stopping nested i3..." | |
if [ -z $(xephyr_pid) ]; then | |
echo "Not running: not stopped :)" | |
exit 0 | |
else | |
kill $(xephyr_pid) | |
echo "Done." | |
fi | |
;; | |
restart) | |
echo -n "Restarting i3..." | |
kill -s SIGHUP $(xephyr_pid) | |
;; | |
run) | |
shift | |
DISPLAY=:1.0 "$@" & | |
;; | |
*) | |
usage | |
;; | |
esac |
It looks like this script:
- Checks i3 is present
- Checks Xephyr is present
- If they are, it will start a 800x600 screen, and start an instance of i3
It also gives you a run command to execute command within that i3
I'm not the owner, just playing around with Xephyr and stumbled across this
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
May I ask what does this script do?. I’m looking for ways to have isolated “group of workspace” for every screen. I saw Xephyr as a candidate that can be used to achieve this.