Merge pull request #305092 from OPNA2608/init/lomiri/ayatana-indicator-power

This commit is contained in:
Sandro 2024-05-21 16:01:47 +02:00 committed by GitHub
commit b4bf5efd73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 116 additions and 1 deletions

View File

@ -72,6 +72,7 @@ in {
packages = (with pkgs; [
ayatana-indicator-datetime
ayatana-indicator-messages
ayatana-indicator-power
ayatana-indicator-session
]) ++ (with pkgs.lomiri; [
telephony-service

View File

@ -29,6 +29,7 @@ in {
packages = with pkgs; [
ayatana-indicator-datetime
ayatana-indicator-messages
ayatana-indicator-power
ayatana-indicator-session
] ++ (with pkgs.lomiri; [
lomiri-indicator-network

View File

@ -290,13 +290,14 @@ in {
# There's a test app we could use that also displays their contents, but it's abit inconsistent.
with subtest("ayatana indicators work"):
mouse_click(735, 0) # the cog in the top-right, for the session indicator
machine.wait_for_text(r"(Notifications|Time|Date|System)")
machine.wait_for_text(r"(Notifications|Battery|Time|Date|System)")
machine.screenshot("indicators_open")
# Indicator order within the menus *should* be fixed based on per-indicator order setting
# Session is the one we clicked, but the last we should test (logout). Go as far left as we can test.
machine.send_key("left")
machine.send_key("left")
machine.send_key("left")
# Notifications are usually empty, nothing to check there
with subtest("lomiri indicator network works"):
@ -304,6 +305,11 @@ in {
machine.wait_for_text(r"(Flight|Wi-Fi)")
machine.screenshot("indicators_network")
with subtest("ayatana indicator power works"):
machine.send_key("right")
machine.wait_for_text(r"(Charge|Battery settings)")
machine.screenshot("indicators_power")
with subtest("ayatana indicator datetime works"):
machine.send_key("right")
machine.wait_for_text("Time and Date Settings")

View File

@ -0,0 +1,107 @@
{ stdenv
, lib
, gitUpdater
, fetchFromGitHub
, nixosTests
, cmake
, dbus
, dbus-test-runner
, glib
, gtest
, intltool
, libayatana-common
, libnotify
, librda
, lomiri
, pkg-config
, python3
, systemd
, wrapGAppsHook3
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ayatana-indicator-power";
version = "24.1.0";
src = fetchFromGitHub {
owner = "AyatanaIndicators";
repo = "ayatana-indicator-power";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-VUDNy6pPOsjioV5UNiKm8dzYb02ZrZ8CiIiJmAoQYaM=";
};
postPatch = ''
# Replace systemd prefix in pkg-config query, use GNUInstallDirs location for /etc
substituteInPlace data/CMakeLists.txt \
--replace-fail 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)' 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir DEFINE_VARIABLES prefix=''${CMAKE_INSTALL_PREFIX})' \
--replace-fail 'XDG_AUTOSTART_DIR "/etc' 'XDG_AUTOSTART_DIR "''${CMAKE_INSTALL_FULL_SYSCONFDIR}'
# Path needed for build-time codegen
substituteInPlace src/CMakeLists.txt \
--replace-fail '/usr/share/accountsservice/interfaces/com.lomiri.touch.AccountsService.Sound.xml' '${lomiri.lomiri-schemas}/share/accountsservice/interfaces/com.lomiri.touch.AccountsService.Sound.xml'
'';
strictDeps = true;
nativeBuildInputs = [
cmake
intltool
pkg-config
wrapGAppsHook3
];
buildInputs = [
glib
libayatana-common
libnotify
librda
systemd
] ++ (with lomiri; [
cmake-extras
deviceinfo
lomiri-schemas
lomiri-sounds
]);
nativeCheckInputs = [
dbus
(python3.withPackages (ps: with ps; [
python-dbusmock
]))
];
checkInputs = [
dbus-test-runner
gtest
];
cmakeFlags = [
(lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "ENABLE_LOMIRI_FEATURES" true)
(lib.cmakeBool "ENABLE_DEVICEINFO" true)
(lib.cmakeBool "ENABLE_RDA" true)
(lib.cmakeBool "GSETTINGS_LOCALINSTALL" true)
(lib.cmakeBool "GSETTINGS_COMPILE" true)
];
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
passthru = {
ayatana-indicators = [ "ayatana-indicator-power" ];
tests.vm = nixosTests.ayatana-indicators;
updateScript = gitUpdater { };
};
meta = with lib; {
description = "Ayatana Indicator showing power state";
longDescription = ''
This Ayatana Indicator displays current power management information and
gives the user a way to access power management preferences.
'';
homepage = "https://github.com/AyatanaIndicators/ayatana-indicator-power";
changelog = "https://github.com/AyatanaIndicators/ayatana-indicator-power/blob/${finalAttrs.version}/ChangeLog";
license = licenses.gpl3Only;
maintainers = with maintainers; [ OPNA2608 ];
platforms = platforms.linux;
};
})