diff options
author | Mickaël Delahaye | 2015-11-03 22:03:21 +0100 |
---|---|---|
committer | Mickaël Delahaye | 2015-11-03 22:10:23 +0100 |
commit | eb59679f5c93e81147056c4c7ccaad0834020467 (patch) | |
tree | bd8e4387a9306b7f61be45d6a015fe65808c8a85 | |
parent | 1398d2b3614efff94c87c2d61cc01a30fb2ed083 (diff) | |
download | aur-eb59679f5c93e81147056c4c7ccaad0834020467.tar.gz |
Refactor & add NVIM_TUI env for cursor and color to script
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 13 | ||||
-rw-r--r-- | neovim.desktop | 2 | ||||
-rwxr-xr-x | nvim-wrapper | 32 |
4 files changed, 34 insertions, 21 deletions
@@ -1,7 +1,7 @@ pkgbase = neovim-gnome-terminal-wrapper pkgdesc = A wrapper for running neovim in a separate instance of gnome-terminal - pkgver = 1 - pkgrel = 6 + pkgver = 2 + pkgrel = 1 url = http://github.com/fmoralesc/ arch = any license = GPL @@ -11,8 +11,8 @@ pkgbase = neovim-gnome-terminal-wrapper source = neovim.desktop source = nvim-wrapper source = neovim.svg - md5sums = fe784928af34009c09c7fcdd4e731fe4 - md5sums = 02f2a478f4a11ba591b75e2cf6aee31a + md5sums = c5b9b5db24db814376b6925ce0f9ad52 + md5sums = c519ffa40ad62448f51bdd91e32518e0 md5sums = 2b271742492f200bcac78dbfe33caa3c pkgname = neovim-gnome-terminal-wrapper @@ -1,16 +1,19 @@ # Maintainer: Felipe Morales <hel.sheep@gmail.com> pkgname=neovim-gnome-terminal-wrapper -pkgver=1 -pkgrel=6 +pkgver=2 +pkgrel=1 pkgdesc="A wrapper for running neovim in a separate instance of gnome-terminal" arch=(any) url="http://github.com/fmoralesc/" license=('GPL') groups=() depends=('python-dbus' 'neovim-git' 'gnome-terminal') -source=(neovim.desktop nvim-wrapper neovim.svg) -md5sums=('fe784928af34009c09c7fcdd4e731fe4' '02f2a478f4a11ba591b75e2cf6aee31a' '2b271742492f200bcac78dbfe33caa3c') - +source=('neovim.desktop' + 'nvim-wrapper' + 'neovim.svg') +md5sums=('c5b9b5db24db814376b6925ce0f9ad52' + 'c519ffa40ad62448f51bdd91e32518e0' + '2b271742492f200bcac78dbfe33caa3c') package() { cd "$srcdir/" diff --git a/neovim.desktop b/neovim.desktop index 604985dae3a2..6332f1b8403c 100644 --- a/neovim.desktop +++ b/neovim.desktop @@ -3,7 +3,7 @@ Version=1.0 Type=Application Name=Neovim Icon=neovim -Exec=env NVIM_TUI_ENABLE_TRUE_COLOR=1 nvim-wrapper %F +Exec=nvim-wrapper %F NoDisplay=false Categories=X-GNOME-Other; StartupNotify=false diff --git a/nvim-wrapper b/nvim-wrapper index 6ea768294ae8..f0062ee0fcb5 100755 --- a/nvim-wrapper +++ b/nvim-wrapper @@ -8,19 +8,26 @@ import subprocess import dbus from time import time + +APP_ID = 'org.neovim' +CLASS = 'neovim' +NAME = 'Neovim' + SERVER_CMD = [ '/usr/lib/gnome-terminal/gnome-terminal-server', - '--app-id=org.neovim', + '--app-id', APP_ID, + '--class', CLASS, + '--name', NAME, ] TERM_CMD = [ 'gnome-terminal', - '--name=Neovim', + '--app-id', APP_ID, + '--class', CLASS, + '--name', NAME, '--hide-menubar', - '--geometry=90x60', - '--app-id=org.neovim', - '--class=neovim', + '--geometry', '90x60', '-x', - 'nvim' + 'nvim', ] def main(): @@ -29,21 +36,24 @@ def main(): # launch the terminal server with a custom app-id # and window class (so the .desktop file gets associated) - if not session_bus.name_has_owner('org.neovim'): + if not session_bus.name_has_owner(APP_ID): subprocess.Popen(SERVER_CMD) # wait until the name is registered, or 2 seconds pass (when launching from # cold cache it might more time) timeout = time() + 2 - while not session_bus.name_has_owner('org.neovim') and time() <= timeout: + while not session_bus.name_has_owner(APP_ID) and time() <= timeout: pass # launch nvim in a gnome-terminal instance - if session_bus.name_has_owner('org.neovim'): + if session_bus.name_has_owner(APP_ID): + env = os.environ.copy() + env['NVIM_TUI_ENABLE_CURSOR_SHAPE'] = '1' + env['NVIM_TUI_ENABLE_TRUE_COLOR'] = '1' with open(os.devnull, 'wb') as fnull: subprocess.Popen(TERM_CMD + sys.argv[1:], stdout=fnull, - stderr=fnull) - # preexec_fn=os.setpgrp) + stderr=fnull, + env=env) if __name__ == '__main__': main() |