/usr/bin/blueman-applet is in blueman 2.0.4-1ubuntu2.
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #! /usr/bin/python3
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
import os.path
import os
import signal
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from blueman.Constants import *
import gi
gi.require_version("Gtk", "3.0")
gi.require_version('Notify', '0.7')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import Notify
try: import __builtin__ as builtins
except ImportError: import builtins
DBusGMainLoop(set_as_default=True)
#support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if os.path.exists(os.path.join(_dirname, "CHANGELOG.md")):
sys.path.insert(0, _dirname)
from blueman.Functions import *
from blueman.main.DbusService import DbusService
import blueman.plugins.applet
from blueman.plugins.AppletPlugin import AppletPlugin
from blueman.plugins.BasePlugin import BasePlugin
import blueman.bluez as Bluez
from blueman.main.SignalTracker import SignalTracker
from blueman.main.PluginManager import PersistentPluginManager
# Workaround introspection bug, gnome bug 622084
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
class BluemanApplet(object):
def __init__(self):
setup_icon_path()
if not Notify.init("Blueman"):
dprint("Error: Failed to initialize libnotify")
check_single_instance("blueman-applet")
self.Manager = None
self.DbusSvc = DbusService("org.blueman.Applet", "/")
self.Signals = SignalTracker()
self.Plugins = PersistentPluginManager(AppletPlugin, blueman.plugins.applet, self)
self.Plugins.Load()
self.Plugins.Run("on_plugins_loaded")
self.bus = dbus.SystemBus()
self.bus.watch_name_owner("org.bluez", self.on_dbus_name_owner_change)
Bluez.Adapter().handle_signal(self.on_adapter_property_changed, 'PropertyChanged', path_keyword='path')
Gtk.main()
def manager_init(self):
try:
self.Signals.DisconnectAll()
self.Manager = Bluez.Manager()
self.Plugins.Run("on_manager_state_changed", True)
self.Signals.Handle("bluez", self.Manager, self.on_adapter_removed, "AdapterRemoved")
self.Signals.Handle("bluez", self.Manager, self.on_adapter_added, "AdapterAdded")
except dbus.exceptions.DBusException as e:
dprint(e)
self.manager_deinit()
dprint("Bluez DBus API not available. Listening for DBus name ownership changes")
def manager_deinit(self):
self.Signals.DisconnectAll()
self.Manager = None
self.Plugins.Run("on_manager_state_changed", False)
def on_dbus_name_owner_change(self, owner):
dprint("org.bluez owner changed to", owner)
if owner == "":
self.manager_deinit()
elif self.Manager is None:
self.manager_init()
def on_adapter_property_changed(self, key, value, path):
self.Plugins.Run("on_adapter_property_changed", path, key, value)
def on_adapter_added(self, path):
dprint("Adapter added ", path)
def on_activate():
dprint("Adapter activated")
self.Plugins.Run("on_adapter_added", path)
adapter = Bluez.Adapter(path)
wait_for_adapter(adapter, on_activate)
def on_adapter_removed(self, path):
dprint("Adapter removed ", path)
self.Plugins.Run("on_adapter_removed", path)
set_proc_title()
BluemanApplet()
|