clipboard stuff

This commit is contained in:
Mars 2024-06-16 02:36:54 -04:00
parent e1177bee61
commit 34ab1b9119
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895

View file

@ -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 <<EOF
/^[0-9]+\s<meta http-equiv=/ { next }
match(\$0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp) {
system("echo " grp[1] "\\\\\t | cliphist decode >$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}"