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

Focus on desktop (folder view) without using mouse?

Tags: None
(comma "," separated)
User avatar
danniken
Registered Member
Posts
91
Karma
0
Hello, I am using KDE 4.10.2 under Fedora 17 (among others), and have my desktop set to "folder view".

While I can place a "show desktop" entry in the "Alt - Tab" menu, I cannot navigate around the desktop with my keyboard without first clicking on it with the mouse. Being a keyboard-oriented person, it is rather cumbersome to have to reach up to use the mouse just to click on the desktop to be able to use it with the keyboard.

Is there any way to establish focus on the desktop without having to click on it with the mouse? Thanks.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I'm not sure if there is a built in way between KWin and Plasma Desktop to ensure the folder view receives focus. However, you could try simulating a mouse click.
Code: Select all
xte 'mouseclick 1'

You could setup a custom shortcut, and then invoke this shortcut, which should then trigger a change of focus to the desktop.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
danniken
Registered Member
Posts
91
Karma
0
Thanks cooks, it looks like that is part of the "xautomation" package, which is available for my system. I'll play around with that and see if something works. One thing though, is there a command for the "show desktop" (besides the one on "Alt-Tab"? I will need some way to have the desktop shown before xte can click on it (figuring this will all be done in a small bash script).

I can set a shortcut to "Show Desktop" in the KWin shortcuts menu, but what command would one use in a script for this?

The odd part about the focus is that it goes to the desktop if I go back to the desktop after using an open window (desktop in focus -> use open window --> return to desktop with desktop retaining focus), but it seems that opening up a new window kills the focus and I have to re-click on the desktop. So it looks like there is something about opening up a new window that kills the desktop focus.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Hmm. I've just checked and unfortunately it seems that this is not scriptable as such.
You might be best to set the KWin shortcut for "Show Desktop" and simulate a keypress for this using your script as well.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
danniken
Registered Member
Posts
91
Karma
0
Thanks cooks, I was able to make a script using the xte package to get my focus onto the desktop. I used xdotool for the mouseclicks, but xte did the same thing.

#! /bin/bash

xte 'sleep 1'
xte 'keydown Alt_R' 'key F9' 'keyup Alt_R'
xte 'mousemove 60 60'
xdotool click 1
xte 'mousemove 180 60'
xdotool click 1


The script is called through the application launcher, which points to the script in the Command line, and is activated with a keyboard shortcut. "Alt_R+F9" is the KWIN shortcut for "Show Desktop"

The sleep command was necessary in order to get it to work reliably, and one second is the smallest value permitted. I don't know why it requires two seperate mouse moving and clicking events, but without the second one it would only get to the desktop but not focus.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Not a problem. Thanks for publishing your script so others can use it.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

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