Patchwork [1/1] lib/oe/terminal: add support for XFCE's terminal emulator

login
register
mail settings
Submitter Joshua Lock
Date Oct. 31, 2011, 9:53 p.m.
Message ID <a80b8487fb7e392cfc167f427e7a00e9d035a7e0.1320097805.git.josh@linux.intel.com>
Download mbox | patch
Permalink /patch/14075/
State Accepted
Commit 162b70a36388ac44fc1b39e172cd53579707bff3
Headers show

Comments

Joshua Lock - Oct. 31, 2011, 9:53 p.m.
That's Terminal on Fedora and xfce4-terminal on Ubuntu/Debian... This
could get interesting!

Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
 meta/lib/oe/terminal.py |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
Richard Purdie - Nov. 1, 2011, 11:18 a.m.
On Mon, 2011-10-31 at 14:53 -0700, Joshua Lock wrote:
> That's Terminal on Fedora and xfce4-terminal on Ubuntu/Debian... This
> could get interesting!
> 
> Signed-off-by: Joshua Lock <josh@linux.intel.com>
> ---
>  meta/lib/oe/terminal.py |   23 +++++++++++++++++++++++
>  1 files changed, 23 insertions(+), 0 deletions(-)

Merged to master, thanks.

Richard

Patch

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 1455e8e..43639d5 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -57,6 +57,20 @@  class Gnome(XTerminal):
     command = 'gnome-terminal --disable-factory -t "{title}" -x {command}'
     priority = 2
 
+class Xfce(XTerminal):
+    command = 'Terminal -T "{title}" -e "{command}"'
+    priority = 2
+
+    def __init__(self, command, title=None, env=None):
+        # Upstream binary name is Terminal but Debian/Ubuntu use
+        # xfce4-terminal to avoid possible(?) conflicts
+        distro = distro_name()
+        if distro == 'ubuntu' or distro == 'debian':
+            cmd = 'xfce4-terminal -T "{title}" -e "{command}"'
+        else:
+            cmd = command
+        XTerminal.__init__(self, cmd, title, env)
+
 class Konsole(XTerminal):
     command = 'konsole -T "{title}" -e {command}'
     priority = 2
@@ -131,3 +145,12 @@  def check_konsole_version(konsole):
         if ver.startswith('Konsole'):
             vernum = ver.split(' ')[-1]
     return vernum
+
+def distro_name():
+    try:
+        p = Popen(['lsb_release', '-i'])
+        out, err = p.communicate()
+        distro = out.split(':')[1].strip().lower()
+    except:
+        distro = "unknown"
+    return distro