commit c760810aea94e24d6418dbcd5a75d2ccf7a52a9f
parent 63486f5372e47ce81788da2b2a67d32dc35a25c4
Author: oscarbenedito <oscar@oscarbenedito.com>
Date:   Sat, 25 Apr 2020 01:12:26 +0200

i3 config revised and organized

Diffstat:
Mdot_config/i3/config | 223+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
1 file changed, 127 insertions(+), 96 deletions(-)

diff --git a/dot_config/i3/config b/dot_config/i3/config @@ -1,46 +1,60 @@ -# 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! +# initial declarations {{{ set $mod Mod4 - -# 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 10 -# 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 8 +# /initial declarations }}} -# 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. +# i3 shortcuts {{{ -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod +# 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 + +# /i3 shortcuts }}} + +# program shortcuts {{{ # start a terminal bindsym $mod+Return exec i3-sensible-terminal +# start i3-dmenu-desktop (dmenu wrapper with support for .desktop files) +bindsym $mod+d exec --no-startup-id i3-dmenu-desktop + +# open program shortcuts +set $ai $HOME/.local/share/applications +bindsym $mod+o mode "$mode_open" +set $mode_open (f)irefox, (j)oplin, (k)eepassxc, (n)extcloud, (t)utanota +mode "$mode_open" { + bindsym f exec firefox, mode "default" + bindsym j exec "$HOME/.local/bin/,appimage $ai/appimagekit-joplin.desktop", mode "default" + bindsym k exec "$HOME/.local/bin/,appimage $ai/keepassxc.desktop", mode "default" + bindsym n exec "$HOME/.local/bin/,appimage $ai/nextcloud.desktop", mode "default" + bindsym t exec "$HOME/.local/bin/,appimage $ai/tutanota-desktop.desktop", mode "default" + + # exit open mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# /program shortcuts }}} + +# windows {{{ + # kill focused window bindsym $mod+Shift+q kill -# start dmenu (a program launcher) -bindsym $mod+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 $mod+d exec --no-startup-id i3-dmenu-desktop +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod # change focus bindsym $mod+h focus left @@ -81,7 +95,7 @@ bindsym $mod+e layout toggle split bindsym $mod+Shift+space floating toggle # change focus between tiling / floating windows -#bindsym $mod+space focus mode_toggle +bindsym $mod+Control+space focus mode_toggle # focus the parent container bindsym $mod+a focus parent @@ -89,7 +103,36 @@ bindsym $mod+a focus parent # focus the child container #bindsym $mod+d focus child -# Define names for default workspaces for which we configure key bindings later on. +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 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 + + # 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 or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# /windows }}} + +# workspaces {{{ + # We use variables to avoid repeating the names in multiple places. set $ws1 "1" set $ws2 "2" @@ -114,7 +157,7 @@ bindsym $mod+8 workspace $ws8 bindsym $mod+9 workspace $ws9 bindsym $mod+0 workspace $ws10 -# move focused container to workspace +# move focused container to workspace and switch to workspace bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 @@ -126,42 +169,37 @@ bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 bindsym $mod+Shift+0 move container to workspace $ws10; 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'" +# /workspaces }}} -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode +# session commands {{{ - # 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 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 +# exit 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'" - # 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 +bindsym $mod+m mode "$mode_system" +set $mode_system (l)ock, (e)xit, (r)eboot, (s)hutdown +mode "$mode_system" { + bindsym l exec --no-startup-id "i3lock -i $wp", mode "default" + bindsym e exec --no-startup-id "i3-msg exit", mode "default" + bindsym r exec --no-startup-id "systemctl reboot", mode "default" + bindsym s exec --no-startup-id "systemctl poweroff", mode "default" - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" } -bindsym $mod+r mode "resize" +# /session commands }}} -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) +# theme {{{ + +# borders and gaps +for_window [class="^.*"] border pixel 2 +gaps inner 15 +smart_gaps on +smart_borders on + +# status bar bar { font pango:mono 10 status_command i3blocks @@ -169,54 +207,47 @@ bar { tray_output none } +# wallpaper +set $wp $HOME/.config/i3/wallpaper.png +exec --no-startup-id "xwallpaper --zoom $wp" +# /theme }}} + +# XF86 shortcuts {{{ + +# volume bindsym XF86AudioRaiseVolume exec amixer -q -D pulse sset Master unmute && amixer -q -D pulse sset Master 5%+ && pkill -RTMIN+10 i3blocks bindsym XF86AudioLowerVolume exec amixer -q -D pulse sset Master unmute && amixer -q -D pulse sset Master 5%- && pkill -RTMIN+10 i3blocks bindsym XF86AudioMute exec amixer -q -D pulse sset Master toggle && pkill -RTMIN+10 i3blocks -for_window [class=".*"] border pixel 0 +# brightness +bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 15 +bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15 + +# /XF86 shortcuts }}} -exec --no-startup-id "setxkbmap -option 'caps:super' es" -exec --no-startup-id "xcape -e 'Super_L=Escape'" -exec --no-startup-id "numlockx" -exec --no-startup-id "mullvad connect" +# keyboards and monitors {{{ -for_window [class="^.*"] border pixel 2 -gaps inner 15 -smart_gaps on -smart_borders on +# use caps as super +exec --no-startup-id "setxkbmap -option 'caps:super'" -exec --no-startup-id "xwallpaper --zoom $HOME/.config/i3/wallpaper.png" +# tap caps for escape (hold down for super) +exec --no-startup-id "xcape -e 'Super_L=Escape'" -# Aquesta comanda ha de ser post setxkbmap -exec --no-startup-id "$HOME/.local/bin/,configure-monitors" +# activate num lock +exec --no-startup-id "numlockx" -bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 15 -bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15 +# configure monitors +exec --no-startup-id "$HOME/.local/bin/,configure-monitors" +# toggle keymap bindsym $mod+space exec "$HOME/.local/bin/,toggle-kbmap" -# open program shortcuts -bindsym $mod+o mode "$mode_open" -set $mode_open (f)irefox, (k)eepassxc -mode "$mode_open" { - bindsym k exec keepassxc, mode "default" - bindsym f exec firefox, mode "default" +# /keyboards and monitors }}} - # exit open mode: "Enter" or "Escape" - bindsym Return mode "default" - bindsym Escape mode "default" -} +# other {{{ -bindsym $mod+m mode "$mode_system" -set $mode_system (l)ock, (e)xit, (r)eboot, (s)hutdown -mode "$mode_system" { - bindsym l exec --no-startup-id i3exit lock, mode "default" - bindsym e exec --no-startup-id i3exit logout, mode "default" - bindsym r exec --no-startup-id i3exit reboot, mode "default" - bindsym s exec --no-startup-id i3exit shutdown, mode "default" +# connect to vpn +exec --no-startup-id "mullvad connect" - # exit system mode: "Enter" or "Escape" - bindsym Return mode "default" - bindsym Escape mode "default" -} +# other }}}