Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ffb693c08 | ||
|
|
6a96ffc7f4 | ||
|
|
590adfc3ab | ||
|
|
d2dc03084d |
No files matched your search
@@ -0,0 +1,51 @@
|
||||
# Forked from Alpine INSERT-REASON-HERE (CHANGEME!)
|
||||
|
||||
pkgname=gnome-clocks
|
||||
pkgver=48.0
|
||||
pkgrel=2
|
||||
pkgdesc="Clock application designed for GNOME 3"
|
||||
url="https://apps.gnome.org/Clocks"
|
||||
arch="all"
|
||||
license="GPL-2.0-or-later"
|
||||
depends="gsettings-desktop-schemas"
|
||||
makedepends="
|
||||
desktop-file-utils
|
||||
geoclue-dev
|
||||
geocode-glib-dev>=3.26.4-r1
|
||||
gettext-dev
|
||||
glib-dev
|
||||
gnome-desktop-dev
|
||||
gsound-dev
|
||||
gtk4.0-dev
|
||||
itstool
|
||||
libadwaita-dev
|
||||
libgweather4-dev
|
||||
meson
|
||||
vala
|
||||
"
|
||||
checkdepends="appstream-glib"
|
||||
subpackages="$pkgname-lang $pkgname-doc"
|
||||
source="https://download.gnome.org/sources/gnome-clocks/${pkgver%.*}/gnome-clocks-$pkgver.tar.xz
|
||||
gnome-clocks.desktop
|
||||
"
|
||||
|
||||
build() {
|
||||
abuild-meson . output
|
||||
meson compile -C output
|
||||
}
|
||||
|
||||
check() {
|
||||
meson test --print-errorlogs -C output
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="$pkgdir" meson install --no-rebuild -C output
|
||||
|
||||
install -Dm644 "$srcdir"/gnome-clocks.desktop \
|
||||
"$pkgdir"/etc/xdg/autostart/gnome-clocks.desktop
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
6bf6c4c4b8827ccf04df8bf899098145566eeb9bcd5d4df437ef2193fa7c56d7309ab9447cecdd7bec56c2a247b7ed93b1ae4b7a2d099f8fcf34151b4eb11ecb gnome-clocks-48.0.tar.xz
|
||||
c8439890965b8c81f61381559282935eafc86fcb6d3c537048ab9366249a3daabc50bce96218e2724e5740c06b029e3f9484977f615b0620117d333b0b010790 gnome-clocks.desktop
|
||||
"
|
||||
@@ -0,0 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Autostart gnome-clocks in background mode for alarms
|
||||
Exec=/usr/bin/gnome-clocks -b
|
||||
Terminal=false
|
||||
X-GNOME-AutoRestart=true
|
||||
X-GNOME-HiddenUnderSystemd=true
|
||||
@@ -7,7 +7,7 @@
|
||||
# How to add a new service file (5 steps):
|
||||
pkgname=systemd-services
|
||||
# 1. bump pkgver
|
||||
pkgver=74
|
||||
pkgver=75
|
||||
pkgrel=0
|
||||
pkgdesc="Systemd service files"
|
||||
url="https://postmarketos.org"
|
||||
@@ -149,7 +149,7 @@ _flatpak_sources="
|
||||
_fnott_sources="user/fnott.service"
|
||||
_fprintd_sources="system/fprintd.service" # From https://gitlab.freedesktop.org/libfprint/fprintd/-/blob/master/data/fprintd.service.in
|
||||
_geoclue_sources="system/geoclue.service" # From https://gitlab.freedesktop.org/geoclue/geoclue/-/blob/master/data/geoclue.service.in
|
||||
_gnome_clocks_sources="user/gnome-clocks.service"
|
||||
_gnome_clocks_sources="user/gnome-clocks.service" # https://gitlab.gnome.org/guidog/gnome-clocks/-/blob/phosh/data/gnome-clocks.service.in + using -b instead of --hidden
|
||||
_gnome_terminal_sources="user/gnome-terminal-server.service" # From https://gitlab.gnome.org/GNOME/gnome-terminal/-/blob/master/src/gnome-terminal-server.service.in
|
||||
_goimapnotify_sources="user/goimapnotify@.service" # From https://gitlab.com/shackra/goimapnotify/-/raw/master/goimapnotify@.service
|
||||
_greetd_wlgreet_sources="system/wlgreet.service"
|
||||
@@ -381,7 +381,7 @@ ae2d20da95e519041f6eca39dd140895b2c46284f0894c60a29cf56b87704805146ddc2435e46e7f
|
||||
0924315d4b7337edb42a2ecd7ba84d6a10437633028cd9c6ebd143c0668a6e6fea365d6644c336c70158e62d75a072db38bdee36cb677dfbfa609e9fdf43aca0 user-fnott.service
|
||||
c86ffe994aa78b3d68c3956c54255c9479d832c4a2fd3905deec6ef620871bacf60f7a9cb7ef9a3dfd7993354d4590b8b5efef3159274477857c3ead614dee02 system-fprintd.service
|
||||
f3463b85ac47055b400dfd2e24694c5e1dc6ab039efac0fe54496fc027c0732cda5e52a362a497b372dea671dc615154e8abfea866728d243cbbcd25e68a91aa system-geoclue.service
|
||||
bc7987a001d2076788d904f1ea6d3e97a2ab905ee55302ffb90402133c2b9fb760d7ad94e06971d811b9d905048e164cb78355f8cd087219b5b8ff6dab2fbd9c user-gnome-clocks.service
|
||||
d769a271cb050ea68ee144a86ad71a1636246adada03fcb2ee902813c4a298b394c87bef7a006bc86e35921081b417736c94d879e8ed8105a800711272ff62fb user-gnome-clocks.service
|
||||
ccf803ac6a764570a98845f0b0ddcde0529943472ce4cc3dc904501883a51fda482d7aef3b84fac89590e869fecdcec9142a6eac3db8ae73782a5e29f32eaae1 user-gnome-terminal-server.service
|
||||
e0c5baf8030bae74c1ddb0f6f9bc4fdf2a1febaa344de1957d9a69a01eb7e1dc143b9d324ef15214289934b3a7fd4725df26b032f9225102d9cf5633145320bc user-goimapnotify@.service
|
||||
e226bdb71f6fafe92d14046dfa19ddbccb765b579c1f90687a9ece376fa12406db9f2cf8035ff07d5a78ef77dc73615d39a8790f8722585bf65872be773888ff system-wlgreet.service
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
[Unit]
|
||||
Description=GNOME clocks
|
||||
Description=GNOME Clocks
|
||||
PartOf=gnome-session.target
|
||||
Requisite=gnome-session-initialized.target
|
||||
After=gnome-session-initialized.target
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
BusName=org.gnome.clocks
|
||||
ExecStart=/usr/bin/gnome-clocks -b
|
||||
Restart=on-failure
|
||||
AmbientCapabilities=CAP_WAKE_ALARM
|
||||
Environment=ADW_DISABLE_PORTAL=1
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
WantedBy=gnome-session.target
|
||||
@@ -0,0 +1,61 @@
|
||||
# Forked from Alpine INSERT-REASON-HERE (CHANGEME!)
|
||||
|
||||
pkgname=gnome-clocks
|
||||
pkgver=48.0
|
||||
pkgrel=1
|
||||
pkgdesc="Clock application designed for GNOME 3"
|
||||
url="https://apps.gnome.org/Clocks"
|
||||
arch="all"
|
||||
license="GPL-2.0-or-later"
|
||||
depends="gsettings-desktop-schemas"
|
||||
makedepends="
|
||||
desktop-file-utils
|
||||
geoclue-dev
|
||||
geocode-glib-dev>=3.26.4-r1
|
||||
gettext-dev
|
||||
glib-dev
|
||||
gmobile-dev
|
||||
gnome-desktop-dev
|
||||
gsound-dev
|
||||
gtk4.0-dev
|
||||
itstool
|
||||
libadwaita-dev
|
||||
libcap-setcap
|
||||
libgweather4-dev
|
||||
meson
|
||||
vala
|
||||
"
|
||||
checkdepends="appstream-glib"
|
||||
subpackages="$pkgname-lang $pkgname-doc"
|
||||
source="https://download.gnome.org/sources/gnome-clocks/${pkgver%.*}/gnome-clocks-$pkgver.tar.xz
|
||||
timerfd.patch
|
||||
background.patch
|
||||
gnome-clocks.desktop
|
||||
"
|
||||
options="setcap" # see below
|
||||
|
||||
build() {
|
||||
abuild-meson . output
|
||||
meson compile -C output
|
||||
}
|
||||
|
||||
check() {
|
||||
meson test --print-errorlogs -C output
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="$pkgdir" meson install --no-rebuild -C output
|
||||
|
||||
# for wakeup timer
|
||||
setcap cap_wake_alarm+ep "$pkgdir"/usr/bin/gnome-clocks
|
||||
|
||||
install -Dm644 "$srcdir"/gnome-clocks.desktop \
|
||||
"$pkgdir"/etc/xdg/autostart/gnome-clocks.desktop
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
6bf6c4c4b8827ccf04df8bf899098145566eeb9bcd5d4df437ef2193fa7c56d7309ab9447cecdd7bec56c2a247b7ed93b1ae4b7a2d099f8fcf34151b4eb11ecb gnome-clocks-48.0.tar.xz
|
||||
5625a9b3a77484117ae946d81083fb02259f675b9daef32c48277be714a8f21adf7970d2228ec6bc42825aaf33fe51358f7e7bfde8c41249186f7b94a17b3b44 timerfd.patch
|
||||
ffb93c5e5ff4f888c3e1308142af332f15293b84018b262398f7a41216bc1b91eb1c02bd551db079b4e35cca184c70462d8fa900a94f3afeadb033ff41046b55 background.patch
|
||||
c8439890965b8c81f61381559282935eafc86fcb6d3c537048ab9366249a3daabc50bce96218e2724e5740c06b029e3f9484977f615b0620117d333b0b010790 gnome-clocks.desktop
|
||||
"
|
||||
@@ -0,0 +1,63 @@
|
||||
From 94e223701269f5c9e60bd69575b62aca91c0f85a Mon Sep 17 00:00:00 2001
|
||||
From: Adam Plumb <adamplumb@gmail.com>
|
||||
Date: Fri, 10 Sep 2021 20:14:19 -0400
|
||||
Subject: [PATCH] Add argument to start initial instance in the background
|
||||
|
||||
---
|
||||
src/application.vala | 19 ++++++++++++++++++-
|
||||
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/application.vala b/src/application.vala
|
||||
index 6c1e39a..864b277 100644
|
||||
--- a/src/application.vala
|
||||
+++ b/src/application.vala
|
||||
@@ -21,6 +21,7 @@ namespace Clocks {
|
||||
public class Application : Adw.Application {
|
||||
const OptionEntry[] OPTION_ENTRIES = {
|
||||
{ "version", 'v', 0, OptionArg.NONE, null, N_("Print version information and exit"), null },
|
||||
+ { "background", 'b', 0, OptionArg.NONE, null, N_("Start in the background"), null },
|
||||
{ (string) null }
|
||||
};
|
||||
|
||||
@@ -37,6 +38,7 @@ public class Application : Adw.Application {
|
||||
private uint world_clocks_id = 0;
|
||||
private Window? window;
|
||||
private List<string> system_notifications;
|
||||
+ private bool background = false;
|
||||
|
||||
private Window ensure_window () ensures (window != null) {
|
||||
if (window == null) {
|
||||
@@ -97,7 +99,15 @@ public class Application : Adw.Application {
|
||||
base.activate ();
|
||||
|
||||
var win = ensure_window ();
|
||||
- win.present ();
|
||||
+
|
||||
+ // The first activation will toggle the background flag to false
|
||||
+ // That way the next activation (of other instances)
|
||||
+ // will cause the window to display
|
||||
+ if (background) {
|
||||
+ background = false;
|
||||
+ } else {
|
||||
+ win.present ();
|
||||
+ }
|
||||
}
|
||||
|
||||
protected override void startup () {
|
||||
@@ -117,6 +127,13 @@ public class Application : Adw.Application {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ // This allows the primary instance to start in the background
|
||||
+ // Any subsequent instances will cause the window to display
|
||||
+ // Even if they pass in the background argument
|
||||
+ if (options.contains ("background")) {
|
||||
+ background = true;
|
||||
+ }
|
||||
+
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Autostart gnome-clocks in background mode for alarms
|
||||
Exec=/usr/bin/gnome-clocks -b
|
||||
Terminal=false
|
||||
X-GNOME-AutoRestart=true
|
||||
X-GNOME-HiddenUnderSystemd=true
|
||||
@@ -0,0 +1,208 @@
|
||||
Patch-Source: https://gitlab.gnome.org/GNOME/gnome-clocks/-/merge_requests/344
|
||||
---
|
||||
From 21e24df2987484d7ac2af61cb6e28e7b40cf320e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
|
||||
Date: Wed, 16 Apr 2025 10:56:05 +0200
|
||||
Subject: [PATCH 1/2] build: Add gmobile
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Will be simpler once we can rely on a released version
|
||||
|
||||
Signed-off-by: Guido Günther <agx@sigxcpu.org>
|
||||
---
|
||||
.gitignore | 1 +
|
||||
build-aux/flatpak/org.gnome.clocks.json | 18 ++++++++++++++++++
|
||||
meson.build | 21 +++++++++++++++++++++
|
||||
src/meson.build | 2 ++
|
||||
subprojects/gmobile.wrap | 5 +++++
|
||||
5 files changed, 47 insertions(+)
|
||||
create mode 100644 subprojects/gmobile.wrap
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 0b94280d..778c3502 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -4,3 +4,4 @@ _build
|
||||
.vscode
|
||||
.flatpak-builder/
|
||||
.flatpak/
|
||||
+subprojects/gmobile/
|
||||
diff --git a/build-aux/flatpak/org.gnome.clocks.json b/build-aux/flatpak/org.gnome.clocks.json
|
||||
index d0a5a730..c9dd09f7 100644
|
||||
--- a/build-aux/flatpak/org.gnome.clocks.json
|
||||
+++ b/build-aux/flatpak/org.gnome.clocks.json
|
||||
@@ -43,6 +43,24 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
+ {
|
||||
+ "name": "gmobile",
|
||||
+ "buildsystem": "meson",
|
||||
+ "config-opts": [
|
||||
+ "-Dexamples=false",
|
||||
+ "-Dintrospection=true",
|
||||
+ "-Dvapi=true",
|
||||
+ "-Dgtk_doc=true",
|
||||
+ "-Dtests=false"
|
||||
+ ],
|
||||
+ "sources": [
|
||||
+ {
|
||||
+ "type": "git",
|
||||
+ "url": "https://gitlab.gnome.org/World/Phosh/gmobile.git",
|
||||
+ "branch": "main"
|
||||
+ }
|
||||
+ ]
|
||||
+ },
|
||||
{
|
||||
"name": "libgweather",
|
||||
"buildsystem": "meson",
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 1ff638c5..8e9dddba 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -23,6 +23,27 @@ endif
|
||||
gnomedesktop = dependency('gnome-desktop-4')
|
||||
libgeoclue = dependency('libgeoclue-2.0', version: '>=2.4')
|
||||
libadwaita = dependency ('libadwaita-1', version: '>=1.6.alpha')
|
||||
+gmobile = dependency('gmobile', version: '>= 0.3.0', required: false)
|
||||
+
|
||||
+if not gmobile.found()
|
||||
+ gmobile_project = subproject(
|
||||
+ 'gmobile',
|
||||
+ version: '>= 0.3.0',
|
||||
+ default_options:
|
||||
+ [ 'examples=false',
|
||||
+ 'introspection=true',
|
||||
+ 'vapi=true',
|
||||
+ 'gtk_doc=false',
|
||||
+ 'tests=false'
|
||||
+ ]
|
||||
+ )
|
||||
+ gmobile = declare_dependency(
|
||||
+ dependencies: [
|
||||
+ gmobile_project.get_variable('gmobile_dep'),
|
||||
+ gmobile_project.get_variable('gmobile_vapi')
|
||||
+ ]
|
||||
+ )
|
||||
+endif
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
math = cc.find_library('m', required: false)
|
||||
diff --git a/src/meson.build b/src/meson.build
|
||||
index 344781c8..a219326e 100644
|
||||
--- a/src/meson.build
|
||||
+++ b/src/meson.build
|
||||
@@ -56,6 +56,7 @@ clocks_vala_args = [
|
||||
|
||||
clocks_c_args = [
|
||||
'-include', 'config.h',
|
||||
+ '-DGMOBILE_USE_UNSTABLE_API',
|
||||
'-DGWEATHER_I_KNOW_THIS_IS_UNSTABLE',
|
||||
'-DGNOME_DESKTOP_USE_UNSTABLE_API',
|
||||
]
|
||||
@@ -63,6 +64,7 @@ clocks_c_args = [
|
||||
clocks_dependencies = [
|
||||
glib,
|
||||
gio,
|
||||
+ gmobile,
|
||||
gobject,
|
||||
gtk,
|
||||
gweather,
|
||||
diff --git a/subprojects/gmobile.wrap b/subprojects/gmobile.wrap
|
||||
new file mode 100644
|
||||
index 00000000..db820e0e
|
||||
--- /dev/null
|
||||
+++ b/subprojects/gmobile.wrap
|
||||
@@ -0,0 +1,5 @@
|
||||
+[wrap-git]
|
||||
+directory=gmobile
|
||||
+url=https://gitlab.gnome.org/World/Phosh/gmobile.git
|
||||
+revision=main
|
||||
+depth=1
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 450af33d051feaa5412e3b7db9198387cb6fe2d2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
|
||||
Date: Wed, 16 Apr 2025 10:56:59 +0200
|
||||
Subject: [PATCH 2/2] alarm: Use wakeup timer
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This will take the system out of suspend when needed. If not activated
|
||||
via systemd (which allows to preserve CAP_WAKE_ALARM) it needs:
|
||||
|
||||
sudo setcap 'cap_wake_alarm=ep' _build/src/gnome-clocks
|
||||
|
||||
Signed-off-by: Guido Günther <agx@sigxcpu.org>
|
||||
---
|
||||
src/alarm-item.vala | 28 +++++++++++++++++++++++++++-
|
||||
1 file changed, 27 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/alarm-item.vala b/src/alarm-item.vala
|
||||
index 27968f75..22ccee58 100644
|
||||
--- a/src/alarm-item.vala
|
||||
+++ b/src/alarm-item.vala
|
||||
@@ -16,6 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
+using Gm;
|
||||
|
||||
namespace Clocks {
|
||||
namespace Alarm {
|
||||
@@ -69,6 +70,13 @@ private class Item : Object, ContentItem {
|
||||
|
||||
public AlarmTime time { get; set; }
|
||||
private GLib.DateTime? _ring_time;
|
||||
+ private uint wakeup_id;
|
||||
+
|
||||
+ private void on_wakeup_timeout () {
|
||||
+ debug ("Boottime alarm fired");
|
||||
+ wakeup_id = 0;
|
||||
+ /* TODO: take suspend inhibitor */
|
||||
+ }
|
||||
|
||||
[CCode (notify = false)]
|
||||
public GLib.DateTime? ring_time {
|
||||
@@ -87,6 +95,24 @@ private class Item : Object, ContentItem {
|
||||
notify_property ("active");
|
||||
}
|
||||
notify_property ("ring-time");
|
||||
+
|
||||
+ if (wakeup_id > 0) {
|
||||
+ GLib.Source.remove (wakeup_id);
|
||||
+ wakeup_id = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (_ring_time != null) {
|
||||
+ var now = new GLib.DateTime.now ();
|
||||
+ var seconds_left = (ulong)(ring_time.difference (now)) / 1000 / 1000;
|
||||
+ debug (@"Scheduling wakeup in $seconds_left seconds");
|
||||
+ try {
|
||||
+ wakeup_id = Gm.wakeup_timeout_add_seconds_once_full (GLib.Priority.DEFAULT,
|
||||
+ seconds_left,
|
||||
+ on_wakeup_timeout);
|
||||
+ } catch (GLib.Error e) {
|
||||
+ critical ("Failed to schedule wakeup for alarm: %s", e.message);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +157,7 @@ private class Item : Object, ContentItem {
|
||||
|
||||
public string time_label {
|
||||
owned get {
|
||||
- // FIXME: Format the time without creating GLib.DateTime
|
||||
+ /* FIXME: Format the time without creating GLib.DateTime */
|
||||
var wallclock = Utils.WallClock.get_default ();
|
||||
var now = wallclock.date_time;
|
||||
var dt = new GLib.DateTime (wallclock.timezone,
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
From 6e906c1de7bc5442ca2232d851e20bfc2c02ed98 Mon Sep 17 00:00:00 2001
|
||||
From: Clayton Craft <clayton@craftyguy.net>
|
||||
Date: Fri, 19 Nov 2021 18:52:03 -0800
|
||||
Subject: [PATCH 1/3] cmake: add install target
|
||||
|
||||
This adds a simple install target to install the compiled binary + dbus
|
||||
conf file.
|
||||
|
||||
The intention is to simplify distro packaging, building/installing will
|
||||
be similar to most other projects that use cmake.
|
||||
---
|
||||
CMakeLists.txt | 11 +++++++++++
|
||||
src/CMakeLists.txt | 11 ++---------
|
||||
2 files changed, 13 insertions(+), 9 deletions(-)
|
||||
create mode 100644 CMakeLists.txt
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 0000000..245bb10
|
||||
--- /dev/null
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -0,0 +1,11 @@
|
||||
+cmake_minimum_required(VERSION 3.5)
|
||||
+project(waked LANGUAGES CXX)
|
||||
+
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
+
|
||||
+find_package(sdbus-c++ REQUIRED)
|
||||
+
|
||||
+add_subdirectory(src)
|
||||
+
|
||||
+install(FILES de.seath.Waked.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/etc/dbus-1/system.d/")
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index a24e527..a89508d 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -1,12 +1,5 @@
|
||||
-cmake_minimum_required(VERSION 3.5)
|
||||
-
|
||||
-project(waked LANGUAGES CXX)
|
||||
-
|
||||
-set(CMAKE_CXX_STANDARD 17)
|
||||
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
-
|
||||
-find_package(sdbus-c++ REQUIRED)
|
||||
-
|
||||
add_executable(waked main.cpp alarm.cpp)
|
||||
|
||||
target_link_libraries(waked PRIVATE SDBusCpp::sdbus-c++)
|
||||
+
|
||||
+install(TARGETS waked DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From 6facb897036eb2fe4dd5b066b51f3120e52f7e03 Mon Sep 17 00:00:00 2001
|
||||
From: Jane Rachinger <jane400@bingo-ev.de>
|
||||
Date: Tue, 13 Jun 2023 22:13:58 +0200
|
||||
Subject: [PATCH 2/3] Include typedef for uint64_t, fixes compilation
|
||||
|
||||
---
|
||||
src/alarm.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/alarm.h b/src/alarm.h
|
||||
index ad32676..c7107e2 100644
|
||||
--- a/src/alarm.h
|
||||
+++ b/src/alarm.h
|
||||
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define ALARM_H
|
||||
|
||||
#include <string>
|
||||
+#include <cstdint>
|
||||
|
||||
class Alarm
|
||||
{
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
From 1ed6ba38f2b7f9161164d7fadf4245972e150c68 Mon Sep 17 00:00:00 2001
|
||||
From: Jane Rachinger <jane400@bingo-ev.de>
|
||||
Date: Tue, 13 Jun 2023 22:14:16 +0200
|
||||
Subject: [PATCH 3/3] use relative times for broken RTCs
|
||||
|
||||
---
|
||||
src/main.cpp | 16 ++++++++++------
|
||||
1 file changed, 10 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/main.cpp b/src/main.cpp
|
||||
index f781fff..f448e88 100644
|
||||
--- a/src/main.cpp
|
||||
+++ b/src/main.cpp
|
||||
@@ -34,11 +34,15 @@ std::list<Alarm> alarmList;
|
||||
sdbus::UnixFd suspendDelayLockFd;
|
||||
|
||||
|
||||
-void writeToRTC(std::uint64_t data) {
|
||||
+void writeToRTC(std::uint64_t data, bool relative) {
|
||||
std::cout << "Writing to RTC: " << data << std::endl;
|
||||
std::ofstream rtc("/sys/class/rtc/rtc0/wakealarm");
|
||||
if (rtc.is_open()) {
|
||||
- rtc << data << std::endl;
|
||||
+ if (relative) {
|
||||
+ rtc << "+" << data << std::endl;
|
||||
+ } else {
|
||||
+ rtc << data << std::endl;
|
||||
+ }
|
||||
} else {
|
||||
std::cout << "ERROR: Couldn't open RTC to write" << std::endl;
|
||||
}
|
||||
@@ -69,8 +73,8 @@ void rescedule()
|
||||
if (alarmList.size()) {
|
||||
uint64_t localReadFromRTC = readFromRTC();
|
||||
if ((localReadFromRTC > alarmList.front().getTime()) || (!localReadFromRTC)) {
|
||||
- writeToRTC(0);
|
||||
- writeToRTC(alarmList.front().getTime());
|
||||
+ writeToRTC(0, false);
|
||||
+ writeToRTC(alarmList.front().getTime() - now, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,7 +99,7 @@ std::string removeAlarm(const std::string& id)
|
||||
if ((alarmList.size())
|
||||
&& (alarmList.front().getId() == id)
|
||||
&& (alarmList.front().getTime() == readFromRTC())) {
|
||||
- writeToRTC(0);
|
||||
+ writeToRTC(0, false);
|
||||
}
|
||||
|
||||
alarmList.remove_if([id](Alarm &a){return id == a.getId();});
|
||||
@@ -123,7 +127,7 @@ void handleSuspend(const bool active) {
|
||||
std::time_t now = std::time(nullptr);
|
||||
if ((alarmList.size()) && (alarmList.front().getTime() < now + 10UL)) {
|
||||
std::cout << "Next alarm too close. Wake up in 10 Seconds ..." << std::endl;
|
||||
- writeToRTC(now + 10UL);
|
||||
+ writeToRTC(10UL, true);
|
||||
}
|
||||
suspendDelayLockFd.reset();
|
||||
} else {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Revived from Alpine since it's required by gnome-clocks standby alarm support on openrc
|
||||
pkgname=waked
|
||||
pkgver=0.1.1
|
||||
pkgrel=4
|
||||
license="GPL-2.0-or-later"
|
||||
pkgdesc="Waked is a daemon which lets Apps wake the system from suspend at requested times"
|
||||
arch="all"
|
||||
url="https://gitlab.com/seath1/waked"
|
||||
makedepends="cmake samurai sdbus-cpp-dev"
|
||||
source="https://gitlab.com/seath1/waked/-/archive/v$pkgver/waked-v$pkgver.tar.bz2
|
||||
waked.initd
|
||||
0001-cmake-add-install-target.patch
|
||||
0002-Include-typedef-for-uint64_t-fixes-compilation.patch
|
||||
0003-use-relative-times-for-broken-RTCs.patch
|
||||
"
|
||||
subpackages="$pkgname-openrc"
|
||||
options="!check" # No test suite
|
||||
builddir="$srcdir/$pkgname-v$pkgver"
|
||||
|
||||
build() {
|
||||
if [ "$CBUILD" != "$CHOST" ]; then
|
||||
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
|
||||
fi
|
||||
cmake -B build -G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DBUILD_SHARED_LIBS=True \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
$CMAKE_CROSSOPTS
|
||||
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="$pkgdir" cmake --build build --target install
|
||||
install -Dm755 "$srcdir"/waked.initd "$pkgdir"/etc/init.d/waked
|
||||
|
||||
mkdir -p "$pkgdir"/usr/share/dbus-1/system.d/
|
||||
mv "$pkgdir"/etc/dbus-1/system.d/* "$pkgdir"/usr/share/dbus-1/system.d/
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
8d0c3d659e7e8a8f4d8c0462871a234931d0e915935cdd119f79a8059ac74baba22ce9d12c1a376cad232a7ef79a8bdd35392f04c435ad8653ec8947ed170c37 waked-v0.1.1.tar.bz2
|
||||
04364b519d7266859b151a12178c68e5837c8b6310f6b1ca7920d4163970dfd6310a7c4816ec81d0bfbd8ab9c9e93168ad5ef473b8ebc69304da45c0ca196f11 waked.initd
|
||||
2de6b05dc8dcb5c526c2d419c022a728029dac390926413078eaf9347d7e018e73aa285256882bbbf35ecbdc2f0f277c3eff17ad5238e97e6e38d9bdaf310539 0001-cmake-add-install-target.patch
|
||||
a932f341cafce2ef14112f1dd53888fea941ad2adfa5ff420ab8ef7ec10c08fd7afadbe0d2f0a8aba1cab963dc0a25d55daffb331f539879420d551106fce143 0002-Include-typedef-for-uint64_t-fixes-compilation.patch
|
||||
38d14cabea4cde437f7825d86a628040ae0c0e37b380cf48da2364c0607a7fcf9746884299468b9f86f1c34dd80fadf6a3d37b98ff1fb18bbf9e31f7dc2733ea 0003-use-relative-times-for-broken-RTCs.patch
|
||||
"
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/sbin/openrc-run
|
||||
name="wake daemon"
|
||||
description="wakes up system at times set by other applications"
|
||||
|
||||
command=/usr/bin/waked
|
||||
command_background=yes
|
||||
pidfile="/run/$RC_SVCNAME.pid"
|
||||
Reference in new issue
Block a user