about summary refs log blame commit diff
path: root/configs/shared/.config/i3/config
blob: e52bf23b3d9689bb85ac4f7f3508db529088bd83 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                               
             
                     
               

                           
 
                                                                              

                                 



                                                                  
                                           
















                                                                                             

                 
                                                      






                                                                           
              





                                                   
 
                               
                                                                                
 










                                                             
 


                                                                                    

                                         














                                                                                                                         
 


                                            
                                                  
                               
 






                                                                                                  

              
                                             
 



                                                                          




                                                                                
 
            











                                                            

                      
                                                                           

               
                                       




                           



                                 
 





                                          




                                                 


                                       
              



                             

                     



                                   
 
                                                 
                                   

                                                         


                                    

                          



                                    
 
                            
                             
                                


                                                                                   








             

              
                   










                              












                                                         


                                                                      

                                                                      





                                                                       
 












                                                     

                                                                                                                   
 















                                                                                                        


                                                     
                                                      
                                                      

                                                      



                                     
 
                                  





                                                                                  
 






                                                                              


                           
                             
                

                               
            







                                                             
     



                                            
# 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 $window Mod1+Ctrl
set $super Mod4
set $terminal terminator
set $browser  google-chrome

# 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 10px

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

# i3-gaps (depends on i3-gaps installation)
# gaps inner 7
# 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

# Support XF86 keys for audio playback and volume control
bindsym XF86AudioMute        exec --no-startup-id pactl set-sink-mute   @DEFAULT_SINK@ toggle
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10%
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10%
bindsym XF86AudioPrev        exec --no-startup-id playerctl previous
bindsym XF86AudioNext        exec --no-startup-id playerctl next
bindsym XF86AudioStop        exec --no-startup-id playerctl play-pause
bindsym XF86AudioPlay        exec --no-startup-id playerctl play-pause

# 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
bindsym $mod+Ctrl+t exec $terminal
bindsym $mod+Return exec $terminal
bindsym $mod+Ctrl+e exec emacsclient --create-frame
bindsym $mod+Ctrl+c exec $browser
bindsym $mod+Ctrl+s exec spotify
bindsym $mod+Ctrl+i exec zsh -i -c intellij

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

set $bookmarks_mode Bookmarks (a) add, (d) delete, (b) browse
mode "$bookmarks_mode" {
     bindsym a exec zsh -i -c add_bookmark,  mode "default"
     bindsym d exec zsh -i -c rm_bookmark,   mode "default"
     bindsym b exec zsh -i -c open_bookmark, mode "default"

     bindsym Escape mode "default"
     bindsym Ctrl+g mode "default"
     bindsym Ctrl+c mode "default"
}
bindsym $mod+Ctrl+b mode "$bookmarks_mode"

# 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
# TODO: Support "coding size", "dialog-size" (for org_capture)
# TODO: Support way to cycle through predefined sizes.
for_window [class="GoogleEmacs" instance="floating"] floating enable, resize set height 1200px, resize set width 780px

# Here is a sketch of the cycle sizes idea.
# TODO: Support this.
# mode "cycle_sizes_floating_mode" {
#      # coding mode
#      bindsym a for_window [mode="floating", class="actively-selected"] resize set height 1200px, resize set width 780px
#      bindsym b for_window [mode="floating", class="actively-selected"] resize set height 500px, resize set width 500px
#
#      bindsym Escape mode "default"
#      bindsym Ctrl+g mode "default"
#      bindsym Ctrl+c mode "default"
# }

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

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

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

# switch workspaces
bindsym $mod+Tab       workspace next
bindsym $mod+Shift+Tab workspace prev

# file manager
bindsym $mod+n exec $terminal -x 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: Support variants: (a) App (r) Region (f) Fullscreen.
# TODO: Support hosting to third-party image hosting.
set $screenshot_mode Screenshot (g) googleplex (l) local
mode "$screenshot_mode" {
     bindsym g exec zsh -i -c snipit,     mode "default"
     bindsym l exec zsh -i -c screenshot, mode "default"

     bindsym Escape mode "default"
     bindsym Ctrl+g mode "default"
     bindsym Ctrl+c mode "default"
}
bindsym $mod+s mode "$screenshot_mode"

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

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

# disable mouse hover focus
focus_follows_mouse no

# kill focused window
bindsym $window+q kill

# Toggle focus
bindsym $window+f floating toggle

# 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

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

# change focus
bindsym $window+h focus left
bindsym $window+j focus down
bindsym $window+k focus up
bindsym $window+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

# enter fullscreen mode for the focused container
bindsym $window+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

# 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

# edit configuration files
# TODO: Standardize KBDs for C,R,U,D operations.
# TODO: Move shell script to /usr/local/bin
# Create
# TODO: Choose another KBD. This is temporary.
bindsym $mod+a       exec zsh -i -c add_config
# Read
bindsym $mod+c       exec zsh -i -c edit_config
# Update
# TODO: Support operation to update_config label and path
# Delete
bindsym $mod+Shift+c exec zsh -i -c rm_config

# 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

# logout dialog
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
    bindsym l       exec --no-startup-id xsecurelock,                        mode "default"
    bindsym e       exit,                                                    mode "default"
    bindsym s       exec --no-startup-id xsecurelock && systemctl suspend,   mode "default"
    bindsym h       exec --no-startup-id xsecurelock && systemctl hibernate, mode "default"
    bindsym r       exec --no-startup-id systemctl reboot,                   mode "default"
    bindsym Shift+s exec --no-startup-id systemctl poweroff,                 mode "default"

    # back to normal: Enter or Escape
    bindsym Escape mode "default"
    bindsym Ctrl+g mode "default"
    bindsym Ctrl+c mode "default"
}
bindsym Ctrl+Mod1+Delete mode "$mode_system"

# 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 Escape mode "default"
        bindsym Ctrl+g mode "default"
        bindsym Ctrl+c 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"

# class                 border     backgr     text      indicator child_border
client.focused          #83526a   #83526a   #8de0e1 #E8C35F  #83526a
client.focused_inactive #83526a   #83526a   #8de0e1 #E8C35F  #5a3849
client.unfocused        #5a3849 #5a3849 #8de0e1 #E8C35F  #5a3849
client.urgent           #E8C35F   #E8C35F   #8de0e1 #E8C35F  #E8C35F
client.placeholder      #31213f   #629c9d   #8de0e1 #31213f  #629c9d
client.background       #31213f

bar {
    status_command i3status
    font pango:Monospace 10px
    position top
    # disable system tray icons
    tray_output none
    colors {
           background #31213f
           statusline #83526a # text color in status line
           separator  #83526a
           # class            border     text       indicator
           focused_workspace  #83526a   #8de0e1  #31213f
           active_workspace   #83526a   #5a3849 #83526a
           inactive_workspace #5a3849 #83526a   #5a3849
           urgent_workspace   #5a3849 #83526a   #5a3849
    }
}

# wpg integration
exec --no-startup-id ~/.config/wpg/wp_init.sh