Closed maphew closed 5 years ago
@maphew make_shortcut
could return the full paths. For now, you could do:
scut = make_shortcut(scriptcmd, name="Script Name", icon=iconpath)
targets = [os.path.join(f, scut.target) for f in (scut.desktop, scut.start_menu)]
For programmatically deleting shortcuts, I suppose pyshortcuts could keep a file (say in $HOME/.config/pyshortcuts.created_links
) that records where shortcuts are made so that it can also have a method to clean these out. Sort of like Windows "Add/Remove Programs".
I can definitely see how "Remove App" could be important. At least, it gives the user the choice to clean up unused (or flaky or conflicting) versions of Apps. I'm less sure about "Remove Shortcuts".
That is, I guess I view the shortcuts as handy placeholders for running apps that the user can alter or delete. I think a lot of people find them annoying and/or carefully manage what is on their desktop, start menu, taskbar, Dock, etc so the Apps they need most are easily found by them. Still, I can see that it could be useful to be able to try to clean up what was installed. That almost seems like it would have to be part of pip/setuptools or conda or whatever package manager was used.
Thanks for the list comprehension alternate. Agreed that remove app is better than remove shortcut and that the proper place for all this is a package manager. They're not there yet! Thinking about it more. Remove shortcut fits my sense of symmetry but is probably not all that useful in the real world. People are going to conda or pip remove thing and only later "oh yeah, the shortctuts too", at which time it will be too late for this.
I'm closing this as not needed sufficiently enough to warrant the work (and maintenance). The stub is here if anyone wants to re-open and run with it.
The other side of creating shortcuts is deleting them! ;-) It's unreasonable to have pyshortcut record where links are created; too many variable conditions to take into account, not least of which is where to save the record.
My naive but workable approach to a
remove
command is: to create new shortcuts, which likely overwrite ones already there, and then immediately delete these new ones.This would be slightly easier if scut returned the full path to the targets created.
I opened this issue for discussion and to share an idea. e.g. it's not a direct request to add a
remove
function (though I'd be okay if it were).