gcampax / gtk-js-app Goto Github PK
View Code? Open in Web Editor NEWA template for a standard Gtk/GNOME JS application
License: BSD 3-Clause "New" or "Revised" License
A template for a standard Gtk/GNOME JS application
License: BSD 3-Clause "New" or "Revised" License
autogen.sh does not use bash-specific features, so we can change it to #!/bin/sh
. #!/bin/bash
causes error on systems which do not have bash installed in /bin.
you should be able to run './src/my-js-app' and stuff should just work
-- https://github.com/gcampax/gtk-js-app/blob/master/README
% ./src/my-js-app
no such file or directory: ./src/my-js-app
Ok let's try gjs.
% gjs ./src/main.js
(gjs:1281): Gjs-WARNING **: 15:27:19.845: JS ERROR: ReferenceError: pkg is not defined
@./src/main.js:27:1
Script ./src/main.js threw an exception
Ok let's build this
% meson build
[....]
% ./build/src/com.example.Gtk.JSApplication
permission denied: ./build/src/com.example.Gtk.JSApplication
% chmod +x ./build/src/com.example.Gtk.JSApplication
% ./build/src/com.example.Gtk.JSApplication
(com.example.Gtk.JSApplication:1424): Gjs-WARNING **: 15:28:32.957: JS ERROR: ImportError: No JS module 'main' found in search path
@./build/src/com.example.Gtk.JSApplication:6:1
Script ./build/src/com.example.Gtk.JSApplication threw an exception
Ok let's install this
% cd build
% DESTDIR=./install ninja install
% ./install/usr/local/bin/com.example.Gtk.JSApplication
(com.example.Gtk.JSApplication:2282): Gjs-WARNING **: 15:35:38.003: JS ERROR: ImportError: No JS module 'main' found in search path
@./install/usr/local/bin/com.example.Gtk.JSApplication:6:1
Script ./install/usr/local/bin/com.example.Gtk.JSApplication threw an exception
I'm on Linux Mint:
$ make
make all-recursive
make[1]: Entering directory /home/bruce/gjs/gtk-js-app' Making all in po make[2]: Entering directory
/home/bruce/gjs/gtk-js-app/po'
make[2]: Nothing to be done for all'. make[2]: Leaving directory
/home/bruce/gjs/gtk-js-app/po'
Making all in data
make[2]: Entering directory /home/bruce/gjs/gtk-js-app/data' Makefile:822: *** missing separator. Stop. make[2]: Leaving directory
/home/bruce/gjs/gtk-js-app/data'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bruce/gjs/gtk-js-app'
make: *** [all] Error 2
I am a complete newcomer to GTK & GJS development. I write TypeScript professionally and I prefer using TypeScript using plain JavaScript. I see that multiple GTK apps are written in TypeScript now.
One popular example is pop-os/shell, however that project does not use type definitions for GJS itself. It also uses quite a weird build setup with sed
scripts.
Then I found ts-for-gir which seems to be the most mature library that provides types for GJS. They also have a lot of example projects. Meson is not used as a build tool for these example projects (esbuild is used instead for most).
It would be great to have a standard template for starting out GJS development that includes TypeScript.
After running the ./autogen.sh, in the configure step throws this error:
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 12460: syntax error near unexpected token 0.9.6' ./configure: line 12460:
GOBJECT_INTROSPECTION_REQUIRE(0.9.6)'
I can build the code correctly and execute the program with "com.example.Gtk.JSApplication" , but when I launch it from the desktop environments (Gnome) it doesn't start. Looking at .application file, it try to execute
gapplication launch com.example.Gtk.JSApplication
and if I do this command I get this error:
error sending Activate message to application: GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Could not activate remote peer.
No idea how I can try to fix this
Hi!
When I execute the application in a Fedora Rawhide with GNOME 3.8 the following error shown: "Error: No JS module 'package' found in search path."
Thanks.
Hi!
Is there any possibility to support this app in debian testing aka wheeze? When running ./autogen.sh I've got:
Requested 'gtk+-3.0 >= 3.7.10' but version of GTK+ is 3.4.2
I don't want to use debian experimental ...yet! Thanks for your work :)
Hi
I am trying build a test app just to get to know better GJS and found this repo in Gnome Documentation about GJS.
I was learning how meson and ninja works but I can't figure it out how to run the app inside the project folder without making a ninja install.
If I try to do gjs src/main.js
it complains about pkg not being defined, and if I do ninja
inside de build directory and run gjs _build/src/com.example.Gtk.JSApplication
without making ninja install, it complains about not finding main in the search path.
The only thing I could do is after running sudo ninja install
, and then gjs _build/src/com.example.Gtk.JSApplication
that's when the app launches, but every time I make a change I would have to start over and make an install.
What am I missing? I see here https://wiki.gnome.org/Projects/Gjs/Package that pkg is available at runtime through the package.js, but I can't understand how to run from src without installing.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.