From 68e1f51aec61a006a5ab2a10d94b86c25d5fb7d3 Mon Sep 17 00:00:00 2001 From: krakissi Date: Sun, 26 Dec 2021 18:34:14 -0500 Subject: Add option to force refresh from the commandline Return immediately after calling --help (consistent UX with other CLI tools). --- magnus | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/magnus b/magnus index 723f512..dfedd41 100755 --- a/magnus +++ b/magnus @@ -34,6 +34,7 @@ class Main(object): self.last_y = -1 self.refresh_interval = 250 self.started_by_keypress = False + self.force_refresh = False def handle_shutdown(self, app): if self.started_by_keypress: @@ -56,6 +57,14 @@ class Main(object): print(" Show about dialogue") print(" --refresh-interval=120") print(" Set refresh interval in milliseconds (lower is faster)") + print(" --force-refresh") + print(" Refresh every on interval even if the viewport has not moved.") + return 0 + + if "--force-refresh" in args: + # If this argument is supplied, refresh the view even if the mouse + # has not moved. Useful if the screen content is video. + self.force_refresh = True # Override refresh rate on command line for arg in args: @@ -235,7 +244,7 @@ class Main(object): (screen, x, y, modifier) = display.get_pointer() if x == self.last_x and y == self.last_y: # bail if nothing would be different - if not force_refresh: + if not force_refresh and not self.force_refresh: return True self.last_x = x self.last_y = y -- cgit