You are not logged in.
Is anybody still interested in JumNav?
Now that the hinting branch is working (albeit with the webkit development version only if I am right) the JumNav intermediary solution might not be needed anymore.
However version 1.0 (with word match working) is almost ready. So, if it is still worth the effort, I will probably release it later today or tomorrow (provided no showstopper bug will show up in the final testing).
A short feature summary:
- widely configurable
- switchable between two sets of colors for hinting labels and element nodes to adapt to given web page layouts
- select from hinting labels
- interactive "navigation mode" allows selecting nodes back and forth in hierarchy
- hinting and navigation mode can be toggled and thus used in conjunction
- "word matching" sub-mode of navigation mode allows to select labels matching some given pattern
- word matching and plain navigation modes can be toggled and thus used in conjunction
- the currently selected node is kept through all modes and can be always "clicked on"
To know or not to know ...
... the questions remain forever.
Offline
Hello,
brisbin33 wrote:just got hit with this when i pulled git two minutes ago... too bad b/c hinting finally works for me! i don't want to roll back...
Since I can not reproduce it (for whatever reason) can one of you run git bisect for me? (If you need help with that just join the irc channel)
Best regards
//blue/130/~/jumanji/ git bisect good
213481a1e6d9db5dbfaa4d0e910b1928f4b9ab61 is the first bad commit
commit 213481a1e6d9db5dbfaa4d0e910b1928f4b9ab61
Author: mlq <mlq@pwmt.org>
Date: Sun Aug 22 11:32:02 2010 +0200
Key mapping bug in cb_inputbar_kb_pressed
Thanks to Maxime de Roucy
:100644 100644 b490c3e1d4136eba23e8c9026d310fac5f298c27 c45ee6a39f4c6dd6d8a657ed586610d98807b534 M config.def.h
:100644 100644 2a7ed543530066a85cd2be71cecf530ea682656c 0e57738fa4bc722686364747b63365904b9c1f3c M jumanji.c
hope this helps sort things out.
//github/
Offline
I took the patch that portix made for session support (thank you!) and reworked it a little bit. I didn't want to remember/use one keybind for quitting and another for save-quitting. I'd rather set a config variable to "use_session" and continue using my WM to close the browser. I basically just copied the save and restore functions from his patch and adjusted slightly how/where they're used.
The session file is read at startup before opening any arguments, The session is saved in the same spot as your history and bookmarks -- this means on quit and any auto_save.
NOTE: This patch is against commit a86f8dbb which (as per above) is the most recent commit where link following (through dwb2_hints) and tab completion works for me. No worries if this doesn't go anywhere, I think portix's version was already applied upstream -- I'm just putting it out there.
diff -uN jumanji.orig//config.def.h jumanji/config.def.h
--- jumanji.orig//config.def.h 2010-08-29 13:58:40.000000000 -0400
+++ jumanji/config.def.h 2010-08-29 14:04:43.000000000 -0400
@@ -15,6 +15,7 @@
static const char JUMANJI_BOOKMARKS[] = "bookmarks";
static const char JUMANJI_HISTORY[] = "history";
static const char JUMANJI_COOKIES[] = "cookies";
+static const char JUMANJI_SESSION[] = "session";
/* browser specific settings */
char* user_agent = "jumanji/0.1";
@@ -63,6 +64,7 @@
gboolean show_tabbar = TRUE;
gboolean next_to_current = TRUE;
gboolean single_instance = TRUE;
+gboolean use_session = FALSE;
#define GDK_COSHIFT_MASK GDK_CONTROL_MASK | GDK_SHIFT_MASK
@@ -277,6 +279,7 @@
{"statusbar_ssl_bgcolor", &(statusbar_ssl_bgcolor), NULL, 's', 1, 0, 0, "Statusbar (SSL) background color"},
{"statusbar_ssl_fgcolor", &(statusbar_ssl_fgcolor), NULL, 's', 1, 0, 0, "Statusbar (SSL) foreground color"},
{"single_instance", &(single_instance), NULL, 'b', 0, 0, 0, "Allow only one instance"},
+ {"use_session", &(use_session), NULL, 'b', 0, 0, 0, "Store and use a session file"},
{"stylesheet", NULL, "user-stylesheet-uri", 's', 0, 1, 0, "Custom stylesheet"},
{"tabbar", &(show_tabbar), NULL, 'b', 0, 0, 0, "Show tabbar"},
{"tabbar_bgcolor", &(tabbar_bgcolor), NULL, 's', 1, 0, 0, "Tabbar background color"},
diff -uN jumanji.orig//config.h jumanji/config.h
--- jumanji.orig//config.h 2010-08-29 13:58:45.000000000 -0400
+++ jumanji/config.h 2010-08-29 14:05:55.000000000 -0400
@@ -15,6 +15,7 @@
static const char JUMANJI_BOOKMARKS[] = "bookmarks";
static const char JUMANJI_HISTORY[] = "history";
static const char JUMANJI_COOKIES[] = "cookies";
+static const char JUMANJI_SESSION[] = "session";
/* browser specific settings */
char* user_agent = "jumanji/0.1";
@@ -63,6 +64,7 @@
gboolean show_tabbar = TRUE;
gboolean next_to_current = TRUE;
gboolean single_instance = TRUE;
+gboolean use_session = FALSE;
#define GDK_COSHIFT_MASK GDK_CONTROL_MASK | GDK_SHIFT_MASK
@@ -278,6 +280,7 @@
{"statusbar_ssl_bgcolor", &(statusbar_ssl_bgcolor), NULL, 's', 1, 0, 0, "Statusbar (SSL) background color"},
{"statusbar_ssl_fgcolor", &(statusbar_ssl_fgcolor), NULL, 's', 1, 0, 0, "Statusbar (SSL) foreground color"},
{"single_instance", &(single_instance), NULL, 'b', 0, 0, 0, "Allow only one instance"},
+ {"use_session", &(use_session), NULL, 'b', 0, 0, 0, "Store and use a session file"},
{"stylesheet", NULL, "user-stylesheet-uri", 's', 0, 1, 0, "Custom stylesheet"},
{"tabbar", &(show_tabbar), NULL, 'b', 0, 0, 0, "Show tabbar"},
{"tabbar_bgcolor", &(tabbar_bgcolor), NULL, 's', 1, 0, 0, "Tabbar background color"},
diff -uN jumanji.orig//jumanji.c jumanji/jumanji.c
--- jumanji.orig//jumanji.c 2010-08-29 13:58:22.000000000 -0400
+++ jumanji/jumanji.c 2010-08-29 14:05:31.000000000 -0400
@@ -443,6 +443,7 @@
void bcmd_scroll(char*, Argument*);
void bcmd_toggle_sourcecode(char*, Argument*);
void bcmd_zoom(char*, Argument*);
+void bcmd_save_session(char*, Argument*);
/* special command delcarations */
gboolean scmd_search(char*, Argument*);
@@ -3048,6 +3049,10 @@
g_free(history_file);
g_string_free(history_list, TRUE);
+ /* save session */
+ if (use_session)
+ bcmd_save_session(0, NULL);
+
return TRUE;
}
@@ -3890,6 +3895,47 @@
return TRUE;
}
+/* session support */
+gboolean
+restore_session(void) {
+ char *content;
+ char *path = g_build_filename(g_get_home_dir(), JUMANJI_DIR, JUMANJI_SESSION, NULL);
+ gboolean ret = FALSE;
+
+ if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) {
+ g_file_get_contents(path, &content, NULL, NULL);
+ if (content && strlen(content)) {
+ char **lines = g_strsplit(content, "\n", -1);
+ for (int i=0; i<g_strv_length(lines) - 1; i++) {
+ create_tab(lines[i], FALSE);
+ }
+ g_free(content);
+ g_strfreev(lines);
+ ret = TRUE;
+ }
+ }
+ g_free(path);
+ return ret;
+}
+
+void
+bcmd_save_session(char* UNUSED(buffer), Argument* UNUSED(argument)) {
+ GString *buffer = g_string_new(NULL);
+
+ for (int i=0; i<gtk_notebook_get_n_pages(Jumanji.UI.view); i++) {
+ WebKitWebView *web = GET_NTH_TAB(i);
+ const char *uri = webkit_web_view_get_uri(web);
+ char *newuri = g_strconcat(uri, "\n", NULL);
+ g_string_append_printf(buffer, newuri);
+ }
+ gchar *path = g_build_filename(g_get_home_dir(), JUMANJI_DIR, JUMANJI_SESSION, NULL);
+ g_file_set_contents(path, buffer->str, -1, NULL);
+ g_free(path);
+ g_string_free(buffer, true);
+
+ //cmd_quitall(0, NULL);
+}
+
/* main function */
int main(int argc, char* argv[])
{
@@ -3955,8 +4001,18 @@
if(auto_save_interval)
g_timeout_add(auto_save_interval * 1000, auto_save, NULL);
+ /* restore from session */
+ if(use_session) {
+ if(!restore_session())
+ create_tab(home_page, FALSE);
+
+ /* create any other tabs */
+ if(argc >= 2)
+ for(; i < argc; i++)
+ create_tab(argv[i], FALSE);
+ }
/* create tab */
- if(argc < 2)
+ else if(argc < 2)
create_tab(home_page, FALSE);
else
for(; i < argc; i++)
@@ -3975,3 +4031,4 @@
return 0;
}
+
Just add set use_session to your config.
//github/
Offline
Is there a way to paste from the clipboard? I don't mean the Ctrl+C/Ctrl+V one, but the same one you yank from. For example, let's say I visit a page and I'd like to bookmark it in delicious. I'd yank the url, go to delicious to save it. Usually I'd either use Shift+Insert to paste (or, rarely, the middle mouse button). Can this be implemented somehow? It'd be better than having to type in the url all the time.
Would also be great if it worked in the command input bar.
Offline
Oh well, this is really frustrating - there appears to be no one who likes JumNav.
Now, although JumNav obviously lost the hinting navigation race, for the sake of completeness: this is version 1.0 as promised. Note that you must patch jumanji.c (from the main branch) to enable the script to communicate with the jumanji global buffer.
Note: This is a new patch. The recent ones do not work any more.
--- jumanji.c 2010-08-28 19:28:54.000000000 +0000
+++ jumanji.c.new 2010-08-28 19:16:02.000000000 +0000
@@ -1838,20 +1835,74 @@
else
cmd = g_strdup("focus_next()");
}
- else if(Jumanji.Global.buffer && Jumanji.Global.buffer->len > 0)
- cmd = g_strconcat("update_hints(\"", Jumanji.Global.buffer->str, "\")", NULL);
+ else if(Jumanji.Global.buffer)
+ {
+ if(Jumanji.Global.buffer->len > 0)
+ {
+ cmd = g_strconcat("update_hints(\"", Jumanji.Global.buffer->str, "\")", NULL);
+ }
+ else if(Jumanji.Global.buffer->len == 0)
+ {
+ /* probably not needed actually (see below), just for being sure */
+ cmd = g_strconcat("update_hints(\"", "", "\")", NULL);
+ }
+ }
+ else
+ {
+ /* jumanji removes the buffer if it gets cleared on a delete operation
+ * (hopefully there are no nasty side effects) */
+ cmd = g_strconcat("update_hints(\"", "", "\")", NULL);
+ }
run_script(cmd, &value, NULL);
g_free(cmd);
if(value && strcmp(value, "undefined"))
{
- if(open_mode == -1)
- open_uri(GET_CURRENT_TAB(), value);
+ /* value = "\\abcd"; / * debug */
+
+ /* Was there a buffer reset special command returned? */
+ if(value[0] == '\\')
+ {
+ if (Jumanji.Global.buffer)
+ {
+ if(strlen(value) == 1) {
+ /* Only clear the global buffer. */
+ g_string_free(Jumanji.Global.buffer, TRUE);
+ Jumanji.Global.buffer = NULL;
+ gtk_label_set_markup((GtkLabel*) Jumanji.Statusbar.buffer, "");
+ }
+ else if(strlen(value) == 2 && value[1] == '\\')
+ {
+ /* Clear the global buffer and reset to normal mode. */
+ g_string_free(Jumanji.Global.buffer, TRUE);
+ Jumanji.Global.buffer = NULL;
+ gtk_label_set_markup((GtkLabel*) Jumanji.Statusbar.buffer, "");
+
+ change_mode(NORMAL);
+ gtk_widget_hide(GTK_WIDGET(Jumanji.UI.inputbar));
+ webkit_web_view_unmark_text_matches(GET_CURRENT_TAB());
+ }
+ else
+ {
+ /* Change the buffer contents. */
+ GString* temp = g_string_new_len(value + 1, strlen(value + 1));
+ g_string_free(Jumanji.Global.buffer, TRUE);
+ Jumanji.Global.buffer = temp;
+ gtk_label_set_markup((GtkLabel*) Jumanji.Statusbar.buffer, Jumanji.Global.buffer->str);
+ }
+ }
+ }
else
- create_tab(value, TRUE);
+ {
+ /* There has been an address returned. Go there. */
+ if(open_mode == -1)
+ open_uri(GET_CURRENT_TAB(), value);
+ else
+ create_tab(value, TRUE);
- sc_abort(NULL);
+ sc_abort(NULL);
+ }
}
}
These are the default command keys:
"#" toggles between hinting and link navigation mode
When in navigation mode:
"n" selects the next link in sequence
"p" selects the previous link in sequence
"/" enables the word match mode
"=" disables the word match mode
With word match mode enabled
"#" toggles between navigation and word match mode
"n" and "p" in navigation mode work as usual but are restricted to the elements group matching the regular pattern entered in word match mode.
In any mode
"," simulates a mouse click on the currently selected element. (I'd rather like to use Enter for this, but jumanji obviously filters this one out.)
The navigation links are displayed in different colors depending on the current mode. The currently selected link is displayed in another color so it stands out.
Usually the viewport will adjust to the currently selected link. There are, however, some complicated structured pages where this automatic viewport positioning fails. Navigating with "n" or "p" usually helps in those cases.
There are two sets of colors for the hinting labels/element nodes display to adapt to different page layouts.
"+" in navigation mode (not in word match) toggles between these.
On some pages the hinting labels/element nodes appear displaced.
"-" in navigation mode allows to toggle to another ("raw") postioning algorithm which in many cases helps. On some such pages toggling in raw mode and out again apears to "snap in" the elements to their correct positons.
Remember that you can customize all those command characters as well as the display colors and the collateral sequences to be used for hinting labels construction. For this and some drawbacks of the current JumNav version see the notes at the beginning of the script.
And don't forget to have a look at the "user configuration section" there.
Happy navigating!
------------------------
Well, folks, this was it. Now I will have to look for other challenges.
Keep up your good work.
And, yes, sorry for noise and nuisance.
Last edited by bernarcher (2010-08-29 23:51:46)
To know or not to know ...
... the questions remain forever.
Offline
No nuisance at all -- on the contrary. I've been using jumnav on and off now for a while, and I'm quite happy with it. My only issue with it is that since it goes through all the links in a page and not the visible ones, the hinting can get quite slow (and the hint names quite long) if one is at the bottom of a page with many links on it.
I haven't tried the new "native" hinting yet, so I can't tell which is better, but thanks for JumNav anyway.
Offline
@brisbin33 : the commit you mention solve a bug and introduce a new one for people with "special" keybinding.
I made a patch that should solve the pb ... but it change a lot of things so it's now to neldoreth to decide to apply it or not.
another thing : session support is in the main branch since revision 1857350b90da39cabaf2c7672db874ee8dee6f98
just add "set save_session 1" to your jumanjirc.
Offline
@bernarcher : since hinting branch isn't merged into master and it only works with unstable webkit ... JumNav IS useful :-)
thanks for your work
Offline
Is there a way to paste from the clipboard? I don't mean the Ctrl+C/Ctrl+V one, but the same one you yank from. For example, let's say I visit a page and I'd like to bookmark it in delicious. I'd yank the url, go to delicious to save it. Usually I'd either use Shift+Insert to paste (or, rarely, the middle mouse button). Can this be implemented somehow? It'd be better than having to type in the url all the time.
Would also be great if it worked in the command input bar.
For now : "y" yank in the primary clipboard XA_PRIMARY (man xclip for detail) and "Y" in the XA_CLIPBOARD ...
You can change that in config.h...
So if I well understand your problem .. just use "Y" and then Ctrl+V in delicious.
Offline
My only issue with it is that since it goes through all the links in a page and not the visible ones, the hinting can get quite slow (and the hint names quite long) if one is at the bottom of a page with many links on it.
This is because JumNav uses a recursive algorithm to catch as many links as possible. It would not be too difficult to implement a considerably faster method - using the document.getElementsBy(id) DOM method - but at least for me this missed several important links on the pages I regularly use. Thus it is a trade off for completeness against speed.
I also thought about sort of a "mixed" mode which uses the "flat" DOM method initially and then builds the complete tree in the background. This would be not too difficult to impelement but it would blow up the already far too long script once more. And it would only be worth the effort if JumNav were a more long-term project.
One could rather easily confine the hinting labels naming to the current vewport, resulting in shorter labels. But, frankly, I don't like this behaviour, as I often navigate beyond the vieport limits.
It is kind of a pity that JumNav's lifetime is that limited because I have a bunch of other ideas to experiment with, as for instance showing tooltips when navigating the links directly (with "n" and "p"), or some kind of spatial "h, j, k, l" navigation horizontally and vertically through the links. But as said, it is not really worth the effort, and it would considerably blow up the script once more.
And, last but not least, thanks for the feedback.
(It is not always easy to keep up working on such a project in the void.)
To know or not to know ...
... the questions remain forever.
Offline
It is kind of a pity that JumNav's lifetime is that limited because I have a bunch of other ideas to experiment with
why don't you clone the hinting branch and start hacking it ?
Offline
Just pulled in the latest git and now the bookmark access doesn't work. Hit o (for :open),then I type in bbs and then hit Tab (to get access to the bookmarks.
However, this takes the cursor into the first available text box on the page. My home page is gmail ...so it takes me into the username -- to log into gmail
Is there any other way to access the bookmarks?
This is problem with numlock ! When numlock is off Tab-looking history/bookmark work good...
Offline
tommykr, you are absolutely right. I just tried it and it works. I have numlockx in my xinitrc. I guess I will just have to remove it because I use jumanji way more often than the numpad.
However, previously, it was working irrespective of the numlock.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
@brisbin33 : the commit you mention solve a bug and introduce a new one for people with "special" keybinding.
I made a patch that should solve the pb ... but it change a lot of things so it's now to neldoreth to decide to apply it or not.
Could this be related to the numlock issue mentioned a few posts up? I too have numlockx in my xinitrc.
another thing : session support is in the main branch since revision 1857350b90da39cabaf2c7672db874ee8dee6f98
just add "set save_session 1" to your jumanjirc.
Awesome, I didn't know there was a difference like that between what portix wrote and what was actually applied. It was fun to write some C anyway .
//github/
Offline
Could this be related to the numlock issue mentioned a few posts up? I too have numlockx in my xinitrc.
Yes I think is related. "Tab" is map to "completion" but the mask is "0" and currently 0 mean "no mask button AT ALL". What the patch I propose do : the mask is no longer compare directly with the event->state (button like SHIFT, CTRL, ALT, etc.) but it's now representing a minimum state ...
For example : mask = SHIFT map all the event->state with at least SHIFT in it (while currently it map only event->state == SHIFT).
so mask = 0, with my patch map all the state possible. -> including "num lock" for example.
If you want to test the patch (it is still in review !! but work well for me) : http://paste.pocoo.org/show/256333/
Offline
Inxsible wrote:Just pulled in the latest git and now the bookmark access doesn't work. Hit o (for :open),then I type in bbs and then hit Tab (to get access to the bookmarks.
However, this takes the cursor into the first available text box on the page. My home page is gmail ...so it takes me into the username -- to log into gmail
Is there any other way to access the bookmarks?
This is problem with numlock ! When numlock is off Tab-looking history/bookmark work good...
Same issue with escaping out of command mode; i.e. you want to open a new tab, change your mind and try to escape. Only way is to turn off numlock
Offline
the patch I give have some issue .. I will work on it this night.
Offline
Is there any way to use a search engine to search with the terms I type into the ':open' dialogue? A recent commit and a post by Akira86 a few pages back seems to suggest there is, but I can't seem to get it to work.
Offline
open should use the first search engine you define :
:open test
will search test on google for me...
in my jumanjirc :
searchengine g4 http://www.google.com/search?q=%s
Offline
Is there a way to open links from external apps or from the command line in a new tab? Sth like
jumanji --new-tab http://archlinux.org
Last edited by eyolf (2010-08-30 19:30:51)
Offline
Is there a way to open links from external apps or from the command line in a new tab? Sth like
jumanji --new-tab http://archlinux.org
as far as i can tell, jumanji <url> opens in a new tab if there's already an instance running (if using single_instance ofcourse).
//github/
Offline
eyolf wrote:Is there a way to open links from external apps or from the command line in a new tab? Sth like
jumanji --new-tab http://archlinux.org
as far as i can tell, jumanji <url> opens in a new tab if there's already an instance running (if using single_instance ofcourse).
If you are not using single_instance : jumanji -e <num> <url>
Where <num> is the jumanji instance number in which you want the tab to open.
Offline
Thanks. Single_instance was what I was looking for. the -e option seems useful too. How do I figure out the jumanji instance number?
Offline
Hello,
Thanks. Single_instance was what I was looking for. the -e option seems useful too. How do I figure out the jumanji instance number?
-e is only needed, if you are using tabbed.
Best regards
pwmt.org : programs with movie titles
Offline
Just for anyone still interested, the JumNav source is now at http://github.com/bernarcher/JumNav.
Last edited by bernarcher (2010-08-31 14:45:34)
To know or not to know ...
... the questions remain forever.
Offline