-
Notifications
You must be signed in to change notification settings - Fork 16
Add option to specify directories to watch #74
Conversation
Adds a check for the APPIMAGED_WATCH_DIRS environment variable. If present, appimaged will watch the colon (:) separated list of directories instead of the default. If using systemd, the user can create `$HOME/.config/systemd/user/appimaged.service.d/10-watch-dirs.conf` as a drop-in for appimaged.service with something similar to the following contents: ``` [Service] Environment=APPIMAGED_WATCH_DIRS=/home/avery/Applications:/Applications ``` Note that systemd will not perform variable expansion, so you can't specify something like `$HOME/Applications`, unfortunately. In the current implementation, if using APPIMAGED_WATCH_DIRS, the check for /Applications on all mounts will not be performed. I wrapped `g_getenv("APPIMAGE")` in a call to `g_strdup()` because the GLib documentation states, "The returned string may be overwritten by the next call to g_getenv(), g_setenv() or g_unsetenv()." I didn't want to risk my call to `g_getenv()` invalidating the reference to `appimage_location`. I also later freed it after it was used.
Thanks @genderquery. We are trying to do without configurability where we can, in order to make things simple, reproducible, easy to explain/document, and avoid differences between user's systems. Can you give an example where the provided locations are not sufficient? |
That makes sense @probonopd. I wrote this for my own purposes and figured I'd share in case it was useful and I understand if you'd rather not merge it. To remind those following this conversation, appimaged currently looks in the following locations:
On my system, my Thank you for taking the time to review my pull request. |
True, I think this is what we need to tackle first and foremost. Do you have ideas how to make the directory scanning more efficient? One way to achieve this would be to only use AppImages that have the |
Looking at the file extension would help considerably, however this would run counter to the current draft of the AppImage Specification which states that an AppImage "MUST NOT rely on any specific file name extension". I'll think on it more and if I come up with anything, I'll open a new issue or make a pull request for it. Feel free to close this PR. Thanks for taking the time to review it and offer feedback :-) |
This first and foremost means that the AppImage still must work when it is renamed or moved (not necessarily the |
Hi, I am not sure where to put this at all, as the issues like #29 are closed. I believe that it should be possible to stop registering a certain AppImage by renaming it, like "Emacs-26.3-x86_64.AppImage_disabled" is literally telling a human being that ... this AppImage file is disabled. (In this case, because I compiled Emacs manually. I decided to keep the downloaded AppImage file just in case. But it appears in my Cinnamon Desktop menu. I am a keyboard junky and more, I don't want to have distractions when calling a/any program.) Alternatively I could move the file from my ~/Downloads/... directory, but that would be very unnatural, to modify directory structures that have been proven OK for years. Just not to have an entry in my launcher menu. I could use that environment variable But this would overwrite I would suggest 2+0,5+0,5 things out of this:
The user installing AppImaged will always have the In the first case, as you stated, you would speed up the search and stop weird cases like VBox image files. And, honestly, as a user I want to be able to disable things with at least effort possible. Calling a thing ".disabled" should be a hint. |
Thanks for your thoughtful considerations @is-this-a-comma-or-period. I do like the |
Adds a check for the
APPIMAGED_WATCH_DIRS
environment variable. Ifpresent, appimaged will watch the colon (:) separated list of
directories instead of the default.
If using systemd, the user can create
$HOME/.config/systemd/user/appimaged.service.d/10-watch-dirs.conf
as adrop-in for appimaged.service with something similar to the following
contents:
Note that systemd will not perform variable expansion, so you can't
specify something like
$HOME/Applications
, unfortunately.In the current implementation, if using
APPIMAGED_WATCH_DIRS
, the checkfor /Applications on all mounts will not be performed.
I wrapped
g_getenv("APPIMAGE")
in a call tog_strdup()
because theGLib documentation states, "The returned string may be overwritten by
the next call to g_getenv(), g_setenv() or g_unsetenv()." I didn't want
to risk my call to
g_getenv()
invalidating the reference toappimage_location
. I also later freed it after it was used.May resolve issues #29 and #44.
I'm not sure if this is the best approach, but I didn't want to introduce complexity with configuration files.