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] 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)