1
0
mirror of https://github.com/gryf/tabbedalt.git synced 2025-12-17 11:30:31 +01:00

restored tab_property_notify hook

This commit is contained in:
2013-11-12 09:47:40 +01:00
parent 28d687cb5a
commit fe408c9cd6
2 changed files with 31 additions and 19 deletions

View File

@@ -2,8 +2,8 @@
Tabbed Tabbed
====== ======
This is modified tabbed extension for well known `urxvt-unicode This is modified tabbed extension for well known `urxvt-unicode`_ terminal
<http://software.schmorp.de/pkg/rxvt-unicode.html>`_ terminal emulator emulator
Features Features
-------- --------
@@ -13,7 +13,7 @@ Features
under CTRL+SHIFT+N shortcut. After creating first custom shell this default under CTRL+SHIFT+N shortcut. After creating first custom shell this default
will be discarded. will be discarded.
.. image:: https://raw.github.com/gryf/tabbed/master/screens/tabbed.png .. image:: screens/tabbed.png
:alt: Named tabs :alt: Named tabs
* Shortcuts can be attached to Super_L and Super_R keys together with others * Shortcuts can be attached to Super_L and Super_R keys together with others
@@ -21,17 +21,14 @@ Features
where *num* can be 0 to 9. CTRL+0 will switch to tenth tab. where *num* can be 0 to 9. CTRL+0 will switch to tenth tab.
* Numbers in tabs can be switched off in by setting * Numbers in tabs can be switched off in by setting
resource:``URxvt.tabbed.tab-numbers: false`` resource:``URxvt.tabbed.tab-numbers: false``
* Integrated `activity indicator * Integrated `activity indicator`_ with additional features like colors and
<http://mina86.com/2009/05/16/tabbed-urxvt-extension/>`_ with additional different characters instead of simply asterisk depending on time.
features like colors and different characters instead of simply asterisk
depending on time.
.. image:: https://raw.github.com/gryf/tabbed/master/screens/tabbed.gif .. image:: screens/tabbed.gif
:alt: Indicator activity :alt: Indicator activity
* Integrated tab renaming from `stepb * Integrated tab renaming from `stepb`_. Default under SHIFT+UP, then type some
<http://github.com/stepb/urxvt-tabbedex>`_. Default under SHIFT+UP, then type text and RETURN for accept, ESC for cancel.
some text and RETURN for accept, ESC for cancel.
Installation Installation
------------ ------------
@@ -106,3 +103,7 @@ After that invoke urxvt with perl extensions enabled::
$ urxvt -pe tabbed $ urxvt -pe tabbed
That's all. That's all.
.. _urxvt-unicode: http://software.schmorp.de/pkg/rxvt-unicode.html
.. _activity indicator: http://mina86.com/2009/05/16/tabbed-urxvt-extension/
.. _stepb: http://github.com/stepb/urxvt-tabbedex

27
tabbed
View File

@@ -90,12 +90,16 @@
# [1] http://moc.daper.net # [1] http://moc.daper.net
# #
# 2011-07-12 21:05:26 # 2011-07-12 21:05:26
# - Fixed defaults for not defined tabcommands - now it is possible to use # - Fixed defaults for not defined tabcommands - now it is possible to use
# tabbed just as described. # tabbed just as described.
# - Added some sort of primitive session ability, defined via resource # - Added some sort of primitive session ability, defined via resource
# session, which should contain pipe separated shortcuts defined in tabcmds # session, which should contain pipe separated shortcuts defined in tabcmds
# resource. If there is no shortcuts (or wrong was defined), plain shell tab # resource. If there is no shortcuts (or wrong was defined), plain shell tab
# will appear. # will appear.
#
# 2013-11-12 09:23:49
# - Restored tab_property_notify hook. Whatever was the cause of the memory
# consumption is gone or doesn't have anything to do with that function.
sub tab_activity_mark ($$) { sub tab_activity_mark ($$) {
@@ -439,7 +443,7 @@ sub on_start {
# Ugly as hell ``session'' implementation # Ugly as hell ``session'' implementation
my $count = 0; my $count = 0;
if (qx(ps x|grep urxvt|grep -v grep|wc -l) < 2 && scalar(@{$self->{session}})){ if (qx(ps x|grep " urxvt "|grep -v grep|wc -l) < 2 && scalar(@{$self->{session}})){
for my $item (@{$self->{session}}){ for my $item (@{$self->{session}}){
if (exists($self->{tabcmds}{uc($item)})){ if (exists($self->{tabcmds}{uc($item)})){
$self->new_tab(@{$self->{tabcmds}{uc($item)}}); $self->new_tab(@{$self->{tabcmds}{uc($item)}});
@@ -543,7 +547,7 @@ sub tab_key_press {
if(not %{$self->{tabcmds}}){ if(not %{$self->{tabcmds}}){
print chr($keysym) . "\n"; print chr($keysym) . "\n";
print chr($keysym) == "M". "\n"; print chr($keysym) == "M". "\n";
if ($keysym == 0x4e){ if ($keysym == 0x4e){
print "wtf?\n"; print "wtf?\n";
$self->new_tab("shell"); $self->new_tab("shell");
return 1; return 1;
@@ -624,6 +628,14 @@ sub tab_add_lines {
(); ();
} }
sub tab_property_notify {
my ($self, $tab, $event) = @_;
$self->copy_properties
if $event->{window} == $tab->parent;
()
}
package urxvt::ext::tabbed::tab; package urxvt::ext::tabbed::tab;
@@ -631,7 +643,7 @@ package urxvt::ext::tabbed::tab;
# simply proxies all interesting calls back to the tabbed class. # simply proxies all interesting calls back to the tabbed class.
{ {
for my $hook qw(start destroy key_press add_lines) { for my $hook qw(start destroy key_press add_lines property_notify) {
eval qq{ eval qq{
sub on_$hook { sub on_$hook {
my \$parent = \$_[0]{term}{parent} my \$parent = \$_[0]{term}{parent}
@@ -642,4 +654,3 @@ package urxvt::ext::tabbed::tab;
die if $@; die if $@;
} }
} }