This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Is it possible to maximise window with arrow keys?

Tags: None
(comma "," separated)
Eb_theKillerBunny
Registered Member
Posts
2
Karma
0
I am new to KDE and am wondering if it is possible to set up gnome/windows style window tiling shortcuts? I find the default setup fine with one exception, that being that I can't maximise a window using just windows(meta) and the arrow keys. On both gnome and windows, depending on how a window is currently tilled, either one or two presses of windows and up will maximise it. Is it possible to achieve this in KWin?

I can find nothing online nor can I see a logical way to achieve it though the shortcut manager.

I am running Arch Linux and and Wayland using all defaults. I have installed all packages recommended in the Arch wiki page on KDE (plasma, kde-applications, sddm, sddm-kcm, plasma-wayland-session).

Any help would be greatly appreciated.
dzon
Registered Member
Posts
493
Karma
3
EDIT: Before you read this...I totally misread your post. I thought you needed a button. My bad. Although intresting, the following is useless in this case. ;D

Yes. Since I sometimes switch to a tiling mode, the lack of an easy switch is a pain. I believe 5.27 will come with soething of the likes but I'm not sure.
Anywho, as an example I'll take Bismuth. Since I use the active window control widget, I don't need titlebars and as such no max/mi/close buttons. But the principle is the same.
Stick with me, cause it's quite elaborate. Remember, this is for BISMUTH.

1) You need to set the keybind shortcuts in the system settings first.
2) You need to create an executable script. Like so:


#!/bin/bash
current=`kreadconfig5 --file kwinrc --group Plugins --key bismuthEnabled`

if [ $current = "true" ]; then
kwriteconfig5 --file kwinrc --group Plugins --key bismuthEnabled false
elif [ $current = "false" ]; then
kwriteconfig5 --file kwinrc --group Plugins --key bismuthEnabled true
fi

qdbus org.kde.KWin /KWin reconfigure

3) You need to install xdotool ( a must have key emulator)
4) You need to make desktop file(s) which go in ~/.local/share/applications. For instance, toggle a tile layout ( the executable points to the script):

[Desktop Entry]
Comment[nl_BE]=
Comment=
Exec=/home/john/Scripts/Toggle
GenericName[nl_BE]=toggle
GenericName=toggle
Icon=bismuth-kcm
MimeType=
Name[nl_BE]=Toggle Tiler
Name=Toggle Tiler
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

At this point you have a desktop application that toggles and untoggles a tile layout. You can put the thing on your desktop, menu, panel or a jgmenu if you should use that.

Now, if you want a bunch of clickable desktop files for the tiler, you need, again, make desktop applications. They to go in ~/.local/share/applications. But this time, the executables are done with xdotool key (key combo assigned to them). For example, a quarter layout:

[Desktop Entry]
Comment[nl_BE]=
Comment=
Exec=/home/john/Scripts/Toggle
GenericName[nl_BE]=toggle
GenericName=toggle
Icon=bismuth-kcm
MimeType=
Name[nl_BE]=Toggle Tiler
Name=Toggle Tiler
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

So, in the same manner you can create an entire bunch of tiling actions. You can create a dropdown menu for it if you like on your panel or wherever.

Now. You can also create a service menu for it. Either as several actions, or a simple toggle tile layout. Such a file goes in ~/.local/share/kservices5/ServiceMenus. The executives will be the same as for the desktop applications.

[Desktop Entry]
Type=Service
Icon=align-vertical-top
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all;
Actions=ToggleTiler
X-KDE-Priority=TopLevel
#X-KDE-Submenu=
Encoding=UTF-8

[Desktop Action ToggleTiler]
Name=ToggleTiler
Icon=align-vertical-top
Exec=/home/john/Scripts/Toggle

To summarize, there's a bunch you can do. First, set the keybinds and the rest are some files. As for maximizing the window with an arrow key, that's a setting in system settings. https://imgur.com/a/cF1ZPx4


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
dzon
Registered Member
Posts
493
Karma
3
So, what tiling do you mean? The regular default? The snap tiling? In either case, the default max window is meta + page up. If you want meta+arrow up, you need to reasign it.
Myself, especially since I don't use titlebars, I use the active control widget with mouse gestures.I'm kind of a keyboard hater.https://imgur.com/a/yE3YfrF
Active window control. There are other solutions, but imo, this is the best. https://store.kde.org/p/998910


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
Eb_theKillerBunny
Registered Member
Posts
2
Karma
0
Sorry I have not been clear enough. What I am looking for is simply window snapping not tiling. For example when I press windows+left then windows+up I get a window snapped in the top left corner despite there not being an explicit shortcut set for that. That is what I am hoping for with maximising. I have attached a series of images showing what I am thinking of.
Starting with a floating window (1), windows+up will snap it to the top (2). Then when snapped to the top (2) windows+up a second time will maximise the window (3).
(1) https://imgur.com/KFZNIQX
(2) https://imgur.com/OcYodUz
(3) https://imgur.com/kNAC5BB
Is there any way of achieving this?
dzon
Registered Member
Posts
493
Karma
3
Oooo, ok. I see. I have a couple of custom keybinds on my openbox setups for tiling, like:
<keybind key="A-Right">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<x>1/2</x>
<y>0</y>
<width>50%</width>
<height>97%</height>
</action>
</keybind>

The placement of the windows is defined by X/Y. But that's openbox.

I don't think it's currently possible in plasma. I know they're going to implement a new kind of tiling in 5.27 and maybe it'll have those options, dunno. Maybe there's a tiling kwin script available that has keyboard options. Again, dunno. Although... you might have a look at kzones:https://github.com/gerritdevriese/kzones, https://store.kde.org/p/1909220. I'm taking a quick look...https://imgur.com/a/oJEHTVF

The tiler/snapper I use is bismuth. It comes with a few preset layouts and toggling, moving etc is by custom shortcuts. But I think you're looking for a more.."preset" layout. So, maybe kzones is what you want. There might be others, dunno.


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kesang, Yahoo [Bot]