You are not logged in.

#526 2017-07-27 11:08:21

Onyros
Member
From: Lisbon, Portugal
Registered: 2007-10-11
Posts: 307

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

How will per domain stylesheets work? So I gather that you set a list of stylesheets that qutebrowser should load, for instance

set ui user-stylesheets stylesheetlist

(You've made myyyyy sheetlist)

Which might contain something like:

inbox.css
whatsapp.css
facebook.css

But how are you going to enable the css per domain? Is it defined within the css file, e.g.

@-moz-document domain("inbox.google.com")

or does the filename itself define the domain?

It's really the only thing missing for my full time adoption of qutebrowser right... Can't stand those default backgrounds wink

Offline

#527 2017-07-27 11:55:43

The Compiler
Member
From: Switzerland
Registered: 2011-05-01
Posts: 214
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

The Python API isn't really finished yet, but you'd do something along those lines in your config.py:

with config.domain("*.facebook.com"):
    config.val.content.user_stylesheets = ["facebook.css"]

>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Offline

#528 2017-08-18 22:34:52

buttcake
Member
Registered: 2016-10-16
Posts: 37

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Does qt5-webengine care about font rendering settings in fontconfig, because last time I checked chromium didn't and I can't find anything about this right now.

Or maybe I'm not seeing it because you shouldn't ln -s X ~/.config/fontconfig.

edit: Nevermind I'm a retard, I should have whitelisted X in firejail.

Last edited by buttcake (2017-08-18 23:25:17)

Offline

#529 2017-08-19 03:47:49

monodromy
Member
Registered: 2014-02-08
Posts: 62

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

I have an issue where after I open a background tab via hints, I'm unable to use the scroll command from my assigned key. So I'll hit "F", select a hint, then press "J" (scroll down), but nothing happens. move-to-next-line works, and if I enter ":scroll down", scrolling starts working again. (In fact, if I just enter ":" and escape out, scrolling works again.) I'm using webengine. Do you have any suggestions? Obviously not a major issue, but it is a bit annoying.

Great browser by the way!

Offline

#530 2017-08-19 06:47:14

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 748

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Offline

#531 2017-08-19 17:36:38

monodromy
Member
Registered: 2014-02-08
Posts: 62

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

My goodness @lahwaacz, it is! I never noticed the new tab scrolls. Thanks, I will use the work-around.

Offline

#532 2017-09-11 19:55:35

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

It seems qutebrowser (with either rendering backend) fails to use any css @page settings.  For example, I have a page with the following CSS but the margins are completely ignored when printing from qutebrowser:

@page {
   margins: 2in;
}

I installed chromium, to give that a try, and it properly printed with the specified margins.  I changed the margins in the CSS and chromium properly printed with my new margins.

Qt5WebEngine *should* work like chromium, I think.  So I don't know if this is a difference between webengine and chromium, or in qutebrowsers implementation.  Would anyone know where to look for more information on this behavior or if there are currently any bug/feature requests on it?


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

Offline

#533 2017-09-11 20:04:45

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 748

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Trilby, that's certainly not the only difference between chromium and webengine. Coincidentally, I've made this fix today which I tested on chromium, but it completely broke the layout with webengine (the column-count property of the container seemed to be ignored, there were as many columns as would fit on the screen). The proper fix working even on webengine seems to be this.

Last edited by lahwaacz (2017-09-11 20:05:09)

Offline

#534 2017-09-11 21:57:37

The Compiler
Member
From: Switzerland
Registered: 2011-05-01
Posts: 214
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Trilby wrote:

It seems qutebrowser (with either rendering backend) fails to use any css @page settings.  For example, I have a page with the following CSS but the margins are completely ignored when printing from qutebrowser:

@page {
   margins: 2in;
}

I installed chromium, to give that a try, and it properly printed with the specified margins.  I changed the margins in the CSS and chromium properly printed with my new margins.

Qt5WebEngine *should* work like chromium, I think.  So I don't know if this is a difference between webengine and chromium, or in qutebrowsers implementation.  Would anyone know where to look for more information on this behavior or if there are currently any bug/feature requests on it?

That's a bug in Qt's glue to integrate Chromium's printing with Qt's printing classes.

lahwaacz wrote:

Trilby, that's certainly not the only difference between chromium and webengine. Coincidentally, I've made this fix today which I tested on chromium, but it completely broke the layout with webengine (the column-count property of the container seemed to be ignored, there were as many columns as would fit on the screen). The proper fix working even on webengine seems to be this.

I'd guess that's one of many Chromium multicolumn bugs which was fixed somewhere between Chromium 56 (QtWebEngine 5.9.1) and 61 (current stable).


>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Offline

#535 2017-09-11 22:16:18

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Thanks.  Maybe I can hack together something to change the QPageLayout.  If this issue might take a while for Qt to fix up, would it be worthwhile to have Qutebrowser set some reasonable default margin via QPageLayout.  Right now it seems whatever default that is used may be all zero margins (or very close at least).

EDIT: well, I found one approach that doesn't work.  I tried creating a QPageLayout on line 122 of webenginetab.py, setting the margins (and margin units) and passing this as a second argument to the QWebEnginePage's printToPdf function.  It didn't seem to have any effect at all.

Last edited by Trilby (2017-09-11 23:04:21)


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

Offline

#536 2017-09-12 15:08:17

The Compiler
Member
From: Switzerland
Registered: 2011-05-01
Posts: 214
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Trilby wrote:

EDIT: well, I found one approach that doesn't work.  I tried creating a QPageLayout on line 122 of webenginetab.py, setting the margins (and margin units) and passing this as a second argument to the QWebEnginePage's printToPdf function.  It didn't seem to have any effect at all.

Are you using :print --pdf? If you're using :print and the print dialog, to_printer is what you'd need to modify.


>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Offline

#537 2017-09-12 16:04:04

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Ah, thanks - I was using the print dialog.  I'll tinker with this again later today.


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

Offline

#538 2017-09-19 21:08:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

I'm struggling migrating my old conf to config.py. In particular the syntax of the aliases and searchengines is eluding me. This is what I have, based on my reading of the documentation and my complete lack of knowledge of python:

# searches
c.url.searchengines['a'] = 'https://wiki.archlinux.org/?search={}'
c.url.searchengines['g'] = 'http://www.google.com/search?hl=en&source=hp&ie=ISO-8859-l&q={}'
c.url.searchengines['y'] = 'https://www.youtube.com/results?search_query={}'
c.url.searchengines['w'] = 'https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%%3ASearch&search={}'
c.url.searchengines['gh'] = 'https://github.com/search?q={}&type=Code'

# aliases
c.aliases['gb'] = 'open -t http://bitbucket.jasonwryan.com'
c.aliases['ge'] = 'open -t https://wiki.archlinux.org/index.php/Forum_Etiquette'
c.aliases['gf'] = 'open -t http://flickr.jasonwryan.com'
c.aliases['gj'] = 'open -t http://jasonwryan.com'
c.aliases['gp'] = 'open -t http://127.0.0.1:4000'
c.aliases['gr'] = 'open -t https://feedbin.com/'
c.aliases['gs'] = 'open -t https://unix.stackexchange.com'

Weirdly, the last alias (:gs) works. Nothing else does. All of them, in the previous format, worked.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#539 2017-09-20 00:36:21

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

I can confirm the above syntax doesn't work.  It is valid python unless the c.aliases dict isn't created prior to the parsing of the config.py.  As a workaround creating the dict does work:

c.aliases = {
   'gb': 'open -t http://bitbucket.jasonwryan.com',
   'ge': 'open -t https://wiki.archlinux.org/index.php/Forum_Etiquette',
   'gf': 'open -t http://flickr.jasonwryan.com',
   'gj': 'open -t http://jasonwryan.com',
   'gp': 'open -t http://127.0.0.1:4000',
   'gr': 'open -t https://feedbin.com/',
   'gs': 'open -t https://unix.stackexchange.com',
}

Of course this prevents/replaces the default aliases, so if you want to keep those you'd have to add them to that list.


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

Offline

#540 2017-09-20 01:28:54

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Thanks Trilby. It is reassuring to know I was not doing anything especially stupid... tongue


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#541 2017-09-20 01:37:05

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Trilby wrote:

I can confirm the above syntax doesn't work.  It is valid python unless the c.aliases dict isn't created prior to the parsing of the config.py.

But... that sounds like a bug!


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#542 2017-09-20 07:09:11

The Compiler
Member
From: Switzerland
Registered: 2011-05-01
Posts: 214
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

That was indeed a bug, and is now fixed (thanks to ryan-farley).


>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Offline

#543 2017-09-20 07:26:22

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Awesome: everything works as expected now!


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#544 2017-09-20 16:20:21

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

I have started using qutebrowser again, but I am having trouble in creating config.py due to my poor understanding of python. Is there any documented default config.py available that can be modified by nubes, if I remember correctly older versions of qutebrowser were providing default qutebrowser.conf.

Offline

#545 2017-09-20 16:22:22

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

The wiki page has a link to one at the bottom... smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#546 2017-09-20 16:31:03

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

As I completely redo all the bindings, I didn't really like writing out all the redundant bindings.  So I put all keybinings in a yaml file, eg:

normal:
   j: scroll down
   k: scroll up
   h: scroll left
   l: scroll right
   ...

command:
   <Escape>: leave-mode
   ...

Then in config.py:

import yaml

config.load_autoconfig = False
c.bindings.default = {}
c.bindings.commands = yaml.load(open('/path/to/bindings.yaml', 'r'))

I'd like to do the same with colors.  They are clearly divided into nested namespaces* yet I've not been able to just load a yaml file of colors.  The bindings are nested dicts which make that easier where colors are object attributes - I had a method of coercing dicts to objects (a dictAttr class I think it was called) but setting c.colors to this caused some griping on startup.

I hope to see some more yaml-fication options as this develops.  I see the defaults are all read from a yaml file, but even there the colors are not treated as nested objects, just long dotted strings.

* "Namespaces are one honking great idea – let’s do more of those!"

As my own corolarry to the above quote: Yaml is beautiful - lets do more of that!

Last edited by Trilby (2017-09-20 16:34:36)


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

Offline

#547 2017-09-20 18:33:18

The Compiler
Member
From: Switzerland
Registered: 2011-05-01
Posts: 214
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Docbroke wrote:

I have started using qutebrowser again, but I am having trouble in creating config.py due to my poor understanding of python. Is there any documented default config.py available that can be modified by nubes, if I remember correctly older versions of qutebrowser were providing default qutebrowser.conf.

Did you see the config documenation which (should have) opened when you first started qutebrowser with the new config? Anything in it you think could be improved? Also, there is an issue about creating a template config.py file on the first start or so.

Trilby wrote:

As I completely redo all the bindings, I didn't really like writing out all the redundant bindings.

What do you mean with redundant bindings?

Trilby wrote:

I'd like to do the same with colors.  They are clearly divided into nested namespaces* yet I've not been able to just load a yaml file of colors.  The bindings are nested dicts which make that easier where colors are object attributes - I had a method of coercing dicts to objects (a dictAttr class I think it was called) but setting c.colors to this caused some griping on startup.

I hope to see some more yaml-fication options as this develops.  I see the defaults are all read from a yaml file, but even there the colors are not treated as nested objects, just long dotted strings.

You can do this:

import yaml

with open('/tmp/trilby/config/colors.yml', 'r') as f:
    yaml_data = yaml.load(f)

def _dict_attrs(obj, path=''):
    if isinstance(obj, dict):
        for k, v in obj.items():
            yield from _dict_attrs(v, '{}.{}'.format(path, k) if path else k)
    else:
        yield path, obj

for k, v in _dict_attrs(yaml_data):
    config.set(k, v)

Last edited by The Compiler (2017-09-20 18:35:16)


>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Offline

#548 2017-09-20 18:46:31

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

The Compiler wrote:

What do you mean with redundant bindings?

Sorry, that was poorly worded.  'Verbose' might have been a better word.  It's largely an aesthetic thing, but to me a config file with many entries with a majority of each line being identical just begs for simplifcation through nesting.  Without imporing a yaml file, I'd either have countless lines all repeating "c.bindings.commands['normal']['key'] = 'command'" or "config.bind('<key>', 'command', mode='normal')".  When only the key and command is changing, it just feels much cleaner if only the changing element can be listed.  So my first approach was just to define the dict in config.py, but that's where I realized it'd be cleaner to just import a yaml file (no need for lots of quotes and curly braces).

TheCompiler wrote:

You can do this...

Awesome, thanks.  I'll give that a shot tonight.


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

Offline

#549 2017-09-21 03:06:21

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

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

@jsonwryan, thanks, I was looking at cached wiki page using wiki-search-html. The wiki page seems to be outdated, esp., config part.

@Trilby, I liked that creating yml idea. That shall give me a framework to start modification.

@The Compler, Yes, I did see that config documentation, and it helped me in creating some essential configs (with plenty of trial and errors), as an example, I was able to bind x for spawning url, with  (note: without default config at hand it is actually difficult to decide which character to use for keybinding)

config.bind('x', 'spawn lariza-external-handler -u {url}')

as there was relevant example present in config documentation, but to spawn hint-url, I had to try about ten different things, before reaching this

config.bind('X', 'hint links spawn lariza-external-handler -u {hint-url}')

and to use all-tabs-are-windows thing I had to use :set as I couln't figure out how to do that from config.py. (note: after having jsonwryan's config.py example, now I know that I missed to add c., and it actually sound very silly now, but at that time..)

It would be extremely useful to have template config.py with all defaults commented out, as in the open issue.

Offline

#550 2017-09-21 03:08:46

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: qutebrowser - A keyboard-driven, vim-like browser based on PyQt5

Docbroke wrote:

The wiki page seems to be outdated, esp., config part.

Once the new config is part of a stable release, it will be out-of-date.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB