Fri, 27 May 2016 18:02:00 -0400
cheaply color diffs, disable nested quote colors
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 | ||
55
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
44 | WaitProgName() |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
45 | { |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
46 | echo "Waiting on $1" |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
47 | for i in `seq $MAXWAIT` # count from 1 to MAXWAIT |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
48 | do |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
49 | if xdotool search --onlyvisible --name $1; then |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
50 | return 0 |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
51 | fi |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
52 | sleep 1 |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
53 | done |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
54 | notify-send "Error waiting on $1: $@" |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
55 | } |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
56 | |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
57 | WaitClassName() |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
58 | { |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
59 | echo "Waiting on window class $1" |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
60 | for i in `seq $MAXWAIT` # count from 1 to MAXWAIT |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
61 | do |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
62 | if xdotool search --onlyvisible --class $1; then |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
63 | return 0 |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
64 | fi |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
65 | sleep 1 |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
66 | done |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
67 | notify-send "Error waiting on $1: $@" |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
68 | } |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
69 | |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
70 | |
1 | 71 | # ### --- emacs --- ### |
72 | # StartProg emacs | |
73 | # | |
74 | # ### --- ding ---- ### | |
75 | # StartProg ding | |
76 | # i3-msg border none | |
77 | # | |
78 | # # make right half bigger | |
79 | # i3-msg resize grow left 16 px or 16 ppt | |
80 | # | |
81 | # # build container | |
82 | # i3-msg split v | |
83 | # sleep 1 | |
84 | # | |
85 | # ### --- terminal --- ### | |
86 | # StartProg rxvt | |
87 | # | |
88 | # # Make Terminal bigger and Ding smaller | |
89 | # i3-msg resize grow up 32 px or 32 ppt | |
90 | # | |
91 | # ### --------------------------------- tab START--- ### | |
92 | # ### ---------------------------------------------- ### | |
93 | # i3-msg split v | |
94 | # i3-msg layout tabbed | |
95 | # | |
96 | # ### --- gnome-commander --- ### | |
97 | # StartProg gnome-commander | |
98 | # | |
99 | # ### --- chromium --- ### | |
100 | # StartProg chromium | |
101 | # | |
102 | # ### --- pdf --- ### | |
103 | # StartProg evince "~/Dokumente/Haskell/Haskell.pdf" | |
104 | # ### ---------------------------------------------- ### | |
105 | # ### ---------------------------------- tab END --- ### | |
106 | # | |
107 | # ### --- new terminal left under emacs --- ### | |
108 | # i3-msg focus left | |
109 | # i3-msg split v | |
110 | # StartProg rxvt | |
111 | # | |
112 | # # terminal without border and make it smaller | |
113 | # i3-msg border none | |
114 | # i3-msg resize shrink up 32 px or 32 ppt | |
115 | # | |
116 | ||
55
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
117 | # StartProg urxvt |
43
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
118 | # i3-msg 'split h' |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
119 | # StartProgName gvim |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
120 | # i3-msg 'focus left; split v' |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
121 | # StartProg urxvt |
958afe229467
just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents:
29
diff
changeset
|
122 | # i3-msg 'resize shrink height 20 px or 20 ppt' |
1 | 123 | |
55
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
124 | if [ -r ~/.i3/auto-start.local ]; then |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
125 | . .i3/auto-start.local |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
126 | fi |
fe505cd6be19
Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents:
51
diff
changeset
|
127 | |
1 | 128 | exit 0 |