Readit News logoReadit News
kelnos · a year ago
Funny, I maintain xfdesktop (the Xfce component that draws the desktop background and icons), and this past summer I just did a major refactor/rewrite of how xfdesktop saves and restores icon positions as well.

Fortunately I didn't have as much trouble in the "reading code is the hardest part" dimension, as I was largely redoing code I myself wrote around 20 years ago (though others had changed it a bit in the meantime).

It's fun to see a lot of the same problems I had when modeling how all of this should work. Xfce 4.20 (probably end of next month) will have all of my changes for this, but of course I expect I've broken some things as well and will have to add in a bunch of little hacks and workarounds. It's a truly weird, complex problem, even though at first look it feels like it should be simple.

tecleandor · a year ago
> Fortunately I didn't have as much trouble in the "reading code is the hardest part" dimension, as I was largely redoing code I myself wrote around 20 years ago

Sometimes, when I'm reviewing code I did just some weeks ago, I'm completely lost.

acomjean · a year ago
Updating some code years ago, I asked who wrote this abomination?

(Checks source history)

Crap, I did

cwillu · a year ago
Thank you and everyone else who works on XFCE for your sanity-preserving work.
thfuran · a year ago
>It's a truly weird, complex problem, even though at first look it feels like it should be simple.

Unfortunately, almost everything is.

mass_and_energy · a year ago
Thank you immensely for your selfless contribution to the FOSS community. Xfce has allowed me to turn the dustiest of old laptops into media center boxes, though its so pretty and light that I use it on everything. You're doing the lords work my friend.
kwanbix · a year ago
Thanks for XFCE guys.
porridgeraisin · a year ago
Love XFCE, everything about it.
wruza · a year ago
You know how wired earbuds always, always get tangled when you place them in a drawer or your pocket or something for few seconds?

Do not wind them around your hand, this creates a curling force that makes them tangle. It’s a fundamental symmetry effect in action, with which you turn a straight line into a knot. Try the same with a flexible ruler tape and you’ll see how much it twists, unless you counter-twist every loop.

Instead just gather the wire into a flat compressed /\/\…/\ form and put it there. The worst thing that will happen now is one accidental semi-knot that is trivial to shake away.

Now I wonder how that applies to code, maybe we’re onto something here.

lloeki · a year ago
> unless you counter-twist every loop.

That's the whole trick: don't wind, twist.

Observe: take a short cable (or a piece of thread), hold it straight at each end with two fingers by the wire; at one end, roll the cable along its main axis between the two fingers; a loop forms, purely through created stress.

Now, with a longer cable you just accumulate such loops by iterating over the length; stress can be relieved by accompanying the cable while twisting: there should never be any resistance felt.

If done correctly the folded cable should be able to lay flat on a table and not move a millimetre. Note that there's a "natural" radius that is best respected.

One could stack a bunch of those in a box and they basically won't mix unless massively shaken, but to make sure one can tie a single point of the loop to eliminate lateral slack.

Source: folded a cumulated thousands of kilometres of usb/ethernet/XLR/6.35" cables over the years, packed together in bags or boxes.

wruza · a year ago
While this works, it’s mostly useful for storing naturally curled wires/hoses. The downside is it becomes twisted again by pulling straight.

The “accordion” method actually counteracts knotting because it forms a sort of an amorphous spring that is unstable outwards rather than inwards (careless winding) or just being stable (twisting). I find it more useful as it never twists and tends to decay into a straight wire by itself. But ymmw, cause it tends to be all over the place in your pocket/drawer/etc. also doesn’t work for hoses cause they deteriorate at sharp folds.

The moral is just know your methods and where they apply and if that suits you the best.

marcosdumay · a year ago
You can also wind it while twisting the remaining of the cable on the opposite direction.

On a short cable like a headphone string, this is just a matter of holding the cable up so the plug can rotate freely. Then you can do anything, you won't accumulate stress. (On a longer cable that means putting temporary stress on the non-wound part of the cable. If it's too long, you need to remove it from time to time.)

Anyway, I've just printed a ton of cable-winders, for all sizes and calipers, and never thought about it again.

