Sway: Pretty print swaymsg json output by default

Created on 31 Jul 2016  路  7Comments  路  Source: swaywm/sway

This feature was rejected from i3 because apparently michael wanted to not break programs that checked for exact json strings.

I could do it with a wrapper script, but it's nicer to have it built in.

What do you think?

Most helpful comment

I'm okay with pretty printing. Any program that depends on exact string matches for JSON output was written by an idiot anyway.

All 7 comments

I'm okay with pretty printing. Any program that depends on exact string matches for JSON output was written by an idiot anyway.

I also would like to see non-JSON pretty printing happen sometime, so you could do something like this:

$ swaymsg -ht get_outputs

DVI-I-1: 1920x1080+3840,0 x1
    Visible: true
    Active: true
    Primary: false
    Current workspace: 3
DVI-D-1: 1920x1080+0,0 x1
    Visible: true
    Active: true
    Primary: false
    Current workspace: 2
HDMI-A-1: 1920x1080+1920,0 x1
    Visible: true
    Active: true
    Primary: false
    Current workspace: 1

Would also be useful for inputs.

Sure, is yaml good enough for that?

No, machine readable isn't a goal of a human-friendly output mode.

Do we want the ipc itself to give pretty printed json to clients or just reparse and pretty print in swaymsg? I think you could make an argument for either way.

Better to have swaymsg do the pretty printing imo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dnkl picture dnkl  路  4Comments

mcmfb picture mcmfb  路  3Comments

Alphare picture Alphare  路  3Comments

aidanharris picture aidanharris  路  3Comments

WhyNotHugo picture WhyNotHugo  路  3Comments