Organise i3 config

Jonathan Hodgson 6 years ago
parent e29deaa771
commit 35aee760ba
  1. 306
      i3/configWork

@ -1,10 +1,14 @@
# vim: filetype=i3config
# i3 config file (v4) # i3 config file (v4)
# #
# Please see http://i3wm.org/docs/userguide.html for a complete reference! # Please see http://i3wm.org/docs/userguide.html for a complete reference!
# Key Shortcuts {{{1
set $mod Mod4 set $mod Mod4
set $alt Mod1 set $alt Mod1
# Colours {{{1
set $base00 #101218 set $base00 #101218
set $base01 #1f222d set $base01 #1f222d
set $base02 #252936 set $base02 #252936
@ -22,7 +26,14 @@ set $base0D #97bbf7
set $base0E #c0b7f9 set $base0E #c0b7f9
set $base0F #fcc09e set $base0F #fcc09e
# Widow Colours
# border background text indicator
client.focused $base01 $base01 $base07 $base0F
client.focused_inactive $base02 $base02 $base03 $base0F
client.unfocused $base02 $base02 $base03 $base0F
client.urgent $base02 $base08 $base00 $base0F
# Fonts {{{1
# Font for window titles. Will also be used by the bar unless a different font # Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below. # is used in the bar {} block below.
font pango:monospace 8 font pango:monospace 8
@ -31,86 +42,34 @@ font pango:monospace 8
# text rendering and scalability on retina/hidpi displays (thanks to pango). # text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Mono 8 font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default: #restart i3 {{{1
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
# The font above is very space-efficient, that is, it looks good, sharp and bindsym $mod+Shift+r restart
# 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.
# Window Controll {{{1
# Floating Mod {{{2
# Use Mouse+$mod to drag floating windows to their wanted position # Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod floating_modifier $mod
# start a terminal # Killing Windows {{{2
# bindsym $mod+Return exec xfce4-terminal
# bindsym $mod+Return exec konsole
# bindsym $mod+Return exec termite
# bindsym $mod+Return exec /usr/local/bin/st
bindsym $mod+Return exec ~/.dotfiles/bin/i3-shell
bindsym $mod+Shift+Return exec ~/.dotfiles/bin/i3-shell "ranger"
# kill focused window # kill focused window
bindsym $mod+q kill bindsym $mod+q kill
# start dmenu (a program launcher) # Focus {{{2
#bindsym $mod+d exec dmenu_run # Make i3 use proper vim keys
#bindsym $mod+d exec albert toggle
bindsym XF86Search exec dmenu_run
#bindsym $mod+z exec xfce4-appfinder
# Start Rofi as program launcher
bindsym $mod+d exec rofi -show drun
# Start Rofi as ssh launcher
bindsym $mod+Shift+d exec rofi -show ssh
#Start Rofi as emoji finder
bindsym $mod+u exec ~/.dotfiles/rofi/scripts/rofi-emoji
#kill i3
bindsym $mod+Shift+x exec killall i3
# Man page lookup
bindsym $mod+m exec man -k . | awk '{ print $1 " " $2 }' | rofi -dmenu -p man -matching regex | awk '{ print $2 " " $1 }' | tr -d '()' | xargs -r man -t | ps2pdf - - | zathura -
# TLDR page lookup
bindsym $mod+Shift+m exec "/usr/bin/tldr --list-all | sed 's/, /\\n/g' | rofi -dmenu -p 'TL;DR' -matching regex | xargs -r tldr -m | pandoc -f markdown -t ms | groff -ms - -T pdf | zathura -"
# WP Lookup
bindsym $mod+Shift+w exec wpLookup
# Config Help
bindsym $mod+F1 exec showI3Help
bindsym $mod+Shift+s exec cat ~/.dotfiles/rofi/scripts/http-status-codes | rofi -i -dmenu -p 'HTTP Status Code' | awk '{ print "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/"$1 }' | xargs -r qutebrowser
# Send signals to i3 blocks and zsh to tell them that capslock has been pushed
# The message to zsh is technically a "window change" which causes zsh to re-draw the prompt
# https://unix.stackexchange.com/questions/440184/update-zsh-ps1-propt-on-keypress
bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks && pkill -SIGWINCH zsh
#Send a message to i3blocks to say that numlock has been pushed
bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
# 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 $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+h focus left bindsym $mod+h focus left
bindsym $mod+j focus down bindsym $mod+j focus down
bindsym $mod+k focus up bindsym $mod+k focus up
bindsym $mod+l focus right bindsym $mod+l focus right
# alternatively, you can use the cursor keys: # alternatively, you can use the cursor keys although I can't imagine why
bindsym $mod+Left focus left bindsym $mod+Left focus left
bindsym $mod+Down focus down bindsym $mod+Down focus down
bindsym $mod+Up focus up bindsym $mod+Up focus up
bindsym $mod+Right focus right bindsym $mod+Right focus right
# move focused window # move focused window with vim keys
bindsym $mod+Shift+h move left bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up bindsym $mod+Shift+k move up
@ -122,11 +81,9 @@ bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right bindsym $mod+Shift+Right move right
# split in horizontal orientation # Layouts / Floats {{{2
bindsym $mod+g split h # toggle the split direction
bindsym $mod+v split toggle
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container # enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle bindsym $mod+f fullscreen toggle
@ -142,12 +99,7 @@ bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows # change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle bindsym $mod+space focus mode_toggle
# focus the parent container # Workspaces {{{2
#bindsym $mod+Shift+a focus parent
bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24
bindsym $mod+shift+a exec --no-startup-id ddspawn dropdownnotepad
#set workspace names #set workspace names
set $workspace1 "1: Browser " set $workspace1 "1: Browser "
set $workspace2 "2: Terminal " set $workspace2 "2: Terminal "
@ -190,20 +142,7 @@ bindsym $mod+control+Right move workspace to output right
bindsym $mod+control+h move workspace to output left bindsym $mod+control+h move workspace to output left
bindsym $mod+control+l move workspace to output right bindsym $mod+control+l move workspace to output right
# Resizing {{{2
#assign programs to workspaces
#assign [class="chromium"] $workspace1
#assign [class="skypeforlinux"] $workspace10
#make applications open in floating mode
for_window [class="Galculator"] floating enable
# 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
# resize window (you can also use the mouse for that) # resize window (you can also use the mouse for that)
mode "resize" { mode "resize" {
# These bindings trigger as soon as you enter the resize mode # These bindings trigger as soon as you enter the resize mode
@ -235,18 +174,114 @@ mode "resize" {
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
# Widow Colours
# border background text indicator
client.focused $base01 $base01 $base07 $base0F
client.focused_inactive $base02 $base02 $base03 $base0F
client.unfocused $base02 $base02 $base03 $base0F
client.urgent $base02 $base08 $base00 $base0F
# Application Shortcuts {{{1
# Special Keyboard buttons {{{2
bindsym XF86Search exec rofi -show drun
bindsym XF86Mail exec thunderbird
# Pulse Audio controls {{{3
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% && pkill -SIGRTMIN+10 i3blocks #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% && pkill -SIGRTMIN+10 i3blocks #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle && pkill -SIGRTMIN+10 i3blocks # mute sound
# Volume using alt+scroll {{{4
bindsym --whole-window $alt+button4 exec --no-startup-id pactl set-sink-volume 0 -5% && pkill -SIGRTMIN+10 i3blocks #decrease sound volume
bindsym --whole-window $alt+button5 exec --no-startup-id pactl set-sink-volume 0 +5% && pkill -SIGRTMIN+10 i3blocks #increase sound volume
# Media player controls {{{3
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
#calculator button
bindsym XF86Calculator exec galculator
# Print Screen {{{2
# printscreen
bindsym Print exec xfce4-screenshooter -f
bindsym ctrl+Print exec xfce4-screenshooter -w
bindsym Shift+Print exec xfce4-screenshooter -r
# Return {{{2
# start a terminal in current working dir
bindsym $mod+Return exec ~/.dotfiles/bin/i3-shell
# start Ranger in current working dir
bindsym $mod+Shift+Return exec ~/.dotfiles/bin/i3-shell "ranger"
# Insert {{{2
bindsym $mod+Shift+Insert exec --no-startup-id rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
# A {{{2
# Opens R in Terminal in Scratchpad
bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24
# Opens Vim in Terminal in Scratchpad
bindsym $mod+shift+a exec --no-startup-id ddspawn dropdownnotepad
# B {{{3
# Opens DBeaver
bindsym $mod+b exec dbeaver
# C {{{2
# Opens Chromium
bindsym $mod+c exec chromium-snapshot-bin
# Opens Chromium in "Big Mode"
bindsym $mod+Shift+c exec google-chrome-stable --force-device-scale-factor=2
# D {{{2
# Start Rofi as program launcher
bindsym $mod+d exec rofi -show drun
# Start Rofi as ssh launcher
bindsym $mod+Shift+d exec rofi -show ssh
# F {{{2
bindsym control+mod1+f exec thunar
# L {{{2
# Opens Logout / Lock / Shutdown etc. prompt
bindsym ctrl+shift+l exec --no-startup-id ~/.config/rofi/scripts/rofi-shutdown
# M {{{2
# Man page lookup - Opens man page as PDF - Uses Rofi to chose
bindsym $mod+m exec man -k . | awk '{ print $1 " " $2 }' | rofi -dmenu -p man -matching regex | awk '{ print $2 " " $1 }' | tr -d '()' | xargs -r man -t | ps2pdf - - | zathura -
# Same idea as above but uses TLDR pages
bindsym $mod+Shift+m exec "/usr/bin/tldr --list-all | sed 's/, /\\n/g' | rofi -dmenu -p 'TL;DR' -matching regex | xargs -r tldr -m | pandoc -f markdown -t ms | groff -ms - -T pdf | zathura -"
# Q {{{2
# Starts Qute Browser
bindsym $mod+Shift+q exec qutebrowser
# S {{{2
# Looks up http status codes
bindsym $mod+Shift+s exec cat ~/.dotfiles/rofi/scripts/http-status-codes | rofi -i -dmenu -p 'HTTP Status Code' | awk '{ print "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/"$1 }' | xargs -r qutebrowser
# U {{{2
#Start Rofi as emoji finder
bindsym $mod+u exec ~/.dotfiles/rofi/scripts/rofi-emoji
# W {{{2
# WP Lookup
bindsym $mod+Shift+w exec wpLookup
# Z {{{2
# Opens Zeal
bindsym $mod+z exec zeal
# Blocks {{{1
# Send signals to i3 blocks and zsh to tell them that capslock has been pushed
# The message to zsh is technically a "window change" which causes zsh to re-draw the prompt
# https://unix.stackexchange.com/questions/440184/update-zsh-ps1-propt-on-keypress
bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks && pkill -SIGWINCH zsh
#Send a message to i3blocks to say that numlock has been pushed
bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
# Start i3bar to display a workspace bar (plus the system information i3status # Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available) # finds out, if available)
bar { bar {
#status_command i3status
status_command i3blocks -c ~/.dotfiles/i3/i3blocks.conf status_command i3blocks -c ~/.dotfiles/i3/i3blocks.conf
output eDP1 output eDP1
output primary output primary
@ -265,7 +300,6 @@ bar {
} }
bar { bar {
#status_command i3status
status_command i3blocks -c ~/.dotfiles/i3/i3blocks-secondary.conf status_command i3blocks -c ~/.dotfiles/i3/i3blocks-secondary.conf
output HDMI-1 output HDMI-1
tray_output none tray_output none
@ -282,54 +316,12 @@ bar {
} }
} }
bindsym $mod+c exec chromium-snapshot-bin, workspace $workspace1 # Gaps {{{1
bindsym $mod+Shift+c exec google-chrome-stable --force-device-scale-factor=2, workspace $workspace1
bindsym $mod+b exec dbeaver
bindsym control+mod1+f exec thunar
bindsym XF86Mail exec thunderbird
bindsym $mod+z exec zeal
bindsym $mod+Shift+q exec qutebrowser
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% && pkill -SIGRTMIN+10 i3blocks #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% && pkill -SIGRTMIN+10 i3blocks #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle && pkill -SIGRTMIN+10 i3blocks # mute sound
#Alt + scroll for volume
bindsym --whole-window $alt+button4 exec --no-startup-id pactl set-sink-volume 0 -5% && pkill -SIGRTMIN+10 i3blocks #decrease sound volume
bindsym --whole-window $alt+button5 exec --no-startup-id pactl set-sink-volume 0 +5% && pkill -SIGRTMIN+10 i3blocks #increase sound volume
# Touchpad controls
#bindsym XF86TouchpadToggle exec /some/path/toggletouchpad.sh # toggle touchpad
# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
#calculator button
bindsym XF86Calculator exec galculator
#printscreen
bindsym Print exec xfce4-screenshooter -f
bindsym ctrl+Print exec xfce4-screenshooter -w
bindsym Shift+Print exec xfce4-screenshooter -r
bindsym $mod+x exec --no-startup-id ~/.config/i3/i3exit logout
bindsym ctrl+shift+l exec --no-startup-id ~/.config/rofi/scripts/rofi-shutdown
bindsym $mod+Shift+Insert exec --no-startup-id rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
##################################################
# #
# i3 Gaps #
# #
##################################################
# Removes the boader on everything
for_window [class="^.*"] border pixel 0 for_window [class="^.*"] border pixel 0
# Sets up some tiny gaps
gaps outer -2 gaps outer -2
gaps inner 5 gaps inner 5
smart_gaps on smart_gaps on
@ -338,7 +330,6 @@ set $mode_gaps Gaps: (o) outer, (i) inner, (d) default
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps" bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" { mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer" bindsym o mode "$mode_gaps_outer"
@ -378,6 +369,7 @@ mode "$mode_gaps_outer" {
bindsym Escape mode "default" bindsym Escape mode "default"
} }
# Scratchpad {{{1
# General dropdown window traits. The order can matter. # General dropdown window traits. The order can matter.
for_window [instance="dropdown_*"] floating enable for_window [instance="dropdown_*"] floating enable
for_window [instance="dropdown_*"] move scratchpad for_window [instance="dropdown_*"] move scratchpad
@ -387,16 +379,32 @@ for_window [instance="dropdown_*"] resize set 1200 600
for_window [instance="dropdown_*"] border pixel 20 for_window [instance="dropdown_*"] border pixel 20
for_window [instance="dropdown_*"] move position center for_window [instance="dropdown_*"] move position center
#Startup {{{1
exec --no-startup-id redshift # Compositor {{{2
exec --no-startup-id compton -f -i 0.95 exec --no-startup-id compton -f -i 0.95
# Notifications {{{2
exec_always --no-startup-id /usr/bin/dunst
# KDE Connect {{{2
exec_always --no-startup-id /usr/lib/kdeconnectd exec_always --no-startup-id /usr/lib/kdeconnectd
exec_always --no-startup-id indicator-kdeconnect exec_always --no-startup-id indicator-kdeconnect
#exec --no-startup-id xfce4-clipman
# Monitor Setup {{{2
# Work {{{3
exec --no-startup-id xrandr --output DP-1 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --off exec --no-startup-id xrandr --output DP-1 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --off
# Laptop {{{3
exec --no-startup-id xrandr --output HDMI2 --off --output HDMI1 --off --output DP1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off exec --no-startup-id xrandr --output HDMI2 --off --output HDMI1 --off --output DP1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off
#exec --no-startup-id signal-desktop --start-in-tray
exec_always --no-startup-id /usr/bin/dunst # Clipboard manager {{{2
exec --no-startup-id greenclip daemon && notify-send "Install Greenclip" exec --no-startup-id greenclip daemon
# Restore Background {{{2
exec --no-startup-id nitrogen --restore exec --no-startup-id nitrogen --restore
#exec_always --no-startup-id setbackground
# Blue light filter {{{2
exec --no-startup-id redshift
# Layout Manager
exec --no-startup-id i3autolayout

Loading…
Cancel
Save