MightyCreak / diffuse

Diffuse is a graphical tool for comparing and merging text files. It can retrieve files for comparison from Bazaar, CVS, Darcs, Git, Mercurial, Monotone, RCS, Subversion, and SVK repositories.
http://mightycreak.github.io/diffuse/
GNU General Public License v2.0
260 stars 46 forks source link

Fix keybindings for Next/Previous Difference on macOS #174

Closed krlmlr closed 1 year ago

krlmlr commented 1 year ago

Ctrl + Up/Down is typically a system hotkey.

Can we also change the hotkey for switching tabs to Ctrl + (Shift + ) Tab? Page Up/Down isn't easy to access.

MightyCreak commented 1 year ago

Well, I remember a few years ago I proposed the GNOME team to change their HIG in order to use Ctrl+Tab and Shift+Ctrl+Tab to switch between tabs (preferably in a Most Recently Used -- MRU -- fashion). It was listing Ctrl+PageUp and Ctrl+PageDown which, I agree, is not very practical, and is even worse if we want to implement an MRU behaviour.

My proposition was merged and then reverted because Ctrl+Tab was used elsewhere for accessibility purpose, so they couldn't change that. I argued that Ctrl+Tab was a well known shortcut for tabs and we might consider changing the accessibility shortcut instead, but it didn't get much traction (you don't mess with accessibility I guess :sweat_smile: ).

All that said, I checked again and they seem to have loosen the guidelines a bit:

So it seems that they are more inclined to let the devs choose whatever behaviour they want. They are still not talking about MRU, but that's another issue.

The thing though is that it's for GTK4, and I don't know how to change that in GTK3 as the tab widget is simply following the GTK3 HIG. It seems it will require some custom overloading of the widget.

I also know that they did some standardisation around all the tabs widget in GTK4 as all the devs were doing their own behaviours depending on the apps.

TL;DR: it's not easy to change in GTK3 apparently (or at least I'm not expert enough yet to do that), and GTK4 seems to have simplified the tabs widget.

krlmlr commented 1 year ago

I'm confused, don't we specify the hotkeys in our code?

https://github.com/MightyCreak/diffuse/blob/122879df07ae316298073d83ed7df2b9ee1b0ef1/src/diffuse/resources.py#L82-L85

krlmlr commented 1 year ago

(Please, if we do MRU, can it be an option, and implement easy tab relocation instead? And perhaps accessing individual tabs with a hotkey?)

MightyCreak commented 1 year ago

I'm confused, don't we specify the hotkeys in our code?

https://github.com/MightyCreak/diffuse/blob/122879df07ae316298073d83ed7df2b9ee1b0ef1/src/diffuse/resources.py#L82-L85

Good point, I thought Diffuse was relaying on GTK's widget for that. It's worth trying at least. At least changing it for Ctrl+Tab and Shift+Ctrl+Tab and see how it goes.

Edit: Sorry, I thought this was an issue and just noticed it's a PR. I'll try that when I can. Have you tried it on your side? Does it work with macOS?

(Please, if we do MRU, can it be an option, and implement easy tab relocation instead? And perhaps accessing individual tabs with a hotkey?)

Won't be done right now, and can surely be an option, don't worry :wink:

Easy tab relocation? You mean reordering the tabs manually?

We could have something like Alt+1/2/3/4/5 to quickly access the tabs (as in Firefox for instance).

krlmlr commented 1 year ago

Yes, reordering tabs manually. Alt+1 or Apple+1 (on the Mac) would be good to have too. I'll try in a separate PR.

Side note: the color scheme for dark mode isn't ideal yet on my system. I remember tweaking it in a previous installation.

MightyCreak commented 1 year ago

Side note: the color scheme for dark mode isn't ideal yet on my system. I remember tweaking it in a previous installation.

I was looking at that when I dabble on the Rust syntax earlier. I think it would be possible to create a common color scheme for all the languages, instead of setting the comment color for each one for instance.

I was thinking of something like var <var_name> "<var_value>", and then use the colour command like that: colour <keyword> @<var_name> and it would simply replace @<var_name> with it's value.

Then we could have a dark and a light schemes for all languages (or even more schemes if we want).

TBC

MightyCreak commented 1 year ago

I just understood that we were talking about the previous/next difference. I was sure you were talking about tabs there.

That changes a few things about what I said, which must have been pretty out of context :sweat_smile:

Anyway, you're the Mac guys, I'll let you decide what would be the best. But there must be a good rational. Like, for instance, how other diff tools are doing it? Or why Ctrl+Up/Down is very bad on Mac?

Changing shortcuts needs a lot of reflection because it will frustrate a lot of people because of muscle memory.

MightyCreak commented 1 year ago

The main thread has been resolved, so I merged this PR.