aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2024-11-17 22:56:02 +1300
committerTom Ryder <tom@sanctum.geek.nz>2024-11-17 23:00:46 +1300
commit6f591d5e1b8cf1e22f58d367b5edaeca07cc5240 (patch)
treef0971ebdf22d5614e92e8b3cf55ccfca56f250c7
parentMake focus delay configurable (diff)
downloadvixf-6f591d5e1b8cf1e22f58d367b5edaeca07cc5240.tar.gz
vixf-6f591d5e1b8cf1e22f58d367b5edaeca07cc5240.zip
Move editor and terminal fallbacks to constants
-rw-r--r--vixf.py328
1 files changed, 16 insertions, 12 deletions
diff --git a/vixf.py3 b/vixf.py3
index 3629692..22cd379 100644
--- a/vixf.py3
+++ b/vixf.py3
@@ -22,8 +22,20 @@ import pyperclip
SELF = 'vixf'
+EDITOR_FALLBACKS = [
+ 'editor',
+ 'sensible-editor',
+ 'vi',
+]
+
FOCUS_DELAY_DEFAULT = 0.1
+TERMINAL_FALLBACKS = [
+ 'x-terminal-emulator',
+ 'sensible-terminal',
+ 'xterm',
+]
+
def main(environ):
"""
@@ -116,12 +128,8 @@ def select_editor(config, environ):
elif 'EDITOR' in environ:
editor = environ['EDITOR']
else:
- for candidate in [
- 'editor',
- 'sensible-editor',
- 'vi',
- ]:
- editor = candidate
+ for fallback in EDITOR_FALLBACKS:
+ editor = fallback
if shutil.which(editor):
break
return editor
@@ -136,12 +144,8 @@ def select_terminal(config):
terminal = None
terminal = config.get('terminal', 'command', fallback=None)
if not terminal:
- for candidate in [
- 'x-terminal-emulator',
- 'sensible-terminal',
- 'xterm',
- ]:
- terminal = candidate
+ for fallback in TERMINAL_FALLBACKS:
+ terminal = fallback
if shutil.which(terminal):
break
else: