Skip to content

Commit 11a6809

Browse files
committed
Make i3 config work from any path
I do that to move it to .config/i3
1 parent 481a4e9 commit 11a6809

File tree

6 files changed

+26
-37
lines changed

6 files changed

+26
-37
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config

README.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,17 @@ It's as simple as that:
2424

2525
```bash
2626
cd
27-
git clone https://github.com/ivyl/i3-config.git .i3
28-
ln -s .i3/xinitrc .xinitrc
29-
ln -s .i3/gtkrc-2.0 .gtkrc-2.0
30-
ln -f $PWD/gtk-3.0-settings ~/.config/gtk-3.0/settings.ini
27+
git clone https://github.com/ivyl/i3-config.git .config/i3
28+
ln -s .config/i3/xinitrc .xinitrc
29+
ln -s .config/i3/gtkrc-2.0 .gtkrc-2.0
30+
ln -f .config/i3/gtk-3.0-settings ~/.config/gtk-3.0/settings.ini
3131
```
3232

3333
## Additional Features
3434
Udev folder contains udev rules and executables to be put under /opt
3535

36-
The rule makes use of `dockery.sh` and handles docking and undocking of
37-
Thinkpad's minidock.
38-
39-
`touch ~/.thinkpad_dock` to enable.
36+
config is created from config.base and config.local to allow for
37+
per-machine configuration
4038

4139

4240
## Bindings

bin/conky-wrapper

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
echo "{\"version\":1}"
33
echo "[[]"
4-
conky -c ~/.i3/conkyrc
4+
conky -c $I3_CONFIG_DIR/conkyrc 2>/dev/null

bin/i3-regenerate

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
cd $I3_CONFIG_DIR
4+
cat config.base config.local > config

config config.base

+2-22
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ font pango:Terminus 11px
55
new_window pixel 3
66
focus_follows_mouse no
77

8-
#don't move to neighbouring screen with hjkl
98
force_focus_wrapping yes
109

1110
set $gray1 #323232
@@ -15,65 +14,48 @@ client.focused $gray1 $gray1 #FFFFFF $gray1
1514
client.focused_inactive $gray2 $gray2 #FFFFFF #000000
1615
client.unfocused $gray2 $gray2 #FFFFFF #000000
1716

18-
# use Mouse+$mod to drag floating windows to their wanted position
1917
floating_modifier $mod
2018

21-
# start a terminal
2219
bindsym $mod+Return exec st
2320

24-
# kill focused window
2521
bindsym $mod+c kill
2622

27-
# start dmenu (a program launcher)
2823
bindsym $mod+p exec "dmenu_run -nb black -p run"
2924

3025
bindsym $mod+Shift+p exec "~/.bin/pass-autotype-dmenu"
3126

32-
# screen lock
3327
bindsym Control+$mod+l exec slimlock
3428

35-
# change focus
3629
bindsym $mod+h focus left
3730
bindsym $mod+j focus down
3831
bindsym $mod+k focus up
3932
bindsym $mod+l focus right
4033

41-
# move focused window
4234
bindsym $mod+Shift+h move left
4335
bindsym $mod+Shift+j move down
4436
bindsym $mod+Shift+k move up
4537
bindsym $mod+Shift+l move right
4638

47-
# split in horizontal orientation
4839
bindsym $mod+v split h
4940

50-
# split in vertical orientation
5141
bindsym $mod+g split v
5242

53-
# enter fullscreen mode for the focused container
5443
bindsym $mod+f fullscreen
5544

56-
# change container layout (tabbed, toggle split)
5745
bindsym $mod+n layout tabbed
5846
bindsym $mod+m layout toggle split
5947

60-
# container navigation
6148
bindsym $mod+d focus parent
6249
bindsym $mod+b focus child
6350

64-
# move container between displays
6551
bindsym $mod+semicolon move workspace to output right
6652

67-
# toggle tiling / floating
6853
bindsym $mod+Shift+f floating toggle
6954

70-
# change focus between tiling / floating windows
7155
bindsym $mod+space focus mode_toggle
7256

73-
# switch to last workspace
7457
bindsym $mod+6 workspace back_and_forth
7558

