You are not logged in.

#126 2021-02-08 17:36:03

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Yes, renaming my test file to use .html extension solves the issue. I was actually trying to open code posted by qinohe in #116. Firefox / vimb seem to open file as html without .html extension. This is no-more an issue though.

EDIT: I think, I actually prefer to open youtube videos using mpv, ( url under mouse helps a lot), so full-screen is not much an issue now.

EDIT2: How about adding a .desktop file ? I know it is easy to do by endusers, but if it is included with browser, just to cover the corners.

EDIT3: Is there integrated duckduckgo search in weaver. When I open "weaver open-window about:blank" it searches about:blank in duckduckgo, same thing is happening with localhost:631.

Ah, this seems related to last update, which directs non-url like links to search engine. I guess there is problem in identifying input at url or non-url. I have no idea how this logic works in c, but in my bash script I use "*.*|*:*|*/*" to catch url, anything that doesn't match is sent to search engine.

Last edited by Docbroke (2021-02-09 11:15:56)

Offline

#127 2021-02-10 01:53:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

Docbroke wrote:

in my bash script I use "*.*|*:*|*/*" to catch url, anything that doesn't match is sent to search engine.

Thanks - that sounds like a good approach.  Since the start weaver has sent every entry that Qt's QUrl class doesn't see as a valid url to duckduckgo, but I realized that single words were considered "valid urls" as they might be a domain name.  So every time I tried to just enter something I wanted to look up, if it was a single word I'd just get the error that the domain could not be found.  So I wanted to add a check that a single word actually was url-like - in my first pass I just checked whether the input included a ".".  I'll update momentarily to use the check you suggested.

As for a desktop file, I'm not qualified to write one.  I've never used them and don't really understand their purpose.  But if you wanted to create one (or perhaps a couple if different ones would be used for server vs client functions) I could put them in the source repo.

Last edited by Trilby (2021-02-10 02:02:05)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#128 2021-02-10 02:36:20

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

I am so glad that, that code, was useful.
Regarding desktop file, I created one based on vimb.desktop, however the problem is with this line

Exec=weaver open-window %U

based on this when I open an local html file using weaver, file-manager will  open it like "weaver open-window file.html",
which makes weaver think it as a url and opens http://file.html, instead of file:///$CURRENTPATH/file.html"
This issue is not there with other browsers, probably they look into the current working directory before considering file.html as url. Here is an example deskstop file /usr/share/applications/weaver_client.desktop

[Desktop Entry]
Name=weaver_client
GenericName=Web Browser
Comment=Access the Internet
Terminal=false
Icon=
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
Actions=CurrentWindow;NewWindow;PrivateBrowsing;

[Desktop Action CurrentWindow]
Name=Open in Currentiweaver Window
Exec=weaver open $(pwd)/%U

[Desktop Action NewWindow]
Name=Open New weaver Window
Exec=weaver open-window $(pwd)/%U

Edit: Updated the desktop file

Edit2: I don't see a need for desktop file for server, as server is not supposed to be started by file-managers or other application trying to open something in browser. However if you consider this proper, you may create one systemd/User service file to start weaver server at boot.

Edit3: How about command "weaver open-incognito" or "weaver open-private"

Last edited by Docbroke (2021-02-10 05:51:11)

Offline

#129 2021-02-10 03:11:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

Local files must use a full path.  The QUrl class can resolve local file names based on the current working directory, but this would not be useful for weaver as the "current working directory" would be that of the server, not the client process - so this would hardly ever work and mostly result in confusion. I think I could add an 'open-private' command, I look at that tomorrow.  For now, it's easily scripted:

weaver open-window about:blank
weaver set-profile [mem]
weaver open $your_url

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#130 2021-02-10 03:21:13

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

With my file-manager (vifm), I have assigned to open .html file using "weaver open-window file:///%d/%c &", while for firefox (or most other browsers) I can simply use "firefox %c &"

Current working directory shall be of the program trying to open url using weaver-client or that was what I was thinking. Not a critical issue though. It is easy to workaround.

Yes, I am already using script to open in private windows, but I was not very confident or happy using that in .desktop file.

EDIT: correction of typo , vimb --> vifm

Last edited by Docbroke (2021-02-10 04:44:05)

Offline

#131 2021-02-10 03:38:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

Docbroke wrote:

Current working directory shall be of the program trying to open url using weaver-client

But that's the problem, it wouldn't be.  All the client does is pass the command to the socket.  No parsing is done on the client side: "weaver window-open %c" is equivalent to "echo window-open %c > $XDG_RUNTIME_DIR/weaver".  The server interprets the command, so any attempt to get a relative filename would be relative to the CWD of the server.

I don't see any mention of the %d or %c in the vimb man page, where are those documented?  Usually if a program has those, they'd have a nother format specifier for the full path of the file which would work ("file://" is not necessary, just the full path should do).

Last edited by Trilby (2021-02-10 03:40:57)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#132 2021-02-10 04:43:44

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Ooops, that was typo, I meant vifm not vimb. %c is current file, %d is full-path to directory.

EDIT: updated .desktop file in previous post, which seems to be working now when one wants to open a local file using file-manager. Howeve still it probably is inadequate to for an entry in some start menu type thing ( which I don't use so I am not sure about how to do that ).

Last edited by Docbroke (2021-02-10 06:00:32)

Offline

#133 2021-02-15 05:57:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

I just added optional hinting / hint-navigation as it could be done fully in a userscript.  The script is provided in the examples folder.  You can adjust the default css style of the hints, or the keys used as desired, and copy the hints.js to your $HOME/.config/weaver/scripts/ folder (then restart the weaver server).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#134 2021-02-15 09:14:36

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

When I press "C+;" to use hints, while bottom of this page is in active view, hint labels are displayed at top of the page (out of the current view)

Can we integrate hints with url_undermouse scricpt, so one can retrive hinted link for use with external link-handler script.

EDIT: vimb has nice hints function, that code may be useful, https://github.com/fanglingsu/vimb/tree … rc/scripts

Last edited by Docbroke (2021-02-15 11:50:42)

Offline

#135 2021-02-15 15:47:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

Docbroke wrote:

When I press "C+;" to use hints, while bottom of this page is in active view, hint labels are displayed at top of the page (out of the current view)

Oops - it is.  That's what you get for a first attempt at it written in about an hour.  It seems the coordinates retrieved for the links need to be adjusted by the scroll position: currently any scroll offset has the hints out of position.  I should be able to fix that soon. (edit: fixed)

Docbroke wrote:

Can we integrate hints with url_undermouse scricpt, so one can retrive hinted link for use with external link-handler script.

Feel free - none of this is integrated into weaver, this is just the js script - it's pretty short and simple and should be easy to add that to the event handler where it handles the enter key.

Docbroke wrote:

EDIT: vimb has nice hints function, that code may be useful

If it's actually just javascript, you may be able to use it as-is.  Userscripts are userscripts, there is (generally) nothing that depends on any bit of the actual browser it was written for.  I only include some JS examples that may be useful, there are much better sources out there for userscripts.

Last edited by Trilby (2021-02-15 16:02:24)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#136 2021-02-15 16:43:16

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

that vimb script doesn't work with weaver, probably because vimb is modal like vim, and hints are triggered in command mode.

EDIT: hints are still out of position.

EDIT2: this javascript from lariza works perfectly for hinting, https://www.uninformativ.de/git/lariza/ … ts.js.html

EDIT3: here is my vim like keybindings ( modified from surf script )
EDIT4: updated to include zoom/readingmode/historyforward/historyback

// ==UserScript==
// @name vimkeybindings
// @namespace renevier.fdn.fr
// @author arno <arenevier@fdn.fr>
// @licence GPL/LGPL/MPL
// @description use vim keybingings (i, j, k, l, …) to navigate a web page.
// ==/UserScript==
/*
* If you're a vim addict, and you always find yourself typing j or k in a web
* page, then wondering why it just does not go up and down like any good
* software, that user script is what you have been looking for.
*/

var needle = "";
function up() {
    if (window.scrollByLines)
	window.scrollByLines(-1); // gecko
    else
	window.scrollBy(0, -12); // webkit
}
function down() {
    if (window.scrollByLines)
	window.scrollByLines(1); // gecko
    else
	window.scrollBy(0, 12); // webkit
}
function pageup() {
    if (window.scrollByPages)
	window.scrollByPages(-1); // gecko
    else
	window.scrollBy(0, 0 - _pageScroll()); // webkit
}
function pagedown() {
    if (window.scrollByPages)
	window.scrollByPages(1); // gecko
    else
	window.scrollBy(0, _pageScroll()); // webkit
}
function right() {
    window.scrollBy(15, 0);
}
function left() {
    window.scrollBy(-15, 0);
}
function home() {
    window.scroll(0, 0);
}
function bottom() {
//    window.scroll(document.width, document.height);
    window.scroll(document.body.scrollWidth, document.body.scrollHeight);
}
function hback() {
	window.history.back();
}
function hforward() {
	window.history.forward();
}
function search() {
	needle = prompt("Search String"); window.find(needle, false, false, true);
}
function search_next() {
	window.find(needle, false, false, true);
}
function reload() {
    location.reload();
}
function reload_nocache() {
    location.reload(true);
}

if(window.content && window.content.document && window.content.document.simplyread_original === undefined) window.content.document.simplyread_original = false;

function simplyread(nostyle, nolinks)
{
	/* count the number of <p> tags that are direct children of parenttag */
    document.body.style.zoom = "150%"
	function count_p(parenttag)
	{
		var n = 0;
		var c = parenttag.childNodes;
		for (var i = 0; i < c.length; i++) {
			if (c[i].tagName == "p" || c[i].tagName == "P")
				n++;
		}
		return n;
	}
	
	var doc;
	doc = (document.body === undefined)
	      ? window.content.document : document;
	
	/* if simplyread_original is set, then the simplyread version is currently active,
	 * so switch to the simplyread_original html */
	if (doc.simplyread_original) {
		doc.body.innerHTML = doc.simplyread_original;
		for (var i = 0; i < doc.styleSheets.length; i++)
			doc.styleSheets[i].disabled = false;
		doc.simplyread_original = false
		return 0;
	}
	
	doc.simplyread_original = doc.body.innerHTML;
	doc.body.innerHTML = doc.body.innerHTML.replace(/<br[^>]*>\s*<br[^>]*>/g, "<p>");
	
	var biggest_num = 0;
	var biggest_tag;
	
	/* search for tag with most direct children <p> tags */
	var t = doc.getElementsByTagName("*");
	for (var i = 0; i < t.length; i++) {
		var p_num = count_p(t[i]);
		if (p_num > biggest_num) {
			biggest_num = p_num;
			biggest_tag = t[i];
		}
	}
	
	if (biggest_num == 0) return 1;
	
	/* save and sanitise content of chosen tag */
	var fresh = doc.createElement("div");
	fresh.innerHTML = biggest_tag.innerHTML;
	fresh.innerHTML = fresh.innerHTML.replace(/<\/?font[^>]*>/g, "");
	fresh.innerHTML = fresh.innerHTML.replace(/style="[^"]*"/g, "");
	if(nolinks)
		fresh.innerHTML = fresh.innerHTML.replace(/<\/?a[^>]*>/g, "");
	fresh.innerHTML = fresh.innerHTML.replace(/<\/?span[^>]*>/g, "");
	fresh.innerHTML = fresh.innerHTML.replace(/<style[^>]*>/g, "<style media=\"aural\">"); /* ensures contents of style tag are ignored */
	
	for (var i = 0; i < doc.styleSheets.length; i++)
		doc.styleSheets[i].disabled = true;
	
	srstyle =

        "p{margin:0ex auto;} h1,h2,h3,h4{font-weight:normal}" +
		"p+p{text-indent:2em;} body{background:#cccccc none}" +
		"img{display:block; max-width: 32em; padding:1em; margin: auto}" +
		"h1{text-align:center;text-transform:uppercase}" +
		"div#sr{width:42em; padding:4em; padding-top:2em;" +
		"background-color:#F4ECD8; margin:auto; line-height:1.4;" +
		"text-align:justify; hyphens:auto; font-family:sans-serif; }"; +
        "div,pre,textarea,body,input,td,tr,p{background-color: #000000 !important; background-image: none !important; font-size:26 !important; }" +
        "a {color: #70e070 !important;} a:hover,a:focus { color: #7070e0 !important;} a:visited { color: #e07070 !important;}"

        

		/* text-rendering:optimizeLegibility; - someday this will work,
		 *   but at present it just ruins justify, so is disabled */
	
	doc.body.innerHTML =
		"<style type=\"text/css\">" + (nostyle ? "" : srstyle) + "</style>" +
		"<div id=\"sr\">" + "<h1>"+doc.title+"</h1>" + fresh.innerHTML + "</div>";
    
    return 0;
}
function zoom_normal() {
    document.body.style.zoom = "150%"
}
function zoom_plus() {
    document.body.style.zoom = (window.innerWidth * 150 / document.body.clientWidth) + '%'
}
function zoom_minus() {

    document.body.style.zoom = (window.innerWidth * 75 / document.body.clientWidth) + '%'
}


// If you don't like default key bindings, customize here. 
// if you want to use the combination 'Ctrl + b' (for example), use '^b'
var bindings = {
    'h' : left, 
    'l' : right,
    'k' : up,
    'j' : down,
    'g' : home,
    'G' : bottom,
    '[' : hback,
    'H' : hback,
    ']' : hforward,
    'L' : hforward,
    '/' : search,
    'n' : search_next,
    'r' : reload,
    'd' : simplyread,
    'R' : reload_nocache,
    '+' : zoom_normal,
    '=' : zoom_plus,
    '-' : zoom_minus,
    //'^b': pageup,
    //'^f': pagedown,
}
function isEditable(element) {
    
    if (element.nodeName.toLowerCase() == "textarea")
	return true;
    // we don't get keypress events for text input, but I don't known
    // if it's a bug, so let's test that
    if (element.nodeName.toLowerCase() == "input" && element.type == "text")
	return true;
    // element is editable
    if (document.designMode == "on" || element.contentEditable == "true") {
	return true;
    }
    
    return false;
}
function keypress(evt) {
    var target = evt.target;
	    
    // if we're on a editable element, we probably don't want to catch
    // keypress, we just want to write the typed character.
    if (isEditable(target))
	return;
    var key = String.fromCharCode(evt.charCode);
    if (evt.ctrlKey) {
	key = '^' + key;
    }
    var fun = bindings[key];
    if (fun)
	fun();
}
function _pageScroll() {
    // Gecko algorithm
    // ----------------
    // The page increment is the size of the page, minus the smaller of
    // 10% of the size or 2 lines.  
    return window.innerHeight - Math.min(window.innerHeight / 10, 24);
}
window.addEventListener("keypress", keypress, false);

EDIT 5: I don't understand one part of this script. It appears that when editable part is in focus, keybindings shall work with Ctrl+key inplace of "key" only, but that part doesn't seem to work, also I am not able to use function key or C+key as keybinding ( it doesn't seem to work)

EDIT 6: I need little help with this script, I want to add a passthrough mode, for example when "ctrl-z" is pressed, all keybinding in the script are inactivated, and pressing "ctrl-z" again those keybinds are active again. Purpose is to deactivate vim-like keybinds on some sites where text input area is not detected by this script.

EDIT 7: updated scripts are here https://bbs.archlinux.org/viewtopic.php … 4#p1956514
All issues mentioned in previous edits are addressed in this updated script.

Last edited by Docbroke (2021-02-19 17:58:54)

Offline

#137 2021-02-20 06:53:55

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Can I put a .css file into script folder of weaver or it supports only .js ?

EDIT: How to access browsing history ?

EDIT2: I am not able to login in my ddwrt router's web interface using weaver, as login prompt is not diplayed by weaver. This issue is not present with falkon. I don't have any other similar example at present so this is difficult to reproduce.

EDIT3: Similar issue is seen with simple-file-server, https://github.com/RDCH106/Simple-File-Server, weaver doesn't display login-prompt, instead it says ERROR_TOO_MANY_RETRIES

Last edited by Docbroke (2021-02-20 16:12:03)

Offline

#138 2021-02-20 17:08:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

All user css must be loaded via js.  This is true of all webengine browsers - many of them just have a built in js script running behind the scenes to read a local file into css.  If you know how to read local files from JS, you should be able to modify the provided userCSS.js to load a css file.

For the error, are there any test implementations of that simple file server that can replicate the error - I will not have time to and install and configure that locally to test for some time.  When you say it says "ERROR_TOO_MANY_RETRIES" is that a web-based error page, or is it from the weaver server stdout/stderr?

I just tested my own router and I'm able to log in and access it, but it's not ddwrt.

Last edited by Trilby (2021-02-20 17:09:44)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#139 2021-02-20 18:03:51

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Trilby wrote:

For the error, are there any test implementations of that simple file server that can replicate the error - I will not have time to and install and configure that locally to test for some time.  When you say it says "ERROR_TOO_MANY_RETRIES" is that a web-based error page, or is it from the weaver server stdout/stderr?

That error is seen on web page. No error seen in weaver server. I will report if that error can be seen on any easily reproducible webpage.

Last edited by Docbroke (2021-02-20 18:04:11)

Offline

#140 2021-02-21 00:08:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

I figured out that ERROR_TOO_MANY_RETRIES issue - and it's a crap error message from webengine, so much so that most sources are calling it a bug in chromium.  But it's revealed because weaver fails to handle connections that require (html) authentication.  The error should say something about authorization required, but chromium/webengine gets stuck in a loop not handling that error properly.

The good news is, so long as weaver provides a mechanism for authentication, the problem is avoided.  I tested with the python simple file server (which apparently is easy to run and doesn't need to be installed) and first replicated the problem and then confirmed a solution.  However, as this was just for testing, I just hardcoded the relevant username and password into weaver here.  I need to figure out a decent mechanism for the user to provide the username and password, then I can push the fix to the weaver code repo.  I'm not willing to add user interface code just for this, but if a Qt dialog is easy enough I might use that - otherwise I might add a new weaver command "authenticate" by which one would pass the username, password, options to weaver before trying to open such a page.

In short, solution has been found and is on the way, but I need to tinker with the implementation a bit.

EDIT: actually putting the credentials in the url works already.  No modification is needed.  If you are visiting a site that uses html authentication use the full url form user:password@domain:port/path.  As for the error message being the incorrect one, that's a known chromium/webenegine issue.

Last edited by Trilby (2021-02-21 02:32:32)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#141 2021-02-21 03:32:02

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Thanks for testing this. I just created a bookmark for my router using http://user:pass@192.168.0.1/index.asp and it is now reliable. Yes, that simple file server is quite easy to run, I am just keeping it downloaded in a folder to use as and when required.

EDIT: Same thing needs to done with cups server.

Last edited by Docbroke (2021-02-24 12:13:08)

Offline

#142 2021-03-01 16:06:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

Survey: what socket commands are most valuable / most used?

Given how smoothly user-script based key bindings work (this was a surpise to me and not anticipated in the initial design of weaver) I'm considering drastically simplifying the set of socket commands to those behaviors that are impossible or impractical to acheive through JS.  Even if you'd like to trigger some action like scrolling through a socket command, one socket command that will definitely remain is 'js-run', so even if 'scroll-by' is removed, you could send `js-run "scrollBy({top: 200, behavior: 'smooth' });"` and get the same effect.

But before I start trimming the fat, I'd be interested if there are certain socket-commands that users would strongly prefer to remain.  My current minimal starting list of commands that must be available via the socket are most if not all of the "global" commands, but perhaps only these "window" commands:

js-result js-result-ready js-run set-profile set-user-agent window-info window-url window-xid

Are there other window commands that anyone feels should be retained?

FYI, for anyone who would prefer to have JS disabled in the browser, setting the webengine option to disable js from web pages does not prevent it from being able to run locally loaded JS (via js-run or userscripts).

Last edited by Trilby (2021-03-01 16:07:14)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#143 2021-03-01 17:36:12

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

window-url can be done with javascript.

I need 'weaver open' from window commands, as I use that in my  url-handler script to open url in current window.

How to disable JS in the browser ?

EDIT: weaver open can also be done using js-run, but keeping weaver open may be a good idea, it will be easier to use in scripts.

Last edited by Docbroke (2021-03-01 18:26:20)

Offline

#144 2021-03-01 20:52:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

JS can't be toggled at run-time, but it can be disabled by adding a setting in webengine.c -> initProfile() follow the values here:
https://doc.qt.io/qt-5/qwebenginesettin … ibute-enum


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#145 2021-03-22 06:26:30

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

I was trying to get few more things done.
1) view source-code, it is already possible using mouse right-click and view page source, however to get keybind I am using 'weaver open "view-source:$(weaver url)"'
I tried to get this in keybind.js, but javascript security policy is not allowing it.
2) save webpage, also available in right click menu.
3) print webpage. File saved using right click menu, can be printed but it may be better to be able to print directly from weaver.
I am not sure about best way to add keybinds for 2 & 3

