probonopd / go-appimage

Go implementation of AppImage tools
MIT License
787 stars 70 forks source link

inotifyWatch: *.AppImage notify.InMovedFrom only partly rewrites .desktop files #162

Open almereyda opened 3 years ago

almereyda commented 3 years ago

When moving AppImages with

cd ~
mv Downloads/*.AppImage Software

after .desktop files were already created in ~/.local/share/applications, those are only partially updated:

● appimaged.service - AppImage system integration daemon
     Loaded: loaded (/home/yala/.config/systemd/user/appimaged.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-08-31 01:52:50 CEST; 3min 42s ago
   Main PID: 1993004 (AppRun)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/appimaged.service
             ├─1993004 /home/yala/Software/appimaged-646-x86_64.AppImage
             └─1993010 /home/yala/Software/appimaged-646-x86_64.AppImage

Aug 31 01:52:51 ganglion appimaged[1993004]: 2021/08/31 01:52:51 lstat /boot/grub/Applications: permission denied
Aug 31 01:52:51 ganglion appimaged[1993004]: 2021/08/31 01:52:51 lstat /run/snapd/ns/snap-store.mnt/Applications: not a directory
Aug 31 01:52:51 ganglion appimaged[1993004]: 2021/08/31 01:52:51 lstat /root/Applications: permission denied
Aug 31 01:52:55 ganglion appimaged[1993004]: 2021/08/31 01:52:55 main: Moved 2 desktop files to /home/yala/.local/share/applications/; use -v to see details
Aug 31 01:52:55 ganglion appimaged[1993004]: 2021/08/31 01:52:55 Desktop notification:  Added 2 applications
Aug 31 01:52:55 ganglion appimaged[1993004]: 2021/08/31 01:52:55 Ran update-desktop-database /home/yala/.local/share/applications/
Aug 31 01:54:41 ganglion appimaged[1993004]: 2021/08/31 01:54:41 inotifyWatch: /home/yala/Downloads/Beaker.Browser-1.1.0.AppImage notify.InMovedFrom
Aug 31 01:54:41 ganglion appimaged[1993004]: 2021/08/31 01:54:41 inotifyWatch: /home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage notify.InMovedFrom
Aug 31 01:54:41 ganglion appimaged[1993004]: 2021/08/31 01:54:41 inotifyWatch: /home/yala/Downloads/Beaker.Browser-1.1.0.AppImage notify.InMovedFrom
Aug 31 01:54:41 ganglion appimaged[1993004]: 2021/08/31 01:54:41 inotifyWatch: /home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage notify.InMovedFrom
`~/.local/share/applications/appimagekit_b758209beb2e80f44a566f26f049655e.desktop` ``` [Desktop Entry] Name=Logseq Exec=/home/yala/Software/appimaged-646-x86_64.AppImage wrap "/home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage" Terminal=false Type=Application Icon=/home/yala/.cache/thumbnails/normal/b758209beb2e80f44a566f26f049655e.png StartupWMClass=undefined X-AppImage-Version=0.3.6 Comment=/home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage Categories=Utility X-ExecLocation=/home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage TryExec=/home/yala/Software/appimaged-646-x86_64.AppImage X-AppImage-Identifier=b758209beb2e80f44a566f26f049655e Actions=Trash;OpenPortableHome;CreatePortableHome;Extract;Show; [Desktop Action Trash] Name=Move to Trash Exec=gio trash "/home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage" [Desktop Action OpenPortableHome] Name=Open Portable Home in File Manager Exec=xdg-open "/home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage.home" [Desktop Action CreatePortableHome] Name=Create Portable Home Exec=mkdir -p "/home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage.home" [Desktop Action Extract] Name=Extract to AppDir Exec=bash -c "cd '/home/yala/Downloads' && '/home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage' --appimage-extract && xdg-open '/home/yala/Downloads/squashfs-root'" [Desktop Action Show] Name=Open Containing Folder Exec=xdg-open "/home/yala/Downloads" ```
`~/.local/share/applications/appimagekit_bc5bc678d5046823f08663f5e2787b09.desktop` ``` [Desktop Entry] Name=Beaker Browser Exec=/home/yala/Software/appimaged-646-x86_64.AppImage wrap "/home/yala/Downloads/Beaker.Browser-1.1.0.AppImage" Terminal=false Type=Application Icon=/home/yala/.cache/thumbnails/normal/bc5bc678d5046823f08663f5e2787b09.png StartupWMClass=Beaker Browser X-AppImage-Version=1.1.0 GenericName=Web Browser MimeType=x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/hyper;x-scheme-handler/dat; Categories=Network; Comment=/home/yala/Downloads/Beaker.Browser-1.1.0.AppImage X-ExecLocation=/home/yala/Downloads/Beaker.Browser-1.1.0.AppImage TryExec=/home/yala/Software/appimaged-646-x86_64.AppImage X-AppImage-Identifier=bc5bc678d5046823f08663f5e2787b09 Actions=Trash;OpenPortableHome;CreatePortableHome;Extract;Show; [Desktop Action Trash] Name=Move to Trash Exec=gio trash "/home/yala/Downloads/Beaker.Browser-1.1.0.AppImage" [Desktop Action OpenPortableHome] Name=Open Portable Home in File Manager Exec=xdg-open "/home/yala/Downloads/Beaker.Browser-1.1.0.AppImage.home" [Desktop Action CreatePortableHome] Name=Create Portable Home Exec=mkdir -p "/home/yala/Downloads/Beaker.Browser-1.1.0.AppImage.home" [Desktop Action Extract] Name=Extract to AppDir Exec=bash -c "cd '/home/yala/Downloads' && '/home/yala/Downloads/Beaker.Browser-1.1.0.AppImage' --appimage-extract && xdg-open '/home/yala/Downloads/squashfs-root'" [Desktop Action Show] Name=Open Containing Folder Exec=xdg-open "/home/yala/Downloads" ```

Is there a way to force recreation of the .desktop files, either manually or automatically, to render the menu entries workable again?

probonopd commented 3 years ago

Looks like inotifyWatch doesn't catch all changes? Try moving the file that wasn't caught again.

almereyda commented 3 years ago

Hi, I did that, yet the paths remain the same in the .desktop file:

mv Software/logseq-linux-x64-0.3.6.AppImage Downloads/
less .local/share/applications/appimagekit_b758209beb2e80f44a566f26f049655e.desktop
mv Downloads/logseq-linux-x64-0.3.6.AppImage Software
less .local/share/applications/appimagekit_b758209beb2e80f44a566f26f049655e.desktop

The corresponding unit logs read as:

Aug 31 12:54:03 ganglion appimaged[1993004]: 2021/08/31 12:54:03 inotifyWatch: /home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage notify.InMovedTo
Aug 31 12:54:03 ganglion appimaged[1993004]: 2021/08/31 12:54:03 inotifyWatch: /home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage notify.InMovedTo
Aug 31 12:54:44 ganglion appimaged[1993004]: 2021/08/31 12:54:44 inotifyWatch: /home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage notify.InMovedFrom
Aug 31 12:54:44 ganglion appimaged[1993004]: 2021/08/31 12:54:44 inotifyWatch: /home/yala/Downloads/logseq-linux-x64-0.3.6.AppImage notify.InMovedFrom

Please note the different indications for InMovedTo and InMovedFrom for the two actoins. The same is true for this sequence for the other application:

mv Software/Beaker.Browser-1.1.0.AppImage Downloads
less .local/share/applications/appimagekit_bc5bc678d5046823f08663f5e2787b09.desktop
mv Downloads/Beaker.Browser-1.1.0.AppImage Software
less .local/share/applications/appimagekit_bc5bc678d5046823f08663f5e2787b09.desktop
Aug 31 12:57:47 ganglion appimaged[1993004]: 2021/08/31 12:57:47 inotifyWatch: /home/yala/Downloads/Beaker.Browser-1.1.0.AppImage notify.InMovedTo
Aug 31 12:57:47 ganglion appimaged[1993004]: 2021/08/31 12:57:47 inotifyWatch: /home/yala/Downloads/Beaker.Browser-1.1.0.AppImage notify.InMovedTo
Aug 31 12:58:28 ganglion appimaged[1993004]: 2021/08/31 12:58:28 inotifyWatch: /home/yala/Downloads/Beaker.Browser-1.1.0.AppImage notify.InMovedFrom
Aug 31 12:58:28 ganglion appimaged[1993004]: 2021/08/31 12:58:28 inotifyWatch: /home/yala/Downloads/Beaker.Browser-1.1.0.AppImage notify.InMovedFrom
almereyda commented 3 years ago

Another similar case is reported in #141