1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

clipse: add module (#5777)

clipse is a configurable, TUI-based clipboard manager application written in Go with minimal dependency. Though the app is optimized for a Linux OS using a dedicated window manager, clipse can also be used on any Unix-based system.
This commit is contained in:
DSOverlord 2025-02-22 17:40:15 +02:00 committed by GitHub
parent 34d524f3ed
commit a51e94e51c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 132 additions and 0 deletions

View file

@ -112,6 +112,12 @@
github = "diniamo";
githubId = 55629891;
};
dsoverlord = {
name = "Kirill Zakharov";
email = "dsoverlord@vk.com";
github = "dsoverlord";
githubId = 78819443;
};
dwagenk = {
email = "dwagenk@mailbox.org";
github = "dwagenk";

View file

@ -305,6 +305,7 @@ let
./services/cliphist.nix
./services/clipman.nix
./services/clipmenu.nix
./services/clipse.nix
./services/comodoro.nix
./services/conky.nix
./services/copyq.nix

106
modules/services/clipse.nix Normal file
View file

@ -0,0 +1,106 @@
{ pkgs, config, lib, ... }:
let
cfg = config.services.clipse;
jsonFormat = pkgs.formats.json { };
in {
meta.maintainers = [ lib.hm.maintainers.dsoverlord ];
options.services.clipse = {
enable = lib.mkEnableOption "Enable clipse clipboard manager";
package = lib.mkPackageOption pkgs "clipse" { };
systemdTarget = lib.mkOption {
type = lib.types.str;
default = "graphical-session.target";
example = "sway-session.target";
description = ''
The systemd target that will automatically start the clipse service.
When setting this value to `"sway-session.target"`,
make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`,
otherwise the service may never be started.
'';
};
allowDuplicates = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Allow duplicates";
};
historySize = lib.mkOption {
type = lib.types.int;
default = 100;
description = "Number of history lines to keep.";
};
theme = lib.mkOption {
type = jsonFormat.type;
default = { useCustomTheme = false; };
example = lib.literalExpression ''
{
useCustomTheme = true;
DimmedDesc = "#ffffff";
DimmedTitle = "#ffffff";
FilteredMatch = "#ffffff";
NormalDesc = "#ffffff";
NormalTitle = "#ffffff";
SelectedDesc = "#ffffff";
SelectedTitle = "#ffffff";
SelectedBorder = "#ffffff";
SelectedDescBorder = "#ffffff";
TitleFore = "#ffffff";
Titleback = "#434C5E";
StatusMsg = "#ffffff";
PinIndicatorColor = "#ff0000";
};
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/clipse/custom_theme.json`.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.clipse" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."clipse/config.json".source =
jsonFormat.generate "settings" {
allowDuplicates = cfg.allowDuplicates;
historyFile = "clipboard_history.json";
maxHistory = cfg.historySize;
logFile = "clipse.log";
themeFile = "custom_theme.json";
tempDir = "tmp_files";
};
xdg.configFile."clipse/custom_theme.json".source =
jsonFormat.generate "theme" cfg.theme;
systemd.user.services.clipse = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "Clipse listener";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${cfg.package}/bin/clipse -listen";
};
Install = { WantedBy = [ cfg.systemdTarget ]; };
};
};
}

View file

@ -328,6 +328,7 @@ in import nmtSrc {
./modules/services/cachix-agent
./modules/services/cliphist
./modules/services/clipman
./modules/services/clipse
./modules/services/comodoro
./modules/services/copyq
./modules/services/conky

View file

@ -0,0 +1,17 @@
{ ... }:
{
services.clipse = {
enable = true;
systemdTarget = "sway-session.target";
};
test.stubs = {
clipse = { };
wl-clipboard = { };
};
nmt.script = ''
assertFileExists home-files/.config/systemd/user/clipse.service
'';
}

View file

@ -0,0 +1 @@
{ clipse-sway-session-target = ./clipse-sway-session-target.nix; }