]> Freerunner's - dotfiles.git/commitdiff
add kio user actions with example
authorAndre Ramnitz <andre.ramnitz@mail.de>
Thu, 13 Aug 2026 17:28:06 +0000 (19:28 +0200)
committerAndre Ramnitz <andre.ramnitz@mail.de>
Thu, 13 Aug 2026 17:28:06 +0000 (19:28 +0200)
dot-local/bin/clamav-scan-with-dolphin [new file with mode: 0755]
dot-local/share/kio/servicemenus/clamav-scan.desktop [new file with mode: 0755]

diff --git a/dot-local/bin/clamav-scan-with-dolphin b/dot-local/bin/clamav-scan-with-dolphin
new file mode 100755 (executable)
index 0000000..dc532ec
--- /dev/null
@@ -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 (executable)
index 0000000..a4047d3
--- /dev/null
@@ -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
+