Fri, 13 Jun 2014 13:21:31 -0400
no need to fork
1 | 1 | #! /bin/sh |
2 | ||
3 | # Simple autostart file for i3-wm, you can execute it from i3 config with | |
4 | # exec $HOME/bin/auto-start-for-i3 | |
5 | # | |
43
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
6 | # xdotool and notify-send must be installed. On BSD use jot instead of |
1 | 7 | # seq or install seq from ports. |
8 | ||
9 | ||
10 | # Max seconds to wait until the process is up | |
11 | MAXWAIT=10 | |
12 | ||
13 | # Start the given command and wait until it's visible | |
14 | StartProg() | |
15 | { | |
16 | "$@" & # Handle arguments with whitspaces | |
17 | mypid=$! # Pid of last background process | |
18 | echo "Waiting on ${mypid}: $@" | |
19 | for i in `seq $MAXWAIT` # count from 1 to MAXWAIT | |
20 | do | |
21 | if xdotool search --onlyvisible --pid $mypid; then | |
22 | return 0 | |
23 | fi | |
24 | sleep 1 | |
25 | done | |
51 | 26 | notify-send "Error on executing: $@" |
1 | 27 | } |
28 | ||
29 | StartProgName() | |
30 | { | |
31 | "$@" & # Handle arguments with whitspaces | |
32 | mypid=$! # Pid of last background process | |
33 | echo "Waiting on $1: $@" | |
34 | for i in `seq $MAXWAIT` # count from 1 to MAXWAIT | |
35 | do | |
36 | if xdotool search --onlyvisible --name $1; then | |
37 | return 0 | |
38 | fi | |
39 | sleep 1 | |
40 | done | |
29
c3e57b348ed2
Switch to urxvt, drop xmessage
Meredith Howard <mhoward@roomag.org>
parents:
1
diff
changeset
|
41 | notify-send "Error on executing: $@" |
1 | 42 | } |
43 | ||
44 | # ### --- emacs --- ### | |
45 | # StartProg emacs | |
46 | # | |
47 | # ### --- ding ---- ### | |
48 | # StartProg ding | |
49 | # i3-msg border none | |
50 | # | |
51 | # # make right half bigger | |
52 | # i3-msg resize grow left 16 px or 16 ppt | |
53 | # | |
54 | # # build container | |
55 | # i3-msg split v | |
56 | # sleep 1 | |
57 | # | |
58 | # ### --- terminal --- ### | |
59 | # StartProg rxvt | |
60 | # | |
61 | # # Make Terminal bigger and Ding smaller | |
62 | # i3-msg resize grow up 32 px or 32 ppt | |
63 | # | |
64 | # ### --------------------------------- tab START--- ### | |
65 | # ### ---------------------------------------------- ### | |
66 | # i3-msg split v | |
67 | # i3-msg layout tabbed | |
68 | # | |
69 | # ### --- gnome-commander --- ### | |
70 | # StartProg gnome-commander | |
71 | # | |
72 | # ### --- chromium --- ### | |
73 | # StartProg chromium | |
74 | # | |
75 | # ### --- pdf --- ### | |
76 | # StartProg evince "~/Dokumente/Haskell/Haskell.pdf" | |
77 | # ### ---------------------------------------------- ### | |
78 | # ### ---------------------------------- tab END --- ### | |
79 | # | |
80 | # ### --- new terminal left under emacs --- ### | |
81 | # i3-msg focus left | |
82 | # i3-msg split v | |
83 | # StartProg rxvt | |
84 | # | |
85 | # # terminal without border and make it smaller | |
86 | # i3-msg border none | |
87 | # i3-msg resize shrink up 32 px or 32 ppt | |
88 | # | |
89 | ||
29
c3e57b348ed2
Switch to urxvt, drop xmessage
Meredith Howard <mhoward@roomag.org>
parents:
1
diff
changeset
|
90 | StartProg urxvt |
1 | 91 | |
43
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
92 | # i3-msg 'split h' |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
93 | # StartProgName gvim |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
94 | # i3-msg 'focus left; split v' |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
95 | # StartProg urxvt |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
96 | # i3-msg 'resize shrink height 20 px or 20 ppt' |
1 | 97 | |
98 | exit 0 |