gnomeExtensions.lunar-calendar: fix usability (#352896)

This commit is contained in:
Donovan Glover
2025-02-07 19:15:22 +00:00
committed by GitHub
2 changed files with 64 additions and 0 deletions
@@ -1,5 +1,7 @@
{ lib
, fetchFromGitLab
, fetchzip
, cpio
, ddcutil
, easyeffects
, gjs
@@ -18,6 +20,8 @@
, procps
, smartmontools
, replaceVars
, stdenvNoCC
, substituteAll
, touchegg
, util-linux
, vte
@@ -110,6 +114,35 @@ super: lib.trivial.pipe super [
];
}))
(patchExtension "lunarcal@ailin.nemui" (old: let
chinese-calendar = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "chinese-calendar";
version = "20240107";
nativeBuildInputs = [
cpio # used in install.sh
];
src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "Nei";
repo = "ChineseCalendar";
tag = finalAttrs.version;
hash = "sha256-z8Af9e70bn3ztUZteIEt/b3nJIFosbnoy8mwKMM6Dmc=";
};
installPhase = ''
runHook preInstall
HOME=$out ./install.sh
runHook postInstall
'';
});
in {
patches = [
(substituteAll {
src = ./extensionOverridesPatches/lunarcal_at_ailin.nemui.patch;
chinese_calendar_path = chinese-calendar;
})
];
}))
(patchExtension "pano@elhan.io" (final: prev: {
version = "v23-alpha3";
src = fetchzip {
@@ -0,0 +1,31 @@
diff --git a/backend/ytliu0-loader.js b/backend/ytliu0-loader.js
index 4862c17..25fe9e8 100644
--- a/backend/ytliu0-loader.js
+++ b/backend/ytliu0-loader.js
@@ -8,7 +8,11 @@ import GLib from 'gi://GLib'
// Code from gnome-shell 44 : extenstionUtils.js:installImporter
let custom_importer
const origSearchPath = imports.searchPath.slice()
-imports.searchPath = [GLib.get_user_data_dir(), ...GLib.get_system_data_dirs()]
+imports.searchPath = [
+ GLib.get_user_data_dir(),
+ ...GLib.get_system_data_dirs(),
+ '@chinese_calendar_path@/.local/share'
+]
try {
// importing a "subdir" creates a new importer object that doesn't affect
// the global one
diff --git a/backend/ytliu0.js b/backend/ytliu0.js
index 94abd2c..df6241b 100644
--- a/backend/ytliu0.js
+++ b/backend/ytliu0.js
@@ -60,7 +60,8 @@ class LunarDateX {
const [ok, file] = this._holidayData.load_from_dirs(holiday_fn, [
GLib.get_user_config_dir(),
GLib.get_user_data_dir(),
- ...GLib.get_system_data_dirs()
+ ...GLib.get_system_data_dirs(),
+ '@chinese_calendar_path@/.config'
], GLib.KeyFileFlags.KEEP_TRANSLATIONS)
if (this._notifyHoliday)
this._notifyHoliday()