From 3dcae8af51acd6f5ecc039fa23d044439cd19ae0 Mon Sep 17 00:00:00 2001 From: Joker9944 <9194199+Joker9944@users.noreply.github.com> Date: Sat, 16 Aug 2025 20:07:50 +0200 Subject: [PATCH] hyprshot: init module Co-authored-by: Austin Horstman --- .../misc/news/2025/08/2025-08-16_03-35-44.nix | 12 ++++++ modules/programs/hyprshot.nix | 38 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 modules/misc/news/2025/08/2025-08-16_03-35-44.nix create mode 100644 modules/programs/hyprshot.nix diff --git a/modules/misc/news/2025/08/2025-08-16_03-35-44.nix b/modules/misc/news/2025/08/2025-08-16_03-35-44.nix new file mode 100644 index 00000000..d09b4e7f --- /dev/null +++ b/modules/misc/news/2025/08/2025-08-16_03-35-44.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +{ + time = "2025-08-16T01:35:44+00:00"; + condition = pkgs.stdenv.hostPlatform.isLinux; + message = '' + A new module is available: 'programs.hyprshot' + + Hyprshot is an utility to easily take screenshot in Hyprland using your mouse. + It allows taking screenshots of windows, regions and monitors which are saved + to a folder of your choosing and copied to your clipboard. + ''; +} diff --git a/modules/programs/hyprshot.nix b/modules/programs/hyprshot.nix new file mode 100644 index 00000000..5e9aebd1 --- /dev/null +++ b/modules/programs/hyprshot.nix @@ -0,0 +1,38 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.programs.hyprshot; +in +{ + meta.maintainers = with lib.hm.maintainers; [ + joker9944 + ]; + + options.programs.hyprshot = { + enable = lib.mkEnableOption "Hyprshot the Hyprland screenshot utility"; + package = lib.mkPackageOption pkgs "hyprshot" { nullable = true; }; + saveLocation = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + example = "$HOME/Pictures/Screenshots"; + description = '' + Set the `$HYPRSHOT_DIR` environment variable to the given location. + + Hypershot will save screenshots to the first expression that resolves: + - `$HYPRSHOT_DIR` + - `$XDG_PICTURES_DIR` + - `$(xdg-user-dir PICTURES)` + ''; + }; + }; + + config.home = lib.mkIf cfg.enable { + packages = lib.mkIf (cfg.package != null) [ cfg.package ]; + + sessionVariables = lib.mkIf (cfg.saveLocation != null) { HYPRSHOT_DIR = cfg.saveLocation; }; + }; +}