Main.activateWindow(window) cannot change the last interaction time of the window
# google translate
I am developing a gnome shell plugin, but when I call Main.activateWindow(window)
to activate the window, I can't change the order of the list returned by app.get_windows()
. I think it may be because he didn't change the last interaction of the window. time. But when I activate the window with the mouse or activate the window with atl+tab, the last interaction time is changed.
When there are two google-chrome windows, I can't use this function to properly activate the last displayed window, but instead activate the window that was last clicked by the mouse or received keyboard input.
function run() {
let app = appSys.lookup_app('google-chrome.desktop');
let windows = app.get_windows()
if (windows.length) {
if (windows[0].has_focus() && windows.length > 1) {
Main.activateWindow(windows[1]);
} else {
Main.activateWindow(windows[0]);
}
} else {
app.activate()
}
}
# Chinese
我正在开发一个gnome shell 插件,但是我调用Main.activateWindow(window)
激活窗口时不能正确的改变 app.get_windows()
返回的列表顺序,我想可能是因为他没有改变window的最后交互时间。但我用鼠标激活窗口或是用atl+tab激活窗口时,最后交互时间被改变。
当有两个google-chrome窗口时,我不能用此函数正确的激活最后显示的窗口,而是激活了最后被鼠标点击或是接收过键盘输入的窗口。
function run() {
let app = appSys.lookup_app('google-chrome.desktop');
let windows = app.get_windows()
if (windows.length) {
if (windows[0].has_focus() && windows.length > 1) {
Main.activateWindow(windows[1]);
} else {
Main.activateWindow(windows[0]);
}
} else {
app.activate()
}
}