; Module/File: Desktops_GetWindowList.pb ; Function: Get window list on desktops (needs wmctrl) - Linux ; Author: Omi ; Date: Mar. 31, 2015 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- ; wmctrl must be installed !!! ; install: sudo apt-get install wmctrl EnableExplicit Global.i ProgrammId, I Global.s Output= "", gWinDeskData, gDesktop, gWinTitle ProgrammId = RunProgram("wmctrl", "-G -l", "", #PB_Program_Open | #PB_Program_Read) If ProgrammId While ProgramRunning(ProgrammId) If AvailableProgramOutput(ProgrammId) Output + ReadProgramString(ProgrammId) + #LF$ EndIf Wend CloseProgram(ProgrammId) Output= ReplaceString(Output, " ", " ") Debug "Window list, all desktops:" For I= 1 To CountString(Output, #LF$) gWinDeskData= StringField(Output, I, #LF$) gDesktop = StringField(gWinDeskData, 2, " ") gWinTitle= Mid(gWinDeskData, FindString(gWinDeskData, StringField(gWinDeskData, 3, " ")) + Len(StringField(gWinDeskData, 3, " "))) Debug gDesktop + " = " + gWinTitle Next I Else Debug "'wmctrl' not found!" EndIf ; IDE Options = PureBasic 5.42 LTS (Linux - x86) ; CursorPosition = 17 ; FirstLine = 9 ; EnableUnicode ; EnableXP