1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

clipse: add module

This commit is contained in:
welius 2024-08-27 20:05:02 +02:00
parent c2cd2a52e0
commit c086351fc0
6 changed files with 135 additions and 0 deletions

View file

@ -101,6 +101,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

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

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

@ -0,0 +1,109 @@
{ pkgs, config, lib, ... }:
let
cfg = config.services.clipse;
jsonFormat = pkgs.formats.json { };
in with lib;
{
meta.maintainers = [ lib.maintainers.dsoverlord ];
options.services.clipse = {
enable = mkEnableOption "Enable clipse clipboard manager";
package = 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 = mkOption {
type = types.bool;
default = false;
description = "Allow duplicates";
};
historySize = mkOption {
type = types.int;
default = 100;
description = "Number of history lines to keep.";
};
theme = mkOption {
type = jsonFormat.type;
default = { useCustomTheme = false; };
example = 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 = 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 = {
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

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

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; }