kdotool icon indicating copy to clipboard operation
kdotool copied to clipboard

show desktop

Open cipitaua opened this issue 11 months ago • 11 comments

wwith kdotool is there any way to get the equivalent of wmctrl -k on on plasma wayland? e.g. working in a cron script

cipitaua avatar Jan 10 '25 11:01 cipitaua

There is a slotToggleShowDesktop function in kwin, so a corresponding command can be added to kdotool. But it's a toggle, and there seems to be no way to query the current state, so not exactly the same as -k on|off.

jinliu avatar Jan 10 '25 12:01 jinliu

In theory this should work: qdbus org.kde.KWin /KWin org.kde.KWin.showDesktop true

To query current state: qdbus org.kde.KWin /KWin org.kde.KWin.showingDesktop

Unfortunately the showDesktop method doesn't seem to work properly on my system for some reason (when invoked like this), it only flickers the windows.

As a workaround you could also set a global shortcut for the "Peek at Desktop" function and invoke it using ydotool.

krajj7 avatar Jan 10 '25 14:01 krajj7

I've found this is working:

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Show Desktop"

cipitaua avatar Jan 10 '25 14:01 cipitaua

wwith kdotool is there any way to get the equivalent of wmctrl -k on on plasma wayland? e.g. working in a cron script

Out of curiosity; why do you need to show desktop in a cron script?

piotr-dobrogost avatar Mar 27 '25 13:03 piotr-dobrogost

I have a script that updates the desktop background, and I would like it to show me it upon change

otherwise I would not notice :)

btw, it's just a bing image of the day, upscaled with upscayl and with a descriptive text superimposed using imagemagick. I can share it if you are interested

cipitaua avatar Mar 27 '25 13:03 cipitaua

Are you aware of Picture of the Day plugin which supports Bing and scaling? Image

And to notice wallpaper change wouldn't system notification be better (less intrusive) than showing desktop?

piotr-dobrogost avatar Mar 27 '25 14:03 piotr-dobrogost

I am aware of it, and used it for a while, but I was every time wondering what places are shown in the picture, so I've made the script to get that information superimposed:

Image

also, the bing images are 1920x1080, which visualized on my 1440p monitor result a bit blurred. So I have added upscayl in my script. The result is much better of what Picture of the Day plugin provides.

I could notice wallpaper change using kdialog, but I prefer to see it straightforwardly. That's a matter of tastes. In another machine I call the script upon wake from standby (typically every morning).

cipitaua avatar Mar 27 '25 15:03 cipitaua

I've made the script to get that information superimposed

Nice! If you can please share the script (maybe as a gist at https://gist.github.com/ ?).

piotr-dobrogost avatar Mar 27 '25 15:03 piotr-dobrogost

sure https://gist.github.com/cipitaua/c5dc39b069b264f671d7ce92f3be4c7b

cipitaua avatar Mar 27 '25 16:03 cipitaua

In another machine I call the script upon wake from standby (typically every morning).

What do you hook into to know that system has just woke up?

piotr-dobrogost avatar Jun 04 '25 08:06 piotr-dobrogost

What do you hook into to know that system has just waked up?

if you use systemd, you create a script /usr/lib/systemd/system-sleep/myprepost.sh with the following content (adjust it):

#!/bin/bash

case $1 in
    pre)
    # commands to be executed before suspend, hibernate, etc. goes below
    killall -q ssh
    ;;
    post)
    # commands to be executed after wakeup goes below
    service bluetooth restart #helps gamepad reconnection
    sudo -u taco /home/taco/bin/bing_image_of_the_day.sh force
    ;;
esac

otherwise if you use Networkmanager you can create a script /etc/NetworkManager/dispatcher.d/myprepost.sh with the following content (adjust it):

#!/bin/bash

[ "$1" == "enp7s0" ] && [ "$2" == "up" ] && sudo -u taco --set-home --preserve-env /home/taco/bin/bing_image_of_the_day.sh

exit 0

so that it will be executed upon network connection.

cipitaua avatar Jun 04 '25 10:06 cipitaua