diff options
author | krakissi <mike@krakissi.net> | 2021-12-26 18:34:14 -0500 |
---|---|---|
committer | krakissi <mike@krakissi.net> | 2021-12-26 18:34:14 -0500 |
commit | 68e1f51aec61a006a5ab2a10d94b86c25d5fb7d3 (patch) | |
tree | 9bf096cad1c5d91a896f89a604c86f1bf7c2af8d | |
parent | Merge pull request #11 from bgarnham/resize-fix (diff) | |
download | magnus-68e1f51aec61a006a5ab2a10d94b86c25d5fb7d3.tar.gz magnus-68e1f51aec61a006a5ab2a10d94b86c25d5fb7d3.tar.bz2 magnus-68e1f51aec61a006a5ab2a10d94b86c25d5fb7d3.zip |
Add option to force refresh from the commandline
Return immediately after calling --help (consistent UX with other CLI
tools).
-rwxr-xr-x | magnus | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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 |