Skip to content

Commit

Permalink
Store environment variables with the localization for the macOS notif…
Browse files Browse the repository at this point in the history
…ication in the launchd.plist, rather than passing it along as runtime parameters.
  • Loading branch information
michaelherger committed Sep 18, 2024
1 parent 7ac4f02 commit 92c7d4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Bin/darwin/check-update.pl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ BEGIN
my $pwd = File::Basename::dirname($0);

# new Menubar Item would pass localized strings for a notification
if (@ARGV) {
`LMS_NOTIFICATION_TITLE="$ARGV[0]" LMS_NOTIFICATION_CONTENT="$ARGV[1]" open $pwd/lms-notify.app`;
if ($ENV{LMS_NOTIFICATION_TITLE} && $ENV{LMS_NOTIFICATION_CONTENT}) {
`open $pwd/lms-notify.app`;
}
# legacy: run the preference pane
else {
Expand Down
17 changes: 12 additions & 5 deletions Slim/Utils/OS/OSX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,18 @@ sub initUpdate {
require File::Basename;
my $folder = File::Basename::dirname($script);

my $moreParams;
my $envVariables;
if (IS_MENUBAR_ITEM) {
$moreParams = sprintf("<string>%s</string>", Slim::Utils::Strings::string('SQUEEZEBOX_SERVER'));
$moreParams .= sprintf("<string>%s</string>", Slim::Utils::Strings::string('CONTROLPANEL_UPDATE_AVAILABLE'));
utf8::decode($moreParams);
$envVariables = sprintf(q(
<key>EnvironmentVariables</key>
<dict>
<key>LMS_NOTIFICATION_TITLE</key>
<string>%s</string>
<key>LMS_NOTIFICATION_CONTENT</key>
<string>%s</string>
</dict>
), Slim::Utils::Strings::string('SQUEEZEBOX_SERVER'), Slim::Utils::Strings::string('CONTROLPANEL_UPDATE_AVAILABLE'));
utf8::decode($envVariables);
}

print UPDATE_CHECKER qq(<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -401,8 +408,8 @@ sub initUpdate {
<key>ProgramArguments</key>
<array>
<string>$script</string>
$moreParams
</array>
$envVariables
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
Expand Down

0 comments on commit 92c7d4b

Please sign in to comment.