Combining Configurable Button Widgets With Kwin's Shortcuts to Transform Your KDE Experience

If you are a KDE poweruser, you may already know and use one of KDE's most useful widgets: the configurable button. If you have never used these you will soon know how and if you apply all of what I am about to present, your experience of KDE will be smoother and more refined than it has ever been -- especially if your system (like mine) uses multiple displays.

The first time I ever used the configurable button widget for something was to insert an xrandr command in one of these buttons. I was amazed at how wonderfully it worked, changing my external monitor's screen display with just a click. Here it is:

xrandr --output VGA-1 --gamma .45:.50:.66.

On my dual monitor setup, my 13 inch Dell laptop monitor needed to be brightened up considerably. But this made my external monitor way to bright and I needed to tone it down. Every boot, I had to open a Konsole and run that command. Now all I have to do is click the button as soon as the desktop loads.

In this article I will take you way beyond that. I will show you how to use a plasma qdbus command to trigger with a mouse click any Kwin keyboard shortcut. I will even show you how to combine two or more shortcuts together and activate them with a mouse click. The one with three commands is my favorite:

  1. Move the window to the next monitor.
  2. Expand the window horizontally to the right.
  3. Vertically maximize that window. All done with one click.

Now that I have your attention let me show you how easy this is. All you need to know is a couple of qdbus commands.

First you need to visit the KDE Store, download and install the configurable buttons widget. Just click to install. Then at your desktop click on the menu to add a widget and type "Configurable". See it? Good. That is what you are going to be doing a lot of.

I am not a programmer. I got the qdbus commands courtesy of Luis Bocanegra via KDE Discuss. The first command is what you will need to find the names of all the possible Kwin keyboard shortcuts. Here it is:

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.shortcutNames

Open Konsole and put that command in it. When the huge list is generated, copy it to an editor for future reference.

I my case I was asking Luis how to move a window to the next screen. He replied I could trigger that shortcut by its Kwin shortcut name, inserted into a similar qdbus command. You do it like this:

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window to Next Screen";0

You can try this one to get you started. I like to add an ;0 at the end of all these, as suggested by the button itself. That is the whole command you put into a configurable window button. There are two places to enter the command. Use them both.

Your next job is to figure out which of your Kwin shortcuts you want to create. This will entail having to pick an icon. I use the actions set of icons. The menu says "all" but that is not true.

You can type in words like "go" or "move" to get suggestions. This may be the most time consuming part. I inserted a screenshot of this using GO as a search command so you can find arrows to use for moving windows left and right.

To save you some more time I am giving you several examples of ones I have created and use. They are listed below. May favorites are the ones which maximize the window vertically and expand it horizontally. You want to create a variety to reflect your needs and style.

Now let's try a two-fer command. This one is my favorite. It grows the window to the right, then maximizes it vertically. Note the semi colon separating the two. No space in between.

Here a list of commands you might want to paste into a configurable button. I use all these.

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Grow Horizontal";qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Maximize Vertical";0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window to Next Screen"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Maximize"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Maximize Vertical"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Shade"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Quick Tile Left"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Quick Tile Right"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Minimize"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window Grow Horizontal"; exit 0

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window No Border"; exit 0

Now that you have been testing out a bunch of newly made window control buttons, you no doubt notice something that I did: no two application windows open exactly the same. This is especially true if you have WINE installed for your Windows apps. This is partly why you need a variety of clickable buttons. The window did not maximize as you expected? A quick click of the maximize vertical button to the rescue. Watch the window behavior and click accordingly.

To keep window behavior consistent I try to do this: When a window opens, I place the left side where I want it, then click whatever buttons I need to.

Or, if you know an app always opens a certain way, such as on the right side of the screen, just go with that and drag the left edge out.

You will be experimenting a lot, but you will be refining your window control with more clickable buttons and have a lot of fun doing it.

Load Disqus comments