From 0cb973041ca4883cdcc59ce9b3e81b8e9c287238 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Sun, 13 Oct 2019 11:23:07 -0300 Subject: [PATCH] Including a Dolphin script to copy filenames --- Dolphin/bf-copy.desktop | 24 ++++++++++++++++++++++++ Dolphin/copyFullPath.sh | 7 +++++++ Dolphin/copyName.sh | 7 +++++++ Dolphin/copyPath.sh | 8 ++++++++ 4 files changed, 46 insertions(+) create mode 100644 Dolphin/bf-copy.desktop create mode 100644 Dolphin/copyFullPath.sh create mode 100644 Dolphin/copyName.sh create mode 100644 Dolphin/copyPath.sh 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