diff options
author | Felipe Morales | 2015-11-29 22:39:04 +0100 |
---|---|---|
committer | Felipe Morales | 2015-11-29 22:39:04 +0100 |
commit | 992b462d6348747d5f7a8209acde68c7b0dafbff (patch) | |
tree | 4e69997096c32e55ddd5b82b3816b974dabe2946 | |
parent | ee13be8995e71fdc7ec9b72b98c5e3d8ba9fa1e9 (diff) | |
parent | 6fac2460b711b5f3a8aaa38b47c517b3e635565c (diff) | |
download | aur-992b462d6348747d5f7a8209acde68c7b0dafbff.tar.gz |
Merge pull request #9 from synaptiko/master
Possibility to passthrough command-line options for gnome-terminal
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rwxr-xr-x | nvim-wrapper | 33 |
3 files changed, 34 insertions, 7 deletions
@@ -1,7 +1,7 @@ pkgbase = neovim-gnome-terminal-wrapper pkgdesc = A wrapper for running neovim in a separate instance of gnome-terminal pkgver = 2 - pkgrel = 3 + pkgrel = 4 url = http://github.com/fmoralesc/ arch = any license = GPL @@ -12,7 +12,7 @@ pkgbase = neovim-gnome-terminal-wrapper source = nvim-wrapper source = neovim.svg md5sums = c5b9b5db24db814376b6925ce0f9ad52 - md5sums = 6a2aa98a447d3aa661e39c9b31c4aa7b + md5sums = cec92568d2f1cb5ea889bdc784c82a74 md5sums = 2b271742492f200bcac78dbfe33caa3c pkgname = neovim-gnome-terminal-wrapper @@ -1,7 +1,7 @@ # Maintainer: Felipe Morales <hel.sheep@gmail.com> pkgname=neovim-gnome-terminal-wrapper pkgver=2 -pkgrel=3 +pkgrel=4 pkgdesc="A wrapper for running neovim in a separate instance of gnome-terminal" arch=(any) url="http://github.com/fmoralesc/" @@ -12,7 +12,7 @@ source=('neovim.desktop' 'nvim-wrapper' 'neovim.svg') md5sums=('c5b9b5db24db814376b6925ce0f9ad52' - '6a2aa98a447d3aa661e39c9b31c4aa7b' + 'cec92568d2f1cb5ea889bdc784c82a74' '2b271742492f200bcac78dbfe33caa3c') package() { diff --git a/nvim-wrapper b/nvim-wrapper index af4be8527b39..327803f25a3b 100755 --- a/nvim-wrapper +++ b/nvim-wrapper @@ -38,7 +38,30 @@ TERM_CMD = [ '-x', 'nvim', ] +GTERM_PASSTHROUGH_OPTIONS = [ + '--full-screen', + '--maximize', + '--profile', + '--working-directory', + '--display' +] + +def processArgv(): + argv = sys.argv[1:] + gtermOptions = [] + nvimOptions = [] + + for arg in argv: + argParts = arg.split('=', 1) + if argParts[0] in GTERM_PASSTHROUGH_OPTIONS: + gtermOptions.append(arg) + else: + nvimOptions.append(arg) + return { + 'gterm': gtermOptions, + 'nvim': nvimOptions + } def main(): """Run nvim inside gnome-terminal""" @@ -56,11 +79,15 @@ def main(): pass # launch nvim in a gnome-terminal instance if session_bus.name_has_owner(APP_ID): + options = processArgv() + cmd = [] + TERM_CMD[:-2] + options['gterm'] + TERM_CMD[-2:] + options['nvim'] env = os.environ.copy() - env['NVIM_TUI_ENABLE_CURSOR_SHAPE'] = '1' - env['NVIM_TUI_ENABLE_TRUE_COLOR'] = '1' + if 'NVIM_TUI_ENABLE_CURSOR_SHAPE' not in env: + env['NVIM_TUI_ENABLE_CURSOR_SHAPE'] = '1' + if 'NVIM_TUI_ENABLE_TRUE_COLOR' not in env: + env['NVIM_TUI_ENABLE_TRUE_COLOR'] = '1' with open(os.devnull, 'wb') as fnull: - subprocess.Popen(TERM_CMD + sys.argv[1:], + subprocess.Popen(cmd, stdout=fnull, stderr=fnull, env=env) |