regolith-linux / regolith-st

Suckless simple terminal (st) for Regolith Linux
6 stars 2 forks source link

Mouse wheel scrolling #2

Closed p3k closed 5 years ago

p3k commented 5 years ago

I am new to the st terminal but it seems to be a better choice than e.g. rxvt in Manjaro i3.

The only thing I am currently missing is support for the mouse wheel / vertical mouse scrolling (shift + page up/down works, and mouse wheel generally works in other apps, too).

There seems to be a way to enable this in st by patching the source(?) but I am not sure how to proceed…

Any suggestions?

kgilmer commented 5 years ago

Hi @p3k ! Here you can see the patches currently applied to st for Regolith. In order to get the mouse scroll patches applied you could add them to the build and generate your own version of st. Or, if you can't wait I'll probably add this myself. I wasn't aware of the mouse scroll patch, and I agree it would be a useful addition. I'll respond to this issue if I get it integrated or find out that there is some reason that I cannot.

If you'd like to dive into building it for yourself, you can have a look at the README which describes the process. If you get stuck I can try and help you out as best I can.

p3k commented 5 years ago

Thanks @kgilmer for your suggestions – and apologies for my delayed reply.

Here is a transcript of what I did so far. First, i tried to build regolith-st as is, following your instructions:

wget https://dl.suckless.org/st/st-0.8.2.tar.gz -O regolith-st_0.8.2.orig.tar.gz
git clone -b debian https://github.com/regolith-linux/regolith-st
cd regolith-st
debuild -S -sa
# debuild: command not found
sudo apt install devscripts
debuild -S -sa
# Unmet build dependencies: debhelper libxft-dev
sudo apt install debhelper libxft-dev
debuild -S -sa
# debsign: gpg error occurred!  Aborting....
debuild -S -sa -uc -us
# success!

Then I tried to add the patch:

tar -xzf ../regolith-st_0.8.2.orig.tar.gz -C . --strip 1
quilt push -a
# quilt: command not found
sudo apt install quilt
quilt push -a
# No series file found

As I was not sure whether the (not very encouraging) quilt output already renders futile my further efforts I googled around and was able to apply the patches following Raphael Hertzog’s suggestions regarding the contents of ~/.quiltrc and other quilt commands:

quilt push -a
wget https://st.suckless.org/patches/scrollback/st-scrollback-mouse-0.8.2.diff -P ..
quilt import ../st-scrollback-mouse-0.8.2.diff
quilt push
debuild -S -sa -uc -us
# success! but…

…where is the binary? I did not want to publish the package just to be able to test the executable. So I simply tried to build it with make:

make
./st

And hooray! A new terminal window popped up in which I am able to scroll with the mouse wheel while pressing the shift key.

Encouraged by this outcome I also added the “altscreen” patch:

wget https://st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190131-e23acb9.diff -P ..
quilt import ../st-scrollback-mouse-altscreen-20190131-e23acb9.diff
quilt push
debuild -S -sa -uc -us
make
./st

Now I can just scroll with the mousewheel in the terminal window, no shift key necessary, anymore.

I assume it is very obvious that I never built a debian package before. So there could be multiple issues with my attempts and I would be happy to learn how to do it right.

Furthermore, if you still think the mousewheel support is a worthwhile addition please let me know how to provide these changes in a manner that they could be incorporated in a future release.

kgilmer commented 5 years ago

@p3k you got it, nice work! I've updated the debian metadata of the Regolith st package to pull in the same patches that you added. Have a look at the commit to see what I did to make that happen. I've pushed this package change to the regolith-unstable PPA for testing.

kgilmer commented 5 years ago

Actually I forgot to add the actual patch files in the last commit. :cry: I've just pushed another commit w/ the patch files included.

kgilmer commented 5 years ago

And, as you were asking about the debian packaging stuff, other than what was commited to the git repo, this is the workflow I performed to verify the behavior was as expected, and then pushing it to launchpad to build and host the package in the Regolith PPA:

# From the repo root directory
$ tar xfzv ../regolith-st_0.8.2.orig.tar.gz  #Stage sources in the package directory
$  mv st-0.8.2/* .
$ rmdir st-0.8.2
$ debuild -S -sa #Generate the package metadata
$ sudo pbuilder --build --distribution bionic ../regolith-st_0.8.2-1ubuntu20ppa2.dsc # Build the package locally
# From here I extracted the deb generated in `/var/cache/pbuilder/result/` into temp and was able to run the `st` program and verify the scrollwheel feature.
$ dput -f ppa:kgilmer/regolith-unstable ../regolith-st_0.8.2-1ubuntu20ppa2_source.changes  #Push the package changes to the PPA.  This should only work if you have write access to the Regolith PPA.
kgilmer commented 5 years ago

This change has been tested and promoted to regolith-stable. Closing and thanks @p3k !