Last active
July 24, 2019 20:58
-
-
Save ryanj/672a55fd53f00b5752d972a7c46d506a to your computer and use it in GitHub Desktop.
my i3 window manager configuration (~/.config/i3/config)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# i3 config file (v4) | |
# | |
# Please see https://i3wm.org/docs/userguide.html for a complete reference! | |
# This config file will use environmental variables such as $BROWSER and $TERMINAL. | |
# You can set these variables in ~/.profile or ~/.bash_profile if you have it as below: | |
# | |
# export FILE="ranger" | |
# export TERMINAL="st" | |
# Primary modifier: Super | |
set $mod1 Mod4 | |
# Secondary modifier: Alt | |
set $mod2 Mod1 | |
# 3rd Mod key: | |
set $mod3 Control | |
# WARNING: this config assumes two xrandr displays (above/below) | |
# with a primary/internal display named "eDP-1" | |
set $disp1 eDP-1 | |
# #---Basic Definitions---# # | |
for_window [class="^.*"] border pixel 1 | |
#set $term --no-startup-id $TERMINAL | |
# #---Dropdown Windows---# # | |
# General dropdown window traits. The order can matter. | |
for_window [instance="dropdown_*"] floating enable | |
for_window [instance="dropdown_*"] move scratchpad | |
for_window [instance="dropdown_*"] sticky enable | |
for_window [instance="dropdown_*"] scratchpad show | |
for_window [instance="dropdown_tmuxdd"] resize set 625 450 | |
for_window [instance="dropdown_dropdowncalc"] resize set 800 300 | |
for_window [instance="dropdown_tmuxdd"] border pixel 3 | |
for_window [instance="dropdown_dropdowncalc"] border pixel 2 | |
for_window [instance="dropdown_*"] move position center | |
# 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 16 | |
# This font is widely installed, provides lots of unicode glyphs, right-to-left | |
# text rendering and scalability on retina/hidpi displays (thanks to pango). | |
# font pango:DejaVu Sans Mono 16 | |
font pango:DejaVu Sans Mono, Terminus Bold Semi-Condensed 6 | |
# Before i3 v4.8, we used to recommend this one as the default: | |
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 | |
# The font above is very space-efficient, that is, it looks good, sharp and | |
# clear in small sizes. However, its unicode glyph coverage is limited, the old | |
# X core fonts rendering does not support right-to-left and this being a bitmap | |
# font, it doesn’t scale on retina/hidpi displays. | |
# Use Mouse+$mod1 to drag floating windows to their wanted position | |
floating_modifier $mod1 | |
# start a terminal | |
#bindsym $mod1+Return exec i3-sensible-terminal | |
#bindsym $mod1+Return exec terminator | |
#bindsym $mod1+Return exec st | |
#bindsym $mod1+Return exec urxvt | |
bindsym $mod1+Return exec gnome-terminal | |
bindsym $mod1+n exec google-chrome | |
# kill focused window | |
bindsym $mod1+Shift+q kill | |
# lock screen | |
bindsym $mod1+q exec i3lock -c 000000 | |
# start dmenu (a program launcher) | |
bindsym $mod1+d exec dmenu_run | |
# There also is the (new) i3-dmenu-desktop which only displays applications | |
# shipping a .desktop file. It is a wrapper around dmenu, so you need that | |
# installed. | |
# bindsym $mod1+d exec --no-startup-id i3-dmenu-desktop | |
# change window focus within the current workspace | |
bindsym $mod1+h focus left | |
bindsym $mod1+j focus down | |
bindsym $mod1+k focus up | |
bindsym $mod1+l focus right | |
# alternatively, you can use the cursor keys: | |
bindsym $mod1+Left focus left | |
bindsym $mod1+Down focus down | |
bindsym $mod1+Up focus up | |
bindsym $mod1+Right focus right | |
# move the focused container (within the focused workspace) | |
bindsym $mod1+Shift+Left move left 30 | |
bindsym $mod1+Shift+Down move down 30 | |
bindsym $mod1+Shift+Up move up 30 | |
bindsym $mod1+Shift+Right move right 30 | |
bindsym $mod1+Shift+h move left 30 | |
bindsym $mod1+Shift+j move down 30 | |
bindsym $mod1+Shift+k move up 30 | |
bindsym $mod1+Shift+l move right 30 | |
## if you're using "i3-gaps" on Arch... | |
## mind the gaps? | |
#gaps inner 15 | |
#gaps outer 15 | |
#bindsym $mod1+y gaps outer current plus 5 | |
#bindsym $mod1+o gaps outer current minus 5 | |
#bindsym $mod1+u gaps inner current plus 5 | |
#bindsym $mod1+i gaps inner current minus 5 | |
#bindsym $mod1+Shift+z gaps inner current set 0; gaps outer current set 0 | |
#bindsym $mod1+z gaps inner current set 15; gaps outer current set 15 | |
# split in horizontal orientation | |
bindsym $mod1+t split h | |
# split in vertical orientation | |
bindsym $mod1+v split v | |
# enter fullscreen mode for the focused container | |
bindsym $mod1+f fullscreen toggle | |
# change container layout (stacked, tabbed, toggle split) | |
bindsym $mod1+s layout stacking | |
bindsym $mod1+w layout tabbed | |
bindsym $mod1+e layout toggle split | |
# toggle tiling / floating | |
bindsym $mod1+Shift+space floating toggle | |
# change focus between tiling / floating windows | |
bindsym $mod1+space focus mode_toggle | |
# focus the parent container | |
bindsym $mod1+a focus parent | |
# focus the child container | |
#bindsym $mod1+d 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" | |
# switch to workspace | |
bindsym $mod1+1 workspace $ws1 | |
bindsym $mod1+2 workspace $ws2 | |
bindsym $mod1+3 workspace $ws3 | |
bindsym $mod1+4 workspace $ws4 | |
bindsym $mod1+5 workspace $ws5 | |
bindsym $mod1+6 workspace $ws6 | |
bindsym $mod1+7 workspace $ws7 | |
bindsym $mod1+8 workspace $ws8 | |
bindsym $mod1+9 workspace $ws9 | |
bindsym $mod1+0 workspace $ws10 | |
# switch next / prev active workspace | |
bindsym $mod1+$mod2+h workspace prev | |
bindsym $mod1+$mod2+l workspace next | |
bindsym $mod1+$mod2+Left workspace prev | |
bindsym $mod1+$mod2+Right workspace next | |
# open next/prev workspace (active or inactive) | |
bindsym $mod1+$mod3+h exec "ws=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num-1'); if (test $ws -gt 0); then i3-msg workspace $ws; else i3-msg workspace 10; fi" | |
bindsym $mod1+$mod3+l exec i3-msg workspace $(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num'+1 | tail -c 2) | |
bindsym $mod1+$mod3+Left exec "ws=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num-1'); if (test $ws -gt 0); then i3-msg workspace $ws; else i3-msg workspace 10; fi" | |
bindsym $mod1+$mod3+Right exec i3-msg workspace $(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num'+1 | tail -c 2) | |
# move container to next/prev workspace (active or inactive) | |
bindsym $mod1+$mod3+Shift+h exec "ws=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num-1'); if (test ${ws} -gt 0); then i3-msg \\"move container to workspace $ws; workspace $ws\\"; else i3-msg \\"move container to workspace 10; workspace 10\\" ; fi" | |
bindsym $mod1+$mod3+Shift+Left exec "ws=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num-1'); if (test ${ws} -gt 0); then i3-msg \\"move container to workspace $ws; workspace $ws\\"; else i3-msg \\"move container to workspace 10; workspace 10\\" ; fi" | |
bindsym $mod1+$mod3+Shift+Right exec "ws=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num'+1 | tail -c 2); i3-msg \\"move container to workspace $ws; workspace $ws\\"" | |
bindsym $mod1+$mod3+Shift+l exec "ws=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).num'+1 | tail -c 2); i3-msg \\"move container to workspace $ws; workspace $ws\\"" | |
# move focused container to workspace | |
bindsym $mod1+Shift+1 move container to workspace $ws1; workspace $ws1 | |
bindsym $mod1+Shift+2 move container to workspace $ws2; workspace $ws2 | |
bindsym $mod1+Shift+3 move container to workspace $ws3; workspace $ws3 | |
bindsym $mod1+Shift+4 move container to workspace $ws4; workspace $ws4 | |
bindsym $mod1+Shift+5 move container to workspace $ws5; workspace $ws5 | |
bindsym $mod1+Shift+6 move container to workspace $ws6; workspace $ws6 | |
bindsym $mod1+Shift+7 move container to workspace $ws7; workspace $ws7 | |
bindsym $mod1+Shift+8 move container to workspace $ws8; workspace $ws8 | |
bindsym $mod1+Shift+9 move container to workspace $ws9; workspace $ws9 | |
bindsym $mod1+Shift+0 move container to workspace $ws10; workspace $ws0 | |
# move focused container to next / prev workspace | |
bindsym $mod1+$mod2+Shift+Left move container to workspace prev; workspace prev | |
bindsym $mod1+$mod2+Shift+h move container to workspace prev; workspace prev | |
bindsym $mod1+$mod2+Shift+Right move container to workspace next; workspace next | |
bindsym $mod1+$mod2+Shift+l move container to workspace next; workspace next | |
# toggle between the current and the previously focused workspace | |
bindsym $mod1+Tab workspace back_and_forth | |
# hold down shift to bring the focused container back to the prev workspace | |
bindsym $mod1+Shift+Tab move container to workspace back_and_forth; workspace back_and_forth | |
# swap focus between outputs | |
bindsym $mod1+$mod2+k focus output up | |
bindsym $mod1+$mod2+Up focus output up | |
bindsym $mod1+$mod2+j focus output down | |
bindsym $mod1+$mod2+Down focus output down | |
# move container to output | |
bindsym $mod1+$mod2+Shift+Down move container to output down; focus output down | |
bindsym $mod1+$mod2+Shift+Up move container to output up; focus output up | |
bindsym $mod1+$mod2+Shift+j move container to output down | |
bindsym $mod1+$mod2+Shift+k move container to output up | |
# move workspace to output | |
bindsym $mod1+$mod2+$mod3+Shift+Down move workspace to output down; focus output down | |
bindsym $mod1+$mod2+$mod3+Shift+Up move workspace to output up; focus output up | |
bindsym $mod1+$mod2+$mod3+Shift+j move workspace to output down | |
bindsym $mod1+$mod2+$mod3+Shift+k move workspace to output up | |
# reload the configuration file | |
bindsym $mod1+Shift+c reload | |
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) | |
bindsym $mod1+Shift+r restart | |
# exit i3 (logs you out of your X session) | |
bindsym $mod1+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'" | |
# Toggle between hide state and show state | |
bindsym $mod1+m bar hidden_state toggle | |
bindsym $mod1+b bar mode toggle | |
# Pin a window to the bottom left or right | |
bindsym $mod1+Shift+b floating toggle; sticky toggle; exec --no-startup-id hover left | |
bindsym $mod1+Shift+n floating toggle; sticky toggle; exec --no-startup-id hover right | |
# Single / mirrored output mode | |
bindsym $mod1+Shift+s exec "xrandr --output $disp1 --mode 1920x1080 --same-as $(xrandr | sed -ne 's/^\([A-Z]*-[0-9]\) [^d].*$/\1/p')" | |
# Dual monitor output (default) | |
# Position the native display (eDP-1) below the external output (detected by xrandr) | |
bindsym $mod1+Shift+d exec "xrandr --output $disp1 --auto --below $(xrandr | sed -ne 's/^\([A-Z]*-[0-9]\) [^d].*$/\1/p')" | |
# container resize bindings (no mode switch required) | |
bindsym $mod1+Shift+y resize shrink width 10 px or 10 ppt | |
bindsym $mod1+Shift+u resize shrink height 10 px or 10 ppt | |
bindsym $mod1+Shift+i resize grow height 10 px or 10 ppt | |
bindsym $mod1+Shift+o resize grow width 10 px or 10 ppt | |
# resize window (you can also use the mouse for that) | |
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 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 | |
# same bindings, but for the arrow keys | |
bindsym Left resize shrink width 10 px or 10 ppt | |
bindsym Down resize shrink height 10 px or 10 ppt | |
bindsym Up resize grow height 10 px or 10 ppt | |
bindsym Right resize grow width 10 px or 10 ppt | |
# back to normal: Enter or Escape or $mod1+r | |
bindsym Return mode "default" | |
bindsym Escape mode "default" | |
bindsym $mod1+r mode "default" | |
} | |
bindsym $mod1+r mode "resize" | |
# Start i3bar to display a workspace bar (plus the system information i3status | |
# finds out, if available) | |
bar { | |
status_command i3status | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment