 Hello and welcome to yet another episode of Nicolau tries to do something helpful with his life. In this episode I talk about how I implemented a new feature in KD Plasma or almost implemented, as it's a merge request, but I'm pretty sure it will get in very soon, that is a straight up copied from Windows 11, like the visual part of it, of course the code is different, but in this case it's a minor thing that I think could improve the experience of some Plasma users, so I thought, I mean, why not? It's not like the suus or anything. So what is it? You might know that Windows 11 now has this centered start menu and since that has happened, a lot of people have started trying to customize KD Plasma to look just like that, so actually centering their kickoff icons and the task manager, which is fine, it looks good and I mean, Chrome OS did it too, so what can I bring new to the table? Now the fact is that if you try to center kickoff and the task manager, which you can do, I've done a tutorial on how to do that, when you actually open the application manager, that is kickoff, the window, which I'm going to edit in KD in live, it's at the center of kickoff and of course due to the task manager existing, kickoff won't be at the very center of the screen, which means that the application launcher dialog won't be at the center of the screen either and that's the very simple idea, what if whenever there's an application, sorry, a widget inside a panel that is very close to the horizontal or vertical center of the screen and it's so close that it could be centered and would still cover the original applet, that is, if we just move it a bit to the right, it will still cover the kickoff icon, why don't we just set a hard rule to always center it in these scenarios? So I did that. How do you even try to approach implementing something like this? Because this is actually meant to be educational content, like you learning how to contribute to projects, so how do you approach this task? Okay, firstly, it's important to know what we're dealing with here. So all the things I've talked about this a lot, all the things that you usually see in KD Plasma, that is, the kickoff, all of the widgets that when you click on them and they open up a dialog, KRunner, the sidebar on the left, when you click on Admore widgets, all of these things are a single thing, 100 hood, which is called a dialogue. This dialogue is a very general thing that uses the KD Plasma theme to draw its background and it chooses to position itself in its own code, which is of course called dialogue.C++. Now the only thing in KD Plasma that really isn't a dialogue, even tooltips are dialogue, everything except for the panel. The panel is its own thing, it's not a dialogue. But we only care about dialogues, which is already a pretty good indication. And the side of that dialogue.C++, we only care about dialogues that come out from widgets. Because if you have a tooltip, then you still want to tooltip to be close to, you know, the icon you're hovering and not in the middle of the screen, just because it's almost in the middle, what does that mean? Luckily, the dialogue has a series of classes. You just, I didn't know about them, so I just looked at the dialogue code and so that you can choose what class to give this dialogue. And one of these is indeed a applet. And you know, that means it's a dialogue that was opened by clicking a widget in the panel, which is what we want. At this point, we need to pick up the code where, which decides where to position the panel, the dialogue. And from this point on, it's not that hard. We firstly check if you're dealing with indeed an applet. And then that we check what's the distance between the middle of the dialogue, which is of course, left of the dialogue, plus half of the position, the distance from that to the center of the screen. And if that is less or equal than half of the dialogue, it means that it's close enough to still be able to be centered and cover what was meant to be, what actually opened up the applet. And that's just like that. We just say, okay, if this is the case, you set the x coordinate to be exactly half of the screen minus half of the width, because, you know, when you set the x coordinate, you set the leftmost point, which is always half a dialogue to the left of the center. So that is the merger quest. Just to finish up this video, I quickly want to mention, thanks to all of the patrons, this that you're currently seeing is how much I get paid. And my personal answer to that is not enough as always. So if you'd like to help me grow the channel, do more podcasts, do more KD development, fix more bugs, I'm really trying to fix a lot of bugs, as you can see on my channel. I have a lot of videos coming up about bug fixing. So if you like that, then feel free to pull up donations. And thank you so much. See you tomorrow with another video.