; Module/File: Window_MoveForeignToMonitorNo.pb ; Function: Moving an foreign window to another monitor - Linux ; Author: Omi ; Date: Feb. 12, 2016 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.40 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- ; depends on window manager ; wmctrl must be installed !!! ; install: 'sudo apt-get install wmctrl' EnableExplicit Global.i gProgrammId Global.s gMainMonitorWidth; Width of main monitor (= 1) ; for german language: voller Titel nicht nötig! PB-Debugger -Titel abhängig von Sprache ;Global.s gWinTitle = "Debugger-Ausgabe" ; for english language: full title Not required! PB-Debugger title depends on language Global.s gWinTitle = "Debug Output" Debug "I will be moved to Monitor #2 (if it exists)"; opens the PB-Debugger-Window for demonstration Delay(1000) ;Move to Monitor #2 ... ; the Debug-Window is moved to 'gMainMonitorWidth'= from main (left) monitor width to the right monitor ; see Misc/Monitor_GetMonitorNum.pb, Misc/Monitor_GetGeometries.pb ... If ExamineDesktops() > 1 gMainMonitorWidth= Str(DesktopWidth(0)) ;to move the window from monitor 2 to monitor 1 ... ; gMainMonitorWidth= Str(DesktopX(0)) gProgrammId= RunProgram("wmctrl", "-r " + #DQUOTE$ + gWinTitle + #DQUOTE$ + " -e 0,"+gMainMonitorWidth+",-1,-1,-1", "", #PB_Program_Hide) Else Debug "Only 1 monitor connected!" EndIf ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 3 ; EnableUnicode ; EnableXP