aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmagnus25
1 files changed, 25 insertions, 0 deletions
diff --git a/magnus b/magnus
index 5975a12..e2f492c 100755
--- a/magnus
+++ b/magnus
@@ -22,6 +22,7 @@ class Main(object):
"org.kryogenix.magnus",
Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
self.app.connect("command-line", self.handle_commandline)
+ self.app.connect("shutdown", self.handle_shutdown)
self.resize_timeout = None
self.window_metrics = None
self.window_metrics_restored = False
@@ -30,6 +31,14 @@ class Main(object):
self.last_x = -1
self.last_y = -1
self.refresh_interval = 250
+ self.started_by_keypress = False
+
+ def handle_shutdown(self, app):
+ if self.started_by_keypress:
+ settings = Gio.Settings.new("org.gnome.desktop.a11y.applications")
+ val = settings.get_boolean("screen-magnifier-enabled")
+ if val:
+ settings.set_boolean("screen-magnifier-enabled", False)
def handle_commandline(self, app, cmdline):
args = cmdline.get_arguments()
@@ -57,6 +66,22 @@ class Main(object):
self.refresh_interval = rival
except ValueError:
pass
+ if arg == "--started-by-keypress":
+ self.started_by_keypress = True
+ # This is here so that the autostart desktop file can specify it.
+ # The idea is that Gnome-ish desktops have an explicit keybinding
+ # to run the system magnifier; what this keybinding actually does,
+ # via the {desktop}-settings-daemon, is toggle the gsettings key
+ # org.gnome.desktop.a11y.applications screen-magnifier-enabled
+ # Magnus provides a desktop file to go in /etc/xdg/autostart which
+ # contains an AutostartCondition of
+ # GSettings org.gnome.desktop.a11y.applications screen-magnifier-enabled
+ # and then the {desktop}-session daemon takes care of starting the
+ # app when that key goes true, and closing the app if that
+ # key goes false. However, the user may also explicitly quit Magnus
+ # with the close icon or alt-f4 or similar. If they do so, then
+ # we explicitly set the key back to false, so that the global
+ # keybinding to run the magnifier stays in sync.
# First time startup
self.start_everything_first_time()
bgstack15