[PATCH] Add preference to toggle reverse mouse wheel tab scrolling
Hello friends, This patch adds a preference to toggle the direction of scrolling tabs with the mouse wheel. I personally find it more intuitive reversed, though others might disagree, thus now there can be a choice :) Regards, Alex --- dillorc Sat Mar 9 18:43:51 2024 +++ dillorc Fri Apr 5 15:30:32 2024 @@ -384,6 +384,9 @@ # If set to NO, the page will be scrolled instead. #scroll_switches_tabs=YES +# Reverse the direction of tab scrolling with mouse wheel. +#scroll_switches_tabs_reverse=YES + # Mouse middle click by default drives drag-scrolling. # To paste an URL into the window instead of scrolling, set it to NO. # Note: You could always paste the URL onto the URL box clear button. --- src/prefs.c Sat Mar 9 18:43:51 2024 +++ src/prefs.c Fri Apr 5 15:32:45 2024 @@ -79,6 +79,7 @@ prefs.middle_click_opens_new_tab = TRUE; prefs.right_click_closes_tab = TRUE; prefs.scroll_switches_tabs = TRUE; + prefs.scroll_switches_tabs_reverse = FALSE; prefs.no_proxy = dStrdup(PREFS_NO_PROXY); prefs.panel_size = P_medium; prefs.parse_embedded_css=TRUE; --- src/prefs.h Sat Mar 9 18:43:51 2024 +++ src/prefs.h Fri Apr 5 15:33:40 2024 @@ -107,6 +107,7 @@ bool_t middle_click_opens_new_tab; bool_t right_click_closes_tab; bool_t scroll_switches_tabs; + bool_t scroll_switches_tabs_reverse; bool_t search_url_idx; Dlist *search_urls; char *save_dir; --- src/prefsparser.cc Sat Mar 9 18:43:51 2024 +++ src/prefsparser.cc Fri Apr 5 15:35:19 2024 @@ -192,6 +192,7 @@ PREFS_BOOL, 0 }, { "right_click_closes_tab", &prefs.right_click_closes_tab, PREFS_BOOL, 0 }, { "scroll_switches_tabs", &prefs.scroll_switches_tabs, PREFS_BOOL, 0 }, + { "scroll_switches_tabs_reverse", &prefs.scroll_switches_tabs_reverse, PREFS_BOOL, 0 }, { "no_proxy", &prefs.no_proxy, PREFS_STRING, 0 }, { "panel_size", &prefs.panel_size, PREFS_PANEL_SIZE, 0 }, { "parse_embedded_css", &prefs.parse_embedded_css, PREFS_BOOL, 0 }, --- src/uicmd.cc Sat Mar 9 18:43:51 2024 +++ src/uicmd.cc Fri Apr 5 15:41:30 2024 @@ -254,7 +254,11 @@ int dy = Fl::event_dy(); int dir = dy ? dy : dx; - if (dir > 0) + if (dir > 0 && prefs.scroll_switches_tabs_reverse) + prev_tab(); + else if (dir > 0) + next_tab(); + else if (dir < 0 && prefs.scroll_switches_tabs_reverse) next_tab(); else if (dir < 0) prev_tab();
Hi Alex, On Fri, Apr 05, 2024 at 04:29:08PM +0200, a1ex@dismail.de wrote:
Hello friends,
This patch adds a preference to toggle the direction of scrolling tabs with the mouse wheel. I personally find it more intuitive reversed, though others might disagree, thus now there can be a choice :)
Regards, Alex
--- dillorc Sat Mar 9 18:43:51 2024 +++ dillorc Fri Apr 5 15:30:32 2024 @@ -384,6 +384,9 @@ # If set to NO, the page will be scrolled instead. #scroll_switches_tabs=YES
+# Reverse the direction of tab scrolling with mouse wheel. +#scroll_switches_tabs_reverse=YES
The convention in dillorc is to set the defaults in comments, so this should be: #scroll_switches_tabs_reverse=NO
+ # Mouse middle click by default drives drag-scrolling. # To paste an URL into the window instead of scrolling, set it to NO. # Note: You could always paste the URL onto the URL box clear button.
--- src/prefs.c Sat Mar 9 18:43:51 2024 +++ src/prefs.c Fri Apr 5 15:32:45 2024 @@ -79,6 +79,7 @@ prefs.middle_click_opens_new_tab = TRUE; prefs.right_click_closes_tab = TRUE; prefs.scroll_switches_tabs = TRUE; + prefs.scroll_switches_tabs_reverse = FALSE; prefs.no_proxy = dStrdup(PREFS_NO_PROXY); prefs.panel_size = P_medium; prefs.parse_embedded_css=TRUE;
--- src/prefs.h Sat Mar 9 18:43:51 2024 +++ src/prefs.h Fri Apr 5 15:33:40 2024 @@ -107,6 +107,7 @@ bool_t middle_click_opens_new_tab; bool_t right_click_closes_tab; bool_t scroll_switches_tabs; + bool_t scroll_switches_tabs_reverse; bool_t search_url_idx; Dlist *search_urls; char *save_dir;
--- src/prefsparser.cc Sat Mar 9 18:43:51 2024 +++ src/prefsparser.cc Fri Apr 5 15:35:19 2024 @@ -192,6 +192,7 @@ PREFS_BOOL, 0 }, { "right_click_closes_tab", &prefs.right_click_closes_tab, PREFS_BOOL, 0 }, { "scroll_switches_tabs", &prefs.scroll_switches_tabs, PREFS_BOOL, 0 }, + { "scroll_switches_tabs_reverse", &prefs.scroll_switches_tabs_reverse, PREFS_BOOL, 0 }, { "no_proxy", &prefs.no_proxy, PREFS_STRING, 0 }, { "panel_size", &prefs.panel_size, PREFS_PANEL_SIZE, 0 }, { "parse_embedded_css", &prefs.parse_embedded_css, PREFS_BOOL, 0 },
--- src/uicmd.cc Sat Mar 9 18:43:51 2024 +++ src/uicmd.cc Fri Apr 5 15:41:30 2024 @@ -254,7 +254,11 @@ int dy = Fl::event_dy(); int dir = dy ? dy : dx;
Wouldn't this be simpler? if (prefs.scroll_switches_tabs_reverse) dir = -dir;
- if (dir > 0) + if (dir > 0 && prefs.scroll_switches_tabs_reverse) + prev_tab(); + else if (dir > 0) + next_tab(); + else if (dir < 0 && prefs.scroll_switches_tabs_reverse) next_tab(); else if (dir < 0) prev_tab();
Thanks for the patch, I will merge it when I have a moment. Rodrigo.
Hi Alex, Please reply to the mailing list, so others can follow the conversation too. On Sat, Apr 06, 2024 at 12:05:21PM +0200, a1ex@dismail.de wrote:
The convention in dillorc is to set the defaults in comments
Noted. For some reason I assumed its 'uncomment to enable'.
Wouldn't this be simpler?
if (prefs.scroll_switches_tabs_reverse) dir = -dir;
That does look simpler. I admit my beginner coding skills :)
Check PR #123 [1,2], I added you as author based on your email and name. [1]: https://github.com/dillo-browser/dillo/pull/123 [2]: https://patch-diff.githubusercontent.com/raw/dillo-browser/dillo/pull/123.pa...
So, regarding the idea of a 'new tab page', here is a proof of concept. It just opens bookmarks on a new tab right now, but if you agree this is worth persuing, I can try to work on a preference to set this to any url specified in dillorc.
--- uicmd.cc Thu Apr 4 20:56:39 2024 +++ uicmd.cc Sat Apr 6 11:58:09 2024 @@ -775,6 +775,8 @@ a_UIcmd_set_location_text(new_bw, URL_STR(url)); BW2UI(new_bw)->focus_main(); } else { + DilloUrl *url = a_Url_new("dpi:/bm/", NULL); + a_Nav_push(new_bw, url, NULL); BW2UI(new_bw)->focus_location(); a_UIcmd_set_buttons_sens(new_bw); }
Thanks. I think is a useful feature, but we should allow the current behavior to be kept as it is. In particular, it should be possible to hit Ctrl-T and begin writing a new URL right away, without loading any page. As it will require some though, I will postpone this after 3.1.0. Feel free to work on it in the meanwhile if you are interested :-) Best, Rodrigo.
So, regarding the idea of a 'new tab page', here is a proof of concept. It just opens bookmarks on a new tab right now, but if you agree this is worth persuing, I can try to work on a preference to set this to any url specified in dillorc.
--- uicmd.cc Thu Apr 4 20:56:39 2024 +++ uicmd.cc Sat Apr 6 11:58:09 2024 @@ -775,6 +775,8 @@ a_UIcmd_set_location_text(new_bw, URL_STR(url)); BW2UI(new_bw)->focus_main(); } else { + DilloUrl *url = a_Url_new("dpi:/bm/", NULL); + a_Nav_push(new_bw, url, NULL); BW2UI(new_bw)->focus_location(); a_UIcmd_set_buttons_sens(new_bw); }
Thanks. I think is a useful feature, but we should allow the current behavior to be kept as it is. In particular, it should be possible to hit Ctrl-T and begin writing a new URL right away, without loading any page.
I believe it is possible with fltk to pre-select the url text, so you can start typing right away. I have not figured out how to do that yet. If anyone can offer insight, it would be welcome. Maybe we could have a pref named 'new_tab_page', and if it's undefined, the default blank tab behavior would remain. Otherwise the user defined url would be loaded on new tabs. Regards, Alex
Hi, On Tue, Apr 09, 2024 at 01:15:23PM +0200, a1ex@dismail.de wrote:
I believe it is possible with fltk to pre-select the url text, so you can start typing right away. I have not figured out how to do that yet. If anyone can offer insight, it would be welcome.
The FLTK method that controls the selection is Fl_Input_::position()[1]. [1]: https://www.fltk.org/doc-1.3/classFl__Input__.html#af69c613575f9ddc178f8b721... If you follow the UI::focus_location() method you will see that we already select the location text[2]. However, something else is causing the selection to get lost shortly after. [2]: https://github.com/dillo-browser/dillo/blob/3eb3739980bc50705acbdeff6f175d4c...
Maybe we could have a pref named 'new_tab_page', and if it's undefined, the default blank tab behavior would remain. Otherwise the user defined url would be loaded on new tabs.
It sounds reasonable to me. I would use the empty string ("") as the default value to mean "don't open anything" (but still focus on the location bar). So we only add functionality retaining the same behavior we have now. PS: I have enabled munging so the Reply-To header points to the list. Existing Reply-To headers should be preserved. Also, I added the ML to mail-archive[3], which should be easier to browse with Dillo without JS. [3]: https://www.mail-archive.com/dillo-dev@mailman3.com/msg00001.html Best, Rodrigo.
If you follow the UI::focus_location() method you will see that we already select the location text[2]. However, something else is causing the selection to get lost shortly after.
Ok, this at least confirms that I was looking in the right spot. I guess it will take a deeper dive to figure out whats wrong then.
Maybe we could have a pref named 'new_tab_page', and if it's undefined, the default blank tab behavior would remain. Otherwise the user defined url would be loaded on new tabs.
It sounds reasonable to me. I would use the empty string ("") as the default value to mean "don't open anything" (but still focus on the location bar). So we only add functionality retaining the same behavior we have now.
Sounds good, I will try to come up with a patch when time permits, maybe sometime next week.
Also, I added the ML to mail-archive[3], which should be easier to browse with Dillo without JS.
Nice, I'm sure there are people who will only browse the archive without actually subscribing to the list. I noticed that the mailman3.com web archive is not working great, for example our conversation from yesterday has not showed up there at all yet. Regards, Alex
Nice, I'm sure there are people who will only browse the archive without actually subscribing to the list. I noticed that the mailman3.com web archive is not working great, for example our conversation from yesterday has not showed up there at all yet.
Yeah, and is nice to have threads indexed too. Replying to an email (usually) sets the In-Reply-To header:
In-Reply-To: <ZhRJOjltTdCFqPj-@hop.home>
Which causes the thread to continue, even if you change the subject. The same happens in mailman3 and mail-archive: https://lists.mailman3.com/hyperkitty/list/dillo-dev@mailman3.com/message/IE... https://www.mail-archive.com/dillo-dev@mailman3.com/msg00001.html To start a new thread remove the In-Reply-To header. All emails should be archived in both services, provided dillo-dev is in the recipient list. Otherwise, please report. Rodrigo.
participants (2)
-
a1ex@dismail.de
-
Rodrigo Arias