darkstego / Mudeer

KDE Plasma Screen Splitting Shortcuts ideal for Ultrawide and Super-Ultrawide Monitors
MIT License
157 stars 13 forks source link

Request: Center 2/3 and Center 3/4 settings #12

Closed CypherDragon closed 1 year ago

CypherDragon commented 1 year ago

I really love this script, it adds like 90%+ of the functionality I'm looking for. One thing I think is missing is a 2/3 and 3/4 window that's centered. I know there probably isn't many people that would use this, but I certainly would. I'm a complete noob with javascript, so I can read .js, but I'm lost on how to add these options myself...

darkstego commented 1 year ago

Can you please explain what you mean by the 2/3 and 3/4 window that is centered? Do you mean the middle window that occupies 2/3 or 3/4 screen? Because in the by thirds split you get to modify the width of the middle window. So you can expand it to whatever width you want.

CypherDragon commented 1 year ago

Sure, I would like a windows that is the same size as the 2/3 right and 2/3 left options, but centered on the screen rather than on the right or left edge.

I know I can use the center split options (half or 1/3) and then manually expand the width to what I want, but my ADD tells me it's never quite centered...I also have the same thing when using the 2/3 right (or left) script, and then manually dragging the window to the center. It's never quite centered, and it gives my ADD fits trying to get it "right".

Personally, I would likely only use the 2/3 option, I added 3/4 after scrolling through the code and seeing the 3/4 options in there.

I fully realize this is an option that might only ever be used by me, and I would be happy to submit it myself if I understood js well enough to do so...but the bulk of my knowledge is in python, and even that is pretty small.

darkstego commented 1 year ago

So, in the script's options, there is an adjustment for the middle third width. Instead of it occupying just the middle third, you can put any arbitrary pixel size increase. So instead of manually adjusting the middle third width, you specify how many pixels you want to increase the middle segment by and it does it for you and also shrinks the left and right thirds to fit.

Personally this is the arrangement I use. Split by thirds with the middle third being bigger than the other two thirds.

CypherDragon commented 1 year ago

It seems that option isn't working correctly for me, even after removing mudeer and reinstalling it. I currently have the setting in the script option set for 2000 pixel increase, but it hasn't increased in size at all. I've also tried other values ranging from 20 pixels to 4000 pixels (seems to be the max I can input?) with no change...

Is there something I need to do other than simply saving the setting under Window Management --> KWin Scripts --> Mudeer?

CypherDragon commented 1 year ago

Sorry, figured that out that I have to log out and back in to refresh the script I guess...blah that'll be a pain for testing.

I have the middle third working with a larger window size now, but it also seems to add the same amount to the 2/3 options...is that correct behavior?

darkstego commented 1 year ago

Yes, the configuration changes the split points of the 1/3 and 2/3 splits. Not sure if this provides the best solution for different use-cases, but that is how it is setup currently.

As for the log out requirement, unfortunately that is how kwin scripts are. It is a pain to debug things this way.

CypherDragon commented 1 year ago

Yeaahhhhh...painful for debugging and changing configs. I share your pain there.

I use different window configs throughout the day, depending on what I'm doing...so the option to add a specific pixels to the center 3rd works for one part of my day, but then breaks when I use the 2/3 split for other tasks. Unfortunately that means the current setup doesn't really provide the flexibility I need, so my original request is still valid IMO.

Again, I realize it's a niche request, and don't expect it to be implemented like, right now...but if you do need to write other modifications, and this isn't too much of a burden, I would certainly appreciate it. If you have a kofi or other kind of account, I'd be more than willing to chip you a coffee or two for the change too.

darkstego commented 1 year ago

In that case, you could just add a custom shortcut with a custom Tile for the 2/3 middle split. Clone the git repo, and then in the javascript file, there is a function called registerMudeerShortcuts. In there you will find an array of all the different positions and their shortcuts. The Tile part defines the location of the window. The arguments are basically (x_position, y_position, x_number_of_total_segments, y_number_of_total_segments, x_number_of_segments_to_occupy, y_number_of_segments_to_occupy)

So to get a 2/3 in the middle you would add a line somewhere in the array that says something like

["Two-Thirds Middle",new Tile(1,0,6,1,4,1),"g"],

This will add a shortcut to "meta+g" for middle two-thirds.

Once complete you just run make install from the repo root and it should implement the changes (will likely require a bunch of logout and logins to get the changes to register).

Hope this helps.

CypherDragon commented 1 year ago

The arguments are basically (x_position, y_position, x_number_of_total_segments, y_number_of_total_segments, x_number_of_segments_to_occupy, y_number_of_segments_to_occupy)

That's exactly what I was trying to figure out when I was looking at the code, and now it makes sense looking at it. I just wasn't able to make the leap from the argument names in the Tile function to the argument list in the registerMudeerShortcuts function. Still a long way from being able to do something like this myself, even in Python.

If I leave the hotkey as a null ( " " ) , will it still populate the settings UI and be able to be bound there? If so, I'll fork the repo and add that option (after testing it works, of course), and then submit a merge request.

darkstego commented 1 year ago

This has been added in the last commit.