.i3/auto-start

Mon, 12 Jun 2017 17:20:38 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 12 Jun 2017 17:20:38 -0400
changeset 601
c1615fda063a
parent 377
7190350f2ab3
child 821
013f5efa8f2d
permissions
-rwxr-xr-x

smarter jk maps

377
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
1 #!/bin/sh
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 # Simple autostart file for i3-wm, you can execute it from i3 config with
377
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
3 # exec $HOME/.i3/auto-start
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 #
43
958afe229467 just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents: 29
diff changeset
5 # 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
6 # seq or install seq from ports.
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 # Max seconds to wait until the process is up
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 MAXWAIT=10
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 # Start the given command and wait until it's visible
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 StartProg()
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 {
377
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
14 "$@" & # Handle arguments with whitspaces
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
15 mypid=$! # Pid of last background process
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
16 echo "Waiting on ${mypid}: $@"
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
17 for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
18 do
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
19 if xdotool search --onlyvisible --pid $mypid; then
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
20 return 0
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
21 fi
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
22 sleep 1
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
23 done
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
24 notify-send "Error on executing: $@"
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 }
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 StartProgName()
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 {
377
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
29 "$@" & # Handle arguments with whitspaces
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
30 mypid=$! # Pid of last background process
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
31 echo "Waiting on $1: $@"
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
32 for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
33 do
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
34 if xdotool search --onlyvisible --name $1; then
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
35 return 0
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
36 fi
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
37 sleep 1
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
38 done
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
39 notify-send "Error on executing: $@"
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
40 }
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41
55
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
42 WaitProgName()
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
43 {
377
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
44 echo "Waiting on $1"
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
45 for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
46 do
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
47 if xdotool search --onlyvisible --name $1; then
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
48 return 0
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
49 fi
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
50 sleep 1
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
51 done
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
52 notify-send "Error waiting on $1: $@"
55
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
53 }
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
54
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
55 WaitClassName()
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
56 {
377
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
57 echo "Waiting on window class $1"
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
58 for i in `seq $MAXWAIT` # count from 1 to MAXWAIT
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
59 do
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
60 if xdotool search --onlyvisible --class $1; then
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
61 return 0
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
62 fi
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
63 sleep 1
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
64 done
7190350f2ab3 reformat
Meredith Howard <mhoward@roomag.org>
parents: 55
diff changeset
65 notify-send "Error waiting on $1: $@"
55
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
66 }
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
67
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
68
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
69 # ### --- emacs --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
70 # StartProg emacs
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
71 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
72 # ### --- ding ---- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
73 # StartProg ding
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
74 # i3-msg border none
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
75 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
76 # # make right half bigger
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
77 # i3-msg resize grow left 16 px or 16 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
78 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
79 # # build container
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
80 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
81 # sleep 1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
82 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
83 # ### --- terminal --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
84 # StartProg rxvt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
85 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
86 # # Make Terminal bigger and Ding smaller
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
87 # i3-msg resize grow up 32 px or 32 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
88 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
89 # ### --------------------------------- tab START--- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
90 # ### ---------------------------------------------- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
91 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
92 # i3-msg layout tabbed
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
93 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
94 # ### --- gnome-commander --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
95 # StartProg gnome-commander
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
96 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
97 # ### --- chromium --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
98 # StartProg chromium
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
99 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
100 # ### --- pdf --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
101 # StartProg evince "~/Dokumente/Haskell/Haskell.pdf"
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
102 # ### ---------------------------------------------- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
103 # ### ---------------------------------- tab END --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
104 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
105 # ### --- new terminal left under emacs --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
106 # i3-msg focus left
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
107 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
108 # StartProg rxvt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
109 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
110 # # terminal without border and make it smaller
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
111 # i3-msg border none
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
112 # i3-msg resize shrink up 32 px or 32 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
113 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
114
55
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
115 # StartProg urxvt
43
958afe229467 just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents: 29
diff changeset
116 # i3-msg 'split h'
958afe229467 just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents: 29
diff changeset
117 # StartProgName gvim
958afe229467 just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents: 29
diff changeset
118 # i3-msg 'focus left; split v'
958afe229467 just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents: 29
diff changeset
119 # StartProg urxvt
958afe229467 just urxvt. use notify-send
Meredith Howard <mhoward@roomag.org>
parents: 29
diff changeset
120 # i3-msg 'resize shrink height 20 px or 20 ppt'
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
121
55
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
122 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
123 . .i3/auto-start.local
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
124 fi
fe505cd6be19 Add some funcs, hand off to auto-start.local
Meredith Howard <mhoward@roomag.org>
parents: 51
diff changeset
125
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
126 exit 0

mercurial