Bring window of another application on top of all other application windows lazarus / 32-Linux ---------------------------------------------------------------------- Ricco42 · 2024-03-04 21:05 Hi guys, I try to bring a specific window of another application on top of all other application windows if I press a button in my application. My OS is Ubuntu 20.04.3 LTS. My code highlights the other application in the Bottom Panel and if it was minimized it restores the window but it is not on top of all other application windows. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [...]uses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,  xlib, x, ctypes, DateUtils;[...] procedure TForm1.Button4Click(Sender: TObject);var display: PDisplay;    fenster: TWindow;    root:TWindow;    standard_bildschirm:cint;    myevent:TXEvent;begin fenster:=$36000fc;  display := XOpenDisplay(nil); if (display = nil) then ShowMessage('Display Zugriff fehlgeschlagen :(');  standard_bildschirm:=DefaultScreen(displ ay);  root:=RootWindow(display,standard_bildschirm);  myevent._type:=C lientMessage; myevent.xclient.message_type:=XInternAtom(display,'_NET_ ACTIVE_WINDOW',false); myevent.xclient.window:=fenster; myevent.xclien t.format:=32;  XSendEvent(display,            root,            False,            VisibilityChangeMask            OR StructureNotifyMask          OR SubstructureRedirectMask            OR FocusChangeMask          OR PropertyChangeMask,            @myevent);  XMapWindow(display,fe nster);  XFlush(display);  XCloseDisplay(display); end; ---------------------------------------------------------------------- KodeZwerg · 2024-03-04 23:34 There is no need to crosspost on same forum, you could have asked within other topic that a mod moves it for you (if they wouldnt do on their own) At least on Windows OS it would violate the OS specific Window rules. "Bringing a Window on top of all others" via external 3rd party would cause troubles, imagine more than one app is running and do such, which Window will win? If such rule is same on your OS, or to be more specific your Window- Manager, that I can not tell. ---------------------------------------------------------------------- dbannon · 2024-03-05 09:03 wmctrl is a command line tool, installed by default on many Linuxes, available on almost all others. You can call it (as a process) from within your app and it will bring in any window you can identify to the forground. If you use Workspaces, it will move windows between workspaces for you too. Davo Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TSearchForm.MoveWindowHere(WTitle: string): boolean;{$ifdef LINUX}var    AProcess: TProcess;    List : TStringList = nil;    {$endif}begin  Result := False;    AProcess := TProcess.Create(nil);    AProcess.Executable:= 'wmctrl';    AProcess.Parameters.Add('-R' + WTitle);    AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];    try        AProcess.Execute;        Result := (AProcess.ExitStatus = 0);        // says at least one packet got back    except on        E: EProcess do debugln('Is wmctrl available ? Cannot move ' + WTitle);    end;    List := TStringList.Create;    List.LoadFromStream(AProcess.Output);       // just to clear it away.    List.Free;    AProcess.Free;end;        I have a feeling it has a problem with Wayland, not sure .... ---------------------------------------------------------------------- Ricco42 · 2024-03-12 17:57 @KodeZwerg: Sorry for crossposting. @dbannon: Thanks, works