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

Switch focus between displays

Tags: None
(comma "," separated)
raghuramv
Registered Member
Posts
2
Karma
0

Switch focus between displays

Fri Sep 02, 2016 12:23 pm
Is there any way configure a shortcut to switch focus between displays. I searched a lot on internet but in vain :( (I mean to switch the cursor between displays)
raghuramv
Registered Member
Posts
2
Karma
0

Re: Switch focus between displays

Tue Sep 27, 2016 11:11 am
I solved this by writing a python script. Someone may find it useful.
Code: Select all
import subprocess
import shlex
proc = subprocess.Popen(["xdotool getmouselocation"], stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
x = int(out.split(':')[1].split(' ')[0])
if x > 1920:
    x = 960
else:
    x = 2880
subprocess.call(shlex.split("xdotool mousemove --screen 0 " + str(x) + " 540"))
proc = subprocess.Popen(shlex.split("xdotool getmouselocation --shell"), stdout=subprocess.PIPE)
(out,err) = proc.communicate()
window_name = out.split()[3].split('=')[1]
subprocess.call(shlex.split("xdotool windowactivate "+ window_name), stdout=subprocess.PIPE)


Bind which ever key combination you want to this script. Key binding is very easy in KDE. You should easily be able to find it in global keyboard shortcuts.


Bookmarks



Who is online

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