From: Andre Ramnitz Date: Thu, 13 Aug 2026 17:28:06 +0000 (+0200) Subject: add kio user actions with example X-Git-Tag: v0.6~13 X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=d7592cc56f41a4524655e05bffb421eda10ae66a;p=dotfiles.git add kio user actions with example --- diff --git a/dot-local/bin/clamav-scan-with-dolphin b/dot-local/bin/clamav-scan-with-dolphin new file mode 100755 index 0000000..dc532ec --- /dev/null +++ b/dot-local/bin/clamav-scan-with-dolphin @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ "$#" -eq 0 ]; then + kdialog --error "No files or folders were selected." + exit 1 +fi + +stamp="$(date +%F-%H%M%S)" +logdir="$HOME/.local/state/clamav-kde" +logfile="$logdir/daemon-$stamp.log" +mkdir -p "$logdir" + +if ! rc-service clamd status; then + kdialog --error "[email protected] is not running. Start the daemon first." + exit 1 +fi + +notify-send "ClamAV" "Daemon scan started" + +infected=0 +errors=0 +for target in "$@"; do + if clamdscan --fdpass --log="$logfile" -- "$target"; then + : + else + rc=$? + if [ "$rc" -eq 1 ]; then + infected=1 + else + errors=1 + fi + fi +done + +if [ "$infected" -eq 1 ]; then + notify-send "ClamAV" "Daemon scan found infected files" + kdialog --title "ClamAV Daemon Scan" --textbox "$logfile" 900 600 +elif [ "$errors" -eq 1 ]; then + notify-send "ClamAV" "Daemon scan finished with errors" + kdialog --title "ClamAV Daemon Scan" --textbox "$logfile" 900 600 +else + notify-send "ClamAV" "Daemon scan finished clean" + kdialog --title "ClamAV Daemon Scan" --textbox "$logfile" 900 600 +fi +EOF + diff --git a/dot-local/share/kio/servicemenus/clamav-scan.desktop b/dot-local/share/kio/servicemenus/clamav-scan.desktop new file mode 100755 index 0000000..a4047d3 --- /dev/null +++ b/dot-local/share/kio/servicemenus/clamav-scan.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Name=ClamAV +Type=Service +MimeType=inode/directory;application/octet-stream; +MimeType=inode/directory; +Actions=clamav +# X-KDE-Submenu=ClamAV + +[Desktop Action clamav] +Name=Scan With ClamAV (Daemon) +Name=Mit ClamAV scannen (Daemon) +Icon=security-medium +Exec=~/.local/bin/clamav-scan-with-dolphin %F +