Skip to content

Commit

Permalink
Add startup script support (#198)
Browse files Browse the repository at this point in the history
+ fix pylint errors

Signed-off-by: Gaetan Semet <[email protected]>
  • Loading branch information
gsemet committed Jul 11, 2014
1 parent 7234aba commit 131e1ff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
15 changes: 15 additions & 0 deletions data/guake.schemas
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,21 @@
</locale>
</schema>

<schema>
<key>/schemas/apps/guake/general/startup_script</key>
<applyto>/apps/guake/general/startup_script</applyto>
<owner>guake</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Startup script to execute when guake starts</short>
<long>This property allows you to execute a startup bash
script each time guake starts. You can configure your
initial tab settings within this script. Please see
the command line argument of guake ('guake --help')
for complete help.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/guake/general/start_fullscreen</key>
<applyto>/apps/guake/general/start_fullscreen</applyto>
Expand Down
15 changes: 10 additions & 5 deletions src/guake
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import sys
import vte
import xdg.Exceptions

from pprint import pprint

from pango import FontDescription
from thread import start_new_thread
from time import sleep
Expand All @@ -66,7 +64,6 @@ from guake.globals import ALIGN_BOTTOM
from guake.globals import ALIGN_CENTER
from guake.globals import ALIGN_LEFT
from guake.globals import ALIGN_RIGHT
from guake.globals import ALIGN_TOP
from guake.globals import GCONF_PATH
from guake.globals import KEY
from guake.globals import LOCALE_DIR
Expand Down Expand Up @@ -550,7 +547,7 @@ class GuakeTerminal(vte.Terminal):
tag = self.match_add(expr)
self.match_set_cursor_type(tag, gtk.gdk.HAND2)

for _, match, _ in QUICK_OPEN_MATCHERS:
for _useless, match, _otheruseless in QUICK_OPEN_MATCHERS:
tag = self.match_add(match)
self.match_set_cursor_type(tag, gtk.gdk.HAND2)

Expand Down Expand Up @@ -582,7 +579,7 @@ class GuakeTerminal(vte.Terminal):
use_quick_open = client.get_bool(KEY("/general/quick_open_enable"))
cmdline = client.get_string(KEY("/general/quick_open_command_line"))
if use_quick_open:
for _, _, extractor in QUICK_OPEN_MATCHERS:
for _useless, _otheruseless, extractor in QUICK_OPEN_MATCHERS:
g = re.compile(extractor).match(value)
if g and len(g.groups()) == 2:
filename = g.group(1)
Expand Down Expand Up @@ -1891,6 +1888,14 @@ def main():
# it is already running, so, lets toggle its visibility.
remote_object.show_hide()

if not already_running:
startup_script = instance.client.get_string(KEY("/general/startup_script"))
if startup_script:
print "Calling startup script: ", startup_script
pid = subprocess.Popen([startup_script], shell=True, stdin=None, stdout=None,
stderr=None, close_fds=True)
print "Script started with pid", pid
# Please ensure this is the last line !!!!
return already_running

if __name__ == '__main__':
Expand Down

0 comments on commit 131e1ff

Please sign in to comment.