summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2022-06-02 17:44:25 +0200
committerMarge Bot <marge-bot@gnome.org>2022-07-28 09:04:45 +0000
commit8d8694fd082b9a7e106a6d7067eac373ce18e90e (patch)
tree3a002b3713231b9de43878c1c84f133a43b392ef
parente883046c5fee859a6a6dcf8bc15ca07e9fb4c9c2 (diff)
downloadmutter-8d8694fd082b9a7e106a6d7067eac373ce18e90e.tar.gz
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>
-rwxr-xr-xtools/get-state.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/get-state.py b/tools/get-state.py
index 79d017346..b721e3d4e 100755
--- a/tools/get-state.py
+++ b/tools/get-state.py
@@ -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]