]> git.rmz.io Git - dotfiles.git/blobdiff - qutebrowser/config.py
qutebrowser: use TERMINAL env to open external commands in
[dotfiles.git] / qutebrowser / config.py
index 4b308310b21e434eea83d6b63a03178122c29040..9695b5f0b056165f3d9680780894ab1b6694b6a8 100644 (file)
@@ -3,6 +3,16 @@
 ##   qute://help/configuring.html
 ##   qute://help/settings.html
 
+def in_terminal(cmd: list):
+    """Wraps cmd to be run in the default TERMINAL, as set by environment.
+
+    :cmd: cmd to execute in TERMINAL
+    :returns: A shell command as a list
+    """
+    from os import getenv
+    t = getenv('TERMINAL', 'xterm')
+    return [t, '-e'] + cmd
+
 ## This is here so configs done via the GUI are still loaded.
 ## Remove it to not load settings done via the GUI.
 config.load_autoconfig()
@@ -720,7 +730,7 @@ c.downloads.open_dispatcher = "rifle"
 ## `{line0}`: Same as `{line}`, but starting from index 0. * `{column0}`:
 ## Same as `{column}`, but starting from index 0.
 ## Type: ShellCommand
-c.editor.command = ['urxvtc', '-e', 'vim', '{file}', '-c', 'normal {line}G{column0}l']
+c.editor.command = in_terminal(['vim', '{file}', '-c', 'normal {line}G{column0}l'])
 
 ## Encoding to use for the editor.
 ## Type: Encoding