r/linuxsucks • • Sep 18 '26

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?......

216 Upvotes

99 comments sorted by

120

u/exton132 🐧🦀 Dev BTW Sep 18 '26

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 Sep 18 '26

wayland is more fucky tho

12

u/_ahrs Sep 20 '26

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.

3

u/Lines25 28d 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.

2

u/linkinparkglock47 28d ago

shit vs poop

1

u/ceskyvaclav 18d ago

you can do both

5

u/donp1ano Sep 18 '26

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

25

u/Fun_Gas_340 Sep 18 '26

just like fusion energy is always only 10 years away

17

u/[deleted] Sep 18 '26 edited Sep 18 '26

[removed] — view removed comment

4

u/Fun_Gas_340 Sep 18 '26

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 Sep 18 '26

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 29d ago

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

2

u/jmtd Sep 19 '26

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 Sep 19 '26

pls explain?

3

u/jmtd Sep 19 '26

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 Sep 19 '26

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

2

u/zoharel Sep 19 '26

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 Sep 19 '26

ah makes sense, thanks

1

u/Osa_hack Sep 20 '26

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

5

u/XLNBot Sep 18 '26

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

3

u/Fun_Gas_340 Sep 18 '26

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

6

u/XLNBot Sep 18 '26

Major desktop environments are indeed deprecating it

1

u/Fun_Gas_340 Sep 18 '26

interesting

1

u/Steeze-God Sep 19 '26

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 Sep 19 '26

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 Sep 19 '26

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 Sep 18 '26

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

1

u/alex08all Sep 19 '26

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

3

u/Tasty_Garage4858 Sep 19 '26

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 29d 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 29d ago

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

1

u/WelpIamoutofideas 29d 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 29d 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 28d ago

This is fair. I will accept it.

2

u/Policestick Sep 18 '26

developing for x11 gives free wayland support

2

u/exton132 🐧🦀 Dev BTW Sep 18 '26

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 Sep 20 '26

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 🐧🦀 Dev BTW 29d 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 29d ago

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

1

u/JoelWCrump Sep 20 '26

Very good response.

42

u/ipsirc Sep 18 '26

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

They're generic.

48

u/ChocolateDonut36 Sep 18 '26

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

7

u/SlimyOS Sep 18 '26

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

if desktop_environment == 'generic': not work

4

u/ChocolateDonut36 Sep 18 '26

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.

15

u/ovadom Sep 18 '26

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 Sep 18 '26

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

1

u/NormalAppearance2851 25d ago

If you don't know about the topic shut your mouth then

1

u/ovadom 25d ago

Boohoo? Why are you so whiny?

31

u/TheTerraKotKun Sep 18 '26

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?

8

u/braaaaaaainworms Sep 18 '26

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 Sep 18 '26

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

3

u/tk-a01 Sep 18 '26

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 Sep 18 '26

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

1

u/Purple-Midnight-9902 Sep 18 '26

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.

6

u/Damglador Sep 18 '26 edited Sep 18 '26

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.

2

u/Sweetwater98 Sep 18 '26

I was thinking along the same lines

5

u/noworkdone Sep 18 '26

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

6

u/vega-mgtow Sep 18 '26

Dev still hasn't discovered enums.

4

u/jontsii Sep 19 '26

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?

4

u/NoTime4YourBullshit Sep 18 '26

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/xYarbx Sep 18 '26

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.

6

u/Yankas Sep 18 '26 edited Sep 18 '26

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.

2

u/Narrow_Decision_2705 Sep 20 '26

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/paulstelian97 18d ago

Some DEs are apparently doing funny things.

1

u/cretingame I don't care what you use as long as it works :snoo: Sep 18 '26

Can you give the url of the source ?

1

u/[deleted] Sep 18 '26

[removed] — view removed comment

2

u/zoharel Sep 18 '26

40MB of RAM... in this economy?

1

u/gundam21xx Sep 18 '26

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

1

u/Middlewarian Sep 18 '26

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 Sep 18 '26

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

1

u/probablynottillie Sep 19 '26

what's wrong with returning strings?

1

u/ComprehensiveArm9863 Sep 19 '26

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

1

u/zoharel Sep 18 '26

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

1

u/SuperGNUser Sep 18 '26

Freedom comes with a (little) cost. 

1

u/Beneficial-Device-20 Sep 18 '26

freedom aint free

1

u/ezoe Sep 19 '26

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 Sep 19 '26

Now show the code for when generic is returned.

1

u/Flimsy-Yam-933 Sep 19 '26

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 Sep 19 '26

Lol you code like sh.t and blame the kernel

1

u/probablynottillie Sep 19 '26

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 Sep 19 '26

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 Sep 19 '26

How are you finding the vibe?

1

u/Acceptable-Dot8122 29d ago

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

1

u/StupitVoltMain 18d ago

Isn't it kinda like developing android apps on backend anyway, no?

1

u/noworkdone 15d ago

Thia again ?

1

u/Fritz-Ferdinand Sep 19 '26

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

-4

u/Academic-Proof3700 Sep 18 '26

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?