Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
poezio
poezio
Commits
48e59d37
Commit
48e59d37
authored
Apr 30, 2014
by
mathieui
Browse files
Fix #2282 (change the terminal title depending on the tab name)
- change_title plugin
parent
c1d19fa5
Changes
3
Hide whitespace changes
Inline
Side-by-side
doc/source/plugins/change_title.rst
0 → 100644
View file @
48e59d37
.. _changetitle-plugin:
Title change
============
.. automodule:: change_title
doc/source/plugins/index.rst
View file @
48e59d37
...
...
@@ -235,6 +235,11 @@ Plugin index
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::
...
...
@@ -273,3 +278,4 @@ Plugin index
pointpoint
autocorrect
irc
change_title
plugins/change_title.py
0 → 100644
View file @
48e59d37
"""
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
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment