Skip to content

Instantly share code, notes, and snippets.

@vterdunov
Last active May 25, 2019 10:19
Show Gist options
  • Save vterdunov/bcd095171742a5b23e46c6b855623f53 to your computer and use it in GitHub Desktop.
Save vterdunov/bcd095171742a5b23e46c6b855623f53 to your computer and use it in GitHub Desktop.
i3wm config
# ------------------------------------------------------------
# GENERAL
# ------------------------------------------------------------
set $mod Mod4
set $terminal terminator
set $primary_display DP1
set $secondary_display HDMI3
set $bw 2
# font
font pango: Sans 10
focus_follows_mouse no
popup_during_fullscreen smart
workspace_auto_back_and_forth yes
force_display_urgency_hint 0 ms
focus_on_window_activation urgent
for_window [urgent=latest] focus
new_window pixel $bw
new_float pixel $bw
# windows style
new_window pixel 2
new_float normal
hide_edge_borders none
for_window [class="^.*"] border pixel 2
gaps inner 7
gaps outer 5
### Borders for full windows
# smart_gaps on
# smart_borders on
# scratchpad
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
# drag windows
floating_modifier $mod
# ------------------------------------------------------------
# KEYBINDINGS
# ------------------------------------------------------------
# start a terminal
bindsym $mod+Return exec $terminal
# close focused window
bindsym $mod+Shift+q kill
# start menu (a program launcher)
bindsym $mod+d exec i3-dmenu-desktop --dmenu='rofi -dmenu -i'
# start rofi (window mode)
bindsym $mod+Tab exec rofi -show window -width 50 -padding 50
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split
bindsym $mod+b split h; exec --no-startup-id notify-send --expire-time=400 'Vertical split'
bindsym $mod+v split v; exec --no-startup-id notify-send --expire-time=400 'Horizontal split'
# fullscreen toggle
bindsym $mod+f fullscreen toggle
# container layout
bindsym $mod+s layout stacking; exec notify-send --expire-time=1000 'Stacking'
bindsym $mod+w layout tabbed; exec notify-send --expire-time=1000 'Tabbed'
bindsym $mod+e layout toggle split; exec --no-startup-id notify-send --expire-time=1000 'Toggle split'
bindsym $mod+Shift+s sticky toggle;exec notify-send --expire-time=1000 'Toggle sticky'
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# screenshot
bindsym --release $mod+Print exec "scrot '/tmp/scrot.png' --select -e 'xclip -selection clipboard -target image/png < $f'"
# jump to urgent window
bindsym $mod+x [urgent=latest] focus
# focus the child container
#bindsym $mod+d focus child
bindsym XF86AudioRaiseVolume exec amixer -q -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks
bindsym XF86AudioLowerVolume exec amixer -q -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks
bindsym XF86AudioMute exec amixer -q -D pulse sset Master toggle && pkill -RTMIN+1 i3blocks
# ------------------------------------------------------------
# WORKSPACES
# ------------------------------------------------------------
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 "
# switch 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 focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# lock
bindsym $mod+F5 exec --no-startup-id xset dpms force off && i3lock -n -e -f -t
# bindsym $mod+F5 exec --no-startup-id xset dpms force off && ~/.config/i3/scripts/lock
# ------------------------------------------------------------
# RESIZE
# ------------------------------------------------------------
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Move focused workspace to monitor
bindsym $mod+Shift+bracketleft move workspace to output left
bindsym $mod+Shift+bracketright move workspace to output right
# ------------------------------------------------------------
# COLORS
# ------------------------------------------------------------
set $bg-color #2f343f
set $inactive-bg-color #2f343f
set $urgent-bg-color #5294e2
set $border-color #b4b7b4
set $inactive-border-color #676e7d
set $text-color #f3f4f5
set $inactive-text-color #676e7d
# Property Name Border Background Text Indicator Child_border
client.focused $border-color $border-color $bg-color $border-color
client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color $border-color
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color $border-color
client.urgent $urgent-bg-color $urgent-bg-color $text-color $border-color
# Start bar
bar {
status_command SCRIPT_DIR=~/.config/i3blocks/blocklets i3blocks -c ~/.config/i3/i3blocks.conf
tray_output $secondary_display
position top
font pango: Silkscreen 11
colors {
background $bg-color
separator #757575
# border background text
focused_workspace $border-color $border-color $bg-color
active_workspace $bg-color $bg-color $text-color
inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
urgent_workspace $urgent-bg-color $urgent-bg-color $text-color
}
}
# ------------------------------------------------------------
# WINDOWS RULES
# ------------------------------------------------------------
for_window [window_type="dialog,utility,toolbar,splash,menu,dropdown_menu,popup_menu,tooltip,notification,dock"] floating enable border pixel 1
for_window [window_role="prefwindow"] floating enable
for_window [class="notify"] floating enable border pixel 1
for_window [window_role="pop-up"] floating enable,move absolute center
for_window [class="Skype"] floating enable, border normal, resize set 1000 1200, move scratchpad, scratchpad show, move container to workspace $ws4
for_window [class="Telegram"] floating enable border normal, resize set 1000 1200;
for_window [class="Slack"] floating enable border normal
for_window [class="Lxappearance"] floating enable border normal
for_window [class="Xfce4-taskmanager"] floating enable border normal
for_window [class="(?i)virtualbox"] floating enable border normal
for_window [class="Thunderbird" instance="Mail"] floating enable, border normal, focus
for_window [class="Thunderbird"] move scratchpad, scratchpad show
for_window [class="Xfce4-screenshooter"] floating enable, border normal, move container to workspace back_and_forth
for_window [class="Terminator" title="^Terminator Preferences$"] floating enable, border normal
for_window [class=".*"] title_format "[<b>%class</b>] %title"
# default workspaces
assign [class="Google-chrome|Firefox"] $ws2
assign [class="Thunderbird"] $ws3
assign [class="Slack"] $ws3
assign [class="Telegram"] $ws4
assign [class="Skype"] $ws4
assign [class="Thunar"] $ws6
# workspace default monitors
workspace $ws1 output $primary_display
workspace $ws2 output $secondary_display
workspace $ws3 output $secondary_display
workspace $ws4 output $primary_display
workspace $ws5 output $secondary_display
workspace $ws6 output $primary_display
workspace $ws7 output $primary_display
workspace $ws8 output $primary_display
workspace $ws9 output $primary_display
workspace $ws10 output $secondary_display
# ------------------------------------------------------------
# STARTUP
# ------------------------------------------------------------
exec --no-startup-id xset s off -dpms &
exec --no-startup-id xset b 0 0 0 &
# exec --no-startup-id xrandr --output HDMI3 --mode 2560x1440 --dpi 120 --pos 0x0 --rotate normal --output DP1 --mode 2560x1440 --dpi 120 --pos 2560x0 --primary
exec --no-startup-id xrandr --output DP1 --dpi 120 --right-of HDMI3 --auto
exec --no-startup-id compton --config ~/.config/compton/compton.conf -b
exec --no-startup-id nm-applet
exec --no-startup-id skype
exec --no-startup-id slack
exec --no-startup-id ~/Apps/Telegram/Telegram
exec --no-startup-id thunar
exec --no-startup-id fluxgui
exec --no-startup-id google-chrome
exec --no-startup-id thunderbird
exec_always --no-startup-id numlockx on
exec_always --no-startup-id xrdb -load ~/.Xresources
exec_always --no-startup-id ~/.config/i3/scripts/lock -w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment