You are not logged in.

#26 2021-01-31 01:20:09

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,229

Re: Weaver: a socket controlled web browser

Ah, too bad, well, I don't think I'm gone be of much use for that.
BTW, your PKGBUILD is not working, there is no nightly-weaver, yet I suppose ;-)
You should also run 'namcap' on it - you can't use pkgver with spaces etc. need to make that a function.
There are a few more errors...

Offline

#27 2021-01-31 01:29:50

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

Re: Weaver: a socket controlled web browser

Oh, no - the error should have been clear.  I forgot pkgvers can't have hyphens.  Fossil already provides nightly's, it's built in.  It responds to a wide range of download urls in a reasonable fasion.  Unfortunately it's date-based download must be hyphenated YYYY-MM-DD which can't be the pkgver.  So I'll run date twice if I don't find a more convenient fossil download url soon.

Heh ... I should probably also use the month not minutes in the date!  I fixed the now-tested PKGBUILD above - though the Makefile still needs to be fixed for linking.  I found ld.gold works after seeing lots of Qt forums recommending preferring gold over bfd.  I may go with that - but I'm still exploring.

Last edited by Trilby (2021-01-31 01:37:32)


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

Offline

#28 2021-01-31 01:37:34

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,229

Re: Weaver: a socket controlled web browser

The PKGBUILD don't support fossil, I have tried that both as source and as prepare, which both don't seem to work:(
Support for fossil in the PKBUILD would be awesome..
The error I get is quite clear:

==> ERROR: Failure while downloading https://code.jessemcclure.org/weaver/tarball/pkver/weaver-nightly-pkver.tar.gz
    Aborting...

Offline

#29 2021-01-31 01:39:19

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

Re: Weaver: a socket controlled web browser

That's nonsensical.  "pkgver" is a variable and should be filled it in the source url.  How are you getting a literal "pkgver" there?


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

Offline

#30 2021-01-31 01:42:01

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,229

Re: Weaver: a socket controlled web browser

Sorry my bad, it does compile after I added the date back instead of the function.
I'm still having an error, let my see if I can figure that one out too..;)

@trilby, I'm not getting past the examples dir.
I would need to create a patch for the makefile on my system, which is no problem but that's what it is at the moment and add 'dm' and 'Dm' separately.

Last edited by qinohe (2021-01-31 01:53:18)

Offline

#31 2021-01-31 02:00:21

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

Re: Weaver: a socket controlled web browser

I hadn't addressed that yet - I just pushed the fixed examples install directive a moment ago.

Note that the "nightly" PKGBUILD will pull the upstream code (and makefile) that was current as of the previous midnight.  So as written, it will not pick up the Makefile I just pushed to the repo (tomorrow it will).  You can manually adjust the source url date to any arbitrary time in the future though and it will get the most recent commit.

EDIT: and I see fossil *can* use dates without hyphens ... MUCH better.  I'll simplify the PKGBUILD.

If you want the actual most recent commit from this PKGBUILD, just change _date to _date=trunk (or _date=20400101, or any arbitrary future date).

I'd not want the "20210130" reference to point to the newest code of that day as that would build different packages dependending on what time of day someone ran makepkg.  But since it builds the last commit before 20210130 00:00 it unambiguously identifies the code used in the resulting package.

It can also use time, so this could be an actual VCS build with _date=$(date +%Y%m%dT%H%M).  I think I'll make that adjustment shortly.  Here's the actual VCS version:

# maintainer: Jesse McClure AKA Trilby <code [at] jessemcclure.org>
pkgname=weaver-dev
_ver=$(date -u +%Y%m%d%H%M)
pkgver=r${_ver}
pkgrel=1
pkgdesc='Socket controlled web browser'
url='https://code.jessemcclure.org/weaver'
arch=('x86_64')
license=('MIT')
depends=('qt5-webengine')
source=("${url}/tarball/${_ver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('SKIP')

build() {
	cd "${pkgname}-${pkgver}"
	make
}

package() {
	cd "${pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" install
}

I'm not sure if the pkgname should be weaver-fossil, or something like weaver-dev or weaver-devel as "-fossil" is not widely recognized like -git or -hg, and it doesn't actually use fossil (on the client side) for the clone.

Last edited by Trilby (2021-01-31 03:39:05)


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

Offline

#32 2021-01-31 02:09:32

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,229

Re: Weaver: a socket controlled web browser

Yeah, that did it cool now it's compiling without errors, nice job Trilby.

I was still trying and saw the sources changed, looked at the repo and it did,, all good now, thanks!
Now  tomorrow I will try and make weaver a little nicer with some scripts dmenu etc.

Trilby wrote:

I'm not sure if the pkgname should be weaver-fossil, or something like weaver-dev or weaver-devel as "-fossil" is not widely recognized like -git or -hg, and it doesn't actually use fossil (on the client side) for the clone.

Yes, that's what I meant with would be nice if that was usable like git in the PKGBUILD.

Last edited by qinohe (2021-01-31 02:13:27)

Offline

#33 2021-01-31 02:25:47

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

Re: Weaver: a socket controlled web browser

Well it *is* easy to write a fossil PKGBUILD much like a git one - but it serves no purpose.  That would then require the end user to install fossil as a build-time dependency and it would require a pkgver function.  The weaver-dev PKGBUILD above always gets the most current code, and builds a package with a pkgver that increases monotonically and unambiguously defines the code that was used.  There is no need for the user of the PKGBUILD to install fossil for this.


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

Offline

#34 2021-01-31 02:33:46

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,229

Re: Weaver: a socket controlled web browser

It's just that I tried that to use 'fossil clone repo' both as source and prepare but makepkg hadissues not recognizing the command.
So how should I implement that if I would want to? It's already installed so now is the best time to try;)

Offline

#35 2021-01-31 02:46:47

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

Re: Weaver: a socket controlled web browser

qinohe wrote:

It's just that I tried that to use 'fossil clone repo' both as source

I'm not sure I know what this even means.  The source array is an array, not a function - you cannot run commands in source.  But to use fossil "like git" is awkward because fossil is not git, but to force it into the same pigeonhole you can either add a new DLAGENT for it in makepkg, or do all the retrieval of source code in prepare like we used to have to do with all VCSs:

prepare() {
   fossil clone https://code.jessemcclure.org/weaver
}

pkgver() {
   cd weaver
   # one example pkgver format:
   fossil info | awk '/^tags:/{ tag=$NF; } /^check-ins:/ { printf "%s.r%d", tag, $NF;}'
}

Last edited by Trilby (2021-01-31 02:47:15)


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

Offline

#36 2021-01-31 03:03:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,194
Website

Re: Weaver: a socket controlled web browser

Very cool Jesse!

I'm obviously missing something because, under dwm, the window I am issuing commands to weaver in is the active one (tmux, for example), so I get a lot of: "No active window to handle command". How do I send commands to a non-active window?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#37 2021-01-31 03:08:43

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,229

Re: Weaver: a socket controlled web browser

Yes, you're right I can't use a command in the array, I know that..

No idea why it wouldn't work earlier? my prepare function was the same(exact) but it works ,thanks.
I won't use is but it's nice to see that it works. 'Pigeonhole' big_smile

@jasonwryan, xbindkeys;) (see) #12

Last edited by qinohe (2021-01-31 03:10:31)

Offline

#38 2021-01-31 03:36:38

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

Re: Weaver: a socket controlled web browser

I just realized fossil can use YYYYMMDDHHMM format for checkins, but not for download urls - They do result in a good tarball being downloaded, but the HHMM is ignored and it's just content from the start of the day.  I think I'll just do a versioned PKGBUILD but make it trivially easy for users of it to increment the version/date number to get the latest code.   EDIT: DOH ... I think I need to go to sleep, it *can* do this, but I was putting in local date/time into my download urls.  Fossil, being smarter than me, works in UTC.  So I was really downloading code from several hours ago!  *headdesk*  I added a '-u' flag to "date" now.

JWR, thanks for your input - you are right that you can't really control it from a terminal on the same display that practically but that's not really the intended use (you can do something like "sleep 2 && weaver open bbs.archlinux.org" which I do for testing stuff).  The idea is that these commands could be run from a keybinding or some other mechanism.  There are commands that act globally, and they can be called from a terminal on the same display - and I'm thinking about adding a way to specify a "target" window in commands so what you are attempting could work, but this is not implemented yet.

Last edited by Trilby (2021-01-31 03:39:22)


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

Offline

#39 2021-01-31 03:41:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,194
Website

Re: Weaver: a socket controlled web browser

Trilby wrote:

JWR, thanks for your input - you are right that you can't really control it from a terminal on the same display that practically but that's not really the intended use (you can do something like "sleep 2 && weaver open bbs.archlinux.org" which I do for testing stuff).  The idea is that these commands could be run from a keybinding or some other mechanism.  There are commands that act globally, and they can be called from a terminal on the same display - and I'm thinking about adding a way to specify a "target" window in commands so what you are attempting could work, but this is not implemented yet.

Ah, I misinterpreted your intial description of workflow in your opening post. FWIW, rather than a man page, just printing help would be awesome smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#40 2021-01-31 03:45:20

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

Re: Weaver: a socket controlled web browser

- return QString("No active window to handle command: " + cmdString); break;
+ return QString("RTFM NOOB!"); break;

Like that?  I suppose I don't get to be such a smart ass when there isn't a manual yet.

Really though, can you suggest what would be better there?  Would changing "active" to "focused" make it more meaningful?

Last edited by Trilby (2021-01-31 04:07:05)


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

Offline

#41 2021-01-31 04:09:26

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,194
Website

Re: Weaver: a socket controlled web browser

The two comments were unrelated. The bit about an active window was me just assuming that tmux would be active and the server would track where to send the socket commands.

The second comment was a reflection on your todo list. A man page would be nice, but a help command dumping the contents of the web page to stdout would be better... smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#42 2021-01-31 04:51:10

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

Re: Weaver: a socket controlled web browser

Ah, that makes sense.  I can add "help" as a command (and also "-" to pick up any "-h" or "--help").

I've also considered that if there is only one weaver window open that any command can be sent to it - but if there is more than one weaver window (browser page) open, then it'd be ambiguous which one it should go to.

I previously tinkered with tracking the last focused weaver window and having commands go to that.  I ran into some hurdle with that approach ... I don't recall what the issue was now.  I may have to revisit that idea as I think that'd be the ideal behavior.

Last edited by Trilby (2021-01-31 04:54:16)


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

Offline

#43 2021-01-31 05:00:09

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,194
Website

Re: Weaver: a socket controlled web browser

Without wanting to introduce bloat...

If the Title  command was indexed, you could preface your command with the window index to send it to. Just a thought. tongue


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#44 2021-01-31 06:13:05

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

Re: Weaver: a socket controlled web browser

Yup, that was kind of the thinking behind the Titles, Urls, and Windows commands to get a list of active weaver windows to select from then do something with.  So far just generating the lists exists.

But I just did find a clean way to send commands to the last focused window even if it isn't currently focused (so you can send commands from a terminal on the same display).  Note that it does not track a focus history, so if you have several weaver windows open and send a "weaver delete" to close the last-focused window, no other commands that require a target will work until one of the remaining weaver windows gets focused.

But in the future there will be a mechanism to specify the focus as you suggest above.  It will not be an index paired with a command, but a seperate command to set the target (basically mark a window as being the "last focused" without actually focusing it).

Aaaand, I just wrote most of the code for this new command which will be the letter 'a' for "activate".  It will accept a number which will be the placement in the "weaver Windows" list, or a string.  If a string is provided, it will activate the first window whose title matches the string (if any do).  Activating a window here does not mean raising or focusing, but only setting the a pointer to the specified window as the target of any subsequent commands.  While most of this is written, I really need to cut myself off now and pick this up again tomorrow.

Last edited by Trilby (2021-01-31 06:20:49)


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

Offline

#45 2021-01-31 06:56:16

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,194
Website

Re: Weaver: a socket controlled web browser

Trilby wrote:

Aaaand, I just wrote most of the code for this new command which will be the letter 'a' for "activate".

w00t! Thanks Jess, works great. smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#46 2021-01-31 09:24:33

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

Re: Weaver: a socket controlled web browser

Posting with weaver. I just added some keybindings in cwmrc and it works great with cwm. Is it possible to define default zoom level ( I need to do "weaver Z 1.5" everytime for my current display) ?
Just to note this is the perfect thing I was looking for while doing browser-hoping from firefox to qutebrowser to vimb. Thanks Trilby.


Arch is home!
cwm rofi weaver vifm vim lizzy pass terminator

Offline

#47 2021-01-31 14:23:51

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

Re: Weaver: a socket controlled web browser

In addition to numbers 2 and 3 here there is also QT_SCALE_FACTOR.  If that variable is set in the environment of the server ("weaver" called with no arguments), then it will be used as a default zoom/scaling for all pages opened.

Note with userscripts  you could have one with just one line:

// ~/.config/weaver/scripts/defaultZoom.js
document.body.style.zoom = "150%"

Or if you have a customCSS.js you can set a default font size there too.

So in short, while there are additional ways I could have a weaver-specific configuration to set it's default font or zoom size, I'm reluctant to do so unless a good case can be made why existing generic methods are not suitable.  Note: if such a case can be made, I'd be all for hearing it - but otherwise I'm cautious to avoid reinventing the wheel.  Whenever there are user customizable "system defaults" for some setting, weaver will use.

More generically, I'll include something in the configuration documentation suggesting that anytime one might be include to ask "How to I set a default <setting> in weaver" they should first as "How do I set a default <setting> in linux" and / or "How do I set a default <setting> for QT apps" - if either of those would provide good answers, there's not likely to be a weaver-specific answer.

The exception would be for cases when one might want their browser to have different "defaults" then the rest of their system.  But still the first questions would be "Can I use system/Qt5 settings to specificy <setting> for a certain application"  If so, use that method, not weaver.  This is definitely the case for font families: use font config to set your preferred serif, sans-serif, etc fonts and weaver will pick that up - even if you want different fonts for weaver than everything else, fontconfig has settings for application-specific preferences, so that should be used.

Last edited by Trilby (2021-01-31 14:32:12)


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

Offline

#48 2021-01-31 15:08:35

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

Re: Weaver: a socket controlled web browser

I tried the one-line userscript and it worked just fine. Thanks.


Arch is home!
cwm rofi weaver vifm vim lizzy pass terminator

Offline

#49 2021-01-31 23:17:33

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

Re: Weaver: a socket controlled web browser

FYI, I just made a substantial change to the commands.  Rather than parsing just the first letter, input is now matched against a hash table.  Several commands have changed, please see project page or now you can see `weaver help` (once a weaver server is running) to see a list of available commands.  You can also learn a little more about each command with `weaver help <some-command>`.

EDIT: side note, the binary almost doubled in size due to including the help text in it!  But it's still tiny.

Last edited by Trilby (2021-02-01 02:16:25)


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

Offline

#50 2021-02-01 03:13:52

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

Re: Weaver: a socket controlled web browser

This new version dumps core when 'weaver help' is run to get list of commands, 'weaver help <something>' works.


Arch is home!
cwm rofi weaver vifm vim lizzy pass terminator

Offline

Board footer

Powered by FluxBB