about summary refs log tree commit diff
path: root/configs/shared/misc/.config/i3/config.shared
blob: b39b634704dcaf6ad1ac34a94053a4cf3f8e61ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# Keymapping philosophy:
# When I feel it's appropriate, I try to borrow existing KBDs from OSX or
# Windows. For example, I use Ctrl+Alt+Del to start the screen lock, since this
# is a really well-known KBD. One notable difference is that when I'm borrowing
# OSX KBDs, I prefer using Alt instead of Super since the keyboard that I'm
# using has the Alt key in the same location as the Super key on my mac
# keyboard. I could rebind this, and I just may. But for now, that's worth
# pointing out.
# The reason behind borrowing from Windows and OSX is that some of these
# keybindings are hardwired into my muscle memory. I also tend to work between
# Linux and OSX quite often. Since OSX is much more difficult to remap KBDs
# than it is in Linux, I prefer to support the OSX KBDs to reduce the number of
# KBDs my feeble memory needs to store.

set $mod Mod1
set $super Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# i3-gaps (depends on i3-gaps installation)
gaps inner 20
gaps outer 0
smart_gaps on

bindsym $mod+Ctrl+plus   gaps outer current plus  5
bindsym $mod+Ctrl+minus  gaps outer current minus 5
bindsym $mod+Shift+plus  gaps inner current plus  5
bindsym $mod+Shift+minus gaps inner current minus 5

# KBD Principles:
# $mod+Ctrl+<app_char>       = starting an application
# where <app_char> is a reserved character for a commonly used application.
#
# <app_char> definitions:
# terminal = t, Return
# emacs    = e
# chrome   = c
# spotify  = s
# intellij = i
#
# Vertical
bindsym $mod+Ctrl+t      exec st
bindsym $mod+Ctrl+Return exec st
bindsym $mod+Ctrl+e      exec emacsclient --create-frame ~/programming
bindsym $mod+Ctrl+c      exec google-chrome
bindsym $mod+Ctrl+s      exec spotify
bindsym $mod+Ctrl+i      exec zsh -i -c intellij

# support dmenu-based bookmarks
bindsym $mod+Ctrl+b exec dmenu <$DOTFILES/bookmarks.txt | xargs $BROWSER

bindsym $mod+Return exec st

# pass integration
bindsym $mod+Ctrl+backslash exec ~/.config/i3/passmenu # mirroring the 1password KBD

# integrate with Emacs's org-mode
bindsym $mod+o exec zsh -i -c org_capture
for_window [class="GoogleEmacs" instance="org-protocol-capture"] floating enable

# ensure Spotify windows float
for_window [class="Spotify"] floating enable

# ensure `lf` instances float
for_window [title="lf"] floating enable

# ensure wallpaper
exec --no-startup-id feh --bg-scale ~/.local/share/wallpaper/cartoon-outdoors.jpg

# ensure system service that run through XDG start
exec dex -ae i3

# dmenu configuration
bindsym $mod+space exec --no-startup-id dmenu_run
bindsym $mod+t exec --no-startup-id ~/.config/i3/dmenu_timer.sh ~/.local/share/sounds/gong.mp3

# file manager
bindsym $mod+n exec st -e lf ~/Dropbox

# clipboard manager
# NOTE: Ctrl-c is already covered since `clipmenu` listens for X clipboard
# events using `clipnotify`.
# NOTE: `clipmenud` is started in `.xsessionrc.shared`
# NOTE: This is a bit of a hack intended to support pasting in both the terminal
# and in GUI applications. `st` expects `ctrl+Shift+v` while GUIs expect
# `ctrl+v`. In the instances where GUIs don't support `ctrl+Shift+v` already, it
# acts like `ctrl+v`, so it should "just work".
bindsym Ctrl+$mod+v exec clipmenu && xdotool key --clearmodifiers ctrl+Shift+v

# Screenshot
# TODO: find a better KBD for this
bindsym $mod+s exec zsh -i -c snipit # note that this eclipses Tmux's M-s KBD for switching b/w session
bindsym Ctrl+Print   exec scrot ~/Pictures/screenshots/%b-%d-%Y_%T.png # Windows style
# TODO: debug
# bindsym $mod+Print   exec scrot --focused ~/Pictures/screenshots/%b-%d-%Y_%T.png # Windows style

# online documentation
bindsym $mod+Shift+slash exec google-chrome https://i3wm.org/docs/userguide.html

# no title bars
for_window [class="^.*"] border pixel 2

# disable mouse hover focus
focus_follows_mouse no

# kill focused window
bindsym $mod+q kill

