Skip to content

Conversation

@arebaka
Copy link

@arebaka arebaka commented May 30, 2025

This pull request adds support for JSON-formatted output via the -j flag for the following commands:

  • makoctl list
  • makoctl history

When the flag is provided, the output is serialized as JSON, making it easier to consume in scripts and external tools.

Changes:

  • Added -j flag parsing to relevant CLI commands
  • Implemented recursive serialization of D-Bus sd_bus_message structures into valid JSON
  • Supports:
    • Basic types: string, bool, byte, int32, uint32
    • Variants (v)
    • Dictionaries (a{sv}, a{ss})
    • Arrays (a[...])
  • Safely escapes strings and handles nested containers

Example usage:

makoctl list -j | jq .
makoctl history -j | jq '.[].summary'

Tested:

  • Output is valid JSON (verified with jq)
  • Handles all expected fields: summary, app-name, urgency, actions, etc
  • Works with nested and complex D-Bus structures

Motivation:

This makes makoctl significantly more script- and automation-friendly, especially for use in status bars, dashboards, or notification diagnostics.

Closes #580
CC: @arebaka

@parisni
Copy link

parisni commented Jul 30, 2025

really nice, hope json output could be restored soon on mako

@onion108
Copy link

looking forward for this to be merged!

@aphelei
Copy link

aphelei commented Jan 6, 2026

works well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

makoctl: re-introduce JSON output

4 participants