desktopfolder
desktopfolder copied to clipboard
Can this work on Unity ?
Hi, Unity community developer here. As you know Ubuntu 19.04 will use Nautilus >=3.30 which does not have desktop anymore. Unity is deeply integrated with with the desktop and I was this can be used in unity too.
But, it can not draw wallpaper( draws the icons fine) on unity, just a black screen.
In the absence of the nautilus-desktop, unity-settings-daemon draws the background. It checks it nautilus is drawing the background or org.gnome.desktop.background.show-desktop-icons
is true. (And If it works I can make it to check relative desktop-folder gsettings key, but atm, it doesn't work)
I tried to disable the background plugin from unity-settings-daemon, but it didn't help.
Can you explain why desktop-folder not showing any background ?
I addition to that I want to sync font-settings (interface and document) with gnome gsettings keys. Atm, fonts does not change on unity.
Another thing is change-wallpaper tries to open gnome-control-center which doesn't exist in unity (for unity the command is unity-control-center appearance
) but I believe this can be patched easily.
To summarize:
-
Under unity it should use appearance panel from unity-control-center
-
Use GDK_WINDOW_TYPE_HINT_DESKTOP for compiz.
-
Make separate desktop launcher for unity and set
OnlyShownIn=Unity
Hello @khurshid-alam. Thank you for the interest in desktop folder. We are trying to make the application the widest compatible with others distribution/window managers, but you know, sometimes is difficult. In the case of Unity, I have never checked. First, you should confirm the GTK dependencies compatibility, we are working with Gtk+3.22.
If the problem is a black opaque window, probably you will have to touch css styles and see why is not being rendered correctly in Unity . Probably those styles like this one:
.df_folder.df_note.window-frame.df_transparent, .df_folder.df_note.window-frame.df_transparent:backdrop,
.df_folder.df_note.background.df_transparent, .df_folder.df_note.background.df_transparent:backdrop,
.df_folder.df_note.df_transparent .titlebar, .df_folder.df_note.df_transparent .titlebar:backdrop {
border-color: @noteColorBackgroundTRANSPARENT;
background-color: @noteColorBackgroundTRANSPARENT;
border-color: @noteColorBackgroundTRANSPARENT;
}
Or perhaps, the problem is different... perhaps the problem is that the window manager is wrapping the panel window with another (opaque) window, I remember the issue #127, in that case, the photo window doesn't have a header, and Ubuntu Budgie Window Manager created a wrapper window. You'll need to check.
All generic improvements to make it more compatible are more than welcome. Currently, we are working hard in the next version 1.1.0, with huge changes and improvements. The project was initially focused on elementary OS, and now we are targeting both Elementary and Ubuntu Budgie. If you are interested trying to port the project to unity too, I could try to advise you, doing my best, but I'm currently a bit overloaded :laughing:
Under 18.04
If you do the following:
sudo apt purge libgtk3-nocsd0
Then reboot - on login to Unity the desktop turns grey.
I then killed the desktopfolder process
So I then used dconf-editor to toggle the desktop-icons setting on/off - this then displayed the background wallpaper.
then I restarted the desktopfolder process - all was well
@spheras Under unity the known issue about panel placement is more noticeable as you can see in the screenshot - the icons can disappear under the vertical panel.
Other than that - it does seem to work very well under Unity.
@khurshid-alam I'm guessing that if you run the desktopfolder process without the nocsd preload then it probably should work. EDIT: Reinstalled libgtk3-nocsd0 and used the following for my git built build of desktopfolder
env LD_PRELOAD="" com.github.spheras.desktopfolder
confirmed desktopfolder started ok and no black-screen was displayed.
Thanks @fossfreedom! Looks great, at least a first very good step. Regarding the panel placement problem, this is something we must fix for UB too, I'm thinking about it (in the worst case we could put a setting to move the panel right)
@spheras Thanks for quick response. But @fossfreedom already solved the black background problem.
@fossfreedom
Wow ! Thanks. That indeed worked well.
Any idea why gtk3-nocsd is getting in the way? nocsd just removes the csd headerbar, although LD_PRELOAD is just a hack. I looked at the nocsd code but couldn't find anything related, may be style-context removal is the issue. May be we can blacklist desktop-folder for nocsd.
GTK_CSD=1 /usr/bin/desktopfolder
also seems to work. Problem is, if you open a picture or pdf file from desktop the apps (eog, evince) will also have csd. :(
Nautilus is the exception though (gedit still has headerbar patch)
@khurshid-alam no - not sure why why GTK_CSD=1/LD_PRELOAD would be needed.
Note - I've managed somehow to get my Unity installation to run desktopfolder without needing GTK_CSD=1 / LD_PRELOAD="" ... how ... no idea! I suspect my Unity/GNOME Shell/Budgie VM is fighting each other. Probably should start from a clean Unity only VM. Do you have a 19.04/18.10 Unity ISO download? EDIT: ah - gtk3-nocsd had uninstalled itself ... successfully "broken" it again. yay!
@spheras Also this is another desktop which requires src/logic/DesktopManager.vala "this.get_view ().set_type_hint (Gdk.WindowTypeHint.DOCK);" to be changed to "this.get_view ().set_type_hint (Gdk.WindowTypeHint.DESKTOP);" - this is because the DesktopFolder panels do not respond to mouse over ... nor can then be focused & selected.
I also note DesktopFolder panels under Unity cannot be resized - I'm guessing Unity's window manager is struggling with borderless windows? Let me know where the border size is set in the code - I'll try to set it to a non-zero value to see if that works.
Do you have a 19.04/18.10 Unity ISO download?
Yes, I am testing on 19.04, but it is same as 18.10. And I am using the ppa version.
The only custom css nocsd adds is
window > .titlebar:not(headerbar) {
padding: 0;
border-style: none;
border-color: transparent;
}
.background:not(.tiled):not(.maximized) .titlebar:backdrop,
.background:not(.tiled):not(.maximized) .titlebar {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
@fossfreedom Can you give me access to launchpad code? I am working on unity patches and using lp:~khurshid-alam/desktopfolder/+git/unity repo, but it's better if I can just push unity branch on lp:desktopfolder.
Regarding black background, it could be the issue with missing support of _GTK_FRAME_EXTENTS in compiz since gtk-3.16
Also see: https://github.com/numixproject/numix-gtk-theme/issues/206
gtk-nocsd always set border and background always transparent (even for docks), and unity always set shadows for all window types except desktop and dock....so there can not be any shadows behind, the probable workaround is to remove all shadows from all .window-frame styles.
@khurshid-alam I can - will create a new "DesktopFolder" team
However - just to say though - no actual development is done on Launchpad - it is only there to-do automatic daily build's for bionic, cosmic and disco
https://launchpad.net/~ubuntubudgie-dev/+archive/ubuntu/desktop-icons
At the moment is automatically imports from ubuntubudgie's fork. I intend to switch it to this git repo once I figure out a much better and more robust meson build-time mechanism to change the autostart .desktop folder Exec=desktopfolder rather than at the moment Exec=com.github.spheras.desktopfolder.
@khurshid-alam if you do a pull-request here - or just let me know where your github fork is, I'll also help test this on unity.
@spheras
Is it possible to draw normal titlebar for folder & note panel under unity?
gtk3-nocsd simply removes solid-csd class & client side shadows as well. Hence the black background occurs. See similar issue https://github.com/numixproject/numix-gtk-theme/issues/206
It does not play well with csd headerbar at all. Also It seems I was unable to override .df-folder.window-frame
styles from theme. Editing ~/.config/gtk3.0
works though. Also see gtk3-mushrooms patches to see how it is disabling csd.
See what is happening here:
@khurshid-alam how about an alternative approach since it does seem like a lot of rework?
For Unity you launch desktopfolder via the GTK_CSD=1 desktopfolder trick.
Then if you search in the code for "launch_uris" - where it is running a command like xdg_open
prefix a string "env GTK_CSD=0 " so that the command run is being launched with gtk3-nocsd support ... I presume that is what env GTK_CSD=0 does
If that works - then I would suggest we could come up with a means to-do that launch_uri prefixing depending upon whether this Unity library is running.
The above diff ensures desktop launchers, pictures and text files etc are launched with CSD disabled.
@khurshid-alam
If I comment out https://github.com/spheras/desktopfolder/blob/master/src/widgets/FolderWindow.vala#L162 i.e. so there isnt a custom on_configure event then you can resize the panel - click on the panel to bring it into focus then you can resize the panel.
@spheras Why does FolderWindow have a custom on_configure whereas on NoteWindow - the connection to on_configure has been commented out https://github.com/spheras/desktopfolder/blob/master/src/widgets/NoteWindow.vala#L118 ?
@fossfreedom
Yes launch_uri with GTK_CSD=0 will work, though it should only do that under unity. I will modify the patch to make it work that way. Thanks.
@fossfreedom, initially I used on_configure, but we had a problem because I was saving the new position to the settings file on each event, and it was very expensive process in the case of a note. I changed that for the on_active_change event. So now, the new position and size for the note is saved on each active window change event.
In the last last version, I put a timeout for the folderwindow to save the new position/size only in the last event (avoiding wasting resources). This is a different solution that could be implemented in the note too.
@spheras thanks for the explanation. I'm curious though why (for Unity only), commenting out on_configure for FolderWindow allows the panel to resize - but leaving it connected, stops resizing.
Something to dig into I guess at some point ... unless maybe changing on_configure for FolderWindow to a "on_active_change_event" like Notes?
I'm afraid it is not possible in the case of FolderWindow, because we need to have setted the last dimension after the last onconfigure event is produced to calculate the new grid positions of elements.
I think the problem are these lines inside the on_configure method:
// This is to avoid minimization when Show Desktop shortcut is used
// TODO: Is there a way to make a desktop window resizable and movable?
this.type_hint = Gdk.WindowTypeHint.DESKTOP; // Going to try DIALOG at some point
Have you tried just removing these lines? and perhaps changing the type_hint to NORMAL? There is a lot of type_hint changing tricks in the code to allow moving and resizing windows... That's the only way I found to have dock windows and allow move and resize them at the same time. I mean, probably unity is not allowing resizing it before the type_hint is NORMAL again.
@fossfreedom
I have now pushed basic support for unity. Let me know if anything else is required.
https://github.com/khurshid-alam/desktopfolder/commits/unity
-
Regarding resizing folder panel, it probably beacuse Gdk.WindowTypeHint.DESKTOP. Also we need window border for csd windows. Where do I set that ? But if it can't be done leave it that way. We can hide those option in context menu for unity. A gsettings option would be nice.
-
I like to change the padding for context menu. But can it be done from theme? If it is possible, I will open a merge for ambiance/radiance.
-
"let the app mange" mode has drag & drop which is required for unity but icons appears under panel (issue #211 ?). and free mode doesn't have drag & drop. what can be done about that ? I tried other desktop like caja-desktop, they perfectly calculate the working area for both state hidden, normal. May be we can use the same logic?
-
Also dragging icons throws errors "File exists".
Hi, I'll try to answer your points:
-
Have you tried removing this line? This was a trick I did time ago to allow those windows being dock windows and resizable at the same time... Removing this line probably will bring old problems again, but first, we should confirm if that's the problem. Regarding border, probably touching the Application css, but, a modification like this could add problems to the space calibration, this is something to test carefully.
-
mmm, perhaps touching the application css too?
-
yes, the panel problem is something pending to solve, I will try to solve this in the near future. Free mode has a drag & drop if you press ctrl key previously (if not, the icon is moved).
-
You mean a console error, no? If yes, that's really a controlled warning, but just because the drop was done in the same place, so, it is a warn message we can remove.
@spheras
-
No but I will try now.
-
Yes everything can be done form application.css (though I don't see style for context-menu), but the idea is to locally override it from theme, without touching upstream css.
For that we need style class for main window....for gnome-apps which provides a ui file, it is simply to add <style> com.github.spheras.desktopfolder </style>
on top (See gnome-calendar issue), also we may need Gtk.STYLE_PROVIDER_PRIORITY_THEME
(in application.vala) for that (see this issue)
-
Right. I just discovered that.
-
Warning are ok, though it shouldn't say "error", use g_warning for that.
@fossfreedom
I need X-GNOME-Autostart-Delay=20
to actually use GTK_CSD=1, anything less than 20, it gives the same black screen may be because GTK_CSD is not set yet ?