Summary: | It should be easier to add a template to "Create New..." menu (e.g. look into ~/Templates) | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kio | Reporter: | skierpage <skierpage> |
Component: | general | Assignee: | David Faure <faure> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | 4wy78uwh, adundovi, antti.savo, codestruct, de.techno, elvis.angelaccio, hkz85825915, jagannathante, kdelibs-bugs, loucurapt, meven29, n0body_special, nate, stellarpower, yuilytg7 |
Priority: | NOR | Keywords: | usability |
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/frameworks/kio/-/commit/a72c50527f6d38d49050b97e026e4c44bb550c9e | Version Fixed In: | 6.7 |
Sentry Crash Report: | |||
Attachments: | Dolphin - Create new submenu shows $HOME |
Description
skierpage
2009-05-05 01:12:33 UTC
*** Bug 257062 has been marked as a duplicate of this bug. *** Resetting assignee to default as per bug #305719 *** Bug 351896 has been marked as a duplicate of this bug. *** Git commit de5ab5e74b4c5a6ce482af8ded7b7b60966d20bb by Elvis Angelaccio, on behalf of Marijo Mustac. Committed on 21/06/2018 at 20:53. Pushed by elvisangelaccio into branch 'master'. [KIO] Add support for XDG_TEMPLATES_DIR in KNewFileMenu Summary: This patch adds the support for templates in the XDG_TEMPLATES_DIR location which points in default to: [en] /home/user/templates [de] /home/user/Vorlagen As is all templates have to be a .desktop file maybe a second patch will follow changing this but it seems to be tricky without breaking something. Test Plan: Add new valid .desktop file to your template folder -> shows up in the menu Reviewers: #frameworks, dfaure Reviewed By: dfaure Subscribers: kde-frameworks-devel, broulik, ngraham Tags: #frameworks Differential Revision: https://phabricator.kde.org/D10363 M +33 -4 src/filewidgets/knewfilemenu.cpp https://commits.kde.org/kio/de5ab5e74b4c5a6ce482af8ded7b7b60966d20bb Anything left to do for this ticket? Yeah, you should be able to add templates by just adding files themselves into XDG_TEMPLATES_DIR without the need to manually create a .desktop file for them. Creating templates by simply adding files to $HOME/templates without creating .desktop files would be a great addition. Tell me if I can help in implementing it This would be really useful (along with KDE already shows on the "Create New" menu). The default file managers of most Linux desktop environments do this, except for KDE. The comments on phabricator linked above seem to indicate this was mostly complete, could someone possibly review please, or is there a reason it's not been merged and closed thus far? Thanks! *** Bug 400263 has been marked as a duplicate of this bug. *** *** Bug 412657 has been marked as a duplicate of this bug. *** I too would like to express my desire to have easy to create templates in the ~/Templates folder. Keep ~/.local/share/templates and /usr/share/templates as they are (as in they require a .desktop file) if changing that would break things and make the ~/Templates folder be as easy as it is on XFCE. Similar to this video: https://www.youtube.com/watch?v=967yhGf1JbQ I came here after much research. I would also like to see that implemented. I don't know how difficult it is, since I am not a coder. Judging by the ages that have passed without a solution, it has to be very difficult Further comment on the usability of the templates folder. It probably should allow for creating template folders as well. As in the function that searches the ~/Templates folder for menu entries shouldn't do it recursively. Instead it lists each top level folder as a folder structure template that you can deploy anywhere. This could be useful for initializing custom project folder structures. A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1688 Git commit a72c50527f6d38d49050b97e026e4c44bb550c9e by Méven Car, on behalf of Antti Savolainen. Committed on 07/09/2024 at 10:52. Pushed by meven into branch 'master'. knewfilemenu: Make ~/Templates work by simply placing files and folders there Adds functionality so that placing any file in `~/Templates` creates the same file in the context menu as a template. This also works for directories so you are able to create project skeletons. I think I accidentally made it so that if you already have a `.desktop` file in `~/.local/share/templates` that points to `~/Templates`, the `.desktop` file will take priority and there is no duplication. M +12 -5 autotests/knewfilemenutest.cpp M +39 -32 src/filewidgets/knewfilemenu.cpp https://invent.kde.org/frameworks/kio/-/commit/a72c50527f6d38d49050b97e026e4c44bb550c9e Could it be that this new feature does not work as intended if you don't have `~/Templates` , but it lists all your home directory instead? It seems that I'm having such an issue... I tried deleting my ~/Templates folder and nothing special happened in my context menu. Created attachment 175603 [details]
Dolphin - Create new submenu shows $HOME
Strange, Dolphin's "Create new" in my case is showing all files and folders from my $HOME directory and I don't remember setting up anything like that. See the screenshot attached.
The new feature uses qt QStandardPaths::TemplatesLocation. Not sure if that is pulling the template folder location from XDG_TEMPLATES_DIR bash variable or something else. What does echo "$XDG_TEMPLATES_DIR" return for you? It's empty. But now I see how this issue occurs. The file `~/.config/user-dirs.dirs` is written by `xdg-user-dirs-update` and/or is updated by System Settings > Session > Locations which in my case points "Templates" to my home directory because I deleted `~/Templates`. I wonder if this could be "none" or "empty", i.e., that we have the default "Create new" menu when no user Templates directory exists. |