.i3/auto-start

Fri, 13 Jun 2014 13:21:31 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 13 Jun 2014 13:21:31 -0400
changeset 51
f93e63d400b5
parent 43
958afe229467
child 55
fe505cd6be19
permissions
-rwxr-xr-x

no need to fork

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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
44 # ### --- emacs --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
45 # StartProg emacs
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
46 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
47 # ### --- ding ---- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
48 # StartProg ding
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
49 # i3-msg border none
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
50 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
51 # # make right half bigger
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
52 # i3-msg resize grow left 16 px or 16 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
53 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
54 # # build container
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
55 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
56 # sleep 1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
57 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
58 # ### --- terminal --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
59 # StartProg rxvt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
60 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
61 # # Make Terminal bigger and Ding smaller
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
62 # i3-msg resize grow up 32 px or 32 ppt
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
63 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
64 # ### --------------------------------- tab START--- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
65 # ### ---------------------------------------------- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
66 # i3-msg split v
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
67 # i3-msg layout tabbed
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
68 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
69 # ### --- gnome-commander --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
70 # StartProg gnome-commander
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
71 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
72 # ### --- chromium --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
73 # StartProg chromium
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
74 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
75 # ### --- pdf --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
76 # StartProg evince "~/Dokumente/Haskell/Haskell.pdf"
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
77 # ### ---------------------------------------------- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
78 # ### ---------------------------------- tab END --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
79 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
80 # ### --- new terminal left under emacs --- ###
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
81 # i3-msg focus left
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 # StartProg rxvt
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 without border and make it smaller
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
86 # i3-msg border none
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
87 # i3-msg resize shrink 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
29
c3e57b348ed2 Switch to urxvt, drop xmessage
Meredith Howard <mhoward@roomag.org>
parents: 1
diff changeset
90 StartProg urxvt
1
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
97
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
98 exit 0

mercurial