-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change icon folder to custom icon #1189
Conversation
src/Dialogs/IconPopover.vala
Outdated
@@ -0,0 +1,102 @@ | |||
/* | |||
* Copyright (c) 2011 Marlin Developers (http://launchpad.net/marlin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not need this line - this is a new class
src/Dialogs/IconPopover.vala
Outdated
@@ -0,0 +1,102 @@ | |||
/* | |||
* Copyright (c) 2011 Marlin Developers (http://launchpad.net/marlin) | |||
* Copyright (c) 2015-2018 elementary LLC <https://elementary.io> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New code should be Copyright 2020 elementary, Inc. (https://elementary.io)
now
@AlbertAlonso Glad to see a new contributor to Files - you have dived in the deep end! I have made a couple of preliminary comments on the code. If you install Best get comment from UX team before going too far to check they are happy going down this route and what constraints should be applied. Another issue is how are you going to persist the custom icon per folder? |
@jeremypw Thanks for the comments! Since I started doing it just to get practice, I didn't really thought about if it was right or wrong, so definitely good call on asking the ux team before continuing. TBH I don't really know how to get persistence. I guess I'll just keep playing with it until something works or someone points me to the right direction! PS: The vala-lint is gonna save me from so many fix-commits you can not imagine! Thank you! |
I also started with the task, but from the other side, i first wanted to display the icon and then think about how to solve the UI. I looked up how Nautilus solves the problem. The use GIO and custom metadata which you can set on folders. This can then be read using FileInfo to display the icon. This is a snippet of how i did it (
There is a constant It works great. Only thing i did not test is how to set it usind GIO but i think it's pretty straightforward like reading it. I used the CLI to set it for testing |
For persistence, I can think of two possible approaches - using file meta-data (like sort order) or using the same approach as the color-tag plugin which is to maintain a database. Although, to be honest I have considered whether meta-data could be used for color-tags as well as it is more lightweight. |
Another thing to consider is whether it is a good idea to allow the custom icon set in a desktop file to be overridden - allowing one executable to "masquerade" as a different one. Could this be a security issue? Maybe custom icons should be limited to folders? |
UPDATE: I've tried to fix a bit the Icon selector since it was too easy to mess with the icon and break the icon. Current State:
Current Issues:
Here is the gif showing the current state for those who can't test it. |
I am wondering whether it would be better for the custom icon to be superimposed on the standard folder icon so that it remains clear that it is a folder. However, that would require messing with the icon renderer. Need UX team input. |
I think we need a convenient way to revert the custom icon to the default (i.e. remove the metadata). At the moment it looks like you have to set the default folder icon as a custom icon?? |
@jeremypw Thanks for the help!
That was the original idea and I would love to do that, however it doesn't seem trivial to implement, more so considering how little do I know about Vala and files.
I tried to have a Reset button that removed the attribute with remove attribute but it didn't seem to work. |
I'll see if I can come up with something. There also seems to be a bug if you choose "Browse" instead of choosing from the list - the custom icon is not set. Not sure how to control which icons are chosen if we allow browse anyway. Another issue is zooming a custom icon does not work at the moment. Maybe we should require custom icons to be scalable. |
One issue that has arisen is that only some icons are compatible with the compositing process - others give visual glitches - the reason is not yet clear. |
Moving and copying a customised folder also moves/copies the custom icon now, at least within the same filesystem. |
@AlbertAlonso In the illustration you are in the home directory where the special user folders have "special" icons - these change for small icons even in master so I do not think it is an issue we should address here. Maybe we should stop system special folders being customised by the user though. I am loath to spend too much time on this before we get a review from the UX team to avoid going too far down the wrong road. |
OK, so how about using a small collection of different symbolic icons? That way there is not way for the user themselves to do anything that hasn't been tested. I really dislike the idea of allowing users to completely steamroll any semblence of icon consistency and testability. Edit: How about using the applications-* icons? applications-development, applications-education, applications-games, applications-graphics, applications-multimedia, applications-office and applications-science go really well IMO. |
@hanaral That seems sensible and doable, but this PR needs input from the UX team before pursuing. |
I think we still need to see a rational of "why". People keep getting caught up in the "how" without asking what problem is being solved. |
I guess it is to give an "at a glance" indication of the type folder contents without having to read the name (which might be in small text) 🤷 |
I still don't particularly like user interference with iconography, so making the folder colour tags less fugly might incentivise using them. |
I am inclined to close this PR as it does not look as if it is likely to get any traction. |
I agree with you :) |
So this feature is confirmed not coming? This is supported by Windows, Mac and Ubuntu and helps quickly identify folders at a glance. I feel like it'd be a shame to drop all this work done on the currently most requested feature for files |
The UX team need to be persuaded as to what the problem is and what is the best way to solve it. The best way would be to open a well-thought out issue report where a solution design can be developed and gain UX approval. This PR was probably premature. |
I feel like we should take another look at this. There are already folder icons for videos, pictures, etc. Users should be able to add their own custom folders and apply icons to them so they don't stick out like a sore thumb. |
Please make any further comments on the related issue report. |
In order to learn a bit how this repo works, I've tried to fix #171, but I need some guidance to continue, so don't take this PR too serious.
My current state:
This gif demostrates the current state of the PR ( I know using the firefox exemple is a bad one, but it was just as a demostration )

The icon is changed when dragged or when the properties dialog is opened again though.
Ideally we would be able to put custom images as icons, but this is just a first attempt.
If this pull request is wrong feel free to close it.