I have an app I’m trying to move a window that opens to the side using the top and left settings. No matter what I try, the windows appears dead center of the screen. It works as intended on all the desktop apps (Windows, MacOS and Linux).
I found a thread that mentioned you have to insure the window is visible before changing the position…that didn’t solve the issue.
Any suggestions?
Hello Steve,
There is a trick to make it work. Run the program with sudo.
I made a program called position with the following code in the open event:
Sub Opening() Handles Opening
self.Left = 150
Self.Top = 150
End Sub
On Raspberry Pi, running the program with the following command ignores global settings on Raspberry Pi:
./position
Running the program with sudo privileges allows some code, like window postion, to work
sudo ./position
The problem with sudo, is that your program is granted administrative privileges and has total control over the computer. Programs running on the Raspberry Pi are now using virtual environments to protect the Raspberry Pi Operating System.
I still have to compile the program on my Windows computer, and then copy the executables and libraries over to the Raspberry Pi to make sure the program runs, and is protected, the way that I want.
Hope this helps 
Edit: Added example file
position.zip (3.5 KB)
That does work but seems to cause some other issues with the program 
Shouldn’t have to run the program with sudo for something so simple. Any other suggestions?
Could you help me understand what other issues that are seen on the Raspberry Pi?

It is running a bit slow, but I suspect that’s because I’d disabled the hardware acceleration…I just figured I’d mention that.
I use mMutex in the app to prevent multiple copies from running. When I exit the app issuing a “quit” the app does exit, however If I try to start it again without sudo, my code with mMutex kicks in because it thinks a copy is still running. Then If I run it with sudo again, it will start right up. I haven’t had time to test every feature running with sudo, these are the main things I’ve noticed so far.
1 Like
Possibly related, window positioning does not seem to work in wayland. I have to set GDK_BACKEND=x11 to get it to work.
If you are going to play with using sudo, make sure that you pay attention to permissions. Files that you create and I believe mutexes will only be writeable by root.
Move the window in the Window open event, not the Application open event. Otherwise window initialisation will place it in the ‘specified location’ on the window properties.
This did not do the trick unless I use sudo to run the app.
Hi Steve,
I think your right about hardware selection and the speed of the Raspberry Pi.
Four configurations were tried with the positions program, and the only one that showed the controls properly was using sudo.
- using sudo ./position worked (although I had a XDG_RUNTIME_DIR error)
- using virtual environment did not show controls properly
- changing window position in virtual App opening event instead of Window opening event did not show controls properly
- changing window position in App opening event with sudo instead of Window opening event did not show controls properly
Of the four trial methods, only running the program with sudo privileges and allowing the Operating System to be controlled by the program works.
The reason why code runs in a virtual environment is to prevent conflicts with the operating system. I have had to reinstall Operating Systems too many times in a global environment. Virtual Environments take the pain out of troubleshooting libraries and programming. It seems like Xojo must have global (sudo) control on the Raspberry Pi for controls to work properly.
Edit: changed system to Operating System