aboutsummaryrefslogtreecommitdiff
path: root/home/rices/nord-blue/i3.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home/rices/nord-blue/i3.nix')
-rw-r--r--home/rices/nord-blue/i3.nix107
1 files changed, 107 insertions, 0 deletions
diff --git a/home/rices/nord-blue/i3.nix b/home/rices/nord-blue/i3.nix
new file mode 100644
index 0000000..b42f223
--- /dev/null
+++ b/home/rices/nord-blue/i3.nix
@@ -0,0 +1,107 @@
+{
+ pkgs,
+ lib,
+ ...
+}: let
+ vars = import ./variables.nix;
+ mod = "Mod4";
+
+ lock-screen = pkgs.writeShellScriptBin "lock-screen" ''
+ #!/usr/bin/env sh
+ set -eu
+ WALL="''${1:-$HOME/Pictures/wallpaper.png}"
+ TMP="/tmp/lockscreen.png"
+ RES=$(xrandr | awk '/\*/ {print $1; exit}')
+ magick "$WALL" -resize "''${RES}^" -gravity center -extent "$RES" "$TMP"
+ i3lock -i "$TMP"
+ '';
+
+ app-launcher = pkgs.writeShellScriptBin "app-launcher" ''
+ #!/usr/bin/env sh
+ BG='${vars.colors.background}'
+ FG='${vars.colors.foreground}'
+ ACCENT='${vars.colors.accent}'
+ TEXT='${vars.colors.text}'
+ dmenu_run -fn 'JetBrains Mono-12' -nb "$BG" -nf "$FG" -sb "$ACCENT" -sf "$TEXT"
+ '';
+in {
+ xsession.windowManager.i3 = {
+ enable = true;
+ config = {
+ modifier = mod;
+ bars = [];
+
+ window = {
+ titlebar = false;
+ border = 3;
+ };
+
+ # Colors handled by Stylix
+
+ startup = [
+ {command = "sh -c 'feh --bg-scale ~/Pictures/wallpaper.png'";}
+ ];
+
+ keybindings = lib.mkOptionDefault {
+ "${mod}+Return" = "exec ${pkgs.alacritty}/bin/alacritty";
+ "${mod}+d" = "exec ${app-launcher}/bin/app-launcher";
+ "${mod}+m" = "exec ${app-launcher}/bin/app-launcher";
+ "${mod}+Shift+m" = "exec alacritty -e nnn";
+ "${mod}+n" = "exec firefox";
+ "${mod}+q" = "kill";
+ "${mod}+Ctrl+l" = "exec ${lock-screen}/bin/lock-screen";
+ "${mod}+Shift+r" = "restart";
+ "${mod}+Ctrl+Shift+e" = "exec sh -c 'i3-msg exit'";
+ "${mod}+Shift+s" = "exec flameshot gui";
+
+ # Focus (vim bindings)
+ "${mod}+h" = "focus left";
+ "${mod}+j" = "focus down";
+ "${mod}+k" = "focus up";
+ "${mod}+l" = "focus right";
+
+ # Focus (arrow keys)
+ "${mod}+Left" = "focus left";
+ "${mod}+Down" = "focus down";
+ "${mod}+Up" = "focus up";
+ "${mod}+Right" = "focus right";
+
+ # Move (vim bindings)
+ "${mod}+Shift+h" = "move left";
+ "${mod}+Shift+j" = "move down";
+ "${mod}+Shift+k" = "move up";
+ "${mod}+Shift+l" = "move right";
+
+ # Move (arrow keys)
+ "${mod}+Shift+Left" = "move left";
+ "${mod}+Shift+Down" = "move down";
+ "${mod}+Shift+Up" = "move up";
+ "${mod}+Shift+Right" = "move right";
+
+ # Volume
+ "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
+ "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
+ "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
+ "XF86AudioMicMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
+
+ # Brightness
+ "XF86MonBrightnessUp" = "exec brightnessctl set 5%+";
+ "XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
+ };
+ };
+
+ extraConfig = ''
+ smart_borders on
+ '';
+ };
+
+ home.packages = with pkgs; [
+ dmenu
+ i3lock
+ imagemagick
+ polybar
+ alacritty
+ feh
+ nnn
+ ];
+}