76-
# switch to workspace
7759
bindsym $mod+q workspace 1: q
7860
bindsym $mod+w workspace 2: w
7961
bindsym $mod+e workspace 3: e
@@ -84,7 +66,6 @@ bindsym $mod+u workspace 7: u
8466
bindsym $mod+i workspace 8: i
8567
bindsym $mod+o workspace 9: o
8668

87-
# move focused container to workspace
8869
bindsym $mod+Shift+q move container to workspace 1: q
8970
bindsym $mod+Shift+w move container to workspace 2: w
9071
bindsym $mod+Shift+e move container to workspace 3: e
@@ -105,7 +86,6 @@ mode "resize" {
10586
bindsym k resize shrink height 10 px or 10 ppt
10687
bindsym l resize grow width 10 px or 10 ppt
10788

108-
# back to normal: Enter or Escape or q or ^[
10989
bindsym Return mode "default"
11090
bindsym q mode "default"
11191
bindsym Escape mode "default"
@@ -114,7 +94,6 @@ mode "resize" {
11494

11595
bindsym $mod+s mode "resize"
11696

117-
# multimedia keys
11897
bindsym XF86AudioRaiseVolume exec "amixer -D pulse sset Master '3%+'"
11998
bindsym XF86AudioLowerVolume exec "amixer -D pulse sset Master '1%-'"
12099
bindsym XF86AudioMute exec "amixer -D pulse set Master toggle"
@@ -136,7 +115,7 @@ bindsym $mod+Shift+a exec "pavucontrol"
136115

137116
bar {
138117
position top
139-
status_command ~/.i3/bin/conky-wrapper
118+
status_command conky-wrapper
140119
colors {
141120
statusline #AAAAAA
142121
background $gray2
@@ -145,3 +124,4 @@ bar {
145124
}
146125
}
147126

127+
#include "config.local"

xinitrc

+12-6
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ if [ -d /etc/X11/xinit/xinitrc.d ]; then
77
unset f
88
fi
99

10+
export I3_CONFIG_DIR="$(dirname $(readlink -f $0))"
11+
1012
# so all binaries are visible in dmenu_run
11-
export PATH="$PATH:$HOME/.i3/bin:$HOME/.bin:$HOME/bin"
13+
export PATH="$PATH:$I3_CONFIG_DIR/bin:$HOME/.bin:$HOME/bin"
1214

1315
# logging in with dock
1416
lsusb | grep -q "ThinkPad Mini Dock"
15-
[ "$?" -eq 0 ] && $HOME/.i3/dockery.sh dock &
17+
[ "$?" -eq 0 ] && $I3_CONFIG_DIR/dockery.sh dock &
1618

1719
# use xresources
18-
xrdb -merge ~/.i3/xresources
20+
xrdb -merge $I3_CONFIG_DIR/xresources
1921

2022
# multiple screen setup
2123
[ -e ~/.screen_setup ] && source ~/.screen_setup
@@ -30,34 +32,38 @@ unclutter -root -visible &
3032
start-pulseaudio-x11
3133

3234
# keyboard layout
33-
xmodmap ~/.i3/xmodmap
35+
xmodmap $I3_CONFIG_DIR/xmodmap
3436
[ -e ~/.xmodmap_local ] && xmodmap ~/.xmodmap_local
3537

3638
# color temperature adjustment, set for Gdańsk
3739
redshift -l 54.35:18.65 -m randr -t 5500:4500 -g 0.75:0.75:0.75 &
3840

3941
# notification
40-
dunst -config ~/.i3/dunstrc &
42+
dunst -config $I3_CONFIG_DIR/dunstrc &
4143

4244
# disks automounting
4345
udiskie &
4446

4547
# dropbox
4648
[ -e /usr/bin/dropboxd ] && /usr/bin/dropboxd &
4749

50+
# trackball
51+
xinput set-prop "Primax Kensington Eagle Trackball" "Evdev Middle Button Emulation" 1
52+
4853
# gpg agent
4954
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
5055
gpg-connect-agent updatestartuptty /bye
5156

5257
# composition manager
53-
compton --config ~/.i3/compton.conf &
58+
compton --config $I3_CONFIG_DIR/compton.conf &
5459

5560
# Network Manager applet
5661
>> /dev/null which nm-applet && nm-applet &
5762
>> /dev/null which blueman--applet && blueman-applet &
5863

5964
xcape
6065

66+
i3-regenerate
6167
i3
6268

6369
true

0 commit comments

Comments
 (0)