summary refs log tree commit diff stats
path: root/user/modules
diff options
context:
space:
mode:
authorAlan Pearce2019-10-06 07:46:19 +0200
committerAlan Pearce2019-10-06 07:46:19 +0200
commitd5d667839ffc1c2b1de20df6ef096db14ecb2c9a (patch)
treedf3974e52ed042612b9dc9adf646114b167de1db /user/modules
parent4292c3f69b109ac6da336afb4cbd098cda75b80d (diff)
downloadnixfiles-d5d667839ffc1c2b1de20df6ef096db14ecb2c9a.tar.lz
nixfiles-d5d667839ffc1c2b1de20df6ef096db14ecb2c9a.tar.zst
nixfiles-d5d667839ffc1c2b1de20df6ef096db14ecb2c9a.zip
Import and modularise i3 config
Diffstat (limited to 'user/modules')
-rw-r--r--user/modules/i3.nix136
1 files changed, 131 insertions, 5 deletions
diff --git a/user/modules/i3.nix b/user/modules/i3.nix
index a6acf92f..69ea71a9 100644
--- a/user/modules/i3.nix
+++ b/user/modules/i3.nix
@@ -1,12 +1,138 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
 {
-  xdg.configFile.i3 = {
-    recursive = true;
-    source = ../i3/.config/i3;
-  };
   xdg.configFile.i3status = {
     recursive = true;
     source = ../i3/.config/i3status;
   };
+  xsession.windowManager.i3 = let
+    mod = "Mod4";
+    mode_system = "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown";
+    locker = "${pkgs.xautolock}/bin/xautolock -locknow";
+  in
+  {
+    enable = true;
+    config = {
+      modifier = mod;
+      fonts = [ "Terminus 12px" ];
+      floating = {
+        criteria = [
+          { class = "Pinentry$"; }
+        ];
+      };
+      window = {
+        titlebar = false;
+      };
+      keybindings = {
+        "${mod}+Return" = "exec --no-startup-id xst";
+        # kill focused window
+        "${mod}+w" = "kill";
+        "${mod}+Shift+w" = "kill";
+
+        "--release ${mod}+Mod1+r" = "exec rofi -show run";
+        "--release ${mod}+Shift+semicolon" = "exec rofi-pass";
+        "--release ${mod}+space" = "exec \"rofi -show combi -combi-modi drun,window\"";
+
+        # change focus
+        "${mod}+h" = "focus left";
+        "${mod}+j" = "focus down";
+        "${mod}+k" = "focus up";
+        "${mod}+l" = "focus right";
+
+        # move focused window
+        "${mod}+Shift+h" = "move left";
+        "${mod}+Shift+j" = "move down";
+        "${mod}+Shift+k" = "move up";
+        "${mod}+Shift+l" = "move right";
+
+        "${mod}+Shift+1" = "move container to workspace 1";
+        "${mod}+Shift+2" = "move container to workspace 2";
+        "${mod}+Shift+3" = "move container to workspace 3";
+        "${mod}+Shift+4" = "move container to workspace 4";
+        "${mod}+Shift+5" = "move container to workspace 5";
+        "${mod}+Shift+6" = "move container to workspace 6";
+        "${mod}+Shift+7" = "move container to workspace 7";
+        "${mod}+Shift+8" = "move container to workspace 8";
+        "${mod}+Shift+9" = "move container to workspace 9";
+
+
+        # move workspace
+        "${mod}+Mod1+h" = "move workspace to output left";
+        "${mod}+Mod1+j" = "move workspace to output down";
+        "${mod}+Mod1+k" = "move workspace to output up";
+        "${mod}+Mod1+l" = "move workspace to output right";
+
+        # split in horizontal orientation
+        "${mod}+b" = "split h";
+
+        # split in vertical orientation
+        "${mod}+v" = "split v";
+
+        "${mod}+F11" = "fullscreen toggle";
+        "${mod}+f" = "fullscreen toggle";
+
+        # change container layout (stacked, tabbed, toggle split)
+        "${mod}+Shift+s" = "layout stacking";
+        "${mod}+Shift+t" = "layout tabbed";
+        "${mod}+Shift+v" = "layout toggle split";
+
+        # toggle tiling / floating
+        "${mod}+Shift+f" = "floating toggle";
+
+        # change focus between tiling / floating windows
+        "${mod}+Tab" = "focus mode_toggle";
+
+        # focus the parent container
+        "${mod}+a" = "focus parent";
+
+        # focus the child container
+        "${mod}+d" = "focus child";
+
+        "${mod}+Shift+c" = "reload";
+        "${mod}+Shift+p" = "restart";
+
+        "${mod}+Shift+r" = "mode resize";
+        "${mod}+Shift+o" = "${locker}";
+        "${mod}+Pause" = "mode \"${mode_system}\"";
+        "${mod}+Escape" = "mode \"${mode_system}\"";
+        "${mod}+Shift+q" = "mode \"${mode_system}\"";
+      };
+
+      modes = {
+        resize = {
+          "h" = "resize shrink width 10 px or 10 ppt";
+          "j" = "resize grow height 10 px or 10 ppt";
+          "k" = "resize shrink height 10 px or 10 ppt";
+          "l" = "resize grow width 10 px or 10 ppt";
+
+          "Left" = "resize shrink width 10 px or 10 ppt";
+          "Down" = "resize grow height 10 px or 10 ppt";
+          "Up" = "resize shrink height 10 px or 10 ppt";
+          "Right" = "resize grow width 10 px or 10 ppt";
+
+          "Return" = "mode default";
+          "Escape" = "mode default";
+        };
+        "${mode_system}" = {
+          "l" = "exec --no-startup-id ${locker}, mode default";
+          "e" = "exec --no-startup-id i3-msg exit, mode default";
+          "s" = "exec --no-startup-id systemctl suspend, mode default";
+          "h" = "exec --no-startup-id systemctl hibernate, mode default";
+          "r" = "exec --no-startup-id systemctl reboot, mode default";
+          "Shift+s" = "exec --no-startup-id systemctl poweroff -i, mode default";
+          "Return" = "mode default";
+          "Escape" = "mode default";
+        };
+      };
+
+      bars = [
+        {
+          fonts = [ "Terminus 12px" ];
+          position = "top";
+          hiddenState = "show";
+          statusCommand = "${pkgs.i3status}/bin/i3status -c ~/.config/i3status/config";
+        }
+      ];
+    };
+  };
 }