Skip to content

Commit

Permalink
Allow adding profiles without restarting
Browse files Browse the repository at this point in the history
  • Loading branch information
binwiederhier committed Dec 6, 2015
1 parent 8f01311 commit f490c96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
terminator-hostwatch (0.2.1) unstable; urgency=medium

* Allow adding new profiles without restarting Terminator

-- Philipp Heckel <philipp.heckel@gmail.com> Sun, 06 Dec 2015 23:29:45 +0000

terminator-hostwatch (0.2.0) unstable; urgency=low

* Initial Release.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@

class HostWatch(plugin.Plugin):
watches = {}
profiles = {}

def __init__(self):
self.watches = {}
self.profiles = Terminator().config.list_profiles()
self.update_watches()

def update_watches(self):
Expand All @@ -113,12 +111,13 @@ def check_host(self, _vte, terminal):
last_line = self.get_last_line(terminal)

if last_line:
profiles = Terminator().config.list_profiles()
patterns = self.get_patterns()
for pattern in patterns:
match = re.match(pattern, last_line)
if match:
hostname = match.group(1)
if hostname in self.profiles and hostname != terminal.get_profile():
if hostname in profiles and hostname != terminal.get_profile():
dbg("switching to profile " + hostname + ", because line '" + last_line + "' matches pattern '" + pattern + "'")
terminal.set_profile(None, hostname, False)
break
Expand Down

0 comments on commit f490c96

Please sign in to comment.