diff options
Diffstat (limited to 'nvim-wrapper')
-rwxr-xr-x | nvim-wrapper | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nvim-wrapper b/nvim-wrapper new file mode 100755 index 000000000000..18de932dc81c --- /dev/null +++ b/nvim-wrapper @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +from sys import argv +from subprocess import Popen +from time import time +import dbus + +session_bus = dbus.SessionBus() + +# launch the terminal server with a custom app-id and window class (so the .desktop file gets associated) +Popen("/usr/lib/gnome-terminal/gnome-terminal-server --app-id org.neovim --class=neovim".split()) +# 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: + pass +# launch nvim in a gnome-terminal instance +if session_bus.name_has_owner('org.neovim'): + Popen("gnome-terminal --app-id org.neovim -x nvim".split() + argv[1:]) |