Provide a method of assigning custom default icons for non-XDG dirs
Needs RevisionPublic

Authored by ngraham on Nov 26 2018, 4:18 AM.

Details

Reviewers
cfeck
broulik
dfaure
Group Reviewers
Frameworks
Summary

This patch adds a new folder-to-icon map that makes it possible to assign default icons for non-XDG directories. It is pre-populated with ~/Games, as requested in 401218.

The new map includes entries for the localized and non-located string, because some people like to use English names even with a different locale.

BUG: 401218
FIXED-IN: 5.53

Test Plan
  • Created ~/Games; it got the new folder-games icon
  • Created a new user account and checked out its homedir; all XDG dirs continued to get the correct icon

Diff Detail

Repository
R241 KIO
Branch
custom-icons-for-non-xdg-dirs (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5380
Build 5398: arc lint + arc unit
ngraham created this revision.Nov 26 2018, 4:18 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptNov 26 2018, 4:18 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
ngraham requested review of this revision.Nov 26 2018, 4:18 AM
ngraham updated this revision to Diff 46233.Nov 26 2018, 4:19 AM

Correct typo in the comment

ngraham updated this revision to Diff 46234.Nov 26 2018, 4:21 AM

Match existing brace style for inline initializer

dfaure requested changes to this revision.Nov 30 2018, 12:37 PM

This feels *very* special cased. Where does this automagic ends? Any why only in $HOME? We'll keep adding entries here forever... Why don't people use a .directory file for this?
If ~/Games is a de-facto standard, whoever creates it could add a .directory in there. If it's not, then that makes my point.

This revision now requires changes to proceed.Nov 30 2018, 12:37 PM

This feels *very* special cased. Where does this automagic ends? Any why only in $HOME? We'll keep adding entries here forever... Why don't people use a .directory file for this?
If ~/Games is a de-facto standard, whoever creates it could add a .directory in there. If it's not, then that makes my point.

Well, it is very special cased. :)

But I think the better question is whether it's useful or nice to have. The whole point of this patch is to gain the ability for KIO to automatically set appropriate default icons for common-but-not-XDG directories that people might create. Sure, people can already set custom icons for those folders themselves if they want. It's just a few clicks. This patch simply provides a mechanism for KIO to make it automatic.

Have you ever had one of those moments when you go to do something that you expect to be a manual, multi-step process but the software anticipates what you're going to do and does it for you? It's those little "aha, I love that they thought of this!" moments that make people fall in love with software. That's all this is trying to help facilitate. :)

cfeck added a comment.Dec 6 2018, 5:25 AM

But why hardcode the list in the source, instead of reading it from a file/resource that the user could expand? Ideally, the "New Folder" dialog would have a button to pick an icon, and a checkbox "Remember icon for this folder name", automatically appending/replacing entries in this list.

But why hardcode the list in the source, instead of reading it from a file/resource that the user could expand?

I don't see the benefit of putting the data into a configuration file. The whole idea is to make KIO default to picking a nicer icon when the user creates a folder with a name that would benefit from having a a nice-looking Breeze icon rather than just the standard folder icon. Currently the only one in the list is "Games", but this could be extended over time for other useful folder names. E.g. "Books" "Source Code", etc.

Ideally, the "New Folder" dialog would have a button to pick an icon

That sounds like a good idea. But even with that, this patch would still be useful because it could pre-populate that icon picker with a folder icon more appropriate than just the default one. For example when you type the name "Games" into the text field, the default icon in the picker would automatically change to folder-games.

This doesn't add any new features that users can't already accomplish themselves using handmade .desktop files or the existing icon picker functionality. It just tries to make KIO a little smarter and more considerate about choosing the default icon when the user creates commonly-named folders. A user specifically requested this functionality in https://bugs.kde.org/show_bug.cgi?id=401218