From 34ab1b9119a769533b9bdbe41698934a6dfdd766 Mon Sep 17 00:00:00 2001 From: pupbrained Date: Sun, 16 Jun 2024 02:36:54 -0400 Subject: [PATCH] clipboard stuff --- modules/home/hyprland/default.nix | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/modules/home/hyprland/default.nix b/modules/home/hyprland/default.nix index 31bee4a..a901efe 100644 --- a/modules/home/hyprland/default.nix +++ b/modules/home/hyprland/default.nix @@ -9,7 +9,7 @@ in with pkgs; { home.packages = [ - wl-clipboard-rs + wl-clipboard ]; programs = { @@ -315,6 +315,7 @@ in }; services = { + cliphist.enable = true; udiskie.enable = true; swaync = { @@ -331,6 +332,29 @@ in systemd.variables = ["--all"]; settings = let + rofi-clipboard = pkgs.writeScriptBin "rofi-clipboard" '' + tmp_dir="/tmp/cliphist" + rm -rf "$tmp_dir" + + if [[ -n "$1" ]]; then + cliphist decode <<<"$1" | wl-copy + exit + fi + + mkdir -p "$tmp_dir" + + read -r -d "" prog <$tmp_dir/"grp[1]"."grp[3]) + print \$0"\0icon\x1f$tmp_dir/"grp[1]"."grp[3] + next + } + 1 + EOF + cliphist list | gawk "$prog" + ''; + mod = "SUPER"; modC = "SUPER CTRL"; modS = "SUPER SHIFT"; @@ -339,6 +363,7 @@ in colorPicker = "notify-send -i gtk-color-picker $(${hyprpicker}/bin/hyprpicker -a) 'Copied to clipboard.'"; fileManager = "nautilus"; launcher = "rofi -show drun"; + clipboard = "rofi -modi '   ':${rofi-clipboard}/bin/rofi-clipboard -show '   ' -show-icons"; terminal = "wezterm"; screenshot = mode: "${ @@ -400,7 +425,7 @@ in exec-once = [ "waybar" "${mpvpaper}/bin/mpvpaper -vp -o 'no-audio loop' DP-1 ${builtins.toString ./wall.mp4}" - "mullvad connect" + "${copyq}/bin/copyq --start-server" ]; misc = { @@ -433,6 +458,7 @@ in bind = [ # Apps + "${mod}, v, exec, ${clipboard}" "${mod}, c, exec, ${colorPicker}" "${mod}, w, exec, ${browser}" "${mod}, e, exec, ${fileManager}"