diff --git a/Dolphin/bf-copy.desktop b/Dolphin/bf-copy.desktop new file mode 100644 index 0000000..bfbb2c4 --- /dev/null +++ b/Dolphin/bf-copy.desktop @@ -0,0 +1,24 @@ +# Copyright 2019 Bruno Fontes + +[Desktop Entry] +Type=Service +ServiceTypes=KonqPopupMenu/Plugin +MimeType=application/octet-stream;inode/directory +Actions=copyNameOnly;copyPathOnly;copyPath; +X-KDE-Priority=TopLevel +X-KDE-Submenu=BFCopy + +[Desktop Action copyNameOnly] +Name=Copy Filename +Name[pt_BR]=Copiar nome do arquivo +Exec=bash ~/.local/share/kservices5/ServiceMenus/copyName.sh %F + +[Desktop Action copyPathOnly] +Name=Copy Path +Name[pt_BR]=Copiar caminho +Exec=bash ~/.local/share/kservices5/ServiceMenus/copyPath.sh %F + +[Desktop Action copyPath] +Name=Copy Full Path +Name[pt_BR]=Copiar caminho completo +Exec=bash ~/.local/share/kservices5/ServiceMenus/copyFullPath.sh %F diff --git a/Dolphin/copyFullPath.sh b/Dolphin/copyFullPath.sh new file mode 100644 index 0000000..8e24ec5 --- /dev/null +++ b/Dolphin/copyFullPath.sh @@ -0,0 +1,7 @@ +#! /bin/bash +#printf "$@" | xsel -b -i +filelist="" +for line in "$@"; do + filelist="$filelist$line\n" +done +printf "$filelist" | xsel -b -i diff --git a/Dolphin/copyName.sh b/Dolphin/copyName.sh new file mode 100644 index 0000000..a260fc3 --- /dev/null +++ b/Dolphin/copyName.sh @@ -0,0 +1,7 @@ +#! /bin/bash +filelist="" +for line in "$@"; do + filename=$(basename -- "$line") + filelist="$filelist$filename\n" +done +printf "$filelist" | xsel -b -i diff --git a/Dolphin/copyPath.sh b/Dolphin/copyPath.sh new file mode 100644 index 0000000..bb113a6 --- /dev/null +++ b/Dolphin/copyPath.sh @@ -0,0 +1,8 @@ +#! /bin/bash +filelist="" +for line in "$@"; do + filename=$(basename -- "$line") + folder=${line%"$filename"} + filelist="$filelist$folder\n" +done +printf "$filelist" | xsel -b -i