I'd like to fix virtual desktop names

Hello!

First of all, I hope I’m posting on the right category, but if not please let me know!

Now, virtual desktops are an amazing productivity tool but they have had an issue for the longest time – when switching between them, the popup that appears with their names always truncates at seemingly random spots.
For example, I have six virtual desktops – a main one, another for media, two for study and two for work. The main one gets cut off at the 6th letter, while for the media one it happens right on the 2nd. For the other two pairs (which are named something like “Study 1” and “Study 2”), it’s impossible to distinguish them by name since it gets cut off on the 3rd or 4th letter. And by getting cut off I mean getting truncated with some ellipsis added at the end.

I have looked for this on bugs.kde.org and found nothing. I thought this would be an excellent first thing to contribute to on the KDE project. Thus my question is, should I file a bug report first and then submit a patch or can I just submit a patch? I’m also unsure where in the code that problem really is, but I will have to do some more digging around :laughing:

Thank you!

You can just submit a patch

For this one you have to wait for someone else to answer

Alright, thank you!

Let’s see if anyone has some insight on where in the code this is done (gotta confess it is a bit confusing to find things in Plasma source hehe)

Dunno what system you’re on but, as long as it’s not solved, you might consider ( or rather, give a try) the virtual desktop bar widget. I’m not sure where exactly I got it from, I believe Github here. Anywho, the widget allows a serious bunch of settings. Maybe it could overwrite the issue you have currently.

Thank you for the suggestion, I may look into it!

However, I really want to fix this issue on Plasma’s baseline installation :slight_smile:
In the meanwhile, with the help of GitHub’s new code search (GitLab’s is unfortunately really subpar), I managed to track down the problematic file: src/scripts/desktopchangeosd/contents/ui/osd.qml · master · Plasma / KWin · GitLab
It seems the OSD’s width and height depends on the text element’s width and height, which in turn depend on the parent’s left and right anchor (and thus the width)… Something is triggering that Text.ElideRight where it shouldn’t.
I will try play around with some small examples and see how to fix it.

I’ve been playing around with simple QML files and qmlscene and can’t seem to replicate this eliding behaviour.

With the following scene:

Rectangle {
  Rectangle {
    color: "black"

    width: Math.ceil(textElement.implicitWidth)
    height: textElement.implicitHeight
    anchors.centerIn: parent

    Text {
      id: textElement

      anchors.left: parent.left
      anchors.right: parent.right

      color: "white"
      horizontalAlignment: Text.AlignHCenter
      elide: Text.ElideRight
      wrapMode: Text.NoWrap
      text: "foo bar baz bork"
    }
  }
}

Which is very similar to that osd.qml, the black rectangle always adjusts properly to the text size.
Maybe something isn’t properly calculated with different font sizes? Or maybe it’s something to do with PlasmaCore.Dialog? Will have to investigate further.