From c002bc08c8ea6c87198f3024e8bfd6fdb1c90c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Zwoli=C5=84ski?= Date: Sun, 28 Apr 2024 23:51:59 +0200 Subject: [PATCH] cliphist: support images in clipboard history --- modules/services/cliphist.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/services/cliphist.nix b/modules/services/cliphist.nix index 6ba733fa5e87..504b519a4834 100644 --- a/modules/services/cliphist.nix +++ b/modules/services/cliphist.nix @@ -9,6 +9,14 @@ in { package = lib.mkPackageOption pkgs "cliphist" { }; + allowImages = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Store images in clipboard history. + ''; + }; + systemdTarget = lib.mkOption { type = lib.types.str; default = "graphical-session.target"; @@ -46,5 +54,21 @@ in { Install = { WantedBy = [ cfg.systemdTarget ]; }; }; + + systemd.user.services.cliphist-images = lib.mkIf cfg.allowImages { + Unit = { + Description = "Clipboard management daemon - images"; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + Type = "simple"; + ExecStart = + "${pkgs.wl-clipboard}/bin/wl-paste --type image --watch ${cfg.package}/bin/cliphist store"; + Restart = "on-failure"; + }; + + Install = { WantedBy = [ cfg.systemdTarget ]; }; + }; }; }