Skip to content

Commit

Permalink
Pass hints as environment to scripts (#440)
Browse files Browse the repository at this point in the history
* Pass hints as environment to scripts

* Fix formatting

---------

Co-authored-by: Erik Reider <[email protected]>
  • Loading branch information
SuperDuperDeou and ErikReider authored Mar 3, 2025
1 parent d0998d0 commit 20f41dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions man/swaync.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -728,5 +728,6 @@ SWAYNC_CATEGORY="SwayNC notification category"
SWAYNC_REPLACES_ID="ID of notification to replace"
SWAYNC_ID="SwayNC notification ID"
SWAYNC_SUMMARY="Notification summary"
SWAYNC_HINT_[NAME]="Value of the hint [NAME]"
```
#END scripting
5 changes: 5 additions & 0 deletions src/configModel/configModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ namespace SwayNotificationCenter {
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_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);
}
Expand Down

0 comments on commit 20f41dd

Please sign in to comment.