Mon, 26 May 2014 21:55:25 -0400
more
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 | # | |
6 | # xdotool and xmessage must be installed. On BSD use jot instead of | |
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 | |
26 | xmessage "Error on executing: $@" & | |
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 | |
41 | xmessage "Error on executing: $@" & | |
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 | ||
90 | StartProg xfce4-terminal | |
91 | ||
92 | i3-msg 'split h' | |
93 | ||
94 | StartProgName gvim | |
95 | ||
96 | i3-msg 'focus left; split v' | |
97 | ||
98 | StartProg xfce4-terminal | |
99 | ||
100 | i3-msg 'resize shrink height 20 px or 20 ppt' | |
101 | ||
102 | exit 0 |