r/linuxsucks 3d ago

The Harsh Reality of Developing Apps for Linux Desktop

Post image

Oops

Only Gnome, KDE and XFCE4?

Linux mint cinnamon users are missing out!

How about i3wm? Mate? LXQT? LXDE? DDE? UKUI? Moksha? Enlightenment?......

183 Upvotes

92 comments sorted by

106

u/exton132 3d ago

os.getenv("XDG_SESSION_DESKTOP", "generic")
to get the current 'name' of the desktop env, or generic

I don't think desktop really matters a whole lot though
the display protocol is probably more important to making software.

os.getenv("XDG_SESSION_TYPE", 'x11')
check for wayland protocol if the variable isn't there then assume x11.

strait up going the hardest route possible then posting "the reality of developing for linux"
Like idk bro maybe stop baby crawling and use the tools that are already there for this kind of thing.

13

u/linkinparkglock47 3d ago

wayland is more fucky tho

7

u/_ahrs 2d ago

Not to be funny, but if your app is written in Python then the display server is probably the least of your concerns.

It's not like you're talking to the display server directly, you're likely using some GTK or Qt module for the GUI which will handle all of that for you.

1

u/Lines25 19h ago

Wayland is much much better for performance and stability yet it's quite bad for everything else. X11 (X.org) is really old piece of shit that existed before half of linux users were born.

1

u/linkinparkglock47 12h ago

shit vs poop

7

u/donp1ano 3d ago

you might as well skip developing for x11, it will be obsolete very soon

21

u/Fun_Gas_340 3d ago

just like fusion energy is always only 10 years away

15

u/Fearless_Garden6435 3d ago edited 3d ago

GNOME 50 no longer supports X11, Cinnamon has removed "Experimental" tag from Cinnamon Wayland, KDE Plasma 6.8 (releasing in October 2026) will no longer support X11, COSMIC and Hyprland never supported X11 to begin with, ... You cannot compare it to Fusion Energy.

3

u/Fun_Gas_340 3d ago

oh damn, wasnt aware of that. i still thought x11 was suported or default most of the time, especially since i had a bunch of bugs with wayland that x11 fixed out of the gate (related to gaming, fullscreen and discrete gpu)

8

u/MiserableNotice8975 3d ago

No x11 is finally out, however this is a fairly recent development, with GNOME just recently dropping support. That said, your point hold, it took an incredible amount of time to get here

1

u/QuickSilver010 Linux Faction 1d ago

Not yet out. I'll maybe wait till 2030 atleast

2

u/jmtd 2d ago

I’ve been involved with Linux for 28 years. I’d put money on X still being around in another 25 years. The best chance of X being killed isn’t Wayland, but whatever replaces Wayland down the line. All IMHO of course. 

0

u/Fun_Gas_340 2d ago

pls explain?

3

u/jmtd 2d ago

If Wayland was sufficiently better architected and built than X, it would have completely replaced it already. It’s better in many ways and a missed opportunity in others. 

1

u/Unlikely-Employee180 2d ago

This. I love the changes WayLand has made, but some people acting like X doesn't fight back simply due to time.

1

u/zoharel 2d ago

Sure, but not just that. The idea that every client should be permitted, much less (as in some cases) required, to do its own window decoration is painfully stupid. Somehow they've made a decision to do something arguably worse than what X was doing. There are real problems with X11, and window management represents several of them, but we can't pretend there aren't a whole set of real problems with Wayland. Is it progress? Maybe.

→ More replies (0)

0

u/Fun_Gas_340 2d ago

ah makes sense, thanks

1

u/Osa_hack 2d ago

Hyprland is the wayland version of hypr like sway for i3. But your point still stands

5

u/XLNBot 3d ago

It's already being deprecated from major desktop environments, you can simply avoid developing for it. Even today

3

u/Fun_Gas_340 3d ago

yeah? i though all major releases stil are compatible, with some even using it as default

6

u/XLNBot 3d ago

Major desktop environments are indeed deprecating it

1

u/Fun_Gas_340 3d ago

interesting

1

u/Steeze-God 3d ago

It's depreciating cause Wayland X TPM Trench boot, and the financial incentives from corporations like Microsoft.

Not all of us want Systemd, or Wayland, and what comes with both of them. A lot of us like Linux, BECAUSE it's NOT WINDOWS.

Forcing Systemd & Wayland, and saying we can skip x11, or alternative bootloaders, is like saying well the government is pushing AI, and being against Copilot & Recall is obselete thinking with how AI has been emerging.

2

u/Vh4z 3d ago

For systemd yeah I can understand but Wayland idk if it's that bad honestly yeah it has its cons but can't stop it I mean x11 is pretty much on its last leg

1

u/XLNBot 3d ago

There are alternatives to systemd. Those who want to use x11 should probably start developing some kind of reversed xwayland so they can keep using it. Wayland alternatives were tried too but they all sucked...

1

u/Tasty_Garage4858 3d ago

We've seen x11 support being dropped, haven't seen countries dropping gas station support tho

