This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Device Notifier with default autorun option?

Tags: None
(comma "," separated)
User avatar
sid6point7
Registered Member
Posts
1
Karma
0
OS
Hello out there!

(I hope I post this in the correct spot. The device notifier is a Plasma app, so I think I'm right )
Usually I managed to get most of the stuff running but this time I'm out of ideas or rather out of information. What I post below took me some hours to accomplish (I'm not that of a hacker so I had to learn some commands and so on) but now I'm happy that it works almost perfectly. 8)

The question is: Is there a way to configure the device notifier to execute an action automatically without user interaction (selecting / clicking the action) after a device has been inserted?

Here is what I accomplished so far:
1. I created a new, custom action setting by creating a file called AutoCopy.desktop in the following location:
~/.kde/share/apps/solid/actions/AutoCopy.desktop

The content of this file happens to be as follows:
Code: Select all
[Desktop Entry]
X-KDE-Solid-Predicate=[ StorageVolume.ignored == false AND StorageVolume.usage == 'FileSystem' ]
X-KDE-Autorun=true
Type=Service
Actions=open;

[Desktop Action open]
Name=AutoCopyFotos Test 2
Exec=~/MyBin/AutoCopy.sh %f
Icon=system-file-manager
X-Ubuntu-Gettext-Domain=desktop_kdebase-workspace


2. The purpose of AutoCopy.sh is to copy or move all the JPGs from the plugged in device to my default input folder into a folder with the present date and time, empty the input device and unmount it. See here:
Code: Select all
#!/bin/bash
#
# AutoCopy.sh
NOW=$(date +"%Y-%m-%d_%H%M")
DEST=~/_input/AutoCopy/$NOW
SOURCE=$1
# %f gives StorageAccess.filePath, %d gives Block.device, %i gives UDI

mkdir $DEST
mv `find $SOURCE -name "*.JPG"` $DEST
find $SOURCE -type d -empty -delete
umount $SOURCE


So. ??? All what is missing is: How do I configure the device notifier to "always use this action if the device is plugged in"?

I darkly remember this option used to be there in KDE 3.5.
Is this option not jet implemented in KDE 4? Or did I miss the spot where it is hidden? :'(

Looking forward to your ideas and suggestions!!

Bregards!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Autorun is not available at this time. I would recommend a feature request if one does not already exist.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
TheBlackCat
Registered Member
Posts
2945
Karma
8
OS
It has been requested several times.


Man is the lowest-cost, 150-pound, nonlinear, all-purpose computer system which can be mass-produced by unskilled labor.
-NASA in 1965


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]