mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
tools/get-state: Add --short
Often, most of the output consists of a long list of exposed modes for each monitor. If --short is passed, only pass modes that has properties. In practice, this means "preferred" modes, "current" modes, and similarly special cases, which significantly reduces noise. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2448>
This commit is contained in:
parent
e883046c5f
commit
8d8694fd08
@ -16,6 +16,7 @@ class Source(enum.Enum):
|
||||
parser = argparse.ArgumentParser(description='Get display state')
|
||||
parser.add_argument('file', metavar='FILE', type=str, nargs='?',
|
||||
help='Read the output from gdbus call instead of calling D-Bus')
|
||||
parser.add_argument('--short', action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -25,6 +26,8 @@ if args.file:
|
||||
else:
|
||||
source = Source.DBUS
|
||||
|
||||
short = args.short
|
||||
|
||||
type_signature = '(ua((ssss)a(siiddada{sv})a{sv})a(iiduba(ssss)a{sv})a{sv})'
|
||||
variant_type = GLib.VariantType.new(type_signature)
|
||||
|
||||
@ -106,7 +109,15 @@ for monitor in monitors:
|
||||
properties = monitor[2]
|
||||
print_data(0, is_last, lines, 'Monitor {}'.format(spec[0]))
|
||||
print_data(1, False, lines, f'EDID: vendor: {spec[1]}, product: {spec[2]}, serial: {spec[3]}')
|
||||
print_data(1, False, lines, f'Modes ({len(modes)})')
|
||||
|
||||
mode_count = len(modes)
|
||||
if short:
|
||||
modes = [mode for mode in modes if len(mode[6]) > 0]
|
||||
print_data(1, False, lines,
|
||||
f'Modes ({len(modes)}, {mode_count - len(modes)} omitted)')
|
||||
else:
|
||||
print_data(1, False, lines,
|
||||
f'Modes ({len(modes)})')
|
||||
|
||||
for mode in modes:
|
||||
is_last = mode == modes[-1]
|
||||
|
Loading…
Reference in New Issue
Block a user