From 40c1b6108964964f65f02fb6f0ba81e4cfc77d8d Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 3 Feb 2024 15:41:46 -0600 Subject: [PATCH] Fixed ranger img copy-paste script for wayland --- user/app/ranger/ranger.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/user/app/ranger/ranger.nix b/user/app/ranger/ranger.nix index f3dece8..52c4476 100644 --- a/user/app/ranger/ranger.nix +++ b/user/app/ranger/ranger.nix @@ -1,11 +1,16 @@ { config, pkgs, ... }: let myCbxScript = '' - # TODO fix this for wayland #!/bin/sh + + # this lets my copy and paste images and/or plaintext of files directly out of ranger if [ "$#" -le "2" ]; then if [ "$1" = "copy" -o "$1" = "cut" ]; then - #xclip -selection clipboard -t $(file -b --mime-type $2) -i $2; - xclip -selection clipboard -t image/png -i $2; + if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + wl-copy < $2; + else + # xclip -selection clipboard -t $(file -b --mime-type $2) -i $2; + xclip -selection clipboard -t image/png -i $2; + fi fi fi '';