mceachen · a year ago
Gaffers, sailors, and kite flyers will teach you the “over under” method, discussed here: https://news.ycombinator.com/item?id=21581553
bloopernova · a year ago
Huh, so I have it half right when I quarter-twist the cable so it naturally forms the next loop of the bundle. I just had the "under" part missing.

That is a great tip: "hold the loop in left hand, cable in right, both palms up, then bring thumbs together to create the 'under' loop"

xorcist · a year ago
Roll it up, just like you would roll back toilet paper on its roll, or sewing thread. Then you can roll them around your hand with no tangling issues.

Just like you would with a garden hose, or a rope on a sailing boat. Tangled ropes is a potential problem there so no one would flail your hands about and hope for the best. Instead you roll neatly.

eternityforest · a year ago
Is this why over-under coiling is so effective at preventing tangles?
lelandfe · a year ago
Title made me remember this other example of desktop icons being hard: https://randomascii.wordpress.com/2021/02/16/arranging-invis...
acidburnNSA · a year ago
Read it and enjoyed it. For ref it was discussed previously at https://news.ycombinator.com/item?id=26152335

Hopefully the new code discussed in OP isnt quadratic.

acka · a year ago
Although I also enjoyed reading the article you linked to, I found the following quote from it somewhat condescending:

> Symbol servers are good. If you are on Windows then make sure you are using symbol servers. If you are not on Windows – I’m very sorry (and by that I mean that it is a shame that debugging and profiling – especially of issues on other users’ machines – is so much harder for you).

It seems that the author believes that only Windows has good debugging symbol support, which isn't true at all. In fact, several Linux distributions provide debugging symbols for most of their packages, and from my own experience I know that in particular Arch Linux and Void Linux are quite easy to set up to use them. I'm not even getting started on the availability of source code.

Void Linux in particular is very convenient for debugging issues on different architectures, because its package build system inherently supports cross-compiling for multiple architectures from the same package definition with minimal extra configuration, including generating debugging symbols. Naturally these symbols are packaged separately from the binary packages that reference them, so there is no need to install binary packages for an incompatible architecture just to get at the debugging symbols.

sebazzz · a year ago
From the legendary Bruce Dawson, master of the Windows Performance Toolkit. Too bad he stopped working at Google and stopped blogging. I hope he finds the peace he is looking for.
Chaosvex · a year ago
That's a classic. It's incredible that it's taken Microsoft literal decades to fix that issue. The old recommendation was to hide desktop icons but even that doesn't fully solve it. Garbage collecting them into another directory on the desktop was the fix.
peterkos · a year ago
> It may not sound like much, but this was a lot of work. I spent days just thinking about this problem, trying to understand what is happening now and how to improve it.

I find these kinds of problems the most fun and the most educational! I tried building a grid layout system from scratch in SwiftUI, and it was similarly tricky to map out:

- what the "ideal" behavior one expects is,

- what edge cases exist,

- how to handle the edge cases,

- maintaining ideal behavior while handling edge cases.

(It was tricky b/c SwiftUI lays out its children, then its parent -- so the parent needs to ask its children for its view size, and iterate and set rows/columns that way.)

Maybe because the problem seem simple, it is that much more fun to dig into. Some good ol' time with a whiteboard.

alex-moon · a year ago
To be fair to the author, I actually think desktop icons is a problem that no desktop manager has ever solved, and I think the reason is because it's not solvable in a user friendly way. The problem is that desktop icon arrangement can mean different things to different users: some people are just arranging their icons in a one dimensional list that's wrapped, while others are arranging theirs in clusters (top left is for system, top right is for documents, bottom left is for personal/games etc), while yet others are arranging theirs in columns and so on - how these are supposed to change on resolution change is different per each use case. When I switched to dwm on desktop I felt freed from a problem I had literally just always had.
Rygian · a year ago
If you let the user arrange their icons in the preferred shape, for each screen resolution they use, and save that, the problem is solved. As the article describes.

The bug described in the article was the icons being moved around without user input, and then their wrong/unwanted location saved as "user preferred icon arrangement". Which sounds like an obvious bug in hindsight.

