.i3/auto-start

Sun, 29 May 2016 20:05:37 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 29 May 2016 20:05:37 -0400
changeset 329
d67e61bd4418
parent 55
fe505cd6be19
child 70
431128b5fa0c
child 377
7190350f2ab3
permissions
-rwxr-xr-x

tweaks

#! /bin/sh

# Simple autostart file for i3-wm, you can execute it from i3 config with
# exec $HOME/bin/auto-start-for-i3
#
# xdotool and notify-send 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=10

# Start the given command and wait until it's visible
StartProg()
{
    "$@" &                  # Handle arguments with whitspaces
    mypid=$!                # Pid of last background process
    echo "Waiting on ${mypid}: $@"
    for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
    do
    	if xdotool search --onlyvisible --pid $mypid; then
    	    return 0
    	fi
	sleep 1
    done
    notify-send "Error on executing: $@"
}

StartProgName()
{
    "$@" &                  # Handle arguments with whitspaces
    mypid=$!                # Pid of last background process
    echo "Waiting on $1: $@"
    for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
    do
    	if xdotool search --onlyvisible --name $1; then
    	    return 0
    	fi
	sleep 1
    done
    notify-send "Error on executing: $@"
}

WaitProgName()
{
    echo "Waiting on $1"
    for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
    do
    	if xdotool search --onlyvisible --name $1; then
    	    return 0
    	fi
	sleep 1
    done
    notify-send "Error waiting on $1: $@"
}

WaitClassName()
{
    echo "Waiting on window class $1"
    for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
    do
    	if xdotool search --onlyvisible --class $1; then
    	    return 0
    	fi
	sleep 1
    done
    notify-send "Error waiting on $1: $@"
}


# ### --- emacs --- ###
# StartProg emacs
#
# ### --- ding ---- ###
# StartProg ding
# i3-msg border none
#
# # make right half bigger
# i3-msg resize grow left 16 px or 16 ppt
#
# # build container
# i3-msg split v
# sleep 1
#
# ### --- terminal --- ###
# StartProg rxvt
#
# # Make Terminal bigger and Ding smaller
# i3-msg resize grow up 32 px or 32 ppt
#
# ### --------------------------------- tab START--- ###
# ### ---------------------------------------------- ###
# i3-msg split v
# i3-msg layout tabbed
#
# ### --- gnome-commander --- ###
# StartProg gnome-commander
#
# ### --- chromium --- ###
# StartProg chromium
#
# ### --- pdf --- ###
# StartProg evince "~/Dokumente/Haskell/Haskell.pdf"
# ### ---------------------------------------------- ###
# ### ---------------------------------- tab END --- ###
#
# ### --- new terminal left under emacs --- ###
# i3-msg focus left
# i3-msg split v
# StartProg rxvt
#
# # terminal without border and make it smaller
# i3-msg border none
# i3-msg resize shrink up 32 px or 32 ppt
#

# StartProg urxvt
# i3-msg 'split h'
# StartProgName gvim
# i3-msg 'focus left; split v'
# StartProg urxvt
# i3-msg 'resize shrink height 20 px or 20 ppt'

if [ -r ~/.i3/auto-start.local ]; then
  . .i3/auto-start.local
fi

exit 0

mercurial