Merge lp:~john-pankov/dockmanager/terminal-helper into lp:dockmanager

Proposed by Eugene Pankov
Status: Superseded
Proposed branch: lp:~john-pankov/dockmanager/terminal-helper
Merge into: lp:dockmanager
Diff against target: 112 lines (+81/-0)
4 files modified
metadata/Makefile.am (+1/-0)
metadata/terminal.py.info (+5/-0)
scripts/Makefile.am (+1/-0)
scripts/terminal.py (+74/-0)
To merge this branch: bzr merge lp:~john-pankov/dockmanager/terminal-helper
Reviewer Review Type Date Requested Status
Rico Tzschichholz Needs Fixing
Review via email: mp+49838@code.launchpad.net

This proposal has been superseded by a proposal from 2011-02-21.

To post a comment you must log in.
Revision history for this message
Rico Tzschichholz (ricotz) wrote :
review: Needs Fixing
86. By Eugene Pankov

Added terminal helper to Makefile.am

Unmerged revisions

86. By Eugene Pankov

Added terminal helper to Makefile.am

85. By Eugene Pankov

Gnome Terminal profiles helper

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'metadata/Makefile.am'
2--- metadata/Makefile.am 2010-10-19 18:14:46 +0000
3+++ metadata/Makefile.am 2011-02-21 12:08:18 +0000
4@@ -14,6 +14,7 @@
5 rhythmbox_control.py.info \
6 skype_control.py.info \
7 tomboy_menus.py.info \
8+ terminal.py.info \
9 transmission_badge.py.info \
10 tsclient_menus.py.info \
11 workrave_helper.py.info \
12
13=== added file 'metadata/terminal.py.info'
14--- metadata/terminal.py.info 1970-01-01 00:00:00 +0000
15+++ metadata/terminal.py.info 2011-02-21 12:08:18 +0000
16@@ -0,0 +1,5 @@
17+[DockmanagerHelper]
18+Name=Terminal profiles
19+Description=Launch different terminal profiles quickly
20+Icon=gnome-terminal
21+AppName=gnome-terminal
22
23=== modified file 'scripts/Makefile.am'
24--- scripts/Makefile.am 2010-10-19 18:14:46 +0000
25+++ scripts/Makefile.am 2011-02-21 12:08:18 +0000
26@@ -14,6 +14,7 @@
27 rhythmbox_control.py \
28 skype_control.py \
29 tomboy_menus.py \
30+ terminal.py \
31 transmission_badge.py \
32 tsclient_menus.py \
33 workrave_helper.py \
34
35=== added file 'scripts/terminal.py'
36--- scripts/terminal.py 1970-01-01 00:00:00 +0000
37+++ scripts/terminal.py 2011-02-21 12:08:18 +0000
38@@ -0,0 +1,74 @@
39+#!/usr/bin/env python
40+
41+#
42+# Copyright (C) 2010 Eugeny Pankov <john.pankov@gmail.com>
43+#
44+# This program is free software: you can redistribute it and/or modify
45+# it under the terms of the GNU General Public License as published by
46+# the Free Software Foundation, either version 3 of the License, or
47+# (at your option) any later version.
48+#
49+# This program is distributed in the hope that it will be useful,
50+# but WITHOUT ANY WARRANTY; without even the implied warranty of
51+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52+# GNU General Public License for more details.
53+#
54+# You should have received a copy of the GNU General Public License
55+# along with this program. If not, see <http://www.gnu.org/licenses/>.
56+#
57+
58+import atexit
59+import gobject
60+import dbus
61+import dbus.glib
62+import glib
63+import sys
64+import os
65+import subprocess
66+
67+try:
68+ from dockmanager.dockmanager import DockManagerItem, DockManagerSink
69+ from signal import signal, SIGTERM
70+ import gconf
71+ from sys import exit
72+except ImportError, e:
73+ exit()
74+
75+class TerminalItem(DockManagerItem):
76+ profiles = {'Default' : 'Default'}
77+
78+ def __init__(self, sink, path):
79+ DockManagerItem.__init__(self, sink, path)
80+ client = gconf.client_get_default()
81+ self.add_menu_item('Default', 'gnome-terminal', 'Profiles')
82+
83+ try:
84+ for i in range(0, 999):
85+ client.add_dir('/apps/gnome-terminal/profiles/Profile%i' % i, gconf.CLIENT_PRELOAD_NONE)
86+ name = client.get_string('/apps/gnome-terminal/profiles/Profile%i/visible_name' % i)
87+ if name is None: break
88+ self.profiles[name] = 'Profile%i' % i
89+ self.add_menu_item(name, 'gnome-terminal', 'Profiles')
90+ except:
91+ pass
92+
93+ def menu_pressed(self, menu_id):
94+ subprocess.Popen(['/usr/bin/gnome-terminal', '--profile=' + self.id_map[menu_id]])
95+
96+class TerminalSink(DockManagerSink):
97+ def item_path_found(self, pathtoitem, item):
98+ if item.Get('org.freedesktop.DockItem', 'DesktopFile', dbus_interface='org.freedesktop.DBus.Properties').endswith('gnome-terminal.desktop'):
99+ self.items[pathtoitem] = TerminalItem(self, pathtoitem)
100+
101+terminalsink = TerminalSink()
102+
103+def cleanup ():
104+ terminalsink.dispose ()
105+
106+if __name__ == '__main__':
107+ mainloop = gobject.MainLoop(is_running=True)
108+
109+ atexit.register (cleanup)
110+ signal(SIGTERM, lambda signum, stack_frame: exit(1))
111+
112+ mainloop.run()

Subscribers

People subscribed via source and target branches

to status/vote changes: