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 in
with pkgs; { with pkgs; {
home.packages = [ home.packages = [
wl-clipboard-rs wl-clipboard
]; ];
programs = { programs = {
@ -315,6 +315,7 @@ in
}; };
services = { services = {
cliphist.enable = true;
udiskie.enable = true; udiskie.enable = true;
swaync = { swaync = {
@ -331,6 +332,29 @@ in
systemd.variables = ["--all"]; systemd.variables = ["--all"];
settings = let 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"; mod = "SUPER";
modC = "SUPER CTRL"; modC = "SUPER CTRL";
modS = "SUPER SHIFT"; modS = "SUPER SHIFT";
@ -339,6 +363,7 @@ in
colorPicker = "notify-send -i gtk-color-picker $(${hyprpicker}/bin/hyprpicker -a) 'Copied to clipboard.'"; colorPicker = "notify-send -i gtk-color-picker $(${hyprpicker}/bin/hyprpicker -a) 'Copied to clipboard.'";
fileManager = "nautilus"; fileManager = "nautilus";
launcher = "rofi -show drun"; launcher = "rofi -show drun";
clipboard = "rofi -modi '':${rofi-clipboard}/bin/rofi-clipboard -show '' -show-icons";
terminal = "wezterm"; terminal = "wezterm";
screenshot = mode: "${ screenshot = mode: "${
@ -400,7 +425,7 @@ in
exec-once = [ exec-once = [
"waybar" "waybar"
"${mpvpaper}/bin/mpvpaper -vp -o 'no-audio loop' DP-1 ${builtins.toString ./wall.mp4}" "${mpvpaper}/bin/mpvpaper -vp -o 'no-audio loop' DP-1 ${builtins.toString ./wall.mp4}"
"mullvad connect" "${copyq}/bin/copyq --start-server"
]; ];
misc = { misc = {
@ -433,6 +458,7 @@ in
bind = bind =
[ [
# Apps # Apps
"${mod}, v, exec, ${clipboard}"
"${mod}, c, exec, ${colorPicker}" "${mod}, c, exec, ${colorPicker}"
"${mod}, w, exec, ${browser}" "${mod}, w, exec, ${browser}"
"${mod}, e, exec, ${fileManager}" "${mod}, e, exec, ${fileManager}"