Last edited by Docbroke (2021-03-22 06:55:26)

Offline

#146 2021-03-22 15:00:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

My working code has *drastically* diverged from what's currently in the repo, and I believe all of these have been addressed there (not sure about #1, I'll check on that). But given the substantial changes it was temporarily much less functional than the existing code, so I've not yet pushed it to the public repo.

The update includes a mechanism to run *any* weaver command from JS (e.g., from a key binding).  But I've also - at least for the time being - drastically reduced the number of actual weaver commands to eliminate most things that can be done purely in JS.  I suspect the new code will be pushed to the public repo within the week.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#147 2021-04-12 02:17:24

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Do you have any suggestion regarding how to save and access browsing history ?

Offline

#148 2021-04-13 20:02:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Weaver: qt6-webengine browser w/ minimal UI

I finally got around to pushing the *massive* changes to the VCS.  Note that there have been drastic changes to commands and logic - any key bindings and integrations will need to be modified.  Some benefits include that local html or similar files can be opened on the command line (without requiring a full path) as well as syncronous javascript calls: you no longer need to poll js-result-ready, just make your JS call and wait for the result.  As an example, to get the current window url:

weaver =location.href

Or - an admittedly artificial example - prompt for user input and print the input as a result:

weaver '=prompt("hello")'

