简体   繁体   English

如何将另一个应用程序置于Linux上的GTK敏锐窗口之前?

[英]How to bring another application in front of a GTK sharp window on Linux?

I have an application built with GTK# for Linux that is NOT in full screen. 我有一个不是在全屏模式下用Linux的GTK#构建的应用程序。 Instead I've made it a borderless window that automatically becomes the size of the screen when started like so: 相反,我将其设置为无边界窗口,当启动时,窗口会自动变为屏幕大小,如下所示:

_window.Decorated = false;
_window.SetSizeRequest (_window.Screen.Width, _window.Screen.Height);
_window.Move (0, 0);

Now, when the program starts up I also launch xvkbd (or any keyboard, really) as this is meant to become a touchscreen application at some point like so: 现在,当程序启动时,我还启动了xvkbd(或任何键盘,实际上),因为它打算在某个时候成为触摸屏应用程序,如下所示:

xvkbd -always-on-top

If xvkbd is launched like this it will somehow appear behind my application anyway, despite not being "true" full screen. 如果像这样启动xvkbd,尽管它不是全屏的,它仍然会以某种方式出现在我的应用程序后面。 When decorations are turned on (so there's a border and such) it will appear in front of it properly but this is not what I want out of my application. 当装饰打开(因此有边框等)时,它将正确显示在它的前面,但这不是我想要从应用程序中得到的。

Does anyone know a way of making the keyboard appear in front of the application without making it a windowed application? 有谁知道一种使键盘出现在应用程序前面而不使其成为窗口应用程序的方法? I've tried using wmctrl to move the application to the front but this also does not work in the application. 我尝试使用wmctrl将应用程序移到最前面,但这在应用程序中也不起作用。

Answering relatively quickly after asking but I've solved my issue. 问完后相对较快地回答,但我已经解决了我的问题。

_window.Decorated = false;
_window.SetSizeRequest (_window.Screen.Width - 1, _window.Screen.Height - 1);
_window.Move (0, 0);
TerminalCommand ("pkill", "lxpanel");

This turns the border off, makes the window NOT full screen and also not borderless full screen (because it's 1 pixel off (not noticeable)). 这将关闭边框,使窗口不全屏显示,也不是无边界全屏显示(因为关闭了1个像素(不明显))。 I then move the window to the top left and I kill the taskbar. 然后,我将窗口移到左上角,然后杀死任务栏。 This allows me to invoke the keyboard by doing: 这使我可以通过执行以下操作来调用键盘:

TerminalCommandNoWait("xvkbd", "-always-on-top");

(TerminalCommand simply encapsulates a process that runs those commands in the linux terminal) (TerminalCommand只是封装了在Linux终端中运行这些命令的进程)

Because the window manager does not recognize this as a full screen application it will allow you use the keyboard application until the other application is clicked again (or "always on top" can be invoked on the keyboard application). 由于窗口管理器无法将其识别为全屏应用程序,因此它将允许您使用键盘应用程序,直到再次单击另一个应用程序(或可以在键盘应用程序上调用“始终位于顶部”)。

If you want the taskbar back when the application closes call "lxpanel" in the terminal (as a process in your application in quit). 如果您希望在应用程序关闭时返回任务栏,请在终端中调用“ lxpanel”(作为退出应用程序的过程)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM