You are not logged in.

#1 2011-12-19 14:14:31

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Scrolling/mouse wheel improvments (VTE-like) in urxvt

I like urxvt a lot, but there's one little thing that always annoyed me, especially since I used to use XFCE's terminal which, like (I assume) all VTE-based terminals, behaves differently.

Like pretty much all other emulators, urxvt supports using the mouse wheel to scroll in the terminal's buffer; But, unlike some others, that is all it does.

Other (VTE-based) terminals, when running an application that uses the "secondary screen"(*), will disable their scrollbar, and instead you can use the wheel to interact with said application. For example, when in `less` or `man` you can scroll around using the mouse wheel. And it's a really nice thing, because it feels very natural (to me, at least).

(*) not sure whether this is the "official" term or not, but at least that's how it's called in urxvt.

And it is the one thing that always annoyed me about urxvt: even in such applications, the mouse wheel will simply scroll through urxvt's own buffer. So I finally decided to grab the source code and have a look, and lucky enough it turned out to be pretty easy to change things.

Introducing a new option: secondaryWheel (ssw)

Yeah, that name might not be the best, but it goes along side secondaryScreen (ssc) - which is obviously required for this to work at all - as well as secondaryScroll (ssr) - with which, IMHO, it is somewhat related. So, there you go.

What this new option does, is pretty simple: when using the mouse wheel, if you're on secondary screen then no scrolling will occur, and instead some (3, to be exact) "fake" keystrokes will be sent to the running application. So, a wheel up will have the same result as pressing the Up key three times, and wheel down will do the same as pressing 3 times the Down key.

Easy enough, but that does the trick: now when running `man`, `less` or any other application that uses the secondary screen, you can use the mouse wheel to move around (or whatever said application would do, if you pressed the Up/Down keys). It should be noted that I'm not sure this is actually how things are done in VTE-based terminals - I never checked - but this does the job, so it works for me.

This is just another option (disabled by default), so you can either use it from command-line (ssw), or specify it in your .Xdefaults using it's long-name: secondaryWheel

Like I mentioned earlier, I believe this option is related to secondaryScroll, as in it works best if you disable it, while enabling secondaryWheel
That way, not only can you use your mouse wheel to scroll around in those applications, but whatever you do here will not "mess up" your scrolling buffer (on primary screen). That's how I use it, and I really like it that way.

Less blah, more download

The modified source code is available on this BitBucket repository. Note that it not only features this patch, but also this great one from rlblaster.

Or, you can also simply use this PKGBUILD.

Note: The PKGBUILD includes both patches, and also uses different compilation options (than the official package) to disable utmp/wtmp support and tabbed support. This is mainly because I don't use those, plus I beleive that utmp/wtmp doesn't actually work anyway (it would require setuid to be set, which isn't the case in the official package. Though, I did include the required lines (commented out) in the PKGBUILD; should you want to use it, you can simply uncomment them, and don't forget to change the options as well).

And of course bug reports, suggestions or any other form of constructive criticism is very much welcome.

Offline

#2 2011-12-19 23:00:05

Mad Fish
Member
Registered: 2009-09-22
Posts: 295

Re: Scrolling/mouse wheel improvments (VTE-like) in urxvt

Never actually understood, why people use urxvt. It feels for me like xterm with ugly scrollbar. No tabs, no truetype fonts, perl dependency. Can someone explain, what I'm missing?

Offline

#3 2011-12-19 23:04:29

Meyithi
Member
From: Wirral, UK
Registered: 2009-06-21
Posts: 550
Website

Re: Scrolling/mouse wheel improvments (VTE-like) in urxvt

Mad Fish wrote:

Never actually understood, why people use urxvt. It feels for me like xterm with ugly scrollbar. No tabs, no truetype fonts, perl dependency. Can someone explain, what I'm missing?

Everything you said (apart from scrollbar which I disable) is why I use urxvt, I build with --disable-xft and --disable-unicode3 because who needs them in a term anyway and it slows stuff down.

Edit/ oops, and the perl dep means it's extensible whilst not being bloated.

Last edited by Meyithi (2011-12-19 23:05:26)


The mind roams more freely in empty rooms.
dwm - colours - ncmpcpp - system
irc://irc.freenode.net:meyithi

Offline

#4 2011-12-19 23:20:18

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: Scrolling/mouse wheel improvments (VTE-like) in urxvt

Well, I actually like the scrollbar (scrollstyle: plain). It's simple, tiny, works, and I don't find ugly at all.

Offline

#5 2011-12-20 01:45:22

vbim0nk
Member
Registered: 2011-12-05
Posts: 19

Re: Scrolling/mouse wheel improvments (VTE-like) in urxvt

Just tried it and it works nice. Thanks.

Offline

#6 2015-06-02 15:10:06

sgt_b2002
Member
Registered: 2013-11-19
Posts: 7

Re: Scrolling/mouse wheel improvments (VTE-like) in urxvt

Sorry for the necro-bump, but I found this thread while troubleshooting an issue with scrolling in urxvt.
This is the precise patch I was looking for, but the link to PKGBUILD in the OP's post is broken.
Here is the direct link to the AUR package: https://aur.archlinux.org/packages/rxvt … -scrolling

Also this patch is great. I moved over from Gentoo who includes this patch in the rxvt-unicode ebuild so I never really knew about it.
Moving to Arch caused some frustration as this patch wasn't included and I had no idea what was wrong.
Anyway, this package is great and I hope it's maintained forever and ever (or for as long as I use urxvt).

Offline

#7 2015-06-02 15:19:18

Alad
Wiki Admin/IRC Op/TU
From: Bagelstan
Registered: 2014-05-04
Posts: 1,972
Website

Re: Scrolling/mouse wheel improvments (VTE-like) in urxvt

I'd suggest to take the patch from the AUR package, and add it to the PKGBUILD from ABS (community repo) instead. The AUR one changes quite a few more things than just scrolling behaviour.

Last edited by Alad (2015-06-02 15:19:31)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Honest Alad's Package Emporium—Now with added bugs! (Grand reopening: December 1st 2018)

Offline

Board footer

Powered by FluxBB