/usr/share/doc/ltspfs/examples/kde-desktop-icons is in ltspfs 1.1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #!/usr/bin/python
# example ltspfs hook to add icons on the KDE Desktop.
# based on a patch by Klaus Ade Johnstad: http://bugs.debian.org/459369
# to use this hook, install this in /etc/ltspfs/mounter.d/ and mark it as
# executable.
import sys
import os
mode=sys.argv[1]
if mode != 'cleanup':
mountpoint=sys.argv[2]
dev=mountpoint.split('/')[-1]
def get_desktop_file_path(dev):
# FIXME: respect XDG settings when Desktop is localized
return os.path.expanduser("~/Desktop/ltspfsmounter--%s.desktop" % (dev))
if mode == 'add':
desktop_file_s = get_desktop_file_path(dev)
if os.path.exists(desktop_file_s):
print >>sys.stderr, ".desktop file already exists, skipping"
sys.exit(1)
if dev.startswith('usb'):
icon = 'usbpendrive_mount'
elif dev.startswith('ata'):
icon = 'hdd_mount'
elif dev.startswith('floppy'):
icon = '3floppy_mount'
elif dev.startswith('cdrom'):
icon = 'cdrom_mount'
else:
icon = 'usbpendrive_mount'
try:
desktop_file = open(desktop_file_s, 'w')
desktop_file.write('[Desktop Entry]\nEncoding=UTF-8\nName=%s\nIcon=%s\nType=Link\nURL=%s\n' % (dev, icon, mountpoint))
desktop_file.close()
except IOError, e:
print >>sys.stderr, 'unable to create desktop file:', e
elif mode == 'remove':
desktop_file_s = get_desktop_file_path(dev)
if os.path.exists(desktop_file_s):
os.unlink(desktop_file_s)
elif mode == 'cleanup':
import glob
for filename in glob.glob(os.path.expanduser('~/Desktop/') + 'ltspfsmounter--*.desktop'):
os.unlink(filename)
|