about summary refs log tree commit diff
path: root/home/profiles
diff options
context:
space:
mode:
Diffstat (limited to 'home/profiles')
-rw-r--r--home/profiles/base/default.nix3
-rw-r--r--home/profiles/browsing/default.nix1
-rw-r--r--home/profiles/communication/default.nix5
-rw-r--r--home/profiles/development/default.nix3
-rw-r--r--home/profiles/gui/config/dunst.nix50
-rw-r--r--home/profiles/gui/config/mako.nix45
-rw-r--r--home/profiles/gui/config/sway.nix14
-rw-r--r--home/profiles/gui/config/waybar/settings.nix14
-rw-r--r--home/profiles/gui/config/waybar/style.nix19
-rw-r--r--home/profiles/gui/default.nix111
-rw-r--r--home/profiles/gui/scripts/aeroplane-mode.nix12
-rw-r--r--home/profiles/gui/scripts/scratchpad-indicator.nix18
-rw-r--r--home/profiles/research/default.nix10
-rw-r--r--home/profiles/security/default.nix27
14 files changed, 201 insertions, 131 deletions
diff --git a/home/profiles/base/default.nix b/home/profiles/base/default.nix
index 5e01ca0..0c69f82 100644
--- a/home/profiles/base/default.nix
+++ b/home/profiles/base/default.nix
@@ -28,9 +28,9 @@ in
     home.keyboard.layout = "us";
     home.packages = [
       # Nix Tools
+      pkgs.nh
       pkgs.nix-index
       pkgs.nix-tree
-      pkgs.nix-top
       pkgs.nix-update
       pkgs.hydra-check
 
@@ -48,6 +48,7 @@ in
       pkgs.procs
       pkgs.sops
       pkgs.tree
+      pkgs.units
       pkgs.neovim
 
       # Common build tools
diff --git a/home/profiles/browsing/default.nix b/home/profiles/browsing/default.nix
index e2baa0a..5634b34 100644
--- a/home/profiles/browsing/default.nix
+++ b/home/profiles/browsing/default.nix
@@ -98,6 +98,7 @@ in
 
         extensions = with pkgs.nur.repos.rycee.firefox-addons; [
           bitwarden
+          consent-o-matic
           kagi-search
           tridactyl
         ];
diff --git a/home/profiles/communication/default.nix b/home/profiles/communication/default.nix
index 4a287ee..5379f8a 100644
--- a/home/profiles/communication/default.nix
+++ b/home/profiles/communication/default.nix
@@ -25,7 +25,7 @@ in
   };
 
   config = lib.mkIf cfg.enable (lib.mkMerge [
-    # TODO: is this needed?
+    # TODO: also configure mail in Darwin
     (lib.mkIf pkgs.stdenv.isLinux {
       sops.secrets.sef-email-password = { };
 
@@ -409,7 +409,6 @@ in
 
         discord-canary
         element-desktop
-        kiwitalk
         nheko
         slack
         (weechat.override {
@@ -427,6 +426,8 @@ in
       ];
 
       nixpkgs.allowedUnfree = [ "slack" "discord-canary" ];
+      # TODO: https://github.com/Nheko-Reborn/nheko/issues/1786
+      nixpkgs.allowedInsecure = [ "olm" ];
 
       xdg.configFile."Element/config.json".text = builtins.toJSON (import ./element-config.nix);
     }
diff --git a/home/profiles/development/default.nix b/home/profiles/development/default.nix
index 15cec65..08eacf1 100644
--- a/home/profiles/development/default.nix
+++ b/home/profiles/development/default.nix
@@ -41,7 +41,7 @@ in
         init.defaultBranch = "main";
         pull.rebase = true;
 
-        merge.conflictStyle = "diff3";
+        merge.conflictStyle = "zdiff3";
 
         mergetool.fugitive = {
           cmd = ''nvim -f -c "Gvdiffsplit!" "$MERGED"'';
@@ -229,6 +229,7 @@ in
       pkgs.git-filter-repo
       pkgs.hyperfine
       pkgs.jq
+      pkgs.kicad
       pkgs.lsof
       pkgs.ouch
       pkgs.tcpdump
diff --git a/home/profiles/gui/config/dunst.nix b/home/profiles/gui/config/dunst.nix
deleted file mode 100644
index f6e80b3..0000000
--- a/home/profiles/gui/config/dunst.nix
+++ /dev/null
@@ -1,50 +0,0 @@
-{ config, neotheme }:
-
-with neotheme.colors;
-
-let
-  guiCfg = config.profiles.gui;
-in
-{
-  global = {
-    padding = 8;
-    width = "330";
-    origin = "top-right";
-    offset = "8x25";
-    notification_limit = 5;
-    frame_width = 2;
-    vertical_alignment = "center";
-    horizontal_padding = 8;
-    icon_position = "left";
-    corner_radius = 10;
-
-    markup = "full";
-    word_wrap = true;
-    show_indicators = false;
-    format = "<b>%s</b>\\n\\n%b";
-    font = "${guiCfg.font.name} ${toString guiCfg.font.size}";
-    frame_color = "#${color3}";
-    separator_color = "auto";
-    max_icon_size = 80;
-  };
-
-  urgency_low = {
-    foreground = "#${foreground}";
-    background = "#${background}";
-    frame_color = "#${color4}";
-    timeout = 4;
-  };
-
-  urgency_normal = {
-    foreground = "#${foreground}";
-    background = "#${background}";
-    frame_color = "#${color3}";
-    timeout = 8;
-  };
-
-  urgency_critical = {
-    foreground = "#${foreground}";
-    background = "#${background}";
-    frame_color = "#${color1}";
-  };
-}
diff --git a/home/profiles/gui/config/mako.nix b/home/profiles/gui/config/mako.nix
new file mode 100644
index 0000000..a471a6a
--- /dev/null
+++ b/home/profiles/gui/config/mako.nix
@@ -0,0 +1,45 @@
+{ config, neotheme }:
+
+with neotheme.colors;
+
+let
+  guiCfg = config.profiles.gui;
+in
+{
+  anchor = "top-right";
+  width = 330;
+  padding = "8";
+  margin = "16,8";
+  borderRadius = 10;
+  borderSize = 2;
+
+  borderColor = "#${color3}";
+  backgroundColor = "#${background}";
+  textColor = "#${foreground}";
+  progressColor = "over #${color5}";
+
+  markup = true;
+  font = "${guiCfg.font.name} ${toString guiCfg.font.size}";
+
+  maxVisible = 5;
+
+  extraConfig = ''
+    [urgency=low]
+    border-color=#${color4}
+    default-timeout=4000
+
+    [urgency=normal]
+    border-color=#${color3}
+    default-timeout=8000
+
+    [urgency=critical]
+    border-color=#${color1}
+    default-timeout=0
+
+    [app-name=yubikey-touch-detector]
+    anchor=bottom-center
+    text-alignment=center
+    padding=32
+
+  '';
+}
diff --git a/home/profiles/gui/config/sway.nix b/home/profiles/gui/config/sway.nix
index 36b1b95..cf8bc7a 100644
--- a/home/profiles/gui/config/sway.nix
+++ b/home/profiles/gui/config/sway.nix
@@ -70,6 +70,11 @@ in
 
   # floating
   bindsym $mod+f floating toggle
+  bindsym $mod+Shift+f move position center
+
+  # scratchpad
+  bindsym $mod+grave scratchpad show; focus
+  bindsym $mod+shift+grave move scratchpad
 
   # kill focused
   bindsym $mod+w kill
@@ -84,6 +89,7 @@ in
   for_window [window_type="dialog"]      floating enable
   for_window [window_type="menu"]        floating enable
   for_window [class="mpv"]               floating enable
+  for_window [app_id="kicad"]            floating enable
   for_window [class=".*"]                inhibit_idle fullscreen
   for_window [app_id=".*"]               title_format ""
   for_window [class=".*"]                title_format ""
@@ -250,9 +256,11 @@ in
     tap_button_map lmr          #1Finger > Left Click , 2Finger > Right Click, 3Fingers > MiddleClick
   }
 
-  input "1149:8264:Primax_Kensington_Eagle_Trackball" {
-    accel_profile flat
-    pointer_accel 0
+  # Kensington Slimblade Pro
+  # TODO: directly handle device?
+  input "4012:6878:keyd_virtual_pointer" {
+    accel_profile adaptive
+    pointer_accel -0.7
   }
 
   input type:keyboard {
diff --git a/home/profiles/gui/config/waybar/settings.nix b/home/profiles/gui/config/waybar/settings.nix
index 9470824..341a1b3 100644
--- a/home/profiles/gui/config/waybar/settings.nix
+++ b/home/profiles/gui/config/waybar/settings.nix
@@ -1,4 +1,4 @@
-{ config, lib, neotheme }:
+{ config, lib, pkgs, neotheme }:
 
 with neotheme.colors;
 
@@ -10,7 +10,7 @@ in
   position = "top";
   height = 22;
   modules-left = [ "wireplumber" "custom/separator" "cpu" "custom/separator" "memory" "custom/separator" "idle_inhibitor" ];
-  modules-center = [ "sway/workspaces" ];
+  modules-center = [ "sway/workspaces" "custom/scratchpad-indicator" ];
   modules-right = [ "group/tray" "custom/separator" "network" "custom/separator" ]
     ++ lib.optionals (guiCfg.laptop.enable) [ "battery" "custom/separator" ]
     ++ [ "clock" ];
@@ -96,6 +96,16 @@ in
     tooltip = false;
   };
 
+  "custom/scratchpad-indicator" = {
+    format = "(+{})";
+    interval = 3;
+    return-type = "json";
+    hide-empty-text = true;
+    exec = "${pkgs.writeShellScript "scratchpad-indicator" (import ../../scripts/scratchpad-indicator.nix)}";
+    on-click = "exec swaymsg scratchpad show";
+    on-click-right = "exec swaymsg move scratchpad";
+  };
+
   "custom/separator" = {
     format = "|";
     interval = "once";
diff --git a/home/profiles/gui/config/waybar/style.nix b/home/profiles/gui/config/waybar/style.nix
index 92eb772..1f5327e 100644
--- a/home/profiles/gui/config/waybar/style.nix
+++ b/home/profiles/gui/config/waybar/style.nix
@@ -73,6 +73,21 @@ in
     border-bottom: 1px solid #${bright0};
   }
 
+  @keyframes blinkBattery {
+    to {
+      border-color: #${color3};
+    }
+  }
+
+  #battery.charging {
+    border-bottom: 1px solid transparent;
+    animation-name: blinkBattery;
+    animation-duration: 1s;
+    animation-timing-function: steps(12);
+    animation-iteration-count: infinite;
+    animation-direction: alternate;
+  }
+
   #tray {
     /* TODO: https://github.com/Alexays/Waybar/issues/2906 */
     margin: 0;
@@ -92,6 +107,10 @@ in
     padding-right: 0.2rem;
   }
 
+  #custom-scratchpad-indicator {
+    color: #f0a0c0;
+  }
+
   #custom-separator {
     color: #${alt1};
     background-color: #${background};
diff --git a/home/profiles/gui/default.nix b/home/profiles/gui/default.nix
index 838d2ab..cba6747 100644
--- a/home/profiles/gui/default.nix
+++ b/home/profiles/gui/default.nix
@@ -76,7 +76,17 @@ in
     gtk.enable = true;
     gtk.iconTheme.package = pkgs.papirus-icon-theme;
     gtk.iconTheme.name = neotheme.gtk.iconTheme.dark;
-    gtk.theme.package = (pkgs.orchis-theme.override { tweaks = [ "primary" "compact" ]; });
+    gtk.theme.package = (pkgs.orchis-theme.override { tweaks = [ "primary" "compact" ]; }).overrideAttrs(old: {
+      version = "unstable-2024-07-27";
+
+      # TODO: version >2024-05-30
+      src = pkgs.fetchFromGitHub {
+        repo = "Orchis-theme";
+        owner = "vinceliuice";
+        rev = "ac16750c3fb3499d01eb21b04c4347e3059809e1";
+        hash = "sha256-tGuw5x85qtuAmUalbYywtOELC1yheaOnfZlCHYCWsIQ=";
+      };
+    });
     gtk.theme.name = neotheme.gtk.theme.dark;
     gtk.font.name = "${cfg.font.name} ${toString cfg.font.size}";
 
@@ -84,6 +94,7 @@ in
 
     home.packages = [
       # Sway
+      pkgs.alsa-utils
       pkgs.autotiling
       pkgs.brightnessctl
       pkgs.blueberry
@@ -105,26 +116,17 @@ in
     ];
 
     home.sessionVariables = {
-      # Disabled as Element/Discord currently uses an old version of Electron
-      # that doesn't support IM.
-      # NIXOS_OZONE_WL = 1; # NOTE: might cause problems with old electron
+      NIXOS_OZONE_WL = 1; # NOTE: might cause problems with old electron
       _JAVA_AWT_WM_NONREPARENTING = 1; # Fix 'grey screen' issue on java apps
       SDL_VIDEODRIVER = "wayland";
+      # TODO: https://github.com/qutebrowser/qutebrowser/discussions/7938
+      QT_SCALE_FACTOR_ROUNDING_POLICY = "RoundPreferFloor";
     };
 
     wayland.windowManager.sway = {
       enable = true;
 
-      package =
-        if cfg.laptop.enable then
-          options.wayland.windowManager.sway.package.default.override
-            (prev: {
-              sway-unwrapped = prev.sway-unwrapped.override (s-prev: {
-                wlroots = s-prev.wlroots.overrideAttrs {
-                  patches = [ ../../../overlays/patches/wlroots-displaylink/DisplayLink_v2.patch ];
-                };
-              });
-            }) else options.wayland.windowManager.sway.package.default;
+      package = options.wayland.windowManager.sway.package.default;
 
       wrapperFeatures = {
         base = true;
@@ -164,16 +166,45 @@ in
       waybar = {
         enable = config.wayland.windowManager.sway.enable;
 
-        settings = [ (import ./config/waybar/settings.nix { inherit config lib neotheme; }) ];
+        settings = [ (import ./config/waybar/settings.nix { inherit config lib pkgs neotheme; }) ];
 
         style = import ./config/waybar/style.nix { inherit config neotheme; };
       };
     };
 
     services = {
-      dunst = {
+      darkman = {
         enable = true;
-        settings = import ./config/dunst.nix { inherit config neotheme; };
+        settings = {
+          lat = 36.5;
+          lng = 127.2;
+          usegeoclue = true;
+        };
+
+        darkModeScripts = {
+          gtk-theme = ''
+            ${pkgs.dconf}/bin/dconf write \
+              /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
+
+            ${pkgs.dconf}/bin/dconf write \
+              /org/gnome/desktop/interface/gtk-theme "'${neotheme.gtk.theme.dark}'"
+
+            ${pkgs.dconf}/bin/dconf write \
+              /org/gnome/desktop/interface/icon-theme "'${neotheme.gtk.iconTheme.dark}'"
+          '';
+        };
+        lightModeScripts = {
+          gtk-theme = ''
+            ${pkgs.dconf}/bin/dconf write \
+              /org/gnome/desktop/interface/color-scheme "'prefer-light'"
+
+            ${pkgs.dconf}/bin/dconf write \
+              /org/gnome/desktop/interface/gtk-theme "'${neotheme.gtk.theme.light}'"
+
+            ${pkgs.dconf}/bin/dconf write \
+              /org/gnome/desktop/interface/icon-theme "'${neotheme.gtk.iconTheme.light}'"
+          '';
+        };
       };
 
       kanshi = {
@@ -206,6 +237,10 @@ in
         ];
       };
 
+      mako = {
+        enable = true;
+      } // import ./config/mako.nix { inherit config neotheme; };
+
       swayidle =
         let
           # TODO: remove when >1.6.11
@@ -247,13 +282,7 @@ in
             { timeout = 270; command = "${pkgs.libnotify}/bin/notify-send -t 30000 'Locking screen in 30 seconds'"; }
             # 5m
             { timeout = 300; command = lockCommand; }
-          ] ++ lib.optionals (!cfg.laptop.enable)
-            [{
-              # 10m (desktop only)
-              timeout = 600;
-              command = "${config.wayland.windowManager.sway.package}/bin/swaymsg 'output * dpms off'";
-              resumeCommand = "${config.wayland.windowManager.sway.package}/bin/swaymsg 'output * dpms on'";
-            }] ++ [
+          ] ++ [
             {
               # 10m on laptops, 15m on desktop
               timeout = if cfg.laptop.enable then 600 else 900;
@@ -267,40 +296,6 @@ in
         latitude = "36.5";
         longitude = "127.2";
       };
-
-      darkman = {
-        enable = true;
-        settings = {
-          lat = 36.5;
-          lng = 127.2;
-          usegeoclue = true;
-        };
-
-        darkModeScripts = {
-          gtk-theme = ''
-            ${pkgs.dconf}/bin/dconf write \
-              /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
-
-            ${pkgs.dconf}/bin/dconf write \
-              /org/gnome/desktop/interface/gtk-theme "'${neotheme.gtk.theme.dark}'"
-
-            ${pkgs.dconf}/bin/dconf write \
-              /org/gnome/desktop/interface/icon-theme "'${neotheme.gtk.iconTheme.dark}'"
-          '';
-        };
-        lightModeScripts = {
-          gtk-theme = ''
-            ${pkgs.dconf}/bin/dconf write \
-              /org/gnome/desktop/interface/color-scheme "'prefer-light'"
-
-            ${pkgs.dconf}/bin/dconf write \
-              /org/gnome/desktop/interface/gtk-theme "'${neotheme.gtk.theme.light}'"
-
-            ${pkgs.dconf}/bin/dconf write \
-              /org/gnome/desktop/interface/icon-theme "'${neotheme.gtk.iconTheme.light}'"
-          '';
-        };
-      };
     };
   };
 }
diff --git a/home/profiles/gui/scripts/aeroplane-mode.nix b/home/profiles/gui/scripts/aeroplane-mode.nix
index 9f09c05..0b1ecf3 100644
--- a/home/profiles/gui/scripts/aeroplane-mode.nix
+++ b/home/profiles/gui/scripts/aeroplane-mode.nix
@@ -1,15 +1,13 @@
 ''
 set -euo pipefail
 
-rfkill_soft=$(rfkill -ro soft | tail -n +2 | sort -u)
+radio_status=$(nmcli radio | tail -n +2 | awk 'OFS="\n" {print $2,$4}' | sort -u)
 
-rfkill toggle all
-
-if [[ $rfkill_soft == "unblocked"  ]]; then
+if [[ $radio_status == "enabled" ]]; then
+    nmcli radio all off
     notify-send --urgency=critical "Aeroplane mode ACTIVATED"
-elif [[ $rfkill_soft == "blocked" ]]; then
-    notify-send --urgency=critical "Aeroplane mode DEACTIVATED"
 else
-    notify-send --urgency=critical "WARN: RFKill was in inconsistent state. Aeroplane mode ACTIVATED"
+    nmcli radio all on
+    notify-send --urgency=low "Aeroplane mode DEACTIVATED"
 fi
 ''
diff --git a/home/profiles/gui/scripts/scratchpad-indicator.nix b/home/profiles/gui/scripts/scratchpad-indicator.nix
new file mode 100644
index 0000000..7ee66c3
--- /dev/null
+++ b/home/profiles/gui/scripts/scratchpad-indicator.nix
@@ -0,0 +1,18 @@
+''
+output="$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.name == "__i3_scratch").floating_nodes[]|"`<b>"+.name+"`</b> - "+.app_id+" "+(.id|tostring)')"
+number="$(swaymsg -r -t get_tree | jq -r 'recurse(.nodes[]) | first(select(.name=="__i3_scratch")) | .floating_nodes | length')"
+
+if [ "$number" -gt 0 ]; then
+    text="$number"
+else
+    text=""
+fi
+
+output="$(echo "$output" | sed -r 's/[&]+/and/g')" # Replace unprintable & character with the word 'and'
+tooltip="Scratchpad\n\n"
+tooltip+="$(echo "$output" | sed -z 's/\n/\\n/g')"
+tooltip=''${tooltip::-2}
+
+echo "{\"text\":\"$text\", \"tooltip\":\"$tooltip\"}"
+exit 0
+''
diff --git a/home/profiles/research/default.nix b/home/profiles/research/default.nix
index 2d98905..dd8e31b 100644
--- a/home/profiles/research/default.nix
+++ b/home/profiles/research/default.nix
@@ -31,8 +31,8 @@ in
         index-active-bg = "#dbd3c4";
         index-active-fg = "#4f5058";
 
-        highlight-color = "#d4ae80";
-        highlight-active-color = "#8197bf";
+        highlight-color = "#rgba(212,174,128,0.5)";
+        highlight-active-color = "rgba(129,151,191,0.5)";
 
         notification-bg = "#dbd3c4";
         notification-fg = "#151515";
@@ -51,16 +51,14 @@ in
     };
 
     home.packages = [
-      pkgs.kicad
-      pkgs.ltex-ls
       pkgs.libreoffice
+      pkgs.ltex-ls
       pkgs.obsidian
       pkgs.pandoc
       pkgs.tana
       pkgs.texlive.combined.scheme-small
+      pkgs.tinymist
       pkgs.typst
-      pkgs.typst-lsp
-      pkgs.typst-preview
       pkgs.websocat
 
       pkgs.nanum
diff --git a/home/profiles/security/default.nix b/home/profiles/security/default.nix
index b64de22..2201f3e 100644
--- a/home/profiles/security/default.nix
+++ b/home/profiles/security/default.nix
@@ -12,7 +12,6 @@ in
       pkgs.yubikey-manager
       pkgs.age-plugin-yubikey
 
-      pkgs.keepassxc
       pkgs.bitwarden
       pkgs.bitwarden-cli
 
@@ -20,5 +19,31 @@ in
 
       pkgs.protonvpn-gui
     ];
+
+    systemd.user = lib.mkIf pkgs.stdenv.isLinux {
+      sockets.yubikey-touch-detector = {
+        Unit.Description = "Unix socket activation for YubiKey touch detector service";
+        Socket = {
+          ListenStream = "%t/yubikey-touch-detector.socket";
+          RemoveOnStop = true;
+        };
+        Install.WantedBy = [ "sockets.target" ];
+      };
+
+      services.yubikey-touch-detector = {
+        Unit = {
+          Description = "Detects when your YubiKey is waiting for a touch";
+          Requires = "yubikey-touch-detector.socket";
+        };
+        Service = {
+          ExecStart = "${lib.getExe pkgs.yubikey-touch-detector} --libnotify -v";
+          EnvironmentFile = "-%E/yubikey-touch-detector/service.conf";
+        };
+        Install = {
+          Also = "yubikey-touch-detector.socket";
+          WantedBy = [ "default.target" ];
+        };
+      };
+    };
   };
 }