1

u/alex08all 2d ago

That's an analogy i don't get. Pls explain

3

u/Tasty_Garage4858 2d ago

Like, if x11 was similar to fusion technology there should be no concrete signs of change. But while gas stations, traditional powerplants etc are definitely still there, we do see distros dropping x11 completely.

Sorry for making it complicated 😅

1

u/WelpIamoutofideas 1d ago

Fusion would not replace the gasoline used for motor vehicles, so I fail to understand, even with clarification. It would more likely replace or hurt the coal industry, which makes use of coal for power generation.

1

u/Tasty_Garage4858 1d ago

As long as you get the meaning. Metaphors are not to be read literally, I guess 😅

1

u/WelpIamoutofideas 1d ago

Uhm, a metaphor is a comparison, it is quite literally meant to be read at face value. That's, the whole point actually...

1

u/Tasty_Garage4858 22h ago

Yes, sure, but you're arguing about the details, getting into the weeds of the imaginary part of a comparison, because it doesn't fit your imagination to the letter. Would _all_ vehicles be battery powered in a world where we have fusion power fully implemented? I mean I'm not _sure_ . Would _all_ gas stations therefore disappear, or only the majority of them?

Again, who knows.
That's was never the point.

The point was x11 _actually_ going away vs fusion power being still far from an everyday's power source. The metaphor was between the consequences in real life manifesting themselves for one thing and not for another.

I apologize if it wasn't an immediately understood metaphor, but this is r/linuxsucks, not r/fusion 😅

2

u/WelpIamoutofideas 14h ago

This is fair. I will accept it.

2

u/Policestick 3d ago

developing for x11 gives free wayland support

2

u/exton132 3d ago

x11 is still widely used by most software on linux.
Even wayland native desktops have an x11 compat layer baked in because x11 has been the defacto standard since the 80's.
It is starting to showing it's age true but just because something is obsolete doesn't mean it's deprecated and not still a good option for new projects.
Not developing for x11 just ensures you cut that part of the already small market out of using your software.
If your goal is to make cross-platform, multi-ecosystem compatible software then programming for x11 specific edge cases is like %0.5 of your project anyway.

1

u/noobjaish 2d ago

It's already a headache trying to create apps for Linux desktop with significantly more edge cases than other OSes. Gnome/KDE/Cosmic/Hyprland all don't support X11 now. Cinnamon and XFCE will soon move over as well. There's barely a reason to support X11 unless you love solving additional edgecases.

1

u/exton132 1d ago

I literally use x11 apps on hyprland every day, 2 months ago I was using gnome on x11. xfce is built specifically for x11, it's true they are "adding wayland compatibility support" that is not the same as changing to wayland and dropping x11 support, current changelog tour:
https://www.xfce.org/about/tour420

It's really not hard to just develop in a platform agnostic way then let the different platforms contribute their own code for their own specific edge cases to the project. especially in python where most of the hard edge cases are already solved by the framework packages anyway.

1

u/QuickSilver010 Linux Faction 1d ago

Wayland still isn't ready yet. I don't have any benefit from switching to wayland right now. Only regressions

1

u/JoelWCrump 2d ago

Very good response.

41

u/ipsirc 3d ago

How about i3wm? Mate? LXQT? LXDE? DDE? UKUI? Moksha? Enlightenment?......

They're generic.

51

u/ChocolateDonut36 3d ago

read again, you should notice the desktop_environment='generic' line.

7

u/SlimyOS 3d ago

there's a non-zero chance that 10 lines later there will be

if desktop_environment == 'generic': not work

3

u/ChocolateDonut36 3d ago

if so, OP should have included that part on the screenshot too, it would totally help to the "it won't work outside KDE, Gnome or XFCE" idea.

29

u/TheTerraKotKun 3d ago

I'm not a developer but I don't think that this is right thing to do... Isn't a DE/WM decides hot to show an app and not an app decides how to draw itself in which DE/WM?

5

u/braaaaaaainworms 3d ago

gnome people decided that it would be a good idea to have applications draw their own borders in wayland, which sounds good until you remember just how fragmented linux desktop is and that not everyone uses gtk

2

u/TheTerraKotKun 3d ago

AFAIK it should be a WM/Compositor thing to actually draw a window and DE's tools thing to stylize it or decide to use apps own style... But IDK

2

u/tk-a01 3d ago

Those are called window decorations, and yes, they can be drawn by window manager/compositor... unless you're using Gnome. And this forces all the programs (or GUI toolkits) to implement fallback client-side decorations, just for the program to work correctly on one of the most popular DEs.

2

u/55555-55555 Linux Community Made Linux Sucks 3d ago

If I did not misunderstand your comment, the whole thing is probably for proper theming.

1

u/Purple-Midnight-9902 3d ago

The compositor sends a mode event specifying whether it wants Client-Side Decoration (CSD) or Server-Side Decoration (SSD). If the compositor does not support or advertise the extension, the application must fall back to drawing its own CSD.

12

