Add cliphist

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-03 17:20:33 +03:00
parent 292e0d6f74
commit 4da4cee839
7 changed files with 56 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import gap from './gap/gap';
import date from './date/date';
import launcher from './launcher/launcher';
import workspace from './workspace/workspace';
import date from './date/date';
export default (monitor: number) => Widget.Window({
monitor,

View File

@@ -0,0 +1,10 @@
const icon = () => Widget.Icon({
class_name: 'icon',
icon: "edit-paste-symbolic",
});
export default () => Widget.EventBox({
class_name: 'clipboard',
on_primary_click: () => Utils.execAsync('bash -c "cliphist list | rofi -cache-dir $XDG_CACHE_HOME/rofi -dmenu -display-columns 2 | cliphist decode | wl-copy"'),
child: icon(),
});

View File

@@ -26,6 +26,8 @@ in
hyprland
nixos-icons
rofi-wayland
wl-clipboard
cliphist
];
text = "ags &> /tmp/ags.log";
})} &";

View File

@@ -20,6 +20,7 @@
min-width: .5 * {{custom.padding}}pt
.launcher
.clipboard
@include interactive
min-width: {{custom.font_size}}pt
@@ -27,7 +28,7 @@
.icon
font-size: {{custom.font_size}}pt
padding: 0 .3 * {{custom.padding}}pt
color: {{colors.primary.default.hex}}
color: {{colors.on_surface.default.hex}}
.workspace
@include interactive

View File

@@ -0,0 +1,35 @@
{ user ? throw "user argument is required" }: { config, lib, pkgs, ... }:
let
hmConfig = config.home-manager.users.${user.name};
in
{
home-manager.users.${user.name} = {
home = {
packages = with pkgs; [ wl-clipboard cliphist ];
persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/cliphist" ];
};
wayland.windowManager.hyprland = {
initExtraConfig = ''
${lib.meta.getExe (pkgs.writeShellApplication {
name = "init-cliphist-text";
runtimeInputs = with pkgs; [ wl-clipboard cliphist ];
text = "wl-paste --type text --watch cliphist store";
})} &
${lib.meta.getExe (pkgs.writeShellApplication {
name = "init-cliphist-image";
runtimeInputs = with pkgs; [ wl-clipboard cliphist ];
text = "wl-paste --type image --watch cliphist store";
})} &
'';
settings.bind = [
"$mod, v, exec, cliphist list | ${lib.meta.getExe pkgs.rofi-wayland} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | cliphist decode | wl-copy"
"$mod_CTRL, v, exec, cliphist list | ${lib.meta.getExe pkgs.rofi-wayland} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | cliphist delete"
"$mod_CTRL_SHIFT, v, exec, cliphist wipe"
];
};
};
}

View File

@@ -12,7 +12,10 @@ in
wayland.windowManager.hyprland.initExtraConfig = "${lib.meta.getExe (pkgs.writeShellApplication {
name = "init-swww";
runtimeInputs = with pkgs; [ swww ];
runtimeInputs = with pkgs; [
coreutils-full
swww
];
text = ''
swww-daemon &> /tmp/swww.log
@@ -26,11 +29,7 @@ in
theme.extraConfig = lib.mkAfter "${lib.meta.getExe (pkgs.writeShellApplication {
name = "theme-swww";
runtimeInputs = with pkgs; [
coreutils-full
procps
swww
];
runtimeInputs = with pkgs; [ swww ];
text = "swww img \"${hmConfig.theme.configDir}/wallpaper\"";
})} &";
};

View File

@@ -11,6 +11,7 @@ in
(import ../configs/firefox { inherit user; })
(import ../configs/hyprland { inherit user; })
(import ../configs/hyprshot { inherit user; })
(import ../configs/cliphist { inherit user; })
(import ../configs/ags { inherit user; })
(import ../configs/wev { inherit user; })
(import ../configs/brightnessctl { inherit user; })