Transparent windows in Linux?

Is it possible to create a transparent window in Linux (Ubuntu & Raspbian)? I found some code in the Xojo examples folder called “WindowShape.xojo_binary_project” which may be the answer I’m looking for but it doesn’t seem to be working on my Ubuntu 18 system. When I run the program this is what I get:

Screenshot from 2022-10-22 14-48-30

After looking at the code I can only guess that the program is trying to replace the Red portions of the image with transparency which should leave a picture of a penguin floating on the screen. Since the code has no comments describing what the intended effect is I really don’t know for sure.

Anyway, can anyone advise as to how to create a transparent window?

-Wes

Here’s an example of why I want a transparent window:

I’ve circled the problematic areas. I would like the corners of my pop-up dialog to be transparent so that the unused corner portions of the dialog do not obscure the graphics below it.

This application is a small touch-screen home automation kiosk that really doesn’t fall into the category of a typical desktop GUI app and so I need a bit more control over the presentation.

-Wes

There are posts about the same topic in StackOverflow.

https://stackoverflow.com/search?q=transparent+window+[linux]

Seems transparent is not enough. Perhaps the example worked with older versions of Linux.

Perhaps MBS has something ? @Christian_Schmitz ?

From what you posted, I believe this UI could entirely be done in a canvas. That way you can draw your dialog without having to worry about corners.

OverlayMBS for linux is only half done. If there is interest, I may look into that again…

1 Like

That’s an interesting idea. I’ll have to work out how to handle the modality of the pop-up so that users can’t click any of the buttons on the underlying screen.

My experience with LINUX depends on Ubuntu 20.04 LTS 64b (and actual Ver. 22) with VMware ESXi, which shows the same real transparency as MacOs by using overlapping canvas and Listbox in background.

The pictures are prepared with a transparent layer as Gif (using Graphic Converter) and positioned in a front Canvas. Here also some animations are possible, twinking and thinking pony …

Please try UBUNTU in the newer version. Im am not a Linux-Expert, but my son is one and told me, that this distribution ist nearly perfect. My non professional skills are aimed at desktop applications with principles and practice of gamification …

best regards
Bernd

I’ve worked out the modality issue with my home-brew pop-up dialog. Building my own modal pop-up wasn’t as easy as using the built-in modal dialog but it yielded some benefits.

I made the modal pop-up out of a Container Control with an embedded Canvas Control. The Canvas Control holds a Label and two of my custom buttons.

When I need the pop-up, I stretch the Container Control to fill the entire screen and then draw my decorative frame within the Canvas Control. The Container Control implements MouseDown and MouseUp events which are empty and do nothing other than preventing the mouse events from falling thru the Container Control onto the controls beneath it.

The unanticipated benefit of this technique is that I can set the opacity of the Container Control to make all the elements beneath it appear to be dimmed. This effect forces your attention to the pop-up dialog. When the pop-up dialog is dismissed (hidden) the underlying controls brighten up again.

Here’s a video of the final result:

http://www.westhaver.com/guest_console.mp4

(please ignore the small white bar at the top of the video. It is an artifact from using VNC to bring the Raspberry Pi video to my desktop for recording)

I usually prefer not to roll my own solutions but sometimes it is necessary and in this case I like the final product much more than the usual built-in pop-up dialog mechanism.

-Wes

I wanted to finish this thread with a few final pictures of my project. The home automation console I’ve been working on consists of:

  • SmartiPi Touch Pro case
  • Raspberry Pi Official 7 Inch Touch Screen
  • Raspberry Pi 3B+
  • Custom programing in Xojo

These components combined make for a pretty nice package. I really like the SmartiPi Touch Pro case. I’ve been looking for a Raspberry Pi case that looked better than the typical high school science project and the SmartiPi case looks good enough to have achieved wife approval (not an easy thing to do.)

So now I have a dead-simple home automation console for our guest room.

-Wes



3 Likes

Would this work with formatted text?
I am building an app on the same platform and want to use Textarea or another way to display formatted text.
I would really like to display the text with transparent background.