.i3/auto-start

Fri, 27 May 2016 18:02:00 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 27 May 2016 18:02:00 -0400
changeset 325
6dc43d41bed1
parent 55
fe505cd6be19
child 70
431128b5fa0c
child 377
7190350f2ab3
permissions
-rwxr-xr-x

cheaply color diffs, disable nested quote colors

1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 #! /bin/sh
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 # Simple autostart file for i3-wm, you can execute it from i3 config with
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 # exec $HOME/bin/auto-start-for-i3
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 # seq or install seq from ports.
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 # Max seconds to wait until the process is up
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 MAXWAIT=10
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 # Start the given command and wait until it's visible
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 StartProg()
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 {
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 "$@" & # Handle arguments with whitspaces
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 mypid=$! # Pid of last background process
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 echo "Waiting on ${mypid}: $@"
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 do
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 if xdotool search --onlyvisible --pid $mypid; then
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 return 0
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 fi
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 sleep 1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 done
51
f93e63d400b5 no need to fork
Meredith Howard <mhoward@roomag.org>
parents: 43
diff changeset
26 notify-send "Error on executing: $@"
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 }
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 StartProgName()
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 {
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 "$@" & # Handle arguments with whitspaces
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 mypid=$! # Pid of last background process
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 echo "Waiting on $1: $@"
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 do
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 if xdotool search --onlyvisible --name $1; then
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 return 0
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
38 fi
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39 sleep 1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
42 }
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
71 # ### --- emacs --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
72 # StartProg emacs
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
73 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
74 # ### --- ding ---- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
75 # StartProg ding
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
76 # i3-msg border none
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
77 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
78 # # make right half bigger
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
79 # i3-msg resize grow left 16 px or 16 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
80 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
81 # # build container
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
82 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
83 # sleep 1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
84 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
85 # ### --- terminal --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
86 # StartProg rxvt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
87 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
88 # # Make Terminal bigger and Ding smaller
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
89 # i3-msg resize grow up 32 px or 32 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
90 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
91 # ### --------------------------------- tab START--- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
92 # ### ---------------------------------------------- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
93 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
94 # i3-msg layout tabbed
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
95 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
96 # ### --- gnome-commander --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
97 # StartProg gnome-commander
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
98 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
99 # ### --- chromium --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
100 # StartProg chromium
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
101 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
102 # ### --- pdf --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
103 # StartProg evince "~/Dokumente/Haskell/Haskell.pdf"
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
104 # ### ---------------------------------------------- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
105 # ### ---------------------------------- tab END --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
106 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
107 # ### --- new terminal left under emacs --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
108 # i3-msg focus left
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
109 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
110 # StartProg rxvt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
111 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
112 # # terminal without border and make it smaller
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
113 # i3-msg border none
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
114 # i3-msg resize shrink up 32 px or 32 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
115 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
128 exit 0

mercurial