Den letzten (2013) Workshop zu i3 habe [[mailto:gereon@fsmpi.rwth-aachen.de|ich (Gereon)]] gehalten. Hier habe ich meine Konfiguration von i3 verewigt, zum einen um eine Idee zu geben was man da alles machen kann, zum anderen um ein paar Ideen für Erweiterungen zu zeigen. ======= Config ======= Diese config unter **~/.i3/config** ablegen. Besonderheiten gegenüber der Standard-Config: * Win+a öffnet ein "actions-menü" das skripte anbietet, die unter **~/.i3/actions/** liegen. * Key bindings für Multimedia-Keys von Thinkpads (funktionieren auf meinem X220i) * Standard-Desktops für Mail, IM und Browser * Autostart Eine Warnung vorweg: Ein paar Sachen funktionieren vielleicht nicht sofort mit den Standard-Paketen, insbesondere der andere Programm-Launcher **i3-dmenu-desktop** ist erst ab Version 4.4 dabei. # i3 config file (v4) # default modifier set $mod Mod4 # second modifier set $mod2 Mod1 # font for window titles. ISO 10646 = Unicode font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod ########## # coloring border backgr text indicator client.focused #333333 #333333 #aaaaaa #333333 client.focused_inactive #111111 #111111 #aaaaaa #111111 client.unfocused #111111 #111111 #999999 #111111 client.urgent #aa2222 #aa2222 #000000 #aa2222 # background exec xsetroot -solid "#000000" # start a terminal bindsym $mod+Return exec uxterm # kill focused window bindsym $mod+Shift+Q kill ########## # program & action menu set $dmenuopts -i -nb "#000000" -nf "#999999" -sb "#999999" -sf "#111111" #bindsym $mod+d exec dmenu_run $dmenuopts bindsym $mod+d exec i3-dmenu-desktop --dmenu="dmenu $dmenuopts" bindsym $mod+a exec ~/.i3/actions/`ls ~/.i3/actions/ | dmenu $dmenuopts` ########## # some custom key bindings bindsym Print exec ~/.i3/actions/screenshot bindsym XF86ScreenSaver exec ~/.i3/actions/lock #bindsym XF86WakeUp+XF86Switch_VT_12 exec ~/.i3/actions/hibernate bindsym XF86Launch1 exec todo bindsym XF86AudioMute exec amixer sset Master toggle bindsym XF86AudioLowerVolume exec amixer sset Master "2%-" bindsym XF86AudioRaiseVolume exec amixer sset Master "2%+" ########## # change focus bindsym $mod+j focus left bindsym $mod+k focus down bindsym $mod+l focus up bindsym $mod+odiaeresis 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+J move left bindsym $mod+Shift+K move down bindsym $mod+Shift+L move up bindsym $mod+Shift+Odiaeresis 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 ########## # split in horizontal orientation bindsym $mod+h split h # split in vertical orientation bindsym $mod+v split v # enter fullscreen mode for the focused container bindsym $mod+f fullscreen # change container layout (stacked, tabbed, default) bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout default # toggle tiling / floating bindsym $mod+Shift+space floating toggle # change focus between tiling / floating windows bindsym $mod+space focus mode_toggle # focus the parent container #bindsym $mod+a focus parent # focus the child container #bindcode $mod+d focus child ########## # workspaces # switch to last used workspace workspace_auto_back_and_forth yes bindsym $mod+Tab workspace back_and_forth bindsym $mod2+Tab workspace next 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 workspace 1 bindsym $mod+Shift+2 move workspace 2 bindsym $mod+Shift+3 move workspace 3 bindsym $mod+Shift+4 move workspace 4 bindsym $mod+Shift+5 move workspace 5 bindsym $mod+Shift+6 move workspace 6 bindsym $mod+Shift+7 move workspace 7 bindsym $mod+Shift+8 move workspace 8 bindsym $mod+Shift+9 move workspace 9 bindsym $mod+Shift+0 move workspace 10 # resize window (you can also use the mouse for that) mode "resize" { bindsym j resize shrink left 10 px or 10 ppt bindsym Shift+J resize grow left 10 px or 10 ppt bindsym k resize shrink down 10 px or 10 ppt bindsym Shift+K resize grow down 10 px or 10 ppt bindsym l resize shrink up 10 px or 10 ppt bindsym Shift+L resize grow up 10 px or 10 ppt bindsym odiaeresis resize shrink right 10 px or 10 ppt bindsym Shift+Odiaeresis resize grow right 10 px or 10 ppt # same bindings, but for the arrow keys bindsym Left resize shrink left 10 px or 10 ppt bindsym Shift+Left resize grow left 10 px or 10 ppt bindsym Down resize shrink down 10 px or 10 ppt bindsym Shift+Down resize grow down 10 px or 10 ppt bindsym Up resize shrink up 10 px or 10 ppt bindsym Shift+Up resize grow up 10 px or 10 ppt bindsym Right resize shrink right 10 px or 10 ppt bindsym Shift+Right resize grow right 10 px or 10 ppt # back to normal: Enter or Escape bindsym Return mode "default" bindsym Escape mode "default" } bindsym $mod+r mode "resize" ########## # status bar bar { # show tray on laptop tray_output primary # customized i3status #status_command ~/.i3/i3status -c ~/.i3/i3status.conf # official i3status status_command i3status -c ~/.i3/i3status.conf font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 colors { background #000000 statusline #aaaaaa # class border backgr text focused_workspace #999999 #999999 #000000 active_workspace #aaaaaa #aaaaaa #111111 inactive_workspace #222222 #222222 #999999 urgent_workspace #aa2222 #aa2222 #000000 } } ########## # organize... # Pidgin & Thunderbird -> Workspace 1 assign [class="^Pidgin$" window_role="^buddy_list$"] 1 assign [class="^Pidgin$" window_role="^preferences$"] 1 assign [class="^Thunderbird$"] 1 # Pidgin Conversations -> Workspace 2 assign [class="^Pidgin$" window_role="^conversation$"] 2 # Browser -> Workspace 3 assign [class="^Opera$"] 3 assign [class="^Firefox$" instance="^Navigator$"] 3 assign [class="^Chromium-browser$" window_role="^browser$"] 3 # RSS Reader -> Workspace 9 assign [class="^Liferea$"] 9 for_window [class="^Key-mon$"] floating enable ########## # autostart #exec nm-applet #exec liferea ======= Config für Status bar ======= Die Statusbar wird in **~/.i3/i3status.conf** konfiguriert. Hier meine Config: general { colors = true color_good = "#00FF00" color_degraded = "#FFFF00" color_bad = "#FF0000" interval = 5 output_format = i3bar } order += "disk /" order += "wireless wlan0" order += "ethernet eth0" order += "ethernet usb0" order += "battery 0" order += "cpu_temperature 0" order += "volume master" order += "time" wireless wlan0 { format_up = " %essid (%ip, %quality) " format_down = " wlan0 " } ethernet eth0 { # if you use %speed, i3status requires root privileges format_up = " %ip (%speed) " format_down = " eth0 " } ethernet usb0 { # if you use %speed, i3status requires root privileges format_up = " usb0 up " format_down = " usb0 " } battery 0 { last_full_capacity = true format = " %status %percentage %remaining " low_threshold = 15 threshold_type = "percentage" } run_watch DHCP { pidfile = "/var/run/dhclient*.pid" } run_watch VPN { pidfile = "/var/run/vpnc/pid" } time { format = " %a %d.%m.%Y %T" } load { format = "%1min" } # processor temperature cpu_temperature 0 { format = " %degrees °C " path = "/sys/devices/platform/coretemp.0/temp1_input" } # system temperature cpu_temperature 1 { format = " %degrees °C " path = "/sys/devices/virtual/thermal/thermal_zone0/temp" } disk "/" { format = "/ %percentage_used " } volume master { format = " vol %volume " device = "default" mixer = "Master" mixer_idx = 0 } ======= Skripte unter .i3/actions/ ======= Die Skripte enthalten Befehle, die ich oft benutze. Einige davon benötigen root-Rechte. Meine Lösung für den Fall ist, dass ich meinem Account erlaube diese Befehle mit sudo ausführen darf ohne ein Passwort einzugeben. Das sieht für user **user** und den Befehl **command** dann in der **/etc/sudoers** so aus: user ALL = NOPASSWD:command Wichtig: der **command** muss mit vollständigen Pfad angegeben werden, also beispielsweise **/sbin/shutdown** statt **shutdown**. Diesen Pfad findet man im Zweifel mit **whereis** (oder **which**). Ein paar Beispiele, was ich alles als actions habe: Suspend-to-disk: **hibernate** #!/bin/sh i3lock -c "#000000" && sudo pm-hibernate Bildschirm sperren: **lock** #!/bin/sh i3lock -c "#000000" Ausloggen: **quit** #!/bin/sh i3-msg "exit" Neustarten: **reboot** #!/bin/sh sudo shutdown -r now i3 Config neu laden (Session inklusive aller Fenster bleibt erhalten, Statusbar bleibt wie sie ist): **reload** #!/bin/sh i3-msg "reload" i3 neu starten (Session inklusive aller Fenster bleibt erhalten, Statusbar wird neugestartet): **restart** #!/bin/sh i3-msg "restart" Bildschirm auf VGA spiegeln: **vgamirror** #!/bin/sh xrandr --output VGA1 --auto --same-as LVDS