Unverified Commit 20f41ddc authored by SuperDuperDeou's avatar SuperDuperDeou Committed by GitHub

Pass hints as environment to scripts (#440)

* Pass hints as environment to scripts * Fix formatting --------- Co-authored-by: 's avatarErik Reider <35975961+ErikReider@users.noreply.github.com>
parent d0998d02
...@@ -728,5 +728,6 @@ SWAYNC_CATEGORY="SwayNC notification category" ...@@ -728,5 +728,6 @@ SWAYNC_CATEGORY="SwayNC notification category"
SWAYNC_REPLACES_ID="ID of notification to replace" SWAYNC_REPLACES_ID="ID of notification to replace"
SWAYNC_ID="SwayNC notification ID" SWAYNC_ID="SwayNC notification ID"
SWAYNC_SUMMARY="Notification summary" SWAYNC_SUMMARY="Notification summary"
SWAYNC_HINT_[NAME]="Value of the hint [NAME]"
``` ```
#END scripting #END scripting
...@@ -247,6 +247,11 @@ namespace SwayNotificationCenter { ...@@ -247,6 +247,11 @@ namespace SwayNotificationCenter {
spawn_env += "SWAYNC_REPLACES_ID=%s".printf (param.replaces_id.to_string ()); spawn_env += "SWAYNC_REPLACES_ID=%s".printf (param.replaces_id.to_string ());
spawn_env += "SWAYNC_TIME=%s".printf (param.time.to_string ()); spawn_env += "SWAYNC_TIME=%s".printf (param.time.to_string ());
spawn_env += "SWAYNC_DESKTOP_ENTRY=%s".printf (param.desktop_entry ?? ""); spawn_env += "SWAYNC_DESKTOP_ENTRY=%s".printf (param.desktop_entry ?? "");
foreach (string hint in param.hints.get_keys ()) {
spawn_env += "SWAYNC_HINT_%s=%s".printf (
hint.up ().replace ("-", "_"),
param.hints[hint].print (false));
}
return yield Functions.execute_command (exec, spawn_env, out msg); return yield Functions.execute_command (exec, spawn_env, out msg);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment