#!/usr/bin/python3

# Issue notification on device insertion or removal. Useful for desktops such
# as KDE or LXDE which do not automatically display icons for ltspfs mounts.
#
# To use this feature, copy this file into /etc/ltspfs/mounter.d and
# mark as executable.
#
# Requires python3-notify2 to be installed.

import sys
mode=sys.argv[1]
ltspfs_mount=sys.argv[2]
if mode == 'cleanup':
    # do nothing in cleanup mode.
    sys.exit(0)

import notify2
if not notify2.init("ltspfs"):
    sys.exit(1)
n = notify2.Notification("ltspfs","%s" % mode+' '+ltspfs_mount)
n.show()
