Add custom clipboard scripts
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -6,5 +6,5 @@ const icon = () => Widget.Icon({
|
|||||||
export default () => Widget.EventBox({
|
export default () => Widget.EventBox({
|
||||||
class_name: 'clipboard',
|
class_name: 'clipboard',
|
||||||
child: icon(),
|
child: icon(),
|
||||||
onPrimaryClick: () => Utils.execAsync('bash -c "cliphist list | rofi -cache-dir $XDG_CACHE_HOME/rofi -dmenu -display-columns 2 | cliphist decode | wl-copy"'),
|
onPrimaryClick: () => Utils.execAsync('cliphist-rofi'),
|
||||||
});
|
});
|
||||||
|
@@ -48,10 +48,8 @@ in
|
|||||||
sassc
|
sassc
|
||||||
hyprland
|
hyprland
|
||||||
nixos-icons
|
nixos-icons
|
||||||
rofi-wayland
|
|
||||||
wl-clipboard
|
|
||||||
cliphist
|
|
||||||
libdbusmenu-gtk3
|
libdbusmenu-gtk3
|
||||||
|
(pkgs.callPackage ../cliphist/rofi.nix { })
|
||||||
];
|
];
|
||||||
text = "exec ags";
|
text = "exec ags";
|
||||||
}
|
}
|
||||||
|
@@ -69,14 +69,12 @@
|
|||||||
|
|
||||||
wayland.windowManager.hyprland.settings.bind =
|
wayland.windowManager.hyprland.settings.bind =
|
||||||
let
|
let
|
||||||
|
cliphist-rofi = lib.meta.getExe (pkgs.callPackage ./rofi.nix { });
|
||||||
cliphist = lib.meta.getExe pkgs.cliphist;
|
cliphist = lib.meta.getExe pkgs.cliphist;
|
||||||
rofi = lib.meta.getExe pkgs.rofi-wayland;
|
|
||||||
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
|
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
"$mod, v, exec, ${cliphist} list | ${rofi} -cache-dir ${home}/.cache/rofi -dmenu -display-columns 2 | ${cliphist} decode | ${wl-copy}"
|
"$mod, v, exec, ${cliphist-rofi}"
|
||||||
"$mod_Ctrl, v, exec, ${cliphist} list | ${rofi} -cache-dir ${home}/.cache/rofi -dmenu -display-columns 2 | ${cliphist} delete"
|
"$mod_Ctrl, v, exec, ${cliphist} wipe"
|
||||||
"$mod_Ctrl_Shift, v, exec, ${cliphist} wipe"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
26
hosts/common/user/configs/gui/cliphist/rofi.nix
Normal file
26
hosts/common/user/configs/gui/cliphist/rofi.nix
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{ 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 = with pkgs; [ rofi-wayland ];
|
||||||
|
text = "rofi -modi \"copy:${copy},delete:${delete}\" -show copy";
|
||||||
|
}
|
13
hosts/common/user/configs/gui/cliphist/scripts/copy.sh
Executable file
13
hosts/common/user/configs/gui/cliphist/scripts/copy.sh
Executable 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
|
13
hosts/common/user/configs/gui/cliphist/scripts/delete.sh
Executable file
13
hosts/common/user/configs/gui/cliphist/scripts/delete.sh
Executable 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
|
Reference in New Issue
Block a user