clipnotify: initial service
Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
parent
36f5b8c15f
commit
c35f995fed
2 changed files with 50 additions and 2 deletions
|
@ -35,8 +35,13 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable rootless Xwayland
|
services = {
|
||||||
services.xwayland-satellite.enable = cfg.xwayland;
|
# Enable rootless Xwayland
|
||||||
|
xwayland-satellite.enable = cfg.xwayland;
|
||||||
|
|
||||||
|
# Enable X11/Wayland clipboard sync
|
||||||
|
clipsync.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# https://github.com/YaLTeR/niri
|
# https://github.com/YaLTeR/niri
|
||||||
|
|
43
options/custom/services/clipnotify.nix
Normal file
43
options/custom/services/clipnotify.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.custom.services.clipsync;
|
||||||
|
|
||||||
|
clipnotify = getExe pkgs.clipnotify;
|
||||||
|
wl-copy = getExe' pkgs.wl-clipboard "wl-copy";
|
||||||
|
xclip = getExe pkgs.xclip;
|
||||||
|
in {
|
||||||
|
options.custom.services.clipsync = {
|
||||||
|
enable = mkOption {default = false;};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# https://github.com/cdown/clipnotify
|
||||||
|
systemd.user.services.clipsync = {
|
||||||
|
enable = true;
|
||||||
|
wantedBy = ["graphical-session.target"];
|
||||||
|
|
||||||
|
unitConfig = {
|
||||||
|
Description = "Sync clipboard between Wayland and X11";
|
||||||
|
|
||||||
|
After =
|
||||||
|
["graphical-session.target"]
|
||||||
|
++ optionals config.custom.services.xwayland-satellite.enable ["xwayland-satellite.service"];
|
||||||
|
};
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
|
||||||
|
ExecStart = pkgs.writeShellScript "clipsync" ''
|
||||||
|
while ${clipnotify}; do
|
||||||
|
${xclip} -selection clipboard -out | ${wl-copy}
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue