-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunesmith-gtk4.js
29 lines (26 loc) · 982 Bytes
/
runesmith-gtk4.js
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
#!/usr/bin/gjs -m
import Gtk from 'gi://Gtk?version=4.0'
import Gio from 'gi://Gio?version=2.0'
import GLib from 'gi://GLib?version=2.0'
import Adw from 'gi://Adw?version=1'
import WebKit from 'gi://WebKit?version=6.0'
import Gdk from 'gi://Gdk'
const appID = 'com.github.johnfactotum.Runesmith'
GLib.set_prgname(appID)
GLib.set_application_name('Runesmith')
const moduleDir = GLib.path_get_dirname(GLib.filename_from_uri(import.meta.url)[0])
const modulePath = path => GLib.build_filenamev([moduleDir, path])
const application = new Adw.Application({ applicationId: appID })
application.connect('activate', () => {
const webView = new WebKit.WebView()
webView.set_background_color(new Gdk.RGBA())
webView.load_uri(Gio.File.new_for_path(modulePath('index.html')).get_uri())
const win = new Gtk.ApplicationWindow({
application,
defaultWidth: 1150,
defaultHeight: 720,
child: webView,
})
win.present()
})
application.run([])