From: Samir Benmendil Date: Sat, 30 Jan 2021 16:21:06 +0000 (+0000) Subject: qutebrowser: use TERMINAL env to open external commands in X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/87973e94f4e81925759481af19f266e3afe12625 qutebrowser: use TERMINAL env to open external commands in --- diff --git a/qutebrowser/config.py b/qutebrowser/config.py index 4b30831..9695b5f 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -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