From e8b957a4dced07ba04bb0e3749e6ce2acb651a4e Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 21 Sep 2024 12:24:25 +0000 Subject: [PATCH] megapixels-next: make it the default camera --- hosts/common/programs/megapixels-next.nix | 6 +++++- hosts/common/programs/megapixels.nix | 4 ++++ hosts/common/programs/sane-input-handler/sane-input-handler | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hosts/common/programs/megapixels-next.nix b/hosts/common/programs/megapixels-next.nix index 652c9c0e8..e81d45295 100644 --- a/hosts/common/programs/megapixels-next.nix +++ b/hosts/common/programs/megapixels-next.nix @@ -17,8 +17,12 @@ postInstall = (base.postInstall or "") + '' mv $out/bin/megapixels $out/bin/megapixels-next - rm $out/share/applications/me.gapixels.Megapixels.desktop + substituteInPlace $out/share/applications/me.gapixels.Megapixels.desktop \ + --replace-fail "megapixels" "megapixels-next" \ + --replace-fail "Name=Megapixels" "Name=Megapixels-Next" ''; }); + + env.CAMERA = "me.gapixels.Megapixels.desktop"; }; } diff --git a/hosts/common/programs/megapixels.nix b/hosts/common/programs/megapixels.nix index b6e112ffe..7584334bf 100644 --- a/hosts/common/programs/megapixels.nix +++ b/hosts/common/programs/megapixels.nix @@ -50,5 +50,9 @@ # sandbox.keepPidsAndProc = true; suggestedPrograms = [ "dconf" ]; #< not sure if necessary + + # until `env.` supports priorities, leave it unset and let megapixels-next + consumers figure out the default camera app + # mime.priority = 200; #< fallback + # env.CAMERA = lib.mkDefault "org.postmarketos.Megapixels.desktop"; }; } diff --git a/hosts/common/programs/sane-input-handler/sane-input-handler b/hosts/common/programs/sane-input-handler/sane-input-handler index 640720319..40243df03 100755 --- a/hosts/common/programs/sane-input-handler/sane-input-handler +++ b/hosts/common/programs/sane-input-handler/sane-input-handler @@ -58,6 +58,7 @@ # increments to use for volume adjustment (in %) VOL_INCR=5 KEYBOARD="${KEYBOARD:-wvkbd-mobintl}" +CAMERA="${CAMERA:-org.postmarketos.Megapixels.desktop}" action="$1" @@ -228,7 +229,7 @@ dispatchOn() { ;; "power_and_voldown") # power (hold) -> voldown: open camera - handleWith sane-open --auto-keyboard --application org.postmarketos.Megapixels.desktop + handleWith sane-open --auto-keyboard --application "$CAMERA" ;; "power_then_volup") # power (tap) -> volup: rotate CCW