Commit 48e59d37 authored by mathieui's avatar mathieui

Fix #2282 (change the terminal title depending on the tab name)

- change_title plugin
parent c1d19fa5
.. _changetitle-plugin:
Title change
============
.. automodule:: change_title
...@@ -235,6 +235,11 @@ Plugin index ...@@ -235,6 +235,11 @@ Plugin index
Manage IRC gateways with biboumi more easily Manage IRC gateways with biboumi more easily
Title change
:ref:`Documentation <changetitle-plugin>`
Change the title of the terminal according to the name
of the current tab.
.. toctree:: .. toctree::
...@@ -273,3 +278,4 @@ Plugin index ...@@ -273,3 +278,4 @@ Plugin index
pointpoint pointpoint
autocorrect autocorrect
irc irc
change_title
"""
This plugin will set the title of your terminal to the name of the current tab.
"""
from plugin import BasePlugin
import sys
class Plugin(BasePlugin):
def init(self):
self.on_tab_change(0, self.core.current_tab_nb)
self.api.add_event_handler('tab_change', self.on_tab_change)
def cleanup(self):
"Re-set the terminal title to 'poezio'"
sys.stdout.write("\x1b]0;poezio\x07")
sys.stdout.flush()
def on_tab_change(self, old, new):
new_tab = self.core.get_tab_by_number(new)
sys.stdout.write("\x1b]0;{}\x07".format(new_tab.name))
sys.stdout.flush()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment