Skip to content

Commit

Permalink
clipboard and actions with multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
KVAnton-WEB committed Feb 5, 2019
1 parent 9a437b5 commit 8be4248
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 16 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,30 @@ KDE Dolphin Service Menus

The Service Menu to **show**, **create file** and **check** the **sha512**, **sha256**, **sha1** and **md5** checksums via right-clicking on any file.

Any of these actions - copies the received **checksum values** to the **clipboard**.

Now you can also perform all these actions with multiple files at the same time. (just select multiple files)


## Installation
Copy the file ```checksum_blister.desktop``` to ```~/.local/share/kservices5/ServiceMenus/```
Copy the file ```checksum_blister.desktop``` to ```~/.local/share/kservices5/ServiceMenus/``` and ```checksum_blister```(bash) to ```/usr/local/bin/```:

```
cp ./checksum_blister.desktop ~/.local/share/kservices5/ServiceMenus/
sudo cp ./checksum_blister /usr/local/bin/
```

>Of course, you can edit the checksum_blister.desktop to change the location of the bash-script.
## Requires
"libnotify-tools" and the respective checksum programs.
"*libnotify-tools*", "*xsel*" and the respective *checksum programs*.


Debian/Ubuntu: ```sudo apt install libnotify-bin```
#### Install dependencies in Debian/Ubuntu:
```
sudo apt install libnotify-bin
sudo apt install xsel
```

## Translations
You can help me translate the menu entry to other languages by sending a Pull Request.
58 changes: 58 additions & 0 deletions checksum_blister
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

function checksum {
result=$(cd ${dirCurrent} && ${1} ${fileCurrent} 2>&1)
printf $result | xsel -b -i
case "$cmd" in
"show")
notify-send -t 0 -i "documentinfo" "${2}" "${result}\n"
;;
"create" )
echo "${dirCurrent}/${fileCurrent}.${1}"
echo ${result} > "${dirCurrent}/${fileCurrent}.${1}"
;;
"check" )
notify-send -t 0 -i "dialog-ok" "${2}" "`cd "${dirCurrent}" && "${1}" -wc "${fileCurrent}.${1}" 2>&1`"
;;
esac
}

while [ -n "$1" ]
do
case "$1" in
-f) fileDir="$2"
shift
;;
-a) alg="$2"
shift
;;
-c) cmd="$2"
;;
esac
shift
done
n=0;
fileDir=$(sed -e 's/\ \//,\//g' <<< "$fileDir")
IFS=$(echo -en ",");

for file in $fileDir
do
if [ -f ${file} ]; then
dirCurrent=$(dirname ${file});
fileCurrent=$(basename ${file});
case "$alg" in
"sha256")
checksum "sha256sum" "SHA256 Checksum"
;;
"sha512")
checksum "sha512sum" "SHA512 Checksum"
;;
"md5")
checksum "md5sum" "MD5 Checksum"
;;
"sha1")
checksum "sha1sum" "SHA1 Checksum"
;;
esac
fi
done
26 changes: 13 additions & 13 deletions checksum_blister.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,73 @@ X-KDE-Submenu[ru_RU]=Контрольные суммы


[Desktop Action showmd5]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "documentinfo" "MD5 Checksum" "`cd "${dir}" && md5sum "${file}" 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a md5 -c show
Icon=documentinfo
Name=Show md5 Checksum
Name[ru_RU]=Показать md5 Checksum

[Desktop Action createmd5]
Exec=dir=$(dirname '%F'); file=$(basename '%F'); cd "${dir}" && md5sum "${file}" > '%F'.md5
Exec=/usr/local/bin/checksum_blister -f '%F' -a md5 -c create
Icon=document-new
Name=Create file with md5 Checksum
Name[ru_RU]=Создать файл с md5 Checksum

[Desktop Action checkmd5]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "dialog-ok" "MD5 Checksum" "`cd "${dir}" && md5sum -c "${file}".md5 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a md5 -c check
Icon=dialog-ok
Name=Check md5 Checksum
Name[ru_RU]=Проверить md5 Checksum

[Desktop Action showsha1]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "documentinfo" "SHA1 Checksum" "`cd "${dir}" && sha1sum "${file}" 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha1 -c show
Icon=documentinfo
Name=Show sha1 Checksum
Name[ru_RU]=Показать sha1 Checksum

[Desktop Action createsha1]
Exec=dir=$(dirname '%F'); file=$(basename '%F'); cd "${dir}" && sha1sum "${file}" > '%F'.sha1
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha1 -c create
Icon=document-new
Name=Create file with sha1 Checksum
Name[ru_RU]=Создать файл с sha1 Checksum
Name[ru_RU]=Создать файл с sha1 Checksum

[Desktop Action checksha1]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "dialog-ok" "SHA1 Checksum" "`cd "${dir}" && sha1sum -c "${file}".sha1 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha1 -c check
Icon=dialog-ok
Name=Check sha1 Checksum
Name[ru_RU]=Проверить sha1 Checksum

[Desktop Action showsha256]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "documentinfo" "SHA256 Checksum" "`cd "${dir}" && sha256sum "${file}" 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha256 -c show
Icon=documentinfo
Name=Show sha256 Checksum
Name[ru_RU]=Показать sha256 Checksum

[Desktop Action createsha256]
Exec=dir=$(dirname '%F'); file=$(basename '%F'); cd "${dir}" && sha256sum "${file}" > '%F'.sha256
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha256 -c create
Icon=document-new
Name=Create file with sha256 Checksum
Name[ru_RU]=Создать файл с sha256 Checksum

[Desktop Action checksha256]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "dialog-ok" "SHA256 Checksum" "`cd "${dir}" && sha256sum -wc "${file}".sha256 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha256 -c check
Icon=dialog-ok
Name=Check sha256 Checksum
Name[ru_RU]=Проверить sha256 Checksum

[Desktop Action showsha512]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "documentinfo" "SHA512 Checksum" "`cd "${dir}" && sha512sum "${file}" 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha512 -c show
Icon=documentinfo
Name=Show sha512 Checksum
Name[ru_RU]=Показать sha512 Checksum

[Desktop Action createsha512]
Exec=dir=$(dirname '%F'); file=$(basename '%F'); cd "${dir}" && sha512sum "${file}" > '%F'.sha512
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha512 -c create
Icon=document-new
Name=Create file with sha512 Checksum
Name[ru_RU]=Создать файл с sha512 Checksum

[Desktop Action checksha512]
Exec=dir=$(dirname '%F'); file=$(basename '%F');notify-send -t 0 -i "dialog-ok" "SHA512 Checksum" "`cd "${dir}" && sha512sum -wc "${file}".sha512 2>&1`"
Exec=/usr/local/bin/checksum_blister -f '%F' -a sha512 -c check
Icon=dialog-ok
Name=Check sha512 Checksum
Name[ru_RU]=Проверить sha512 Checksum

0 comments on commit 8be4248

Please sign in to comment.