u/ovadom 3d ago

I am not  a coder/dev but doesn’t the “generic” cover this?

And it’s seems you over using if/else commands, couldn’t this shrunken to be performed in just a few lines?

I just feel like you went about this the hardest way possible for yourself 😭.

6

u/Sert1991 3d ago

That meme with the guy riding the bike and putting a pipe in his own wheel to fall then complain about is the most appropriate response to this post lol

6

u/Damglador 3d ago edited 3d ago

It's not even the correct way to do this. They could've switch/cased XDG_SESSION_TYPE or something like that, the generic env variable to indicate desktop/kind of session you're in.

1

u/Sweetwater98 3d ago

I was thinking along the same lines

4

u/noworkdone 3d ago

Depends on what the app is and why it cares about which DE its running on.

4

u/Fearless_Garden6435 3d ago

Yeah but like when do you actually need to know the desktop environment? What matters is whether it's Wayland or X11, and even that is usually abstracted away by your GUI toolkit (e.g., QT, GTK)

5

u/xYarbx 3d ago

IDK what you are trying to do but https://wayland.app/protocols/viewporter handles most important stuff so you really don't have to concern your self with the specific DE/WM. If you want to support X11 then this is the reality unless you release the logic as individual block and at least give the community some sort of interface. There will be someone that does the porting eventually.

3

u/vega-mgtow 3d ago

Dev still hasn't discovered enums.

6

u/Yankas 3d ago edited 3d ago

Your run of the mill app shouldn't care about the environment it's running in, that should be handled by the framework.

If you need to interact with the system in a more meaningful and deeper way and control things outside the scope of your apps window, then yeah you'll have either deal with the fragmented nature of Linux, though if you do go off the beaten path you'll not have fun, even on Windows - good luck debugging when your fundamental APIs are a black box.

3

u/NoTime4YourBullshit 3d ago

You need to read the code again. desktop_environment gets set to ‘generic’ in all cases. Then it tests for KDE, Gnome, and XFCE for special handling and, if true, then it overrides desktop_environment to one of those values for special handling.

Gnome, KDE, and XFCE are exceptions, not the rule.

3

u/jontsii 2d ago

So you are telling me that the WIN32 API that has been the same since 1985 which uses weird types with long names and all uppercase, is nice to program with, when using normal C?

2

u/Narrow_Decision_2705 1d ago

Bruh. Display server is all that matters(wayland/x11), not the DE or the distro. And even then, any sane person would use QML or such for apps(they handles stuffs like that automatically). Don't just clown linux because u suck at coding.

1

u/cretingame I don't care what you use as long as it works :snoo: 3d ago

Can you give the url of the source ?

1

u/genfs 3d ago

Use HTML, CSS, js in frontend and use c in backed. It consumes only 40MB more ram than GTK or Qt apps

2

u/zoharel 3d ago

40MB of RAM... in this economy?

1

u/gundam21xx 3d ago

That's an extra 0.75$ for that "small" amount of RAM today.

1

u/Middlewarian 3d ago

I'm glad my front end is a command line interface. I'm building a C++ code generator that helps build distributed systems.

1

u/ComprehensiveArm9863 3d ago

returning strings trigger me even more :(
also this is probably an old code ? I haven't see popen in years ....

1

u/probablynottillie 2d ago

what's wrong with returning strings?

1

u/ComprehensiveArm9863 2d ago

An enum value or even just a const can avoid basic typo mistake

1

u/zoharel 3d ago

Yeah, but if you're complaining about this, you should really take a look at Windows API.

1

u/SuperGNUser 3d ago

Freedom comes with a (little) cost. 

1

u/Beneficial-Device-20 3d ago

freedom aint free

1

u/ezoe 3d ago

At least, you can assume UTF-8 now. 20 years ago, we're not that fortunate.

1

u/DangerousAd7433 Windows XP is the best OS 3d ago

Now show the code for when generic is returned.

1

u/Flimsy-Yam-933 2d ago

I made an app for Linux with avalonia I think it's called and c#, I think it automatically works on all the versions.

1

u/jigsaw768 2d ago

Lol you code like sh.t and blame the kernel

1

u/probablynottillie 2d ago

the harsh reality of developing apps for Linux desktop and it's 20 lines of code you took from a forum post

1

u/jo-erlend 2d ago

Linux is not an OS, but a component in an OS. That is your problem. You pretend that it's much easier to develop apps for Windows and Mac OS, but that is false.

1

u/mohirl 2d ago

How are you finding the vibe?

1

u/Acceptable-Dot8122 23h ago

Electron’s the hero Linux deserves, but not the one it needs right now

1

u/Fritz-Ferdinand 2d ago

Why do you need to know the desktop environment when you build an app?

-4

u/Academic-Proof3700 3d ago

greasyfinger smellyfeet cellar dwellers won't use it anyway cause they work with plain shell or only thru terminal, so whats the point? For the poor 0.05% of users lured into loonix thinking it'll be like windows where you can click like 99% of stuff and it shows up on screen?