badmintonbaseba · a year ago
> If you let the user arrange their icons in the preferred shape, for each screen resolution they use, and save that, the problem is solved.

Users normally place their icons using a given, single resolution, so that would only give you one initial saved icon position. You need some heuristic when the user first changes resolution with that icon present on the desktop.

somat · a year ago
I think desktop(and phone) icons are a fundamentally flawed ui design in the first place. something about having your stuff semi randomly spewed across two dimensions makes me feel we are not using our computers correctly. I think we should be doing better than emulating the bucket of legos user interface model.

Give me a one dimensional list, or table I can sort, search and actually find things in.

No, I am not much fun at parties, why do you ask?

wruza · a year ago
Spatial memory is a very useful and important part of navigation. One thing I (and probably we all) miss is an ability to create nameless folders. Well, we sort of can, with “New folder (24)” and “dklstnrigwh”.

I’d like to use spatial sorting more and in regular folders, but that’s very fragile and second-thought in most UIs. Also they provide no visual cues, so I can’t leave my file in the left black drawer with a flower sticker on it.

Yes I know about Bob and how it failed. But it works for me in e.g. Fallout games where I can use multiple boxes in different rooms to sort my loot. I just know that my plasma rifle is in the metal box near the bed and cells are in the dresser.

The ability to find things without creating, remembering and searching the names or containers feels good.

cesarb · a year ago
> I’d like to use spatial sorting more and in regular folders, but that’s very fragile and second-thought in most UIs.

I've heard that the "spatial Finder" from the old Mac OS worked like that: from what I understood from reading a couple of classic Ars Technica articles about it, there was a direct one-to-one correspondence between each folder and the window which represented it on the screen, and each of these windows always preserved its size and position. Quoting from https://arstechnica.com/gadgets/2003/04/finder/

"[...] There was no such thing as a "Finder window" that "displayed the contents of a folder." Double-clicking a folder opened it. The resulting window was the folder. When scrolling, moving, or resizing that window, there was no doubt about which folder was being affected. And the stability of the interface was such that there was no doubt about what that folder would look like the next time it was opened."

klabb3 · a year ago
> Spatial memory is a very useful and important part of navigation.

Oh yes! And so under appreciated. Things that have their place is absolutely crucial. Imagine if your menu bar sorted based on how often you used “edit” vs “file”. Or why not have the keys on the keyboard change based on frequency? I’d argue we should leverage spatial- and muscle memory much more in UX and design.

hulitu · a year ago
> Spatial memory is a very useful and important part of navigation.

Yes, if you can organize your staff. Windows 10 and 11 will just put your icons as it see fit, without the option to change the size of them. Position is also monitor dependent. And the ribbon is a disaster for spatial navigation.

phito · a year ago
Agreed, my desktop will always just be my wallpaper and nothing else. I don't want any icons there.
soared · a year ago
I thought you were about to pitch 3 dimensional space. Like iPhone app pages but instead of a few pages left to right, it’s a 3d cube? Sounds useless and no different but also very exciting
Theodores · a year ago
I always found the 'sea of icons' a bit weird. There is some server management software that I used to have micromanagers specify, not that they would ever use it. I always begged for stock Ubuntu with a command line but they insisted on the 'sea of icons', making it impossible to find things quickly.

I can understand the desktop metaphor but just because it is intuitive to aged boomers that liked Steve Jobs does not make it right. But these people did not get the advantages of the history file or how command line meant that you could repeat common tasks with an exclamation mark + number.

Another thing that gets me with icons is when people over complicate them. An icon has to be simple, if it is not simple then it is not an icon.

meerita · a year ago
Maybe it's just nostalgia, but I felt an amazing sense of happiness with the icons in Windows 3.1 and macOS 8. I loved them all! I'd say that everything up to Windows 95 and macOS 9.2 was great. But then, with macOS X and later versions of Windows and Linux, things went so high-res that I didn't like it. That's just my personal opinion, not a fact.
wruza · a year ago
I’d like both icons and windows from the other display to be collected into a picture-in-picture window at the bottom right. Which you then can click to enter and manage it yourself, rather everything being dumped over my main display every time I accidentally turn it off or something.