Reorganize imports

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-12-21 23:32:29 +02:00
parent 0ae56e6e25
commit 98ce774210
189 changed files with 253 additions and 260 deletions

View File

@@ -0,0 +1,85 @@
{
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{
config,
lib,
pkgs,
...
}:
let
hmConfig = config.home-manager.users.${user};
in
{
environment.persistence."/cache"."${home}/.cache/cliphist" = { };
home-manager.users.${user} = {
home.packages = with pkgs; [
wl-clipboard
cliphist
];
systemd.user.services = {
cliphist = {
Unit = {
Description = "Clipboard manager";
BindsTo = [ "graphical-session.target" ];
After = [
"graphical-session.target"
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
];
};
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"
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
];
};
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-rofi = lib.meta.getExe (
pkgs.callPackage ./rofi.nix { rofi = hmConfig.programs.rofi.finalPackage; }
);
cliphist = lib.meta.getExe pkgs.cliphist;
in
[
"$mod, v, exec, ${cliphist-rofi}"
"$mod_Ctrl, v, exec, ${cliphist} wipe"
];
};
}

View File

@@ -0,0 +1,31 @@
{
rofi ? throw "rofi package is required",
lib,
pkgs,
...
}:
let
copy = lib.meta.getExe (
pkgs.writeShellApplication {
name = "copy";
runtimeInputs = with pkgs; [
cliphist
wl-clipboard
];
text = builtins.readFile ./scripts/copy.sh;
}
);
delete = lib.meta.getExe (
pkgs.writeShellApplication {
name = "delete";
runtimeInputs = with pkgs; [ cliphist ];
text = builtins.readFile ./scripts/delete.sh;
}
);
in
pkgs.writeShellApplication {
name = "cliphist-rofi";
runtimeInputs = [ rofi ];
text = "rofi -modi \"copy:${copy},delete:${delete}\" -show copy";
}

View File

@@ -0,0 +1,13 @@
list() {
echo -en "\0keep-selection\x1ftrue\n"
cliphist list
}
handle() {
cliphist decode <<< "$1" | wl-copy
}
case ${ROFI_RETV} in
0) list ;;
1) handle "$@" ;;
esac

View File

@@ -0,0 +1,13 @@
list() {
echo -en "\0keep-selection\x1ftrue\n"
cliphist list
}
handle() {
cliphist delete <<< "$1"
}
case ${ROFI_RETV} in
0) list ;;
1) handle "$@" && list ;;
esac