eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

[GTK] Get rid of SWT use of $HOME/.swt/trims.prefs

Open iloveeclipse opened this issue 1 year ago • 4 comments

While investigating https://github.com/eclipse-platform/eclipse.platform.swt/issues/1161 and the fix, we've noticed (once again) that SWT does some really unexpected things - in this case it always reads/writes $HOME/.swt/trims.prefs file.

https://github.com/eclipse-platform/eclipse.platform.swt/blob/5b437ee2bd8cdda7083a9f2ceeadb172a583ed37/bundles/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/widgets/Display.java#L551

https://github.com/eclipse-platform/eclipse.platform.swt/blob/5b437ee2bd8cdda7083a9f2ceeadb172a583ed37/bundles/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/widgets/Display.java#L4855

This was introduced via 1efa844f5448fd981224ed57c5cc069ec4754711 to fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=445900.

There are few issues with this approach because the value is not versioned/annotated in any way so we will have issues with:

  • users changing their desktops (KDE -> Gnome etc)
  • users changing the window managers
  • users changing visuals / GTK themes
  • users changing GTK / OS versions

This above can easily happen if users are working in a multi - OS environment, running VNC sessions connected to different hosts but using same account.

Just using some values written by an unknown SWT application at unknown point in time with unknown desktop/window manager from unknown OS seem to be totally wrong.

The code was written for GTK2, we should see if we can get rid of reading/writing to $HOME/.swt/trims.prefs on GTK3 and cleanup code around it.

Conments / help is welcome.

iloveeclipse avatar Apr 11 '24 11:04 iloveeclipse

@SyntevoAlex : is this interesting for you may be?

iloveeclipse avatar Apr 11 '24 11:04 iloveeclipse

I investigated it for a while, but it wasn't trivial, and I was told to forget it, because the problem isn't so important. See #568

SyntevoAlex avatar Apr 11 '24 18:04 SyntevoAlex

Oh so your project is the culprit for $HOME/.swt/trims.prefs... Aren't you also responsible for $HOME/.eclipse?

Please refrain from making any folders or directories directly in the home. I am obsessively trying to reduce creation of new stuff in unexpected places as my home is version controlled and I do not want application clutter interfering with navigation through important files I have there. There are appropriate places to put this kind of files as specified by XDG Base Directory Specification

DusanLesan avatar Jan 02 '25 02:01 DusanLesan

I have just found this in my home dir and had to look up what it is. I assume it is fine to delete it?

While I am here, looks like we have: eclipse-workspace, .eclipse, .p2 and.swt in the home dir.

m4r35n357 avatar Apr 08 '25 17:04 m4r35n357