Bug 477147 - Window titles are cut off if they contain a hyphen
Summary: Window titles are cut off if they contain a hyphen
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Task Manager and Icons-Only Task Manager (show other bugs)
Version: 5.27.8
Platform: Kubuntu Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-17 15:58 UTC by Alex Lowe
Modified: 2023-12-02 04:57 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Lowe 2023-11-17 15:58:41 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Install pycharm
2. Clone a git project with a hyphen in its name (e.g. https://github.com/canonical/craft-cli)
3. Open the project in pycharm

OBSERVED RESULT
Window title in the icons-only task manager calls the window "craft"

EXPECTED RESULT
Window title should be "craft-cli — [filename]"

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kubuntu 23.10
(available in About System)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.27.8
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Using the "Detect Window Properties" item in System Settings's window rules segment shows the correct window title.

This occurs both on Wayland on my laptop (running Kubuntu Mantic) and on xorg on my desktop (running KDE Neon)
Comment 1 Nate Graham 2023-11-17 17:59:40 UTC
Heh, we use the hyphen to cut of the app name, but it looks like we're inappropriately looking for the first one rather than the last one.
Comment 2 Bug Janitor Service 2023-11-23 10:49:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1861
Comment 3 Niccolò Venerandi 2023-11-23 10:51:10 UTC
(In reply to Nate Graham from comment #1)
> Heh, we use the hyphen to cut of the app name, but it looks like we're
> inappropriately looking for the first one rather than the last one.

We do look for the last one, it's just that Pychar uses – instead of — or - (they're all different). I added that dash to the list and, just for sure, also checked for whitespace before it.
Comment 4 Niccolò Venerandi 2023-11-25 12:25:43 UTC
Git commit dbc0d28dd5adcf2cb36fe44fabef7ecdb7b1d52f by Niccolò Venerandi.
Committed on 25/11/2023 at 13:23.
Pushed by niccolove into branch 'master'.

In Task Manager tooltips, only match dash if it follows a space

Since some applications might have a project with a dash in the name,
such as "python-Project", we only match "-" in the tooltip of Task Manager
(to extract the project name) if there's a space before it. We also start
tracking for –, which is a different type of dash compared to -.

M  +2    -2    applets/taskmanager/package/contents/ui/ToolTipInstance.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/dbc0d28dd5adcf2cb36fe44fabef7ecdb7b1d52f