Resize only window width or height
Closed this issue · 6 comments
Hi and thank you for making this script, I have tried every major Kwin tiling scripts and this is by far the most reliable. The only thing I don't understand is how do you resize the width of a window without affecting its height? From my understanding the 'step' parameter changes both dimensions at the same time, is there some way to do so? Thanks
In case someone is interested you can get this behavior by declaring this function in Shortcut.qml
:
function dimensions() {
for (const [text, shortcut, amount] of [
['Decrease Width', 'Meta+Ctrl+Alt+H', -config.divider.step],
['Increase Width', 'Meta+Ctrl+Alt+L', config.divider.step],
['Decrease Height', 'Meta+Ctrl+Alt+J', -config.divider.step],
['Increase Height', 'Meta+Ctrl+Alt+K', config.divider.step],
]) {
register(text, shortcut, () => {
const client = workspace.activeClient;
const screen = manager.getScreen(client);
if (screen) {
if (text.toLowerCase().includes('width'))
screen.changeDivider(amount, client.lineIndex);
if (text.toLowerCase().includes('height'))
screen.lines[client.lineIndex].changeDivider(amount, client.clientIndex);
screen.render(client.screenIndex, client.desktopIndex, client.activityId);
}
});
}
}
(don't forget to call it in init()
below).
@lingtjien by any chance do you plan to add this kind of feature to the core?
Yeah, I've thought about it before, but I never came up with good default shortcut values so I never added them. I don't think h
,l
,j
,k
are great as shortcuts for this either since I would think that some people would use those already for movement related things (Vim style).
But perhaps, there is no good default shortcut for it and I should just add them bare, so people can add the shortcuts themselves if they want to use it
Yes the shortcut part is a real pain in general for tiling managers but I'm quite sure every one has to change them in some way to fully fill their needs anyway (since it usually needs around 10 or more of them it is very unlikely to have them available AND practical for any setup). With the rise of programmable keyboards and software like QMK I think this becomes less of an issue though, I usually take the stock shortcuts and bind then to a convenient key for me.
Also I might be wrong but I think KDE won't override already used shortcuts up on script installation anyway.
I'm currently implementing several features I need and what I really like about your script is that it almost behave like a tiling framework/API, nicely structured and clean to use (it would be perfect with a bit of documentation about how the base geometry is handled), so thanks and congrats!
Thanks for publishing the script. I too was looking for a way to resize only height and width. I think It would be a great addition. As @gterras mentioned, I too use programmable keyboard so this is easily integrated for me. If you dont know what should be the default shortcuts you can leave them blank in my opinion.
Try the dev branch
merged to master