PyQt detect virtual desktop change in x11 - pyqt

Is it possible to detect in PyQt if the user has switched from one virtual desktop to another? I can find out the current virtual desktop using wmctrl -d and switch to one using wmctrl -s N .. but if the user decides to switch in another way, can my app detect this?....

Related

Can I use same software after switching Window Manager or Desktop Environment in Linux

Suppose I am using Kubuntu.
So I have Kwin as Window Manager and
KDE as Desktop Environment.
I use VSCode and other software.
I am switching to other Desktop Environment and Window Manager alongside Kwin and KDE.
Note: This means I will have both KDE and other Desktop Environments installed on my computer and I will switch between these from login screen. [Same for window manager]
Now, If I switch to Cinnamon Desktop Environment or GNOME Desktop Environment or any other Desktop Environment.
or if I switch to i3, bspwm, dwm Tiling Window Manager or Fluxbox, Openbox Stacking/Floating Window Manager.
or switched both Desktop Environment and Window Manager.
Now can I use the same VSCode and other softwares on these different Desktop Environment and Window Manager? or do I need to install same software for each of these Desktop Environments and Window Managers?
All your self installed programs will work fine in whatever environment you choose.
For maximum compatibility, you should still prefer x11 over Wayland as display server - for example screen sharing in ms teams needs x11, last time I checked. This depends on your personal needs.
Although you can always start any program from a terminal, we usually like to have a graphical menu of some kind that lists all available GUI apps. Desktop environments all contain their own menu.
If you go down the window manager route, you are expected to install a launcher yourself (such as dmenu or rofi), and configure keyboard shortcuts to launch each one of your favorite apps.
I recommend watching DistroTube on YouTube for lots of good info about tiling window managers and Linux in general.

Windows 10: pin window only to a specific taskbar

I'm using multiple virtual desktops on Windows 10. Now I'd like to pin for example firefox to the taskbar on desktop 2. But the app icon is then visible on every desktop.
Is it possible to just show it on a specific desktop instead of every desktop?
It is impossible as of Windows 10 version 1909. Virtual desktops are a game of DWM cloaking, and there is no separate preferences/settings for different virtual desktops. See this.

Switch application fullscreen mode programmatically on Linux Mate / Ubuntu

I have an application that runs on a Raspberry Pi with Linux Mate and a touch screen. The normal users control the application via touch screen and should usually only see my application. I have defined a keyboard shortcut in Mate that allows me to toggle the fullscreen mode which can be used when I am remotely connected to the PI and have a keyboard.
From time to time it is, however, necessary for the normal user to access the desktop. Since the Raspberry Pi has no keyboard connected, the (local) user can't use the keyboard shortcut.
For this reason I would like to add a button to my application that would allow the user to toggle fullscreen mode.
As far as I understand this is a function of the Gnome 2 desktop (which Linux Mate uses). I have no idea how to access this from my program and can't find any information on it.
My application is written in .NET Core with Avalonia UI but the function would not necessarily have to be integrated in my application. I could as well call an external script or utility program.
Any idea how to accomplish this?
A friend gave me the tip to check out the wmctrl program. The sources of this program led me to the XLib or XCB library and setting the window to _NET_WM_STATE_FULLSCREEN.
I guess this could be done in .NET by P/Invoking the native lib. Then again it seems much easier to write a shell script that determines the windows ID and calls the wmctrl utility and call that script from the .net application.

Set foreground window for Windows program running under Wine

I'm looking for a way to programmatically manipulate a windows program running on Linux under Wine.
Is there something similar on Linux to the Windows SetWindowForeground win32 command?
A function that sets a window by name to the foreground, that will work with a Windows program running under Wine on Linux?
Doe's wine use X11? If so I may be able to utilize this answer, will experiment and circle back
In Linux application windows (including your wine apps window) are managed by your desktop environment's Window Manager (WM). The Window Manager controls how windows are placed and the controls which operate on the windows (resizing, minimize, maxize etc).
Unfortunately there is no standardised Window Manager the major desktop environments (GNOME, KDE etc) have developed their own Window Managers and some people run stand alone WMs like IceWM or more exotic tiling WMs etc.
KDE's WM is called KWin, Gnome's is Mutter, Unity uses Compiz (I think - haven't used Ubuntu for a long time).
When the WM is running in an X sesion it probably uses X11 API internally to raise and lower windows.
However most modern WMs will prevent userpace X calls from popping up windows (because of security concerns etc) You will need to use the WM's wrapper functions. I think Wayland (whenever it is finally available) will have a proper secure API so this shouldn't be an issue.
The short answer to your question is any program you write will likely need to be Windows Manager specific and you should consult the documentation for your WM.
Long Answer - there is a freedesktop.org standard called Extended Windows Manager Hints I'm not sure how good conformance to the spec is among differing WMs (major ones like Gnome and kDE should be good). The property you are interested in is Window State (NET_WM_STATE)
See: http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html
I hope that helps - my knowledge of WMs is probably outdated but should steer you in the right direction - I haven't really played around with WMs since GLX first came out and Compositing (wobbly windows and all that jazz) was in vogue.
You can use X11 window manager xdotool or X window manager wmctrl.
Consider the following scenario. A MS windows application titled WordWeb Installer running in wine on Ubuntu on workspace 2. Current workspace : 1. To switch to workspace 2 and focus the wine app execute
wmctrl -R wordweb or
xdotool windowactivate $( xdotool search --name wordweb )

change color of window in win 7

I'm using cygwin/X-Sever to ssh into several other machines and then open the same control pannels on each machine. Is it possible to color the Top window bar differently for each one? Either using X11 or windows?
Clientside: Win7 - Cygwin
Serverside: Unix & Linux
If you were using Linux as a client, this could be done clientside using a nice window manager like i3 by just applying a different window decoration style based on namespace.
Now because you're using Windows 7 with cygwin, my best guess is that you're using XWin for Xserver. I am not aware of built-in functionality to XWin that would allow you do to this easily client-side. You said you're opening remote "control panels" on each machine, but not if they are GUI or CLI applications.
For CLI applications, you can set the background and foreground colour on a remote xterm session when connecting with startxwin as the Examples section of the man page shows.
For GUI applications, the simplest solution may be to follow what I described in the first paragraph but server-side. Using ssh this would be easy to script, just set a custom window manager theme on the remote host for the application at runtime. Your remote host window manager's documentation should explain how to configure there.

Resources