Merge branch 'fbd-theme-check' into 'main'
Add theme validator See merge request Librem5/feedbackd!95
This commit is contained in:
+2
-2
@@ -65,9 +65,9 @@ test:native-debian-bookworm:
|
||||
variables:
|
||||
- $PKG_ONLY == "1"
|
||||
|
||||
package:deb-pureos-byzantium:arm64:
|
||||
package:deb-debian-bookwarm:arm64:
|
||||
variables:
|
||||
L5_DOCKER_IMAGE: pureos/byzantium
|
||||
L5_DOCKER_IMAGE: debian:bookworm
|
||||
extends: .l5-build-debian-package
|
||||
tags:
|
||||
- librem5:arm64
|
||||
|
||||
Vendored
+1
-2
@@ -5,7 +5,6 @@ Maintainer: Guido Günther <agx@sigxcpu.org>
|
||||
Build-Depends:
|
||||
dbus,
|
||||
debhelper-compat (= 12),
|
||||
docbook-xsl <!nodoc>,
|
||||
dh-sequence-gir,
|
||||
gsettings-desktop-schemas <!nocheck>,
|
||||
gi-docgen <!nodoc>,
|
||||
@@ -17,8 +16,8 @@ Build-Depends:
|
||||
libjson-glib-dev,
|
||||
meson,
|
||||
pkg-config,
|
||||
python3-docutils <!nodoc>,
|
||||
valac,
|
||||
xsltproc <!nodoc>,
|
||||
Standards-Version: 4.4.0
|
||||
Homepage: https://source.puri.sm/Librem5/feedbackd
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
.. _fbcli(1):
|
||||
|
||||
=====
|
||||
fbcli
|
||||
=====
|
||||
|
||||
------------------------
|
||||
Emit events to feedbackd
|
||||
------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **fbcli** [OPTIONS...]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``fbcli`` can be used to submit events to ``feedbackd`` to trigger
|
||||
audio, visual or haptic feedback.
|
||||
|
||||
OPTIONS
|
||||
=======
|
||||
|
||||
``-h``, ``--help``
|
||||
print help and exit
|
||||
|
||||
``-E=EVENT``; ``--event=EVENT``
|
||||
Submit the given event to ``feedbackd``. Valid events are listes in
|
||||
the event naming spec at
|
||||
`https://source.puri.sm/Librem5/feedbackd/-/blob/main/Event-naming-spec-0.0.0.md`__
|
||||
|
||||
``-t=TIMEOUT``; ``--timeout=TIMEOUT``
|
||||
The timeout in seconds after which feedback for the given event should
|
||||
be stopped.
|
||||
|
||||
``-P=PROFILE``; ``--profile=PROFILE``
|
||||
The feedback profile (``full``, ``quiet``, ``silent``)
|
||||
to use for the given event. If no event is specified then the global
|
||||
feedback profile is changed.
|
||||
|
||||
``-w=TIMEOUT``; ``--watch=TIMEOUT``
|
||||
Maximum timeout to wait for the feedback for the given event to end and
|
||||
``fbcli`` to exit.
|
||||
|
||||
See also
|
||||
========
|
||||
|
||||
``feedbackd(8)``
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
<refentry id="gtester">
|
||||
|
||||
<refentryinfo>
|
||||
<title>fbcli</title>
|
||||
<productname>feedbackd</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Guido</firstname>
|
||||
<surname>Günther</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>fbcli</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>fbcli</refname>
|
||||
<refpurpose>Emit events to feedbackd</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>fbcli</command>
|
||||
<arg choice="opt" rep="repeat">OPTION</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para><command>fbcli</command> can be used to submit events to <command>feedbackd</command>
|
||||
to trigger audio, visual or haptic feedback.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>
|
||||
print help and exit
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-E=<replaceable>EVENT</replaceable></option></term>
|
||||
<term><option>--event=<replaceable>EVENT</replaceable></option></term>
|
||||
<para>
|
||||
Submit the given event to <command>feedbackd</command>. Valid events are
|
||||
listes in the event naming spec at
|
||||
<ulink url="https://source.puri.sm/Librem5/feedbackd/-/blob/main/doc/Event-naming-spec-0.0.0.md"/>
|
||||
</para>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-t=<replaceable>TIMEOUT</replaceable></option></term>
|
||||
<term><option>--timeout=<replaceable>TIMEOUT</replaceable></option></term>
|
||||
<para>
|
||||
The timeout in seconds after which feedback for the given event should
|
||||
be stopped.
|
||||
</para>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-P=<replaceable>PROFILE</replaceable></option></term>
|
||||
<term><option>--profile=<replaceable>PROFILE</replaceable></option></term>
|
||||
<para>
|
||||
The feedback profile (<literal>full</literal>, <literal>quiet</literal>, <literal>silent</literal>)
|
||||
to use for the given event. If no event is specified then the global
|
||||
feedback profile is changed.
|
||||
</para>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-w=<replaceable>TIMEOUT</replaceable></option></term>
|
||||
<term><option>--watch=<replaceable>TIMEOUT</replaceable></option></term>
|
||||
<para>
|
||||
Maximum timeout to wait for the feedback for the given event to end and
|
||||
<command>fbcli</command> to exit.
|
||||
</para>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
||||
|
||||
<refsect1><title>See also</title>
|
||||
<para>
|
||||
<citerefentry>
|
||||
<refentrytitle>feedbackd</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
@@ -0,0 +1,56 @@
|
||||
.. _fbd-theme-validate(1):
|
||||
|
||||
==================
|
||||
fbd-theme-validate
|
||||
==================
|
||||
|
||||
-------------------------
|
||||
Validate feedbackd themes
|
||||
-------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **fbd-theme-validate** [OPTIONS...] <FILE>
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``fbd-theme-validate`` parses and validates the given feedbackd theme
|
||||
file. If the theme specifies parent themes then these are parsed and
|
||||
validates as well.
|
||||
|
||||
OPTIONS
|
||||
=======
|
||||
|
||||
``-h``, ``--help``
|
||||
print help and exit
|
||||
|
||||
``--version``
|
||||
print version information and exit
|
||||
|
||||
``--compatible=COMPATIBLE``
|
||||
Specify the device compatible to use. Specify this if you validate a user
|
||||
theme and want to simulate how it would look like on a device with compatible
|
||||
```COMPATIBLE```.
|
||||
|
||||
EXAMPLES
|
||||
========
|
||||
|
||||
Validate a custom theme in the users home directory the same way as it would be
|
||||
loaded on a Librem 5:
|
||||
|
||||
::
|
||||
|
||||
fbd-theme-validate --compatible=purism,librem5 ~/.config/feedbackd/themes/custom.json
|
||||
|
||||
Validate the device theme for a OnePlus 6T:
|
||||
|
||||
::
|
||||
|
||||
fbd-theme-validate /usr/share/feedbackd/themes/oneplus,fajita.json
|
||||
|
||||
See also
|
||||
========
|
||||
|
||||
``feedbackd(8)`` ``fbcli(1)``
|
||||
@@ -0,0 +1,42 @@
|
||||
.. _feedbackd(8):
|
||||
|
||||
=========
|
||||
feedbackd
|
||||
=========
|
||||
|
||||
--------------------------------------
|
||||
A daemon to provide feedback on events
|
||||
--------------------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **feedbackd** [OPTIONS...]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
``Feedbackd`` is a daemon that runs in the users session to trigger
|
||||
event feedback such as playing a sound, trigger a haptic motor or blink
|
||||
a LED.
|
||||
|
||||
The feedback triggered by a given event is determined by the feedback theme in
|
||||
use. Events are submitted via a DBus API.
|
||||
|
||||
Any feedback triggered by a client via an event will be stopped latest when the
|
||||
client disconnects from DBus. This makes sure all feedbacks get canceled if the
|
||||
app that triggered it crashes.
|
||||
|
||||
For details refer to the event and feedback theme specs at
|
||||
`<https://source.puri.sm/Librem5/feedbackd/>`__
|
||||
|
||||
Options
|
||||
=======
|
||||
|
||||
``-h``, ``--help``
|
||||
print help and exit
|
||||
|
||||
See also
|
||||
========
|
||||
|
||||
``fbcli(1)``
|
||||
@@ -1,76 +0,0 @@
|
||||
<refentry id="gtester">
|
||||
|
||||
<refentryinfo>
|
||||
<title>feedbackd</title>
|
||||
<productname>feedbackd</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Guido</firstname>
|
||||
<surname>Günther</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>feedbackd</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>feedbackd</refname>
|
||||
<refpurpose>A daemon to provide feedback on events</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>feedbackd</command>
|
||||
<arg choice="opt" rep="repeat">OPTION</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>feedbackd</command> is a daemon that runs in the users
|
||||
session to trigger event feedback such as playing a sound, trigger
|
||||
a haptic motor or blink a LED.
|
||||
</para>
|
||||
<para>
|
||||
The feedback triggered by a given event is determined by the feedback
|
||||
theme in use. Events are submitted via a DBus API.
|
||||
</para>
|
||||
<para>
|
||||
Any feedback triggered by a client via an event will be stopped latest
|
||||
when the client disconnects from DBus. This makes sure all feedbacks
|
||||
get canceled if the app that triggered it crashes.
|
||||
</para>
|
||||
<para>
|
||||
For details
|
||||
refer to the event and feedback theme specs at
|
||||
<ulink url="https://source.puri.sm/Librem5/feedbackd/"/>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>
|
||||
print help and exit
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>See also</title>
|
||||
<para>
|
||||
<citerefentry>
|
||||
<refentrytitle>fbcli</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
+21
-21
@@ -50,31 +50,31 @@ endif
|
||||
|
||||
if get_option('man')
|
||||
manpages = [
|
||||
'fbcli',
|
||||
'feedbackd',
|
||||
['fbcli', 1],
|
||||
['fbd-theme-validate', 1],
|
||||
['feedbackd', 8],
|
||||
]
|
||||
|
||||
xsltproc = find_program('xsltproc', required : true)
|
||||
xsltproc_command = [
|
||||
xsltproc,
|
||||
'--nonet',
|
||||
'--stringparam', 'man.output.quietly', '1',
|
||||
'--stringparam', 'funcsynopsis.style', 'ansi',
|
||||
'--stringparam', 'man.th.extra1.suppress', '1',
|
||||
'--stringparam', 'man.authors.section.enabled', '0',
|
||||
'--stringparam', 'man.copyright.section.enabled', '0',
|
||||
'-o', '@OUTPUT@',
|
||||
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
|
||||
'@INPUT@',
|
||||
rst2man = find_program('rst2man', 'rst2man.py', required: false)
|
||||
rst2man_flags = [
|
||||
'--syntax-highlight=none',
|
||||
]
|
||||
man1_dir = get_option('mandir') + '/man1'
|
||||
|
||||
foreach page : manpages
|
||||
custom_target(page + '-man',
|
||||
input : page + '.xml',
|
||||
output : page + '.1',
|
||||
command: xsltproc_command,
|
||||
foreach manpage: manpages
|
||||
man_name = manpage[0]
|
||||
man_section = manpage[1]
|
||||
|
||||
custom_target('man-@0@'.format(man_name),
|
||||
input: '@0@.rst'.format(man_name),
|
||||
output: '@0@.@1@'.format(man_name, man_section),
|
||||
command: [
|
||||
rst2man,
|
||||
rst2man_flags,
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
install: true,
|
||||
install_dir: man1_dir)
|
||||
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
@@ -28,6 +28,7 @@ endif
|
||||
|
||||
prefix = get_option('prefix')
|
||||
|
||||
bindir = join_paths(prefix, get_option('bindir'))
|
||||
datadir = join_paths(prefix, get_option('datadir'))
|
||||
libdir = join_paths(prefix, get_option('libdir'))
|
||||
girdir = join_paths(prefix, join_paths(datadir, 'gir-1.0'))
|
||||
@@ -90,6 +91,7 @@ endif
|
||||
global_c_args = [
|
||||
'-DFEEDBACKD_THEME_DIR="@0@"'.format(feedbackd_theme_dir),
|
||||
'-DLIBFEEDBACK_COMPILATION',
|
||||
'-DFBD_VERSION="@0@"'.format(meson.project_version()),
|
||||
]
|
||||
|
||||
add_project_arguments(
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ option('gtk_doc',
|
||||
description: 'Whether to generate the API reference for Libfeedback')
|
||||
option('man',
|
||||
type: 'boolean', value : false,
|
||||
description : 'generate man pages (requires xsltproc)')
|
||||
description : 'generate man pages (requires rst2man)')
|
||||
option('tests',
|
||||
type: 'boolean', value: true,
|
||||
description: 'Whether to compile unit tests')
|
||||
|
||||
@@ -133,7 +133,7 @@ fbd_theme_expander_find_device_theme_path (FbdThemeExpander *self, const char *t
|
||||
|
||||
theme_path = fbd_theme_expander_find_theme_in_xdg_data (compatible);
|
||||
if (theme_path) {
|
||||
g_info ("Loading themefile for compatible '%s' at: %s", compatible, theme_path);
|
||||
g_debug ("Loading themefile for compatible '%s' at: %s", compatible, theme_path);
|
||||
return g_steal_pointer (&theme_path);
|
||||
}
|
||||
}
|
||||
@@ -367,6 +367,7 @@ fbd_theme_expander_load_theme_files (FbdThemeExpander *self, GError **err)
|
||||
}
|
||||
}
|
||||
|
||||
g_info ("Loading theme file at '%s'", self->theme_file);
|
||||
theme = fbd_feedback_theme_new_from_file (self->theme_file, err);
|
||||
if (theme == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Guido Günther
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0+
|
||||
*/
|
||||
|
||||
#define G_LOG_DOMAIN "fbd"
|
||||
|
||||
#include "fbd-theme-expander.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define BLURP "- A validator for feedback themes"
|
||||
|
||||
static void
|
||||
print_version (void)
|
||||
{
|
||||
g_print ("%s %s " BLURP "\n", g_get_prgname(), FBD_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static void
|
||||
log_handler (const gchar *log_domain,
|
||||
GLogLevelFlags log_level,
|
||||
const gchar *message,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_print ("%s\n", message);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
g_autoptr (GError) err = NULL;
|
||||
g_autoptr (GOptionContext) opt_context = NULL;
|
||||
g_autoptr (FbdThemeExpander) expander = NULL;
|
||||
g_autoptr (FbdFeedbackTheme) theme = NULL;
|
||||
g_autofree char *theme_file = NULL;
|
||||
const char *compatible = NULL;
|
||||
gboolean version = FALSE;
|
||||
GStrv args = NULL;
|
||||
const char *compatibles[] = { NULL, NULL };
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
const GOptionEntry options [] = {
|
||||
{"version", 0, 0, G_OPTION_ARG_NONE, &version,
|
||||
"Show version information", NULL},
|
||||
{"compatible", 0, 0, G_OPTION_ARG_STRING, &compatible,
|
||||
"The device compatible", NULL},
|
||||
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL, NULL },
|
||||
G_OPTION_ENTRY_NULL,
|
||||
};
|
||||
|
||||
opt_context = g_option_context_new ("THEME-FILE " BLURP);
|
||||
g_option_context_add_main_entries (opt_context, options, NULL);
|
||||
if (!g_option_context_parse (opt_context, &argc, &argv, &err)) {
|
||||
g_warning ("%s", err->message);
|
||||
g_clear_error (&err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (version) {
|
||||
print_version ();
|
||||
}
|
||||
|
||||
g_log_set_handler ("fbd-theme-expander", G_LOG_LEVEL_INFO | G_LOG_FLAG_RECURSION,
|
||||
log_handler, NULL);
|
||||
|
||||
if (!args) {
|
||||
g_printerr ("%s: No theme file given\n", g_get_prgname ());
|
||||
g_printerr ("Try \"%s --help\" for more information.", g_get_prgname ());
|
||||
g_printerr ("\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
compatibles[0] = compatible;
|
||||
theme_file = *args;
|
||||
expander = fbd_theme_expander_new (compatibles, NULL, theme_file);
|
||||
theme = fbd_theme_expander_load_theme_files (expander, &err);
|
||||
if (theme == NULL) {
|
||||
g_printerr ("Validation of '%s' failed \n\n", theme_file);
|
||||
g_printerr ("error: %s\n\n", err->message);
|
||||
} else {
|
||||
g_print ("Validation successful.\n");
|
||||
ret = EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -80,4 +80,13 @@ executable(
|
||||
install_dir: libexecdir,
|
||||
)
|
||||
|
||||
executable(
|
||||
'fbd-theme-validate',
|
||||
sources : ['fbd-theme-validate.c'],
|
||||
include_directories : fbd_inc,
|
||||
dependencies : fbd_dep,
|
||||
install : true,
|
||||
install_dir: bindir,
|
||||
)
|
||||
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user