From 0cf9d15723ab29d1b99e35a570de8bba297f9a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 18 Jun 2013 00:16:18 +0200 Subject: =?UTF-8?q?i3:=20Use=20i3-msg=20'exec=20=E2=80=A6'=20for=20process?= =?UTF-8?q?es,=20not=20sh.Command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .i3/scripts/libs/i3.py | 2 ++ .i3/scripts/workspaces.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to '.i3') diff --git a/.i3/scripts/libs/i3.py b/.i3/scripts/libs/i3.py index 343c709..789ef51 100644 --- a/.i3/scripts/libs/i3.py +++ b/.i3/scripts/libs/i3.py @@ -552,6 +552,8 @@ class i3(ModuleType): if name.lower() in self.__module__.MSG_TYPES: return self.__module__.__function__(type=name) else: + if name == "exec_": + name = "exec" return self.__module__.__function__(type='command', message=name) diff --git a/.i3/scripts/workspaces.py b/.i3/scripts/workspaces.py index 5abfea3..137d5fc 100755 --- a/.i3/scripts/workspaces.py +++ b/.i3/scripts/workspaces.py @@ -44,9 +44,12 @@ def new_ws(cmd, args): cmd(str(i+1)) if exe: - try: - sh.Command(exe)() - except sh.CommandNotFound: + # We use i3.exec_ here instead of sh.Command, as we do not want the + # exe to be a child of this script's process + # Also we get startup notification support for free :-) + if sh.which(exe): # i3 exec always yields 'success' + i3.exec_(exe) + else: nag("Command '%s' not found!" % exe) def to_ws(cmd, prompt, args): -- cgit v1.2.3