On Thu, Mar 31, 2016 at 10:28:31PM +0200, Morgon Hed <[email protected]>
wrote:
> I am new to urxtv, so I hope my question is not too idiotic...
It's not, and this reply is far too late, but it is a reply nevertheless :)
> My question is: Is there any way to access the functionality of an
> extension from another extension?
As for calling functions or accessing package variables, you can indeed just
hardcode the package name that urxvt uses (urxt::ext::<extension>). That's
not documented, but if the name ever changes, it's easy to update, and urxvt
does not change the fundamental way that perl works, so the code ends up in
*some* perl package.
More interesting would be calling methods of other extensions or accessing
per-instance extension data.
The bad news is that the terminal object does not actually keep references to
the extension objects - extension objects attach to a term, the term does not
keep track of them.
The only way to communicate would be by cooperating. For example, the
selection-popup stores something in $self->{term}{selection_popup_hook},
which other extensions can then access.
There are no hard rules on the namespace in the %{ $self->{term} } hash - if
you use a long enough or unique enough name, things will work.
> So for example when I have tabbed or tabbedex loaded and from my own
> extension I would like to (among other things) open a new tab is there any
> way to do it?
I don't think there is a way that wouldn't feel like a gross hack, if it
is even possible.
> urxtv::ext::<extension> I assume I would need to somehow get hold of the
> corresponding object for the extensions whose functionality I want to use
> but I can see no way to do that - and maybe that's not the indented way
> anyway.
It's clearly not the intended way, but that's simply because nobody thought
about it.
The "intended" way would be to move shared functionality in some utility
package, with extensions being mostly self-contained, i.e. apart from some
limited cooperation (like in the selection-popup case), it's not expected
that extensions also act as some kind of libraries.
I don't think it would be wrong to let extensions find out about other
extensions, but unfortunately, urxvt doesn't implement this yet.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / [email protected]
-=====/_/_//_/\_,_/ /_/\_\
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode