-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequinto.js
More file actions
executable file
·54 lines (41 loc) · 1.27 KB
/
requinto.js
File metadata and controls
executable file
·54 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env gjs
imports.gi.versions.Gtk = "4.0";
imports.gi.versions.WebKit = "6.0";
const { Gtk, Gio, GLib, WebKit } = imports.gi;
// ------------------------------------------------------------
// Script-anchored index.html
// ------------------------------------------------------------
const scriptFile = Gio.File.new_for_path(
imports.system.programInvocationName
);
const projectRoot = "/app/share/requinto";
const indexFile = GLib.build_filenamev([
"/app/share/requinto",
"src",
"index.html"
]);
const indexGFile = Gio.File.new_for_path(indexFile);
if (!indexGFile.query_exists(null)) {
throw new Error(`index.html NOT FOUND at: ${indexFile}`);
}
const indexURI = indexGFile.get_uri();
const app = new Gtk.Application({
application_id: "social.whereis.requinto"
});
app.connect("activate", () => {
const win = new Gtk.ApplicationWindow({
application: app,
title: "Requinto",
default_width: 900,
default_height: 600
});
const webview = new WebKit.WebView();
const settings = webview.get_settings();
settings.enable_developer_extras = true;
settings.allow_file_access_from_file_urls = true;
settings.allow_universal_access_from_file_urls = true;
webview.load_uri(indexURI);
win.set_child(webview);
win.present();
});
app.run([]);