diff --git a/henrovnix_ok/README.org b/henrovnix_ok/README.org index e7213ecf9..2211ca7b0 100755 --- a/henrovnix_ok/README.org +++ b/henrovnix_ok/README.org @@ -541,6 +541,7 @@ The tree below shows the full repository layout, with the standardized internal │   │   ├── hypridle.nix │   │   ├── hyprland.nix │   │   ├── hyprlock.nix +│   │   ├── hyprscrolling.nix │   │   ├── hyprshell.nix │   │   ├── walker.nix │   │   ├── wallpaper.nix @@ -1583,52 +1584,6 @@ These are some of the services that I enable at the system level. Explanation in }; }; } - -#+end_src - -** Miscellaneous Packages and Programs -#+name: config-system-packages -#+begin_src nix - environment.systemPackages = with pkgs; [ - wget # fetch utility - curl # more fetch utility - binutils # executable utilities, like ld - dmidecode # tool for dumping system info - libnotify # notification daemon - python3 # nice to have this ready for quick things - cacert # certificate authority - remmina # remote desktop app - #rg # ripgrep - wev # for finding keypresses - tree # list foldetrtree's - file # filinfo - htop # sysmonitor - solaar # logitech controller - git # source control - # jetbrains.pycharm # Dev and course environment - - - ]; - - # to enable icons with wlogout - # https://github.com/catppuccin/nix/issues/584 - programs.gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; -#+end_src - -#+name: config-programs -#+begin_src nix - programs = { - nix-ld.enable = true; # helps with linking troubles with dynamic libraries - appimage.enable = true; # allow appimage installations - dconf.enable = true; # to save user settings - gnupg.agent = { - # pgp client - enable = true; - enableSSHSupport = true; - }; - firefox.enable = true; # browser - wireshark.enable = true; # vpn - }; #+end_src ** Fonts @@ -1676,6 +1631,7 @@ This module will import all necessities. ./desktop/hyprland.nix ./desktop/hyprexpo.nix ./desktop/hyprlock.nix + ./desktop/hyprscrolling.nix ./desktop/hyprshell.nix ./desktop/wallpaper.nix ./desktop/waybar.nix @@ -1794,7 +1750,7 @@ in ** Idle Screen -#+begin_src nix :tangle home/desktop/hypridle.nix :noweb tangle :mkdirp yes{ config, lib, pkgs, flakeRoot, +#+begin_src nix :tangle home/desktop/hypridle.nix :noweb tangle :mkdirp yes { config, lib, pkgs, flakeRoot, ... }: let hypridleConf = flakeRoot + "/assets/conf/desktop/hypr/hypridle.conf"; @@ -1805,9 +1761,124 @@ in } #+end_src + +** hyprscrolling +This Nix module integrates the hyprscrolling plugin into a Home-Manager managed Hyprland setup in a declarative and reproducible way. It ensures the plugin is installed, optionally switches Hyprland to the scrolling layout, and renders user-defined plugin settings directly into the Hyprland configuration. The goal is to manage the scrolling workspace behavior entirely from Nix instead of maintaining manual edits inside hyprland.conf. +#+begin_src nix :tangle home/desktop/hyprscrolling.nix :noweb tangle :mkdirp yes +{ config, lib, pkgs, ... }: +let + cfg = config.programs.hyprscrolling; + # Render plugin settings into: + # plugin:hyprscrolling { + # key = value + # } + # + # Values: + # - strings become "..." + # - bools become true/false + # - ints/floats stay numeric + # - lists become [ a b c ] (Hyprland-style arrays) + renderValue = + v: + if lib.isString v then "\"${v}\"" + else if lib.isBool v then (if v then "true" else "false") + else if lib.isInt v || lib.isFloat v then toString v + else if lib.isList v then + "[ " + (lib.concatStringsSep " " (map renderValue v)) + " ]" + else + throw "programs.hyprscrolling.settings: unsupported value type: ${builtins.typeOf v}"; + + renderSettings = + settings: + let + lines = lib.mapAttrsToList (k: v: " ${k} = ${renderValue v}") settings; + in + if settings == { } then "" + else '' + plugin:hyprscrolling { + ${lib.concatStringsSep "\n" lines} + } + ''; + + defaultPluginPkg = + # In nixpkgs this is typically available as pkgs.hyprlandPlugins.hyprscrolling + # (names may vary by channel; override via programs.hyprscrolling.pluginPackage if needed). + (pkgs.hyprlandPlugins.hyprscrolling or null); + +in +{ + options.programs.hyprscrolling = { + enable = lib.mkEnableOption "Hyprland hyprscrolling (scrolling layout) plugin"; + + pluginPackage = lib.mkOption { + type = lib.types.nullOr lib.types.package; + default = defaultPluginPkg; + description = '' + Package that provides the hyprscrolling plugin. + Defaults to pkgs.hyprlandPlugins.hyprscrolling when available. + ''; + }; + + setAsDefaultLayout = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Whether to set `general:layout = scrolling` in Hyprland."; + }; + settings = lib.mkOption { + type = lib.types.attrs; + default = { }; + example = { + # Example keys (actual keys depend on plugin version) + # See hyprscrolling README for supported options. + # swipe_fingers = 3; + # natural_scroll = true; + }; + description = '' + Attribute set rendered into a `plugin:hyprscrolling { ... }` block. + Keys/values must match hyprscrolling config options. + ''; + }; + + extraConfig = lib.mkOption { + type = lib.types.lines; + default = ""; + description = "Extra Hyprland config appended after the generated plugin config."; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = config.wayland.windowManager.hyprland.enable or false; + message = "programs.hyprscrolling.enable requires wayland.windowManager.hyprland.enable = true;"; + } + { + assertion = cfg.pluginPackage != null; + message = '' + Could not find a default hyprscrolling plugin package in this nixpkgs. + Set programs.hyprscrolling.pluginPackage explicitly (either from pkgs or a flake input). + ''; + } + ]; + + wayland.windowManager.hyprland = { + plugins = [ cfg.pluginPackage ]; + + extraConfig = lib.mkAfter '' + ${lib.optionalString cfg.setAsDefaultLayout "general { layout = scrolling }"} + + ${renderSettings cfg.settings} + + ${cfg.extraConfig} + ''; + }; + }; +} +#+end_src + ** Hyprshell For nice task-starting and -switching -#+begin_src nix :tangle home/desktop/hyprshell.nix :noweb tangle :mkdirp yes{ config, lib, pkgs, flakeRoot, +#+begin_src nix :tangle home/desktop/hyprshell.nix :noweb tangle :mkdirp yes # home/desktop/hyprshell.nix (Home-Manager module) { config, pkgs, lib, flakeRoot, ... }: let diff --git a/henrovnix_ok/assets/conf/apps/packages.conf b/henrovnix_ok/assets/conf/apps/packages.conf index 67bf9fe9f..6fbd033d6 100644 --- a/henrovnix_ok/assets/conf/apps/packages.conf +++ b/henrovnix_ok/assets/conf/apps/packages.conf @@ -28,9 +28,6 @@ wofi xdg-utils desktop-file-utils playerctl -pamixer -pavucontrol -brightnessctl rofi simple-scan mpv @@ -48,12 +45,9 @@ hyprpaper # utils wget -nextcloud-client kdePackages.kdeconnect-kde _1password-gui -docker tree -ripgrep gparted file htop @@ -65,8 +59,6 @@ obsidian onlyoffice-desktopeditors # development -git -vscode-with-extensions postman tea @@ -83,6 +75,3 @@ audacity handbrake spotify vlc - -#play -dualsensectl diff --git a/henrovnix_ok/assets/conf/desktop/hypr/bindings.conf b/henrovnix_ok/assets/conf/desktop/hypr/bindings.conf index baf18394e..f590f72e3 100644 --- a/henrovnix_ok/assets/conf/desktop/hypr/bindings.conf +++ b/henrovnix_ok/assets/conf/desktop/hypr/bindings.conf @@ -48,7 +48,7 @@ bind = $mainMod, W, exec, flatpak run app.zen_browser.zen # Switch windows bind = $mainMod, TAB, hyprexpo:expo, toggle -bind = ALT, TAB, cyclenext +bind = ALT, TAB, exec, wofi --show window bind = ALT SHIFT, TAB, cyclenext , prev # Focus movement @@ -163,6 +163,5 @@ bindl = , switch:off:Lid Switch, exec, ~/.config/hypr/scripts/lid-restore.sh ######################### bind = CTRL ALT, B, exec, flatpak run eu.betterbird.Betterbird bind = CTRL ALT, S, exec, spotify -bind = CTRL ALT, z, exec, run zen -bind = CTRL ALT, k, exec, kate +bind = CTRL ALT, z, exec, zeditor bind = $mainMod, w, exec, xdg-open https://nextcloud.data-pro.nu diff --git a/henrovnix_ok/configuration/default.nix b/henrovnix_ok/configuration/default.nix index 664fd13cc..35c27d914 100644 --- a/henrovnix_ok/configuration/default.nix +++ b/henrovnix_ok/configuration/default.nix @@ -17,30 +17,7 @@ ./services/services.nix ]; - environment.systemPackages = with pkgs; [ - wget # fetch utility - curl # more fetch utility - binutils # executable utilities, like ld - dmidecode # tool for dumping system info - libnotify # notification daemon - python3 # nice to have this ready for quick things - cacert # certificate authority - remmina # remote desktop app - #rg # ripgrep - wev # for finding keypresses - tree # list foldetrtree's - file # filinfo - htop # sysmonitor - solaar # logitech controller - git # source control - # jetbrains.pycharm # Dev and course environment - - ]; - - # to enable icons with wlogout - # https://github.com/catppuccin/nix/issues/584 - programs.gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; users.users.${user.username} = { isNormalUser = true; @@ -53,18 +30,7 @@ ]; }; - programs = { - nix-ld.enable = true; # helps with linking troubles with dynamic libraries - appimage.enable = true; # allow appimage installations - dconf.enable = true; # to save user settings - gnupg.agent = { - # pgp client - enable = true; - enableSSHSupport = true; - }; - firefox.enable = true; # browser - wireshark.enable = true; # vpn - }; + fonts.packages = with pkgs; [ aporetic diff --git a/henrovnix_ok/home/default.nix b/henrovnix_ok/home/default.nix index 34ea3bca3..1c547ca12 100644 --- a/henrovnix_ok/home/default.nix +++ b/henrovnix_ok/home/default.nix @@ -8,6 +8,7 @@ ./desktop/hyprland.nix ./desktop/hyprexpo.nix ./desktop/hyprlock.nix + ./desktop/hyprscrolling.nix ./desktop/hyprshell.nix ./desktop/wallpaper.nix ./desktop/waybar.nix diff --git a/henrovnix_ok/home/desktop/hyprscrolling.nix b/henrovnix_ok/home/desktop/hyprscrolling.nix new file mode 100644 index 000000000..305c7c880 --- /dev/null +++ b/henrovnix_ok/home/desktop/hyprscrolling.nix @@ -0,0 +1,109 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.programs.hyprscrolling; + # Render plugin settings into: + # plugin:hyprscrolling { + # key = value + # } + # + # Values: + # - strings become "..." + # - bools become true/false + # - ints/floats stay numeric + # - lists become [ a b c ] (Hyprland-style arrays) + renderValue = + v: + if lib.isString v then "\"${v}\"" + else if lib.isBool v then (if v then "true" else "false") + else if lib.isInt v || lib.isFloat v then toString v + else if lib.isList v then + "[ " + (lib.concatStringsSep " " (map renderValue v)) + " ]" + else + throw "programs.hyprscrolling.settings: unsupported value type: ${builtins.typeOf v}"; + + renderSettings = + settings: + let + lines = lib.mapAttrsToList (k: v: " ${k} = ${renderValue v}") settings; + in + if settings == { } then "" + else '' + plugin:hyprscrolling { + ${lib.concatStringsSep "\n" lines} + } + ''; + + defaultPluginPkg = + # In nixpkgs this is typically available as pkgs.hyprlandPlugins.hyprscrolling + # (names may vary by channel; override via programs.hyprscrolling.pluginPackage if needed). + (pkgs.hyprlandPlugins.hyprscrolling or null); + +in +{ + options.programs.hyprscrolling = { + enable = lib.mkEnableOption "Hyprland hyprscrolling (scrolling layout) plugin"; + + pluginPackage = lib.mkOption { + type = lib.types.nullOr lib.types.package; + default = defaultPluginPkg; + description = '' + Package that provides the hyprscrolling plugin. + Defaults to pkgs.hyprlandPlugins.hyprscrolling when available. + ''; + }; + + setAsDefaultLayout = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Whether to set `general:layout = scrolling` in Hyprland."; + }; + settings = lib.mkOption { + type = lib.types.attrs; + default = { }; + example = { + # Example keys (actual keys depend on plugin version) + # See hyprscrolling README for supported options. + # swipe_fingers = 3; + # natural_scroll = true; + }; + description = '' + Attribute set rendered into a `plugin:hyprscrolling { ... }` block. + Keys/values must match hyprscrolling config options. + ''; + }; + + extraConfig = lib.mkOption { + type = lib.types.lines; + default = ""; + description = "Extra Hyprland config appended after the generated plugin config."; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = config.wayland.windowManager.hyprland.enable or false; + message = "programs.hyprscrolling.enable requires wayland.windowManager.hyprland.enable = true;"; + } + { + assertion = cfg.pluginPackage != null; + message = '' + Could not find a default hyprscrolling plugin package in this nixpkgs. + Set programs.hyprscrolling.pluginPackage explicitly (either from pkgs or a flake input). + ''; + } + ]; + + wayland.windowManager.hyprland = { + plugins = [ cfg.pluginPackage ]; + + extraConfig = lib.mkAfter '' + ${lib.optionalString cfg.setAsDefaultLayout "general { layout = scrolling }"} + + ${renderSettings cfg.settings} + + ${cfg.extraConfig} + ''; + }; + }; +}