Skip to content

Instantly share code, notes, and snippets.

@weynhamz
Last active July 6, 2022 13:33
Show Gist options
  • Save weynhamz/5970670 to your computer and use it in GitHub Desktop.
Save weynhamz/5970670 to your computer and use it in GitHub Desktop.
i3-wm configuration
# i3 config file
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
#####
#
# Fonts
#
#####
# Font for window titles. It will also be used by the bar unless a different
# font is used in the bar {} block below.
# ISO 10646 = Unicode
#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, if you need a lot of unicode glyphs or
# right-to-left text rendering, you should instead use pango for rendering and
# chose a FreeType font, such as:
#font pango:DejaVu Sans Mono 8
font pango:文泉驿等宽微米黑 8
#####
#
# Behaviors
#
#####
# Do not changing focus on mouse moving
focus_follows_mouse no
# Wrapper the focus between containers in the same level
force_focus_wrapping no
# Switch back and forth when pressing workspace changing key bindings
workspace_auto_back_and_forth yes
#####
#
# Basic Key Bindings
#
#####
# kill focused window
bindsym $mod+q kill
# start i3-dmenu-desktop as program launcher
# It is a wrapper around dmenu, which only displays applications shipping a
# .desktop file, so dmenu needs to be installed.
# Use xft patched dmenu in order to use customized fonts to show UTF-8
# characters
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop --dmenu='dmenu -fn "文泉驿等宽微米黑-8"' --entry-type=filename --entry-type=command --entry-type=name
# start a terminal
bindsym $mod+Return exec gnome-terminal
# use $mod+Mouse to drag floating windows to their wanted position
floating_modifier $mod
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+w layout tabbed
bindsym $mod+s layout stacking
bindsym $mod+e layout toggle split
# split in vertical orientation
bindsym $mod+v split vertical
# split in horizontal orientation
bindsym $mod+Shift+v split horizontal
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# Show the first scratchpad window
bindsym $mod+minus scratchpad show
#Make the currently focused window a scratchpad
bindsym $mod+Shift+minus move scratchpad
#####
#
# Focus/Move Key Bindings
#
#####
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
bindsym $mod+Shift+a focus child
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l 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
# change workspace
bindsym $mod+p workspace prev
bindsym $mod+n workspace next
# switch between the current and the previously focused one
bindsym $mod+b workspace back_and_forth
bindsym $mod+Shift+b move container to workspace back_and_forth
# switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# move workspace to outputs
bindsym $mod+Control+h move workspace to output left
bindsym $mod+Control+j move workspace to output down
bindsym $mod+Control+k move workspace to output up
bindsym $mod+Control+l move workspace to output right
bindsym $mod+x move workspace to output VGA1
bindsym $mod+Shift+x move workspace to output LVDS1
# move container to outputs
bindsym $mod+Control+Shift+h move container to output left
bindsym $mod+Control+Shift+j move container to output down
bindsym $mod+Control+Shift+k move container to output up
bindsym $mod+Control+Shift+l move container to output right
bindsym $mod+o move container to output VGA1
bindsym $mod+Shift+o move container to output LVDS1
#####
#
# i3-input Key Bindings
#
#####
# execute commands
bindsym $mod+F2 exec i3-input
# vim-like marks
bindsym $mod+g exec i3-input -F '[con_mark="%s"] focus' -P 'Goto mark: '
bindsym $mod+m exec i3-input -F 'mark "%s"' -P 'Add mark: '
bindsym $mod+Shift+m exec i3-input -F 'unmark "%s"' -P 'Remove mark: '
# rename workspace
bindsym $mod+Shift+y exec i3-input -F 'rename workspace to "%s"' -P 'New name: '
#####
#
# System Control
#
#####
# 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'"
# 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
# lock i3
bindsym $mod+Control+Return exec "sudo xset +dpms && xset s on; i3lock -c 000000"
#####
#
# Configure i3bar
#
#####
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position top
tray_output primary
status_command i3status -c ~/.i3/config.status
}
####
#
# Resize mode
#
####
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
bindsym h resize shrink width 5 px or 5 ppt
bindsym j resize grow height 5 px or 5 ppt
bindsym k resize shrink height 5 px or 5 ppt
bindsym l resize grow width 5 px or 5 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
######
#
# Floating Windows
#
######
for_window [window_role="pop-up"] floating enable
for_window [class="feh"] floating enable
for_window [class="qiv"] floating enable
for_window [class="Eog"] floating enable
for_window [class="Sxiv"] floating enable
for_window [class="MPlayer"] floating enable
for_window [class="Empathy"] floating enable
for_window [class="VirtualBox"] floating enable
for_window [class="screengrab"] floating enable
for_window [class="Nightingale"] floating enable
for_window [class="Gnome-mplayer"] floating enable
for_window [class="file_progress"] floating enable
for_window [class="Gnome-screenshot"] floating enable
###
#
# Autostart Programs
#
###
exec --no-startup-id volumeicon
exec --no-startup-id sh ~/.fehbg
exec --no-startup-id ibus-daemon --xim -d -r
####
#
# GNOME Intergration
#
####
# show gnome logout dialog
bindsym $mod+Shift+q exec gnome-session-quit --logout
# show gnome shutdown menu
bindsym $mod+Shift+s exec gnome-session-quit --power-off
# use gnome-screensaver lock screen
bindsym $mod+Shift+n exec gnome-screensaver-command -l
general {
colors = true
interval = 1
output_format = "i3bar"
}
# Eth
ethernet enp8s0 {
# if you use %speed, i3status requires the cap_net_admin capability
format_up = "E: (%speed) %ip"
format_down = "E: down"
}
order += "ethernet enp8s0"
# Wlan
wireless wlp5s0 {
format_up = "W: (%quality at %essid, %bitrate) %ip"
format_down = "W: down"
}
order += "wireless wlp5s0"
# DHCP
run_watch DHCP {
pidfile = "/run/dhcpcd*.pid"
}
order += "run_watch DHCP"
# VPN
run_watch VPN {
pidfile = "/run/vpnc/pid"
}
order += "run_watch VPN"
# System Load
load {
format = "%5min"
}
order += "load"
# Volume Status
volume master {
format = "♪: %volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}
order += "volume master"
# Battery Status
battery 1 {
format = "%status %percentage %remaining %emptytime"
path = "/sys/class/power_supply/BAT%d/uevent"
low_threshold = 10
}
order += "battery 1"
# CPU Temperature
cpu_temperature 2 {
format = "T: %degrees °C"
path = "/sys/devices/platform/coretemp.0/temp%d_input"
}
order += "cpu_temperature 2"
# CPU Temperature
cpu_temperature 3 {
format = "T: %degrees °C"
path = "/sys/devices/platform/coretemp.0/temp%d_input"
}
order += "cpu_temperature 3"
# Disk Quota
disk "/" {
format = "Disk /: %free"
}
order += "disk /"
# DateTime
tztime local {
format = "%A %Y-%m-%d %H:%M:%S"
}
order += "tztime local"
# vim: ft=conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment