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>
This commit is contained in:
Sniffleupagus
2024-06-11 10:00:32 -07:00
committed by GitHub
parent 3f40c0b7b3
commit e9c12dde94

View File

@ -136,8 +136,9 @@ class View(object):
delay = 1.0 / self._config['ui']['fps'] delay = 1.0 / self._config['ui']['fps']
while True: while True:
try: try:
name = self._state.get('name') if 'showcursor' not in self._config['ui'] or self._config['ui']['showcursor'] == True:
self.set('name', name.rstrip('').strip() if '' in name else (name + '')) name = self._state.get('name')
self.set('name', name.rstrip('').strip() if '' in name else (name + ''))
self.update() self.update()
except Exception as e: except Exception as e:
logging.warning("non fatal error while updating view: %s" % e) logging.warning("non fatal error while updating view: %s" % e)