dhruv8sh / plasma6-desktop-indicator

Plasma 6 applet in order to show virtual desktops in a minimal way
GNU General Public License v3.0
23 stars 2 forks source link

Surrogate pair Nerdfont icons are not being rendered properly. #3

Open Jas-SinghFSU opened 2 months ago

Jas-SinghFSU commented 2 months ago

A lot of unicode characters such as the active dot are represented as a single utf-16 code (\u25cf for filled dot). However, nerd fonts let you have surrogate pair icons such as the pacman icon which in utf-16 is represented as \udb82\udfaf. These surrogate pairs are considered length 2 which makes them incompatible with the following TextField implementation where maximumLength is set to 1.

            QC2.TextField {
                id: activeDot
                QtLayouts.Layout.maximumWidth: 35
                maximumLength: 1
                text: Plasmoid.configuration.activeDot
                horizontalAlignment: TextInput.AlignHCenter
                visible: indicatorType.currentIndex == 0
            }        

Simply setting this to maximumLength: 2 makes icons such as the pacman nerd font icon (󰮯) compatible with this plasmoid. This would let us do cool things like set our desktop indicators to a pacman theme as seen in this pic... image

I can submit a PR if you would like.

dhruv8sh commented 2 months ago

I'll do you one better. I'll allow complete strings with string templates. And separate strings for the left and right part of the activated indicator.

Jas-SinghFSU commented 2 months ago

That works too, though I'm not sure I follow what you mean by "And separate strings for the left and right part of the activated indicator."

es-codes commented 2 months ago

I was gonna suggest this, but you beat me to it

dhruv8sh commented 2 months ago

I am currently working on exactly this. Do you think I should allow strings or just a toggle for surrogate pairs?

es-codes commented 2 months ago

I dont know the general public use, me personally, am still on 5.27 and using the 'virtual desktop bar' widget. I am waiting for my distro new ISO and am looking at the new widgets surging to see if I can reproduce my setup on KDE 6 already, and I saw yours.

image

I also use nerd fonts, I copy the icon from the website and paste him in the virtual desktop name in system settings, in the widget I just have to select to show the desktop name instead of a dot or number.

Sorry, dont know if that helps with your dilemma.

Jas-SinghFSU commented 2 months ago

I can't say this with certainty, but I don't see a downside of making this a string input. Waybar and other modules that have built in workspaces "widgets" accept strings as well for what it's worth. Additionally, the default KDE Plasma workspace widget lets you use the name of the virtual desktop which is essentially the same concept as allowing strings.

Jas-SinghFSU commented 2 months ago

@es-codes Nice bar, may I ask what modules you're using on the right side of the desktop-indicator plasmoid?

dhruv8sh commented 2 months ago

Perfect! Expect a new release today!

es-codes commented 2 months ago

@es-codes Nice bar, may I ask what modules you're using on the right side of the desktop-indicator plasmoid?

Sure, the musical note is 'Scriptinator', dont know if there is already a kde6 version, but essentially I use him to pass/pause music with mouse gestures. He will not show the album art or name of the song tho, I wanted a more minimalistic look on the bar, and put this information on the desktop. The config I used:

image

the other one is called 'weather report' .

dhruv8sh commented 2 months ago

I have run into a bit of a problem. QML does not seem to detect escape sequences. Maybe @es-codes can share the link to virtual desktop bar widget.

es-codes commented 2 months ago

Sure thing @dhruv8sh , here are the link to the original:

https://github.com/wsdfhjxc/virtual-desktop-bar

its a bit on the old side tho.

And here is the link to a modification of this widget made more recently:

https://github.com/AllJavi/virtual-desktop-bar

Its the one I am using right now.

Jas-SinghFSU commented 2 months ago

Would it be possible to view your WIP branch?