conditional key passthrough

Raphaƫl raphael.droz at gmail.com
Tue Oct 13 06:53:34 CEST 2015


bashrc changes the environment of the bash process which is a *child*
of the urxvt process. urxvt probably just got the environment of your WM
(loaded once, by something like a xession or a bash_profile)

To find the environment of a given pid, you can look at /proc/<pid>/environ
To find if the urxvt process is running vim one possibility could be
walking down the children processes tree(s) (but more elegant ones may exist)



On Mon, Oct 12, 2015 at 05:19:53PM -0400, Alexander Tsepkov wrote:
> I started playing with xclipboard, for the most part, sending a different
> event doesn't seem hard at first glance:
> 
> - I put logic in on_user_command checking if currently active app is vim
> - If it is, I emulate fake $self->key_press and $self->key_release events
> (or even tt_write the special ctrl sequence)
> - If not, I do the logic that's already there
> 
> The only problem I'm seeing now is that I can't get the fact that vim is
> running, no matter what, even using logic of urxvt that should be able to
> get me that. Here is what I tried. It also seems like urxvt never updates
> $term->env() after initially reading it (which seems like a bug to me, it's
> possible that other parameters I'm reading are subject to the same bug
> too). Here is what I tried:
> 
> - view $self->resource('title'), assuming it's set to the current window
> title, it's not, it always seems to be set to urxvt (even though the window
> title for the terminal says VIM)
> - view $self->resource('term_name'), because my .vimrc overrides term, no
> effect, it's always the same as one defined in .bashrc
> - view $self->env()->{'DISABLE_CLIPBOARD'} and launch vim with
> "DISABLE_CLIPBOARD=1 vim", that ENV var is never visible from urxvt, only
> ones defined in .bashrc are
> - view if env is getting updated at all: $self->env()->{'PWD'}, initial
> $PWD is correct, but it never changes after, so my suspicion that urxvt
> isn't reading env updates is correct
> 
>  So the bug seems to be:
> urxvt seems to ignore any updates to the environment that weren't already
> there at the time it was loaded.
> 
> Also, if there is a better way to detect current environment/app, please
> let me know, thanks.
> 
> version info:
> 
> rxvt-unicode (urxvt) v9.19 - released: 2013-10-27
> options:
> perl,xft,styles,combining,blink,iso14755,unicode3,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,pixbuf,XIM,frills,selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm
> 
> 
> On Mon, Oct 12, 2015 at 3:33 AM, Alexander Tsepkov <atsepkov at gmail.com>
> wrote:
> 
> > I'm trying to use the same copy/paste keys for both, the terminal and vim.
> > Effectively I want the terminal to be able to detect which one is more
> > appropriate given the situation (vim window on foreground) rather than me
> > trying to remember which combo to use. The terminal has advantage that I
> > can use it with any app. However, vim's internal copy-paste offers more
> > flexibility (ability to ignore line numbers, ability to auto-switch to
> > normal/insert mode as needed), so I would like to use vim's copy/paste
> > (which I already mapped) when vim is active.
> >
> > I can have vim set the title of urxvt, and since urxvt already uses
> > xclipboard perl script to manipulate copy/paste, maybe even have the script
> > auto-detect that the current app is vim and cancel, passing through the key
> > sequence to vim. Is this doable? If not, can I do something else, like send
> > '"*y' (yank to system clipboard) sequence to vim upon copy shortcut if the
> > active app is vim and '"*p' (paste from system clipboard) on paste shortcut?
> >
> > Thanks
> >

> _______________________________________________
> rxvt-unicode mailing list
> rxvt-unicode at lists.schmorp.de
> http://lists.schmorp.de/mailman/listinfo/rxvt-unicode


-- 
GPG id: 0xF41572CEBD4218F4



More information about the rxvt-unicode mailing list