Remove qclipd - now part of qubes-manager
This commit is contained in:
parent
b48446d99f
commit
fcf51c6a6f
@ -1,91 +0,0 @@
|
||||
#!/usr/bin/python2
|
||||
#
|
||||
# The Qubes OS Project, http://www.qubes-os.org
|
||||
#
|
||||
# Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#
|
||||
|
||||
import os
|
||||
import daemon
|
||||
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
|
||||
import dbus
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
import glib,gobject
|
||||
from qubes.qubes import QubesDaemonPidfile
|
||||
|
||||
qubes_clipboard_info_file = "/var/run/qubes/qubes_clipboard.bin.source"
|
||||
|
||||
def watch_qubes_clipboard():
|
||||
def tray_notify(str, timeout = 3000):
|
||||
notify_object.Notify("Qubes", 0, "dialog-information", "", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
||||
|
||||
glib_mainloop = DBusGMainLoop(set_as_default=True)
|
||||
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications", follow_name_owner_changes=True)
|
||||
wm = WatchManager()
|
||||
mask = EventsCodes.OP_FLAGS.get('IN_CLOSE_WRITE')
|
||||
|
||||
if not os.path.exists (qubes_clipboard_info_file):
|
||||
file = open (qubes_clipboard_info_file, 'w')
|
||||
file.close()
|
||||
|
||||
class ClipboardWatcher(ProcessEvent):
|
||||
def process_IN_CLOSE_WRITE (self, event):
|
||||
src_info_file = open (qubes_clipboard_info_file, 'r')
|
||||
src_vmname = src_info_file.readline().strip('\n')
|
||||
if src_vmname == "":
|
||||
tray_notify ("Qubes Clipboard has been copied to the VM and wiped.\n"\
|
||||
"<small>Trigger a paste operation (e.g. Ctrl-v) to insert it into an application.</small>" )
|
||||
else:
|
||||
print src_vmname
|
||||
tray_notify ("Qubes Clipboard fetched from VM: <b>'{0}'</b>\n"\
|
||||
"<small>Press Ctrl-Shift-v to copy this clipboard onto dest VM's clipboard.</small>".format(src_vmname))
|
||||
src_info_file.close()
|
||||
|
||||
notifier = Notifier(wm, ClipboardWatcher())
|
||||
wdd = wm.add_watch(qubes_clipboard_info_file, mask)
|
||||
|
||||
def process_inotify(source, cb_condition):
|
||||
if notifier.check_events():
|
||||
notifier.read_events()
|
||||
notifier.process_events()
|
||||
return True
|
||||
|
||||
glib.io_add_watch(wm.get_fd(), glib.IO_IN, process_inotify)
|
||||
|
||||
gobject.MainLoop().run()
|
||||
|
||||
def main():
|
||||
lock = QubesDaemonPidfile ("qclipd")
|
||||
if lock.pidfile_exists():
|
||||
if lock.pidfile_is_stale():
|
||||
lock.remove_pidfile()
|
||||
print "Removed stale pidfile (has the previous daemon instance crashed?)."
|
||||
else:
|
||||
exit (0)
|
||||
|
||||
context = daemon.DaemonContext(
|
||||
working_directory = "/var/run/qubes",
|
||||
pidfile = lock)
|
||||
|
||||
with context:
|
||||
watch_qubes_clipboard()
|
||||
|
||||
lock.remove_pidfile()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -51,7 +51,6 @@ if not dry_run:
|
||||
qubes_guid_path = "/usr/bin/qubes_guid"
|
||||
qrexec_daemon_path = "/usr/lib/qubes/qrexec_daemon"
|
||||
qrexec_client_path = "/usr/lib/qubes/qrexec_client"
|
||||
qubes_clipd_path = "/usr/bin/qclipd"
|
||||
|
||||
qubes_base_dir = "/var/lib/qubes"
|
||||
|
||||
@ -1496,13 +1495,6 @@ class QubesVm(object):
|
||||
p = self.run('QUBESRPC qubes.WaitForSession none', user="root", passio_popen=True, gui=False, wait=True)
|
||||
p.communicate(input=self.default_user)
|
||||
|
||||
retcode = subprocess.call([qubes_clipd_path])
|
||||
if retcode != 0:
|
||||
print >> sys.stderr, "ERROR: Cannot start qclipd!"
|
||||
|
||||
if notify_function is not None:
|
||||
notify_function("error", "ERROR: Cannot start the Qubes Clipboard Notifier!")
|
||||
|
||||
def start_guid(self, verbose = True, notify_function = None):
|
||||
if verbose:
|
||||
print >> sys.stderr, "--> Starting Qubes GUId..."
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
from qubes import QubesVm,QubesException,QubesVmCollection
|
||||
from qubes import QubesVmClasses
|
||||
from qubes import xs, xl_ctx, qubes_guid_path, qubes_clipd_path, qrexec_client_path
|
||||
from qubes import xs, xl_ctx, qubes_guid_path, qrexec_client_path
|
||||
from qubes import qubes_store_filename, qubes_base_dir
|
||||
from qubes import qubes_servicevms_dir, qubes_templates_dir, qubes_appvms_dir
|
||||
import sys
|
||||
|
@ -34,7 +34,6 @@ import sys
|
||||
import os
|
||||
import os.path
|
||||
|
||||
qubes_clipd_path = "/usr/bin/qclipd"
|
||||
notify_object = None
|
||||
|
||||
# how long (in sec) to wait for VMs to shutdown
|
||||
|
@ -112,7 +112,6 @@ cp systemd/qubes-qmemman.service $RPM_BUILD_ROOT%{_unitdir}
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin/
|
||||
cp qvm-tools/qvm-* $RPM_BUILD_ROOT/usr/bin
|
||||
cp qvm-tools/qubes-* $RPM_BUILD_ROOT/usr/bin
|
||||
cp clipboard_notifier/qclipd $RPM_BUILD_ROOT/usr/bin
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/xen/scripts
|
||||
cp dispvm/block.qubes $RPM_BUILD_ROOT/etc/xen/scripts
|
||||
@ -401,7 +400,6 @@ fi
|
||||
%config(noreplace) %attr(0664,root,qubes) %{_sysconfdir}/qubes/qmemman.conf
|
||||
/usr/bin/qvm-*
|
||||
/usr/bin/qubes-*
|
||||
/usr/bin/qclipd
|
||||
%dir %{python_sitearch}/qubes
|
||||
%{python_sitearch}/qubes/qubes.py
|
||||
%{python_sitearch}/qubes/qubes.pyc
|
||||
|
Loading…
Reference in New Issue
Block a user