Compare commits
4 Commits
1e2cd6e66a
...
9acfe4b630
| Author | SHA1 | Date | |
|---|---|---|---|
| 9acfe4b630 | |||
| 4c6a2fd8e3 | |||
| 8d841cfcd0 | |||
| 5e2585efa0 |
+15
-43
@@ -1764,56 +1764,28 @@ in
|
|||||||
** hyprscrolling
|
** 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.
|
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
|
#+begin_src nix :tangle home/desktop/hyprscrolling.nix :noweb tangle :mkdirp yes
|
||||||
|
# home/desktop/hyprscrolling.nix (Home-Manager module)
|
||||||
|
# home/desktop/hyprscrolling.nix (Home-Manager module)
|
||||||
{ config, lib, pkgs, flakeRoot, ... }:
|
{ config, lib, pkgs, flakeRoot, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.programs.hyprscrolling;
|
cfg = config.programs.hyprscrolling;
|
||||||
defaultPluginPkg = (pkgs.hyprlandPlugins.hyprscrolling or null);
|
repoConf = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf";
|
||||||
# Stable paths (avoid pinning /nix/store/... in your hyprland.conf)
|
targetRel = "hypr/conf.d/90-hyprscrolling.conf";
|
||||||
stableSoPath = "/etc/hypr/plugins/libhyprscrolling.so";
|
|
||||||
dropInConfPath = "/etc/hypr/conf.d/90-hyprscrolling.conf";
|
|
||||||
# Read drop-in config from your repo (flake root)
|
|
||||||
dropInConfSourcePath = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf";
|
|
||||||
dropInConf = builtins.readFile dropInConfSourcePath;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.programs.hyprscrolling = {
|
options.programs.hyprscrolling.enable =
|
||||||
enable = lib.mkEnableOption "Hyprland hyprscrolling (scrolling layout) plugin (NixOS-friendly)";
|
lib.mkEnableOption "hyprscrolling Hyprland 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.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
# Where we install the generated config snippet (so you can `source = ...` it)
|
|
||||||
dropInPath = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = dropInConfPath;
|
|
||||||
description = "Path to the Hyprland drop-in config file (needs to be sourced by your hyprland.conf).";
|
|
||||||
};
|
|
||||||
# Where we install a stable symlink to the plugin .so
|
|
||||||
stablePluginSoPath = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = stableSoPath;
|
|
||||||
description = "Stable path for the plugin shared object (symlinked to the Nix store).";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
assertions = [
|
wayland.windowManager.hyprland = {
|
||||||
{
|
# the key part: load plugin like you did for hyprshell
|
||||||
assertion = cfg.pluginPackage != null;
|
plugins = [ pkgs.hyprlandPlugins.hyprscrolling ];
|
||||||
message = ''
|
# source the generated drop-in
|
||||||
Could not find hyprscrolling plugin package in this nixpkgs.
|
extraConfig = lib.mkAfter ''
|
||||||
Set programs.hyprscrolling.pluginPackage explicitly (e.g. pkgs.hyprlandPlugins.hyprscrolling).
|
source = ~/.config/${targetRel}
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
];
|
# place your repo config into ~/.config/hypr/conf.d/...
|
||||||
environment.systemPackages = [ cfg.pluginPackage ];
|
xdg.configFile."${targetRel}".source = repoConf;
|
||||||
environment.etc."hypr/plugins/libhyprscrolling.so".source =
|
|
||||||
"${cfg.pluginPackage}/lib/libhyprscrolling.so";
|
|
||||||
# Now /etc/hypr/conf.d/90-hyprscrolling.conf is exactly your file’s contents
|
|
||||||
environment.etc."hypr/conf.d/90-hyprscrolling.conf".text = dropInConf;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ wofi
|
|||||||
xdg-utils
|
xdg-utils
|
||||||
desktop-file-utils
|
desktop-file-utils
|
||||||
playerctl
|
playerctl
|
||||||
rofi
|
|
||||||
simple-scan
|
|
||||||
mpv
|
mpv
|
||||||
|
|
||||||
#productivity
|
#productivity
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ bind = $mainMod SHIFT, R, exec, hyprctl reload
|
|||||||
|
|
||||||
# Switch windows
|
# Switch windows
|
||||||
bind = $mainMod, TAB, hyprexpo:expo, toggle
|
bind = $mainMod, TAB, hyprexpo:expo, toggle
|
||||||
bind = ALT, TAB, exec, wofi --show window
|
bind = ALT, TAB, cyclenext
|
||||||
bind = ALT SHIFT, TAB, cyclenext , prev
|
bind = ALT, SHIFT, TAB, cyclenext prev
|
||||||
|
|
||||||
# Hyprscrolling
|
# Hyprscrolling
|
||||||
bind = $mainMod, period, layoutmsg, move +col
|
bind = $mainMod, period, layoutmsg, move +col
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ alias gcp='git add . && git commit && git push'
|
|||||||
alias cd='z'
|
alias cd='z'
|
||||||
|
|
||||||
alias nps='xdg-open https://search.nixos.org'
|
alias nps='xdg-open https://search.nixos.org'
|
||||||
alias hvnx='cd ~/Repos/nixos/henrovnix'
|
alias hvnx='cd ~/Repos/nixos/henrovnix_ok'
|
||||||
alias emt='hvnx && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html'
|
alias emt='hvnx && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html'
|
||||||
alias nxs='hvnx && sudo nixos-rebuild switch --flake .#traveldroid'
|
alias nxs='hvnx && sudo nixos-rebuild switch --flake .#traveldroid'
|
||||||
alias nxt='hvnx && sudo nixos-rebuild test --flake .#traveldroid'
|
alias nxt='hvnx && sudo nixos-rebuild test --flake .#traveldroid'
|
||||||
|
|||||||
@@ -1,62 +1,52 @@
|
|||||||
# --------------------------------------------------
|
{ config, lib, pkgs, flakeRoot, ... }:
|
||||||
# Hyprscrolling – scrolling layout with indicators
|
let
|
||||||
# Managed in repo: assets/conf/desktop/hypr/hyprscrolling.conf
|
cfg = config.programs.hyprscrolling;
|
||||||
# --------------------------------------------------
|
defaultPluginPkg = (pkgs.hyprlandPlugins.hyprscrolling or null);
|
||||||
|
# Stable paths (avoid pinning /nix/store/... in your hyprland.conf)
|
||||||
# Load plugin (.so is symlinked by Nix module)
|
stableSoPath = "/etc/hypr/plugins/libhyprscrolling.so";
|
||||||
plugin = /etc/hypr/plugins/libhyprscrolling.so
|
dropInConfPath = "/etc/hypr/conf.d/90-hyprscrolling.conf";
|
||||||
|
# Read drop-in config from your repo (flake root)
|
||||||
# Make scrolling the default layout
|
dropInConfSourcePath = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf";
|
||||||
general {
|
dropInConf = builtins.readFile dropInConfSourcePath;
|
||||||
layout = scrolling
|
in
|
||||||
|
{
|
||||||
|
options.programs.hyprscrolling = {
|
||||||
|
enable = lib.mkEnableOption "Hyprland hyprscrolling (scrolling layout) plugin (NixOS-friendly)";
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# Where we install the generated config snippet (so you can `source = ...` it)
|
||||||
|
dropInPath = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = dropInConfPath;
|
||||||
|
description = "Path to the Hyprland drop-in config file (needs to be sourced by your hyprland.conf).";
|
||||||
|
};
|
||||||
|
# Where we install a stable symlink to the plugin .so
|
||||||
|
stablePluginSoPath = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = stableSoPath;
|
||||||
|
description = "Stable path for the plugin shared object (symlinked to the Nix store).";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.pluginPackage != null;
|
||||||
|
message = ''
|
||||||
|
Could not find hyprscrolling plugin package in this nixpkgs.
|
||||||
|
Set programs.hyprscrolling.pluginPackage explicitly (e.g. pkgs.hyprlandPlugins.hyprscrolling).
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
environment.systemPackages = [ cfg.pluginPackage ];
|
||||||
|
environment.etc."hypr/plugins/libhyprscrolling.so".source =
|
||||||
|
"${cfg.pluginPackage}/lib/libhyprscrolling.so";
|
||||||
|
# Now /etc/hypr/conf.d/90-hyprscrolling.conf is exactly your file’s contents
|
||||||
|
environment.etc."hypr/conf.d/90-hyprscrolling.conf".text = dropInConf;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# Plugin configuration
|
|
||||||
# --------------------------------------------------
|
|
||||||
|
|
||||||
plugin:hyprscrolling {
|
|
||||||
|
|
||||||
# --- Core behaviour ---
|
|
||||||
enable = true
|
|
||||||
focus_follows_mouse = true
|
|
||||||
smooth_scrolling = true
|
|
||||||
|
|
||||||
# --- Gaps & spacing ---
|
|
||||||
gaps_in = 6
|
|
||||||
gaps_out = 16
|
|
||||||
|
|
||||||
# --- Indicators ---
|
|
||||||
# Show visual indicators for stacked windows
|
|
||||||
indicators = true
|
|
||||||
|
|
||||||
# Style of indicators (examples: line, dots, bar)
|
|
||||||
indicator_style = bar
|
|
||||||
|
|
||||||
# Thickness / size
|
|
||||||
indicator_thickness = 4
|
|
||||||
|
|
||||||
# Spacing between indicators
|
|
||||||
indicator_spacing = 6
|
|
||||||
|
|
||||||
# Offset from window edge
|
|
||||||
indicator_offset = 8
|
|
||||||
|
|
||||||
# Colors (RGBA)
|
|
||||||
indicator_color_active = rgba(137, 180, 250, 0.9) # blue-ish (Catppuccin style)
|
|
||||||
indicator_color_inactive = rgba(88, 91, 112, 0.6)
|
|
||||||
|
|
||||||
# Position (top, bottom, left, right)
|
|
||||||
indicator_position = bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# Optional keybinds
|
|
||||||
# --------------------------------------------------
|
|
||||||
|
|
||||||
# Scroll through stack
|
|
||||||
bind = SUPER, mouse_down, layoutmsg, scroll +1
|
|
||||||
bind = SUPER, mouse_up, layoutmsg, scroll -1
|
|
||||||
|
|
||||||
# Toggle layout manually
|
|
||||||
bind = SUPER, S, layoutmsg, togglesplit
|
|
||||||
|
|||||||
Reference in New Issue
Block a user