From e9c12dde94d84ef37400510c935dc59298fad002 Mon Sep 17 00:00:00 2001 From: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:00:32 -0700 Subject: [PATCH 1/4] Add new configuration option "ui.showcursor" to enable or disable blinking cursor by name When ui.fps is not zero, the default UI adds a blinking cursor next to the pwnagotchi name, as a verification that the display is updating. This proposed change adds a configuration option "ui.showcursor" to allow users to disable the cursor. If ui.showcursor is set to "true" in config.toml, the cursor will show, if set "false" in config, the cursor will not be shown. Default behavior if ui.showcursor is not set is maintained (cursor will show). If ui.fps is set to 0, the cursor will not be shown regardless of the ui.showcursor setting. (tested on a single pwny with showcursor unset, false, and true, multiple times) Signed-off-by: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> --- pwnagotchi/ui/view.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index 8d31ffeb..4c713e83 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -136,8 +136,9 @@ class View(object): delay = 1.0 / self._config['ui']['fps'] while True: try: - name = self._state.get('name') - self.set('name', name.rstrip('█').strip() if '█' in name else (name + ' █')) + if 'showcursor' not in self._config['ui'] or self._config['ui']['showcursor'] == True: + name = self._state.get('name') + self.set('name', name.rstrip('█').strip() if '█' in name else (name + ' █')) self.update() except Exception as e: logging.warning("non fatal error while updating view: %s" % e) From 244d3c03f983e639763d0cea559a598305e98abd Mon Sep 17 00:00:00 2001 From: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> Date: Sun, 18 Aug 2024 12:06:45 -0400 Subject: [PATCH 2/4] Change 'showcursor' to 'curso Signed-off-by: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> --- pwnagotchi/ui/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index 4c713e83..12c1ed2f 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -136,7 +136,7 @@ class View(object): delay = 1.0 / self._config['ui']['fps'] while True: try: - if 'showcursor' not in self._config['ui'] or self._config['ui']['showcursor'] == True: + if self._config['ui'].get('cursor', False) == True: name = self._state.get('name') self.set('name', name.rstrip('█').strip() if '█' in name else (name + ' █')) self.update() From 82b64baaedfbf9f69f0e4649287879245a550d3e Mon Sep 17 00:00:00 2001 From: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> Date: Sun, 18 Aug 2024 12:15:03 -0400 Subject: [PATCH 3/4] Fixed default value to maintain original behavior (True) Signed-off-by: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> --- pwnagotchi/ui/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index 12c1ed2f..8b6fadb8 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -136,7 +136,7 @@ class View(object): delay = 1.0 / self._config['ui']['fps'] while True: try: - if self._config['ui'].get('cursor', False) == True: + if self._config['ui'].get('cursor', True) == True: name = self._state.get('name') self.set('name', name.rstrip('█').strip() if '█' in name else (name + ' █')) self.update() From afb840212db4ea52c23e2c748e32ea3e0d73c97e Mon Sep 17 00:00:00 2001 From: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> Date: Sun, 18 Aug 2024 12:16:14 -0400 Subject: [PATCH 4/4] Added ui.cursor to defaults.toml Signed-off-by: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> --- pwnagotchi/defaults.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnagotchi/defaults.toml b/pwnagotchi/defaults.toml index b5d6f3a8..6df23a9a 100644 --- a/pwnagotchi/defaults.toml +++ b/pwnagotchi/defaults.toml @@ -151,7 +151,7 @@ personality.throttle_a = 0.4 personality.throttle_d = 0.9 ui.invert = false # false = black background, true = white background - +ui.cursor = true ui.fps = 0.0 ui.font.name = "DejaVuSansMono" # for japanese: fonts-japanese-gothic ui.font.size_offset = 0 # will be added to the font size