Created
June 3, 2015 16:03
-
-
Save theit8514/c495fedaf4b039fa73ab to your computer and use it in GitHub Desktop.
Same as auto-start-for-i3-simple, except includes ability to search for a specific window name (eg: feh creates a window, but it doesn't attach it to a pid) and to be able to search child pids for windows (eg: running a batch script which runs a lxterm/xterm/uxterm)
This file contains hidden or 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
| #! /bin/sh | |
| # Simple autostart file for i3-wm, you can execute it from i3 config with | |
| # exec $HOME/bin/auto-start-for-i3-simple | |
| # | |
| # xdotool and xmessage must be installed. On BSD use jot instead of | |
| # seq or install seq from ports. | |
| # Max seconds to wait until the process is up | |
| MAXWAIT=30 | |
| # Start the given command and wait until it's visible | |
| StartProg() | |
| { | |
| window= | |
| case $1 in | |
| -w | --window ) | |
| shift | |
| window=$1 | |
| shift | |
| ;; | |
| esac | |
| "$@" & # Handle arguments with whitspaces | |
| mypid=$! # Pid of last background process | |
| for i in `seq $MAXWAIT`; do # count from 1 to MAXWAIT | |
| if [ -z "$window" ]; then | |
| children=$(pstree -pn $mypid | grep -o "([[:digit:]]*)" | grep -o "[[:digit:]]*") | |
| for cpid in $children; do | |
| if xdotool search --onlyvisible --pid $cpid; then | |
| return 0 | |
| fi | |
| done | |
| else | |
| if xdotool search --onlyvisible --name $window; then | |
| return 0 | |
| fi | |
| fi | |
| sleep 1 | |
| done | |
| xmessage "Error on executing: $@" & | |
| } | |
| # Start some programs | |
| # | |
| # ______________________ | |
| # | | | | |
| # | lxterm | firefox | | |
| # | | | | |
| # | | | | |
| # |----------|----------| | |
| # | feh | lxterm | | |
| # |__________|__________| | |
| i3-msg workspace 1 | |
| StartProg lxterm | |
| i3-msg split h | |
| sleep 2 | |
| StartProg firefox | |
| i3-msg split v | |
| sleep 5 | |
| StartProg $HOME/bin/lxhtop | |
| sleep 1 | |
| i3-msg focus left | |
| sleep 1 | |
| i3-msg split v | |
| sleep 1 | |
| StartProg -w feh $HOME/bin/FGfeh | |
| sleep 5 | |
| i3-msg workspace 2 | |
| StartProg $HOME/bin/lxtorguard | |
| exit 0 |
This file contains hidden or 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
| #!/bin/sh | |
| feh -xrz.Z --image-bg black --slideshow-delay 30 --no-fehbg /path/to/Backgrounds |
This file contains hidden or 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
| #!/bin/sh | |
| lxterm -e bash --init-file <(echo "htop -u jack") |
This file contains hidden or 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
| #!/bin/sh | |
| lxterm -e bash --init-file <(echo "torguard") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment