small-tech / watson Goto Github PK
View Code? Open in Web Editor NEWWatson is a best-practices application template for elementary OS 6 (Odin).
License: GNU General Public License v3.0
Watson is a best-practices application template for elementary OS 6 (Odin).
License: GNU General Public License v3.0
when running watson
I get this error
Step 8 (Delete self) failed on line 239.
I was able to continue by looking at the steps in the watson file itself - but this might cause some people some confusion. I'll do some digging see what the issue is, but wanted to raise it here just so you're aware and in case anyone else experiences it.
For example, in task/install
, the script will just fail without displaying any instructions the user to install the elementary-sdk
package and if vscodium
isn't found on the system, the script will also throw an error instead of continuing.
However, this seems to only occur when task/install
is called from the watson
script.
To run the flatpak package.
e.g.,
flatpak run com.github.small_tech.comet
Given that Flatpaks can be distributed in a decentralised manner, in the spirit of the Small Web, we should make this as easy to do as possible.
task/publish
Running this script:
The site can then be served with Site.js.
Notes:
In order to access constants (like the app version), core apps like elementary OS Code use a config.vala.in file that’s configured by Meson during the build process.
Implement this for the Watson template.
e.g.,
namespace Constants {
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string PROJECT_NAME = @PROJECT_NAME@;
public const string VERSION = @VERSION@;
}
project(
'…',
'vala',
'c',
version: '1.0.0'
)
…
conf_data = configuration_data()
conf_data.set_quoted('PROJECT_NAME', meson.project_name())
conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf_data.set_quoted('VERSION', meson.project_version())
config_header = configure_file(
input : 'src' / 'config.vala.in',
output : 'config.vala',
configuration : conf_data
)
This seems to only happen from flatpak installs. When the flatpak app is run, the app spawns twice, one icon in plank with the app ID and one icon with the app name.
Even after closing the application, the one process with the app name sticks around for a couple of seconds and then closes by itself. Was unfortunately not able to figure out why this happens yet. The screenshot above demos whats going on.
I've created a sample repo for debugging this, its up here: https://github.com/BharatKalluri/double-icon-flatpak-bug
To launch the app in the supported localisations and take screenshots.
A basic version of https://github.com/small-tech/comet/blob/main/task/take-screenshots
In the core apps that ship with elementary OS, the Application constructor manually sets the locale and binds to the gettext package e.g. in Calculator:
Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
GLib.Intl.textdomain (GETTEXT_PACKAGE);
The constants used come from the configuration file (Config.vala.in):
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string LOCALEDIR = @LOCALEDIR@;
And the actual values are substituted in meson.build:
config_data = configuration_data()
config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_file = configure_file(
input: 'src/Config.vala.in',
output: '@BASENAME@',
configuration: config_data
)
However, none of this is shown in the Translations section of the elementary OS developer documentation.
Can someone with better knowledge of all this than me please answer:
Thanks!
Apps generated with Watson should handle universal command-line options (like --help and -v/--version) properly by default.
This should be implemented in a manner that makes it easy for the developer to add further options should they desire (see the core apps, e.g., Code, for an example of a good, maintainable implementation.)
handle_local_options
signal with a custom handler for -v
/--version
argument--help
screen (set_option_context_summary()
)--help
screen (set_option_context_description()
)e.g.,
#!/usr/bin/env bash
set -eu -o pipefail
flatpak-builder build com.github.small_tech.comet.yml --user --install --force-clean
Go through the tasks in Comet and see which we can port back to Watson.
To launch AppCenter, optionally with a given localisation, to preview how the app will look.
Also include: the functionality for commenting in/out the icon so it appears in the preview.
A basic version of https://github.com/small-tech/comet/blob/main/task/preview-in-appcenter
This is something that’s missing from the elementary starter project also.
Add localisation initialisation code to Application
initialiser:
GLib.Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (Constants.GETTEXT_PACKAGE, Constants.LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8");
GLib.Intl.textdomain (Constants.GETTEXT_PACKAGE);
And add the LOCALEDIR
constant to the meson.build
conf_data = configuration_data()
conf_data.set_quoted('PROJECT_NAME', meson.project_name())
conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf_data.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
conf_data.set_quoted('VERSION', meson.project_version())
config_header = configure_file(
input : 'src' / 'config.vala.in',
output : 'config.vala',
configuration : conf_data
)
And add it to config.vala.in:
namespace Constants {
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string PROJECT_NAME = @PROJECT_NAME@;
public const string VERSION = @VERSION@;
public const string LOCALEDIR = @LOCALEDIR@;
}
The colour scheme setup is currently in the MainWindow
class.
This is fine unless you want to, for example, parse command-line arguments, do some processing based on them (e.g., load a file) and display, say, an error dialogue. At which point you must duplicate the code to have the dialogue match the person’s colour scheme preference.
Instead, by moving it to the activate
method of the Application
class, the settings will be active everywhere in the app.
Namespace: Constants.Colors
(Keeping the American spelling as everything else uses it.)
https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
This will make VSCodium actually apply the settings that are set in the EditorConfig file that is part of the template.
Currently, you have to add any new vala files you create to the meson.build
file manually.
This is error-prone and laborious.
We should be able to discover and add the files automatically in the build script. Any vala file in the project should automatically be built.
Once task/package
has been implemented, ensure that the task/build
script runs meson build --prefix=/usr
again if necessary as, otherwise, you get the following error if you run task/build
after task/package
:
~/Projects/elementary/comet/build ~/Projects/elementary/comet
ninja: error: loading 'build.ninja': No such file or directory
So check for this in the task/run
and task/build
scripts and reconfigure meson if you detect that the build.ninja
file doesn’t exist. e.g.,
# The ninja build file may be missing if the
# person ran a flatpak build before running this script.
# If so, reconfigure meson.
if [[ ! -f build/build.ninja ]]; then
meson build --prefix=/usr
fi
Without a releases section, Flatpak / AppCenter does not display or use the app version.
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.