Skip to content

Instantly share code, notes, and snippets.

@navakelvin
Forked from Dobbie03/i3 config
Created October 7, 2022 23:45
Show Gist options
  • Save navakelvin/829ffbcad9a1afcf2f637d340c2c0d15 to your computer and use it in GitHub Desktop.
Save navakelvin/829ffbcad9a1afcf2f637d340c2c0d15 to your computer and use it in GitHub Desktop.

Revisions

  1. Matt created this gist Dec 1, 2017.
    325 changes: 325 additions & 0 deletions i3 config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,325 @@

    set_from_resource $color15_i3wmthemer color15
    set_from_resource $color14_i3wmthemer color14
    set_from_resource $color13_i3wmthemer color13
    set_from_resource $color12_i3wmthemer color12
    set_from_resource $color11_i3wmthemer color11
    set_from_resource $color10_i3wmthemer color10
    set_from_resource $color09_i3wmthemer color9
    set_from_resource $color08_i3wmthemer color8
    set_from_resource $color07_i3wmthemer color7
    set_from_resource $color06_i3wmthemer color6
    set_from_resource $color05_i3wmthemer color5
    set_from_resource $color04_i3wmthemer color4
    set_from_resource $color03_i3wmthemer color3
    set_from_resource $color02_i3wmthemer color2
    set_from_resource $color01_i3wmthemer color1
    set_from_resource $color00_i3wmthemer color0
    set_from_resource $foreground_i3wmthemer foreground
    set_from_resource $background_i3wmthemer background

    #########################################
    ### KEY DEFINITIONS ####
    #########################################
    ## $Mod = Super key or Mod4 ##
    ## Mod1 = ALT key ##
    ## Control = CTRL key ##
    ## Shift = SHIFT key ##
    ## Escape = ESCAPE key ##
    ## Return = ENTER or RETURN key ##
    ## Pause = PAUSE key ##
    ## Print = PRINT key ##
    ## Tab = TAB key ##
    #########################################

    ####################################################################################################
    ################# colors ##################
    ####################################################################################################

    # font
    font pango:Ubuntu Regular 10

    # class border backgr. text indicator
    client.focused $foreground_i3wmthemer $background_i3wmthemer $foreground_i3wmthemer $background_i3wmthemer $background_i3wmthemer
    client.focused_inactive $foreground_i3wmthemer $background_i3wmthemer $foreground_i3wmthemer $background_i3wmthemer $background_i3wmthemer
    client.unfocused $foreground_i3wmthemer $background_i3wmthemer $foreground_i3wmthemer $background_i3wmthemer $background_i3wmthemer
    client.urgent $foreground_i3wmthemer $background_i3wmthemer $foreground_i3wmthemer $background_i3wmthemer $background_i3wmthemer
    client.background $background_i3wmthemer


    ####################################################################################################
    ################# Define variables #################
    ####################################################################################################

    #set Super or Alt key
    set $mod Mod4
    #set $mod Mod1

    # vim directional keys
    set $up l
    set $down k
    set $left j
    set $right semicolon

    ####################################################################################################
    ################# Define Workspaces and screens #################
    ####################################################################################################

    # monitors
    set $firstMonitor DisplayPort-0
    set $secondMonitor HDMI-A-0

    workspace 1 output $firstMonitor
    workspace 2 output $firstMonitor
    workspace 3 output $firstMonitor
    workspace 4 output $firstMonitor
    workspace 5 output $firstMonitor
    workspace 6 output $secondMonitor
    workspace 7 output $secondMonitor
    workspace 8 output $secondMonitor
    workspace 9 output $secondMonitor
    workspace 10 output $secondMonitor

    # switch to workspace
    bindsym $mod+1 workspace 1
    bindsym $mod+2 workspace 2
    bindsym $mod+3 workspace 3
    bindsym $mod+4 workspace 4
    bindsym $mod+5 workspace 5
    bindsym $mod+6 workspace 6
    bindsym $mod+7 workspace 7
    bindsym $mod+8 workspace 8
    bindsym $mod+9 workspace 9
    bindsym $mod+0 workspace 10

    # move focused container to workspace
    bindsym $mod+Shift+1 move container to workspace 1; workspace 1
    bindsym $mod+Shift+2 move container to workspace 2; workspace 2
    bindsym $mod+Shift+3 move container to workspace 3; workspace 3
    bindsym $mod+Shift+4 move container to workspace 4; workspace 4
    bindsym $mod+Shift+5 move container to workspace 5; workspace 5
    bindsym $mod+Shift+6 move container to workspace 6; workspace 6
    bindsym $mod+Shift+7 move container to workspace 7; workspace 7
    bindsym $mod+Shift+8 move container to workspace 8; workspace 8
    bindsym $mod+Shift+9 move container to workspace 9; workspace 9
    bindsym $mod+Shift+0 move container to workspace 10; workspace 10

    ####################################################################################################
    ################# reload configs #################
    ####################################################################################################

    # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
    bindsym $mod+Shift+r restart

    # reload the configuration file
    bindsym $mod+Shift+c reload

    # kill focused window
    bindsym $mod+Shift+q kill

    ####################################################################################################
    ################ Container/window control ##################
    ####################################################################################################

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

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

    # change focus
    bindsym $mod+$left focus left
    bindsym $mod+$down focus down
    bindsym $mod+$up focus up
    bindsym $mod+$right focus right

    # alternatively, you can use the cursor keys:
    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+$left move left
    bindsym $mod+Shift+$down move down
    bindsym $mod+Shift+$up move up
    bindsym $mod+Shift+$right 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

    # resizing
    bindsym mod1+Left resize shrink width 10 px or 5 ppt
    bindsym mod1+Down resize grow height 10 px or 5 ppt
    bindsym mod1+Up resize shrink height 10 px or 5 ppt
    bindsym mod1+Right resize grow width 10 px or 5 ppt

    # next/previous workspace
    bindsym Mod1+Tab workspace next
    bindsym Mod1+Shift+Tab workspace prev
    bindsym $mod+Tab workspace back_and_forth

    #navigate workspaces next / previous
    bindsym Mod1+Ctrl+Right workspace next
    bindsym Mod1+Ctrl+Left workspace prev

    # switch to workspace with urgent window
    for_window [urgent=latest] focus

    # default tiling orientation
    default_orientation horizontal

    # container layout
    bindsym $mod+h split h
    bindsym $mod+v split v
    bindsym $mod+Shift+t layout tabbed
    bindsym $mod+Shift+s layout stacking
    bindsym $mod+Shift+h layout splith
    bindsym $mod+Shift+v layout splitv

    # switch between tiling / floating
    bindsym $mod+space focus mode_toggle

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

    bindsym $mod+Shit+y floating enable, fullscreen disable, sticky toggle, resize set 680 400, move to position 1945 45

    # focus the child container
    #bindsym $mod+d focus child

    ####################################################################################################
    ################# Autostart applications ##################
    ####################################################################################################

    # re-run with every i3 reload
    exec_always --no-startup-id numlockx on
    exec_always --no-startup-id ksuperkey -e 'Super_L=Alt_L|F1'
    exec_always --no-startup-id $HOME/.config/i3/scripts/compositor.sh
    exec_always --no-startup-id $HOME/.config/polybar/launch.sh

    # run once at startup
    exec --no-startup-id xfsettingsd &
    exec --no-startup-id nitrogen --restore
    exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
    #exec --no-startup-id xfce4-power-manager &
    exec --no-startup-id xscreensaver &

    # system tray
    #exec --no-startup-id nm-applet
    #exec --no-startup-id volumeicon


    ####################################################################################################
    ################# application keyboard shortcuts ##################
    ####################################################################################################

    bindsym $mod+e exec --no-startup-id al-open -edit
    bindsym Control+space exec --no-startup-id "rofi -modi run,drun,window -show drun"
    bindsym mod1+F1 exec --no-startup-id "rofi -modi run,drun,window -show drun"
    bindsym $mod+t exec --no-startup-id exo-open --launch TerminalEmulator
    bindsym $mod+w exec --no-startup-id exo-open --launch WebBrowser
    bindsym $mod+f exec --no-startup-id exo-open --launch FileManager
    bindsym Print exec --no-startup-id scrot "'ArchLabs_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; gpicview $$(xdg-user-dir PICTURES)/$f'"

    ####################################################################################################
    ################# application settings #################
    ####################################################################################################

    for_window [class="qt5ct|Lxappearance|^Gpick$|Pamac|Peek|Nitrogen"] floating enable
    for_window [window_role="^Preferences$"] floating enable

    for_window [class="Termite|^Thunar|Geany|Firefox"] focus

    # Assign Applications to specific workspace
    # get class with xprop
    assign [class="Firefox"] → 1
    assign [class="Geany"] → 2
    assign [class="Thunar"] → 3
    assign [class="^Gimp"] → 4

    #for_window [class="(?i)CoverGloobus$"] floating enable, sticky enable, resize set 150 150
    for_window [title="(?i)covergloobus"] floating enable

    ####################################################################################################
    ################# audio settings #################
    ####################################################################################################

    bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause
    bindsym XF86AudioNext exec --no-startup-id playerctl next
    bindsym XF86AudioPrev exec --no-startup-id playerctl previous
    bindsym XF86AudioStop exec --no-startup-id playerctl stop
    bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 2
    bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 2
    bindsym XF86AudioMute exec --no-startup-id pamixer -t
    bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 10 # increase screen brightness
    bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 10 # decrease screen brightness

    ####################################################################################################
    ################# border control #################
    ####################################################################################################

    hide_edge_borders both
    bindsym $mod+shift+b exec --no-startup-id i3-msg border toggle

    #changing border style
    bindsym $mod+n border normal
    bindsym $mod+y border 1pixel
    bindsym $mod+u border none

    new_window pixel 2
    new_float pixel 2
    popup_during_fullscreen smart

    for_window [class="^.*"] border pixel 2
    gaps inner 8
    gaps outer 2
    #smart_gaps on
    #smart_borders on

    ####################################################################################################
    ################# Modes #################
    ####################################################################################################

    # sets gaps
    set $mode_gaps Gaps: +/- (local) Shift +/- (global)
    bindsym $mod+Shift+g mode "$mode_gaps"

    mode "$mode_gaps" {
    bindsym plus gaps inner current plus 2
    bindsym minus gaps inner current minus 2
    bindsym 0 gaps inner current set 0

    bindsym Shift+plus gaps inner all plus 2
    bindsym Shift+minus gaps inner all minus 2
    bindsym Shift+0 gaps inner all set 0

    bindsym Return mode "default"
    bindsym Escape mode "default"
    }


    # exit i3 (logs you out of your X session)
    bindsym $mod+Shift+e exec --no-startup-id "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'"

    #Press $mod (super) and X to exit
    bindsym $mod+X mode "$mode_system"

    set $mode_system (k)  (l)  (u)  (h) ⏾ (r)  (s) 
    mode "$mode_system" {
    bindsym k exec --no-startup-id i3lock-fancy, mode "default"
    bindsym l exec --no-startup-id ~/.config/i3/scripts/i3exit.sh logout, mode "default"
    bindsym u exec --no-startup-id ~/.config/i3/scripts/i3exit.sh suspend, mode "default"
    bindsym h exec --no-startup-id ~/.config/i3/scripts/i3exit.sh hibernate, mode "default"
    bindsym r exec --no-startup-id ~/.config/i3/scripts/i3exit.sh reboot, mode "default"
    bindsym s exec --no-startup-id ~/.config/i3/scripts/i3exit.sh shutdown, mode "default"

    # back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
    }