feat(home): Set copy/paste cmd from apps mod

This commit is contained in:
punkfairie 2025-02-28 19:20:41 -08:00
parent b138bc03b2
commit df532edf02
Signed by: punkfairie
GPG key ID: B3C5488E9A1A7CA6
3 changed files with 53 additions and 11 deletions

View file

@ -16,14 +16,56 @@ in {
description = "The pinentry package to use."; description = "The pinentry package to use.";
}; };
clipboard = lib.mkOption { clipboard = let
type = lib.types.package; isXorg = config.marleyos.xorg.xsession.enable;
default = defaultXorg = {
if config.marleyos.xorg.xsession.enable package = pkgs.clipboard-jh;
then pkgs.clipboard-jh copy-command = "${lib.getExe pkgs.clipboard-jh} copy";
else pkgs.wl-clipboard; paste-command = "${lib.getExe pkgs.clipboard-jh} paste";
description = "The clipboard manager to use."; };
}; defaultWayland = {
package = pkgs.wl-clipboard;
copy-command = lib.getExe' pkgs.wl-clipboard "wl-copy";
paste-command = lib.getExe' pkgs.wl-clipboard "wl-paste";
};
in
lib.mkOption {
type = lib.types.submodule {
options = {
package = lib.mkOption {
type = lib.types.package;
default =
if isXorg
then defaultXorg.package
else defaultWayland.package;
description = "The clipboard manager to use.";
};
copy-command = lib.mkOption {
type = lib.types.str;
default =
if isXorg
then defaultXorg.copy-command
else defaultWayland.copy-command;
description = "The command, including binary, to use for copying.";
};
paste-command = lib.mkOption {
type = lib.types.str;
default =
if isXorg
then defaultXorg.paste-command
else defaultWayland.paste-command;
description = "The command, including binary, to use for pasting.";
};
};
};
default =
if isXorg
then defaultXorg
else defaultWayland;
};
terminal = lib.mkOption { terminal = lib.mkOption {
type = lib.types.package; type = lib.types.package;
@ -63,7 +105,7 @@ in {
config = lib.mkIf (is-linux system) { config = lib.mkIf (is-linux system) {
home.packages = [ home.packages = [
cfg.pinentry cfg.pinentry
cfg.clipboard cfg.clipboard.package
]; ];
programs.rbw = lib.mkDefault { programs.rbw = lib.mkDefault {

View file

@ -161,7 +161,7 @@ in {
open = lib.mkIf (config.programs.fish.enable && (fish_fns ? git_open)) "!fish -c git_open"; open = lib.mkIf (config.programs.fish.enable && (fish_fns ? git_open)) "!fish -c git_open";
chash = "!git log --oneline | gum filter --height 10 | cut -d' ' -f1 | ${config.marleyos.apps.clipboard} &>/dev/null"; chash = "!git log --oneline | gum filter --height 10 | cut -d' ' -f1 | ${config.marleyos.apps.clipboard.copy-command} &>/dev/null";
}; };
}; };
} }

View file

@ -15,7 +15,7 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
gum gum
config.marleyos.apps.clipboard config.marleyos.apps.clipboard.package
]; ];
# ██████╗ ██╗████████╗ # ██████╗ ██╗████████╗