Shortcut: switch focus to different monitor

I have 2 monitors that i use one to read and copy, the other one is to make note and paste… i often have to switch to upper monitor to control youtube video , pause and switch to lower (focus) monitor to make note. all these control i have no choice but to use mouse. if there is a shortcut key to do the switching of focus, then i don’t have to use mouse.

Is there a shortcut for switching to different monitor ? i have 2 monitors, 1 is upper and the other is lower location.
I have switch virtual desktop shortcut: ctrl+alt+left/ right
but i tested out most, can’t find any shortcut for switch monitor (which in my case is upper monitor and lower monitor)

tried: switch to screen 0 - 7
switch to window above and below
switch to one desktop up/ down…

nothing work in that aspect.

Don’t know what " move mouse to center " and “move mouse to focus” are good for *just saying

I’m not running dual monitors, so I cannot check this out, but I suspect that:

System Settings > Workspace > Shortcuts > System Services > KWin > Window to Next Screen

might do what you’re looking for. Maybe.

I tried.
windows to next screen: ctrl+alt+up -> apply
nothing. it does absolutely nothing.
i have “windows to next desktop” and previous desktop shortcut to ctrl+alt+shift + left/ right, which is used to " move the active window to next virtual desktop"…
so, according to that defination, “windows to next screen” simply should means “move the active window to next screen” what ever “screen” here means…
anyhow, nothing.
also i don’t want to move my active windows to another place, i just want to switch focus from on monitor to another so that i don’t have to grab my mouse for it.

Sorry, that was the only idea I had.

It is ok. appreciate it already.

1 Like

I am not sure this makes any sense. Monitors don’t get focus, windows are what gets the focus.

Why not use shortcuts to switch between applications?

how to do that ?
the 2 applications are located in different monitors…
if same monitor i can use 'alt+tab"

alt+tab shouldn’t be specific to a monitor unless you have set that somehow.

2 Likes

After a while, i realized alt+tab not the soln i am looking for.

I saw this thread, but sadly one of the required package is not available in arch.

https://askubuntu.com/questions/5278...witch-displays
linked to:


but, i can’t find “11-xserver-utils” on my arch based linux, hence i can’t use this git app.

If someone thinking “alt+tab” can do the trick, i will let this below to reply him

“I want to switch displays in dual-monitor setup, not windows. I have multiple applications open, and I don’t want to press alt-tab a lot of times until I reach the one on the other display”

I’m assuming you are using KDE? Here are some options to try. I can’t recommend any from personal experience, but these seem to be what you are looking for:

1 Like

Hi,

Thanks. I have tried all these shortcut, but can’t find any that is the right one. I think KDE does not have this option in mind. That’s why some ppl are using external small packages… just that i can’t find the dependancy for it.

Ah, I see that in my previous answer I suggested “Window to next screen” but I should have suggested “Switch to next screen.” :man_facepalming:

@andrew_ysk - will “Switch to next screen” work?

EDIT - never mind, you posted as I was typing. :grin:

2 Likes

@anon3337769
switch to next screen does nothing. :pleading_face:

arg… never mind… i guess there is no such option in design. have to depend on script and shortcut to the script… like the github above. someone in ubuntu asked the same thing… i am not capable of doing that scripting thing… so… i give up on this one. Hee hee… kde is not as what everybody claimed… tweak non ending … lol… i was taken a surprised when many ppl told me kde is no ending tweak… i thought i can’t use such a thing that have no ending options to tinker… i will go mad… LOL
Thx guys.

1 Like

I rarely see a configuration option in KDE that doesn’t work. I’m guessing either switch screen doesn’t mean what we think, or that it functions in a way we don’t yet understand.

I’m on a single screen laptop right now, but when I get back to one of my multi-monitor setups, I’ll play some and see if anything jumps out at me.

:slight_smile:

Edit: Some quick search-foo gives this link and, maybe, an idea to play with:

See the last post in that series.

2 Likes

@bkaplan
This is exactly the one i found.


but, i can’t find “11-xserver-utils” on my arch based linux, hence i can’t use this git app.

this Screen focus changer require both
xdotool
and
11-xserver-utils
but i can’t find 11-xserver-utils in arch

x11-server-utils is a metapackage that was removed from Arch a few years ago, but most (maybe all?) of the packages that it consisted of are available separately.

If you can figure out what specific sub-package (or packages) is/are needed, you can grab what you need.

It moves a window from one screen to another. Very useful.

“switching focus to a screen” is nonsensical.

I haven’t looked at the script but it probably looks at which window is in the foreground and switches focus to that window

2 Likes

This script eventually created by someone, so that we can do a custom shortcut to it… to switch monitor … but it is not perfect yet… because it is writtened for left right monitor, mine is up down monitor… i am not a programmer myself. hence… i can’t do it… the code is not like what i have learn of c++ long long time ago…
anyway, i abandon this idea… beyond my capability.

#!/bin/bash

getwindowat() {
    # move mouse to coordinates provided, get window id beneath it, move mouse back
    eval `xdotool mousemove $1 $2 getmouselocation --shell mousemove restore`
    echo $WINDOW
}

# get active app
active=`xdotool getactivewindow`
# get coordinates of an active app
eval `xdotool getwindowgeometry --shell $active`

# if left border of an app is less than display width
# (e.g. one display is 1920px wide, app has x = 200 - means it's 200px to the right from the left border of left monitor
# if it has x = 1920 or more, it's on the right window), it's on screen 0, and we need to focus to screen 1, otherwise to screen 0
(( $X >= $WIDTH )) && focustoscreen=0 || focustoscreen=1;

# get coordinates of the middle of the screen we want to switch
searchx=$[ ($WIDTH / 2) + $focustoscreen * $WIDTH ]
searchy=$[ $HEIGHT / 2 ]

# get window in that position
window=`getwindowat $searchx $searchy`
# activate it
xdotool windowactivate $window

Beyond my capability … if i know how to do these… i would be glad …lol :smile:

@dalto
@anon3337769
@bkaplan

Thanks guys, I got it working… never expect there is such feature!! Thanks Bkaplan. It is your KDE link that led to this work!
Tardy method of using “Switch to next screen” does not work because lack of a small detail.

System settings → Window behavior → Window Behavior (on the left side) → Separate screen focus [

After this setting is turned on , and switch to next screen JUST WORKED!

Thanks. Wonderful. Thanks Guys.

2 Likes