Another major development is the ability to pass weaver commands to weaver from JS (e.g., from key bindings).  An example of this can be seen in the example key bindings for Ctrl+d or "^d" which closes the currently focused window.  As javascripts "window.close()" can only be used on windows opened by javascript, closing with a keybinding requires passing a command to weaver.  "^d" does this with the weaver-provided js function "weaverCommand".  weaverCommand accepts a command as a first argument, and an optional second argument as a callback function which is passed any result from the weaver command.

The wiki page is being updated, but for now it's a bit sparse.

----

As for the history question, I've been a bit frustrated by this - while webengine tracks the history for the current view (i.e., window) but accessing that data outside of it's built in "back/forward" is a bit tricky.

Any tracking of history on top of this would have to be maintained entirely seperately by - perhaps - storing a list of every command entered and / or every url loaded.  What use-case(s) do you have for accessing history?  Do you want urls from the current session, or commands issued, or persistent data between sessions, etc?

Last edited by Trilby (2021-04-13 20:09:16)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#149 2021-04-14 09:22:25

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Thanks for the update.
I am able get basics working with new version. I will wait for documentation before starting to ask questions.

Last edited by Docbroke (2021-04-14 10:49:23)

Offline

#150 2021-04-29 16:40:22

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Weaver: qt6-webengine browser w/ minimal UI

Hi, I wonder what some commands do.
One is "list", as running weaver :list gives no output, however command is mentions in "weaver -h" output.
Does :downloads take any argument, like stop or halt. Are there any more commands not mentioned in help output. As I don't get any error typing any command like "weaver :something" doesn't give any output.

Offline

Board footer

Powered by FluxBB