Bug 485146 - kscreen-doctor output cannot be easily used in bash scripts anymore
Summary: kscreen-doctor output cannot be easily used in bash scripts anymore
Status: RESOLVED NOT A BUG
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-06 18:50 UTC by Xwang
Modified: 2024-04-06 23:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xwang 2024-04-06 18:50:06 UTC
SUMMARY
Kscreen-doctor -o output has changed in a way that makes it easier to read for a human, but more difficult to integrate in bash scripts.

Before I was able to get the names of external and internal monitors using these bash script lines:

TMP_EXT_MONITOR_NAME=$(kscreen-doctor -o | grep 'DisplayPort' | grep connected | cut -d ' ' -f 3)
TMP_INT_MONITOR_NAME=$(kscreen-doctor -o | grep 'Panel' | grep connected | cut -d ' ' -f 3)
echo "Internal monitor is: $TMP_INT_MONITOR_NAME"
echo "External monitor is: $TMP_EXT_MONITOR_NAME"

because each output information was in a single line.
Now the information of every monitor are split in multiple lines.

STEPS TO REPRODUCE
1.  Execute the four bash script lines above
2.  Read the displayed names

OBSERVED RESULT
It is not possible to read display names

EXPECTED RESULT
Before it was possible to read display names because all display nformations where on the same line

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.8.2-arch2-1 (64-bit)
Graphics Platform: Wayland
Processors: 12 × 12th Gen Intel® Core™ i5-1240U
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: Dell Inc.
Product Name: Latitude 9330

ADDITIONAL INFORMATION
Is it possible to add a command line option to obtain the previous output format?
Comment 1 fanzhuyifan 2024-04-06 23:12:10 UTC
The -j option gives json output, which programs can handle easily.