45 points · by AbuAssar · 2y ago · 15 comments
#!/usr/bin/gjs
const Gtk = imports.gi.Gtk;
const WebKit = imports.gi.WebKit2;
class SimpleBrowser {
constructor() {
this.application = new Gtk.Application({
application_id: 'com.example.SimpleBrowser'
});
this.application.connect('activate', () => {
this.window = new Gtk.ApplicationWindow({
application: this.application,
title: "Simple Browser",
default_height: 600,
default_width: 800
});
this.webview = new WebKit.WebView();
this.window.add(this.webview);
this.webview.load_uri("http://www.example.com");
this.window.show_all();
});
}
}
let app = new SimpleBrowser();
app.application.run(ARGV);In general this sounds pretty cool: GJS is built on the SpiderMonkey JavaScript engine. It utilizes GObject Introspection to provide access to the GNOME APIs using ECMAScript 2021 JavaScript.
Just don't compare it with Node.js; it's something else. No, your code might not run in that environment; APIs are most likely not compatible.
Can confirm. Screenshot of the minimum width, the paddings all disappear: https://i.imgur.com/iv7frHI.png
I can see some value in not spreading the buttons across a vast horizontal swathe of window - much as one doesn't fill a widescreen monitor with a single column of text - but there's no excuse for the waveform not making full use of the available screen width.
The same goes for the width of paragraph text in general. A paragraph stretched to full screen width is much harder to read than a paragraph wrapped at paperback book width. If wide paragraphs were better, books would have a different aspect ratio.