Page 1 of 1

Help to move outside window - Gnome

Posted: Sat Feb 13, 2016 12:30 pm
by holzhacker
Friends,

Anyone out there know how I can move an external window in Linux Desktop to another (another monitor)?

I believe in the API have something, but I'm not finding anything.

I need to move the PureBasic Debugger window to another desktop to slightly improve the working environment

I would appreciate any help.

Re: Help to move outside window - Gnome

Posted: Sat Feb 13, 2016 7:07 pm
by Oma
Hello Romerio,
i don't know a way to do this with gtk or gdk on external windows - what doen't mean there isn't one. But Linux is very strict in such things.

But maybe you can use 'wmctrl' for your needs. It controls the most important windows managers.
If you don't have it installed, use i.e. 'sudo apt-get install wmctrl'.
You can use it from terminal or from PureBasic with RunProgram().

And now i'm not sure what you really want? :?:
If you want to move the PB Debugwindow to another Desktop No, here's an example which you should modify for your need.

Code: Select all

;this needs 'wmctrl' !!!
Debug "";                                         opens the PB-Debugger-Window for demonstration

Global.i gProgrammId
Global.i gToDesk    = 0;                          desired desktop number - numbers starts from '0'
;Global.s gWinTitle  = "Debugger-Ausgabe";         german, full title not required! PB-Debugger title depends on language
Global.s gWinTitle  = "Debug Output";             english,  "

;Delay(500)
; '-r' specifies a window by the title
; '-t' moves specified window to desktop no x
gProgrammId= RunProgram("wmctrl", "-r " + #DQUOTE$ + gWinTitle + #DQUOTE$ + " -t " + Str(gToDesk) , "", #PB_Program_Hide)
I can't test an adaption to move the window to another monitor, but it could work like this:

Code: Select all

;this needs 'wmctrl' too!!!
;replace the 'MainMonitorWidth' within the RunProgramm-command with your main (left) monitor width, i.e. 1920, or more ...
;so the window should shift to the right monitor. If not, i can't help.
gProgrammId= RunProgram("wmctrl", "-r " + #DQUOTE$ + gWinTitle + #DQUOTE$ + " -e 0,MainMonitorWidth,-1,-1,-1", "", #PB_Program_Hide)
For more infos see http://linux.die.net/man/1/wmctrl

So, maybe it will help you
Regards, Charly

Re: Help to move outside window - Gnome

Posted: Mon Feb 15, 2016 5:06 pm
by holzhacker
Thank you Oma, :D

Solved the problem, I will make a tool for IDE that will automatically move the Debugger window to another monitor, I'll do it for windows also make available ... and soon it may be also useful for someone.

I was moving the windows to monitors every running ... and this is very annoying.
Below as I work ... now I'm going to automate.

Image