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

Shake desktop file

Tags: None
(comma "," separated)
dzon
Registered Member
Posts
493
Karma
3

Shake desktop file

Mon May 23, 2022 10:58 am
In case someone is interested. There's a kwin script called Shake. It allows to minimize all current windows to minimize EXCEPT the active one by shaking the active window. Kinda like "minimize all" except..
It's a cool script but I find it unpractical in my case since I don't do titlebars. So I made this desktop file with a similar effect which resides on my panel.
You'll need xdotool for this.
1) Make the script and make it executable:

#!/bin/bash

active_window_id=$(xdotool getactivewindow)
for window_id in $(xdotool search --onlyvisible ".*")
do
if [ $window_id != $active_window_id ]
then
xdotool windowminimize $window_id
fi
done

2) Make the desktop file pointing the executable to the script ( edit the icon to your likings) and put it in, say, ~/.local/share/applications:

[Desktop Entry]
Comment[nl_BE]=
Comment=
Exec=/home/john/Scripts/Shake.sh
GenericName[nl_BE]=shake
GenericName=shake
Icon=auto-transition
MimeType=
Name[nl_BE]=Toggle Shake
Name=Toggle Shake
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

3) drag that desktop file to your panel or something. Done.https://imgur.com/a/UQ9q8bX


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
dzon
Registered Member
Posts
493
Karma
3

Re: Shake desktop file

Mon May 23, 2022 11:29 am
As an alternative:
There's another kwin script that has kind of a similar behaviour, onlyone active window. That one does what it says on the tin, unactive windows are always minimized. It's cool, but not so handy when you DO need two or more visible windows. So, to overcome that, you'd need a switch to quickly toggle the kwin script on or off. So, same procedure, first a script and then a desktop file.

1) Script and make executable ( this one reads the kwinrc):

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

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

qdbus org.kde.KWin /KWin reconfigure

2) Desktop file in, say, ~/.local/share/applications

[Desktop Entry]
Comment[nl_BE]=
Comment=
Exec=/home/john/Scripts/onlyOne.sh
GenericName[nl_BE]=onlyOne
GenericName=onlyOne
Icon=auto-transition
MimeType=
Name[nl_BE]=Toggle onlyOne
Name=Toggle onlyOne
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

Edit the paths and icon,place it maybe on your panel and you're done. https://imgur.com/a/ZQgsDZL

So, if you should use one of these, the choice is yours. The first method starts with a "normal" desktop on which you minimize all inactives. The second one start with the active only and you toggle to have more than one window in case you need it.


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


Bookmarks



Who is online

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