.i3/auto-start

Mon, 02 Jun 2014 17:31:29 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 02 Jun 2014 17:31:29 -0400
changeset 22
96aa7ad42dfe
parent 1
727a469263f2
child 23
a61d6f99a162
child 29
c3e57b348ed2
permissions
-rwxr-xr-x

i3: prefer j4-dmenu-desktop if available

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 #
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 # xdotool and xmessage must be installed. On BSD use jot instead of
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 xmessage "Error on executing: $@" &
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41 xmessage "Error on executing: $@" &
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
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
90 StartProg xfce4-terminal
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
91
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
92 i3-msg 'split h'
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
93
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
94 StartProgName gvim
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
95
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
96 i3-msg 'focus left; split v'
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
97
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
98 StartProg xfce4-terminal
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
99
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
100 i3-msg 'resize shrink height 20 px or 20 ppt'
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
101
727a469263f2 Add dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
102 exit 0

mercurial