Commit 1338aa4aa573

Vincent Demeester <vincent@sbr.pm>
2018-04-30 17:33:41
Manage i3 configuration in envs..
โ€ฆ also gnupg and such.. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 04dd7a7
Changed files (2)
envs/i3.nix
@@ -0,0 +1,232 @@
+{ pkgs, config, lib, ... }:
+
+{
+  xsession.windowManager.i3 = {
+    enable = true;
+    config = {
+      fonts = [ "Ubuntu Mono 10" ];
+      focus = {
+        followMouse = false;
+      };
+      window = {
+        border = 1;
+        hideEdgeBorders = "both";
+      };
+      keybindings = {
+        "Mod4+Return" = "exec termite"; # TODO: use i3-sensible-terminal instead
+        "Mod4+Shift+F11" = "exec 'autorandr -c'";
+      };
+      keycodebindings = {
+        "Mod4+Shift+24" = "kill";
+        "Mod4+33" = "${pkgs.rofi}/bin/rofi -show run -modi 'run,window' -location 2 -hide-scrollbar -separator-style solid -font Ubuntu\ Mono\ 14";
+        # focus window
+        "Mod4+44" = "focus left";
+        "Mod4+45" = "focus down";
+        "Mod4+46" = "focus up";
+        "Mod4+47" = "focus right";
+        "Mod4+38" = "focus parent";
+        # move focused window
+        "Mod4+Shift+44" = "move left";
+        "Mod4+Shift+45" = "move down";
+        "Mod4+Shift+46" = "move up";
+        "Mod4+Shift+47" = "move right";
+        # Split
+        "Mod4+43" = "split h";
+        "Mod4+55" = "split v";
+        # Fullscreen
+        "Mod4+41" = "fullscreen toggle";
+        # Change container layout
+        "Mod4+39" = "layout stacking";
+        "Mod4+25" = "layout tabbed";
+        "Mod4+26" = "layout toggle split";
+        # Manage floating
+        "Mod4+Shift+61" = "floating toggle";
+        "Mod4+61" = "focus mode_toggle";
+        # manage workspace
+        "Mod4+113" = "workspace prev_on_output";
+        "Mod4+114" = "workspace next_on_output";
+        # manage output
+        "Mod4+Shift+113" = "focus output left";
+        "Mod4+Shift+116" = "focus output down";
+        "Mod4+Shift+111" = "focus output up";
+        "Mod4+Shift+114" = "focus output right";
+        # Custom keybinding
+        "Mod4+Shift+32" = "exec loginctl lock-session";
+        "Mod4+Shift+39" = "exec sleep 1 && xset dpms force standby";
+        "Mod4+24" = "border toggle";
+      };
+      modes = {};
+      bars = [{
+        mode = "hide";
+        position = "bottom";
+        statusCommand = "i3status";
+        colors = {
+          background = "#073642";
+          statusline = "#eee8d5";
+          focusedWorkspace = {
+            border = "#cb4b16";
+            background = "#cb4b16";
+            text = "#eee8d5";
+          };
+          activeWorkspace = {
+            border = "#cb4b16";
+            background = "#cb4b16";
+            text = "#eee8d5";
+          };
+          inactiveWorkspace = {
+            border = "#b58900";
+            background = "#b58900";
+            text = "#eee8d5";
+          };
+        };
+      }];
+    };
+    extraConfig = ''
+      set $mod Mod4
+
+      # Use Mouse+$mod to drag floating windows to their wanted position
+      floating_modifier $mod
+
+      set $WS0 0 ๐Ÿ—ช
+      set $WS1 1 ๐ŸŒŽ
+      set $WS2 2 ๐Ÿณ
+      set $WS3 3 ๐Ÿน
+      set $WS4 4 ๐Ÿธ
+      set $WS5 5 ๐Ÿ‘ท
+      set $WS6 6 ๐Ÿง
+      set $WS7 7 ๊™ฎ
+      set $WS8 8 ๐ŸŽง
+      set $WS9 9 ๐Ÿ–ƒ
+      # ๐Ÿ— ๐Ÿ–ณ ๐Ÿ–ง ๐Ÿ–ƒ ๐Ÿ”ฐ ๐Ÿ”ฎ ๐Ÿ“ฐ ๐Ÿ“ ๐Ÿ“ ๐Ÿ“‚ ๐Ÿ’ป ๐Ÿ’ก ๐Ÿ’ข ๐Ÿ‘ท ๐Ÿ‘Š
+      # ๐Ÿณ ๐Ÿธ ๐Ÿน ๐Ÿบ ๐Ÿฝ ๐Ÿฎ ๐Ÿพ ๐Ÿฟ ๐Ÿง ๐Ÿฅ ๐Ÿฃ ๐Ÿ  ๐Ÿ˜ ๐Ÿ™ ๐ŸŸ ๐Ÿญ
+      # ๐Ÿˆ ๐ŸŽง ๐Ÿฐ ๐Ÿช ๐Ÿ™ ๐ŸŒต ๐ŸŒŸ โ›บ โš— โ™บ
+
+      # switch to workspace
+      bindcode $mod+10 workspace $WS1
+      bindcode $mod+11 workspace $WS2
+      bindcode $mod+12 workspace $WS3
+      bindcode $mod+13 workspace $WS4
+      bindcode $mod+14 workspace $WS5
+      bindcode $mod+15 workspace $WS6
+      bindcode $mod+16 workspace $WS7
+      bindcode $mod+17 workspace $WS8
+      bindcode $mod+18 workspace $WS9
+      bindcode $mod+19 workspace $WS0
+
+      # move focused container to workspace
+      bindcode $mod+Shift+10 move container to workspace $WS1
+      bindcode $mod+Shift+11 move container to workspace $WS2
+      bindcode $mod+Shift+12 move container to workspace $WS3
+      bindcode $mod+Shift+13 move container to workspace $WS4
+      bindcode $mod+Shift+14 move container to workspace $WS5
+      bindcode $mod+Shift+15 move container to workspace $WS6
+      bindcode $mod+Shift+16 move container to workspace $WS7
+      bindcode $mod+Shift+17 move container to workspace $WS8
+      bindcode $mod+Shift+18 move container to workspace $WS9
+      bindcode $mod+Shift+19 move container to workspace $WS0
+
+      assign [class="Firefox" window_role="browser"] โ†’ $WS1
+
+      ## quick terminal (tmux)
+      exec --no-startup-id termite --name metask --exec tmux
+      for_window [instance="metask"] floating enable;
+      #for_window [instance="metask"] move scratchpad; [instance="metask"] scratchpad show; move position 0px 0px; resize shrink height 300px; resize grow width 683px; move scratchpad
+      for_window [instance="metask"] move scratchpad; [instance="metask"] scratchpad show; move position 0px 0px; move scratchpad
+      bindcode $mod+49 [instance="metask"] scratchpad show
+
+      bindsym XF86MonBrightnessUp exec "xbacklight -inc 10"
+      bindsym XF86MonBrightnessDown exec "xbacklight -dec 10"
+      bindsym shift+XF86MonBrightnessUp exec "xbacklight -inc 1"
+      bindsym shift+XF86MonBrightnessDown exec "xbacklight -dec 1"
+      bindsym XF86AudioLowerVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl set-sink-volume @DEFAULT_SINK@ -5%"
+      bindsym XF86AudioRaiseVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl set-sink-volume @DEFAULT_SINK@ +5%"
+      bindsym XF86AudioMute exec "pactl set-sink-mute @DEFAULT_SINK@ toggle"
+      bindsym XF86AudioMicMute exec "pactl set-source-mute @DEFAULT_SOURCE@ toggle"
+      bindsym XF86AudioPlay exec "playerctl play-pause"
+      bindsym XF86AudioNext exec "playerctl next"
+      bindsym XF86AudioPrev exec "playerctl previous"
+
+      # reload the configuration file
+      bindsym $mod+Shift+x reload
+      # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
+      bindsym $mod+Shift+o restart
+      # exit i3 (logs you out of your X session)
+      bindsym $mod+Shift+p exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3?' -b 'Yes, exit i3' 'i3-msg exit'"
+      # poweroff
+      bindsym $mod+Shift+F12 exec "i3-nagbar -t warning -m 'You pressed the poweroff shortcut. Do you really want to poweroff?' -b 'Yes, poweroff' 'systemctl poweroff'"
+      # reboot
+      bindsym $mod+Control+F12 exec "i3-nagbar -t warning -m 'You pressed the reboot shortcut. Do you really want to reboot?' -b 'Yes, reboot' 'systemctl reboot'"
+      # move workspace to output
+      set $workspace_move Move workspace to output : [l]eft [r]ight [d]own [u]p
+
+      mode "$workspace_move" {
+      bindsym left move workspace to output left
+      bindsym l move workspace to output left
+
+      bindsym right move workspace to output right
+      bindsym r move workspace to output right
+
+      bindsym down move workspace to output down
+      bindsym d move workspace to output down
+
+      bindsym up move workspace to output up
+      bindsym u move workspace to output up
+
+      bindsym Escape mode "default"
+      bindsym Return mode "default"
+      }
+
+      bindsym $mod+m mode "$workspace_move"
+
+      # resize window (you can also use the mouse for that)
+      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 t resize shrink width 10 px or 10 ppt
+      bindsym s resize grow height 10 px or 10 ppt
+      bindsym r resize shrink height 10 px or 10 ppt
+      bindsym n resize grow width 10 px or 10 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
+      bindsym Return mode "default"
+      bindsym Escape mode "default"
+      }
+
+      bindsym $mod+o mode "resize"
+    '';
+  };
+  xdg.configFile."i3/i3status.conf".text = ''
+    general {
+    colors = true
+    color_bad = "#dc322f"
+    color_degraded = "#cb4b16"
+    color_separator = "#000000"
+    output_format = "i3bar"
+    interval = 5
+    }
+
+    order = ""
+    order = "wireless wlp3s0"
+    order += "disk /"
+    order += "time"
+
+    wireless wlp3s0 {
+    format_up = "W: (%quality at %essid) %ip"
+    format_down = "W: down"
+    }
+
+    disk "/" {
+    format = "/ %free"
+    }
+  '';
+}
envs/wakasu.nix
@@ -1,7 +1,7 @@
 { pkgs, prefix, ...}:
 
 {
-  imports = [ ./ssh.nix ./dev.nix ];
+  imports = [ ./ssh.nix ./dev.nix ./i3.nix ];
   home.keyboard = {
     layout = "fr(bepo),fr";
     variant = "oss";
@@ -9,18 +9,24 @@
   };
   xsession = {
     enable = true;
-    windowManager.command = "i3";
     initExtra = ''
-      ${pkgs.networkmanagerapplet}/bin/nm-applet &
       ${pkgs.xlibs.xmodmap}/bin/xmodmap ~/.Xmodmap &
     '';
+    pointerCursor = {
+      package = pkgs.vanilla-dmz;
+      name = "Vanilla-DMZ";
+    };
   };
   programs.autorandr = {
     enable = true;
   };
-  services.udiskie = {
+  services.gpg-agent = {
     enable = true;
+    enableSshSupport = true;
   };
+  services.dunst.enable = true;
+  services.udiskie.enable = true;
+  services.network-manager-applet.enable = true;
   services.screen-locker = {
     enable = true;
     lockCmd = "i3lock-color --clock -i $HOME/.background-lock --tiling";