# GTK Themes
exec --no-startup-id gnome-settings-daemon

# wireless selection mechanism
exec --no-startup-id nm-applet

# set the split direction
bindsym $mod+v split vertical
# cannot bind $mod+h because of movement commands
bindsym $mod+Shift+v split horizontal

# lock the screen (Window's famous Ctrl-Alt-Delete)
bindsym $mod+Ctrl+Delete exec xsecurelock
bindsym $mod+Shift+q     exec xsecurelock

# sound applet
exec --no-startup-id gnome-sound-applet

# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

# move focused window
bindsym $mod+Shift+h move left  100
bindsym $mod+Shift+j move down  100
bindsym $mod+Shift+k move up    100
bindsym $mod+Shift+l move right 100

# enable duplicating the current window vertically or horizontally
# bindsym $mod+- split v exec terminator
# bindsym $mod+\ split h exec terminator

# enter fullscreen mode for the focused container
bindsym $mod+z fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $super+e layout toggle split
bindsym $super+s layout stacking
bindsym $super+t layout tabbed

# toggle tiling / floating
bindsym $mod+Shift+f floating toggle

# toggle stickiness
bindsym $mod+Shift+s sticky toggle

# change focus between tiling / floating windows
bindsym $mod+f focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent
bindsym $mod+Shift+a focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1  "1"
set $ws2  "2"
set $ws3  "3"
set $ws4  "4"
set $ws5  "5"
set $ws6  "6"
set $ws7  "7"
set $ws8  "8"
set $ws9  "9"
set $ws10 "10"

# jump to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move and follow focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1;  workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2;  workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3;  workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4;  workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5;  workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6;  workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7;  workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8;  workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9;  workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10; workspace $ws10

# move focused container to workspace
bindsym $mod+Ctrl+1 move container to workspace $ws1
bindsym $mod+Ctrl+2 move container to workspace $ws2
bindsym $mod+Ctrl+3 move container to workspace $ws3
bindsym $mod+Ctrl+4 move container to workspace $ws4
bindsym $mod+Ctrl+5 move container to workspace $ws5
bindsym $mod+Ctrl+6 move container to workspace $ws6
bindsym $mod+Ctrl+7 move container to workspace $ws7
bindsym $mod+Ctrl+8 move container to workspace $ws8
bindsym $mod+Ctrl+9 move container to workspace $ws9
bindsym $mod+Ctrl+0 move container to workspace $ws10

# reload, restart i3
bindsym $super+r       exec cat ~/.config/i3/config.shared ~/.config/i3/config.device >~/.config/i3/config; reload
bindsym $super+Shift+r exec cat ~/.config/i3/config.shared ~/.config/i3/config.device >~/.config/i3/config; restart


# resize window (you can also use the mouse for that)
mode "resize" {
        bindsym h resize shrink width  10 px or 10 ppt
        bindsym j resize shrink height 10 px or 10 ppt
        bindsym k resize grow   height 10 px or 10 ppt
        bindsym l resize grow   width  10 px or 10 ppt
        bindsym Return       mode "default"
        bindsym Caps_Lock    mode "default"
        bindsym $mod+Shift+r mode "default"
}
bindsym $mod+Shift+r mode "resize"

# passthrough mode to support Emacs, Tmux, Vim KBDs for window and pane management
mode "passthrough" {
     bindsym $mod+Escape mode "default"
}
bindsym $mod+Escape mode "passthrough"

# Atom One Dark colors
set $black          #1e2127
set $red            #e06c75
set $green          #98c379
set $yellow         #d19a66
set $blue           #61afef
set $magenta        #c678dd
set $cyan           #56b6c2
set $white          #abb2bf
set $bright_black   #5c6370
set $bright_red     #e06c75
set $bright_green   #98c379
set $bright_yellow  #d19a66
set $bright_white   #ffffff
set $bright_blue    #61afef
set $bright_magenta #c678dd
set $bright_cyan    #56b6c2
set $selection      #3a3f4b

# class                 # border    # bg # text #indicator #child_border
client.focused          $red        $red $red   $magenta   $bright_cyan
client.focused_inactive $red        $red $red   $magenta   $black
client.unfocused        $red        $red $red   $magenta   $black

bar {
    status_command i3status
    position top
    # disable system tray icons
    tray_output none
    colors {
           background $black
           statusline $white
           separator  $yellow
           focused_workspace  $black $black $bright_cyan
           active_workspace   $red $bright_blue $blue
           inactive_workspace $black $black $bright_black
           urgent_workspace   $magenta $black $magenta
    }
}