From 9fa71fd3992cab2a2f83b3947ab7ecc6a84aa553 Mon Sep 17 00:00:00 2001 From: elwrcl Date: Sun, 4 Oct 2026 05:58:20 +0300 Subject: [PATCH] home-manager: programs.valw.noctalia.enable; README and checklist --- README.md | 20 +++++++++++++++++++- docs/test-checklist.md | 12 ++++++++++++ nix/checks.ulu.nix | 36 ++++++++++++++++++++++++------------ nix/home-module.ulu.nix | 9 +++++++++ 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 288d3da..7b5bc6f 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ binds { | `valw region` | Drag a region; Shift locks an axis, Alt grows from the centre, Space moves it; Space before dragging switches to window mode | | `valw window [--pick]` | Pick a window from cards over a liquid-paint background (Tab/arrows, Enter, Esc); `--pick` clicks it on screen instead | | `valw zoom` | Freeze the screen and zoom: wheel, drag, `f` flashlight, `c` capture the view, `0` reset, Esc | -| `valw toolbar` | Pick a mode from a floating bar, with a timer and options | +| `valw toolbar` | Pick a mode from a floating bar, with a timer and options; `--state`, `--set KEY=VALUE` and `--run [MODE]` drive it without the bar (the Noctalia plugin uses them) | | `valw edit FILE` | The markup editor (clicking a preview opens it) | | `valw backdrop` | Keep running: the liquid-paint background behind niri's overview (below) | | `valw doctor` | What the compositor and system support | @@ -89,6 +89,24 @@ With Noctalia, turn its own backdrop off (`[backdrop] enabled = false`). Colours elsewhere (the region dim, the window picker's fallback) follow Noctalia's current community palette when there is one. +## Noctalia + +With [Noctalia](https://noctalia.dev), valw comes as a plugin: a camera +button on the bar (left click: the toolbar, right click: a region shot), +the toolbar as a Noctalia panel and a control-center tile. Noctalia draws +them, so they follow your Noctalia theme. + +```nix +programs.valw.noctalia.enable = true; +``` + +Then enable `elars/valw` in Noctalia, add a widget of type `elars/valw:bar` +to a bar, and bind the toolbar: + +```kdl +Mod+Shift+T { spawn "noctalia" "msg" "panel-toggle" "elars/valw:toolbar"; } +``` + ## Configuration Every key is optional; these are the defaults. diff --git a/docs/test-checklist.md b/docs/test-checklist.md index 0e39c7b..a59b79c 100644 --- a/docs/test-checklist.md +++ b/docs/test-checklist.md @@ -188,3 +188,15 @@ image, a cancel brought the thumbnail back, and a swipe still dismissed it. - The backdrop calls every lock error "another backdrop is running"; it keeps its first scale after a scale change. - libEGL is unloaded when the last backdrop surface goes; a removed output leaks its viewport object. - Holding Tab doesn't repeat in the picker; "no windows" exits as an error instead of a cancel. + +## Noctalia plugin + +- [ ] `programs.valw.noctalia.enable` + `elars/valw` enabled: the camera button appears where the widget is placed; its tooltip says Screenshot. +- [ ] Left click opens the toolbar panel next to the bar; it uses Noctalia's colours, font, corners and border; switching the palette or light/dark restyles it. +- [ ] The remembered mode is highlighted; Screen / Region / Window / Zoom each capture, and the panel is never in the shot. +- [ ] Timer and the three toggles persist, and match what `valw toolbar` (the self-drawn bar) shows, both ways; the timer shows valw's countdown. +- [ ] Right click on the button: a region shot (no timer). +- [ ] Control-center tile: click closes the control center, then a region shot; right click opens the toolbar panel. +- [ ] `noctalia msg panel-toggle elars/valw:toolbar` (Mod+Shift+T) opens and closes the panel. +- [ ] With valw off Noctalia's PATH: "valw is not available" and a notification, no crash. +- [ ] Turkish locale: the Turkish strings appear. diff --git a/nix/checks.ulu.nix b/nix/checks.ulu.nix index 36c93a4..b6c44ad 100644 --- a/nix/checks.ulu.nix +++ b/nix/checks.ulu.nix @@ -13,28 +13,32 @@ # The home-manager module, evaluated with stand-ins for the two # home-manager options it sets (no home-manager input needed). homeModule = - settings: + valwConfig: (lib.evalModules { modules = [ self.homeModules.default ( { lib, ... }: - { - options.home.packages = lib.mkOption { - type = lib.types.listOf lib.types.package; - default = [ ]; - }; - options.xdg.configFile = lib.mkOption { + let + files = lib.mkOption { type = lib.types.attrsOf ( lib.types.submodule { options.source = lib.mkOption { type = lib.types.path; }; } ); default = { }; }; + in + { + options.home.packages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + }; + options.xdg.configFile = files; + options.xdg.dataFile = files; config._module.args.pkgs = pkgs; config.programs.valw = { enable = true; - inherit settings; - }; + } + // valwConfig; } ) ]; @@ -58,12 +62,19 @@ let plain = homeModule { }; set = homeModule { - preview.timeout_secs = 3; - sound.volume = 0.4; + settings = { + preview.timeout_secs = 3; + sound.volume = 0.4; + }; }; + noctalia = homeModule { noctalia.enable = true; }; in assert lib.assertMsg (plain.home.packages == [ valw ]) "the module installs valw"; assert lib.assertMsg (plain.xdg.configFile == { }) "no settings, no config file"; + assert lib.assertMsg (plain.xdg.dataFile == { }) "no Noctalia plugin unless asked"; + assert lib.assertMsg ( + noctalia.xdg.dataFile."noctalia/plugins/valw".source == "${valw}/share/valw/noctalia-plugin" + ) "the plugin is linked where Noctalia looks"; pkgs.runCommand "valw-home-module" { } '' grep -qx 'timeout_secs = 3' ${set.xdg.configFile."valw/config.toml".source} grep -qx 'volume = 0.4' ${set.xdg.configFile."valw/config.toml".source} @@ -79,7 +90,8 @@ let fails = settings: - pkgs.testers.testBuildFailure (homeModule settings).xdg.configFile."valw/config.toml".source; + pkgs.testers.testBuildFailure + (homeModule { inherit settings; }).xdg.configFile."valw/config.toml".source; in pkgs.runCommand "valw-home-module-rejects" { } '' grep -q 'sound.volume must be between 0 and 1' ${fails { sound.volume = 2; }}/testBuildFailure.log diff --git a/nix/home-module.ulu.nix b/nix/home-module.ulu.nix index 66311fb..ed30598 100644 --- a/nix/home-module.ulu.nix +++ b/nix/home-module.ulu.nix @@ -45,6 +45,12 @@ valw at build time. Empty means valw's defaults. ''; }; + noctalia.enable = lib.mkEnableOption '' + valw's Noctalia plugin (a bar button, the toolbar as a Noctalia + panel and a control-center tile), linked into + `$XDG_DATA_HOME/noctalia/plugins/valw`. Enable `elars/valw` and + place its widget in Noctalia's own settings + ''; }; config = lib.mkIf cfg.enable { @@ -52,6 +58,9 @@ xdg.configFile."valw/config.toml" = lib.mkIf (cfg.settings != { }) { source = checked cfg.settings; }; + xdg.dataFile."noctalia/plugins/valw" = lib.mkIf cfg.noctalia.enable { + source = "${cfg.package}/share/valw/noctalia-plugin"; + }; }; }; }