Files
nix/hosts/common/user/configs/gui/cliphist/default.nix
Nikolaos Karaolidis d54df170cd Remove impermanence home-manager module
Too many bugs to deal with unfortunately.

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2024-07-31 15:33:04 +03:00

81 lines
2.2 KiB
Nix

{
username ? throw "username argument is required",
}:
{
config,
lib,
pkgs,
...
}:
let
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeCacheHome}/cliphist"
];
home-manager.users.${username} = {
home.packages = with pkgs; [
wl-clipboard
cliphist
];
systemd.user.services = {
cliphist = {
Unit = {
Description = "Clipboard manager";
BindsTo = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service.ExecStart = lib.meta.getExe (
pkgs.writeShellApplication {
name = "init-cliphist";
runtimeInputs = with pkgs; [
wl-clipboard
cliphist
];
text = "exec wl-paste --watch cliphist store";
}
);
Install.WantedBy = [ "graphical-session.target" ];
};
cliphist-image = {
Unit = {
Description = "Clipboard manager (images)";
BindsTo = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service.ExecStart = lib.meta.getExe (
pkgs.writeShellApplication {
name = "init-cliphist-image";
runtimeInputs = with pkgs; [
wl-clipboard
cliphist
];
text = "exec wl-paste --type image --watch cliphist store";
}
);
Install.WantedBy = [ "graphical-session.target" ];
};
};
wayland.windowManager.hyprland.settings.bind =
let
cliphist = lib.meta.getExe pkgs.cliphist;
rofi = lib.meta.getExe pkgs.rofi-wayland;
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
in
[
"$mod, v, exec, ${cliphist} list | ${rofi} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | ${cliphist} decode | ${wl-copy}"
"$mod_Ctrl, v, exec, ${cliphist} list | ${rofi} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | ${cliphist} delete"
"$mod_Ctrl_Shift, v, exec, ${cliphist} wipe"
];
};
}