Hello

(Note: this email uses markdown formatting.)

It's been a while since I've used lilypond, and I had point and click
working on another system, but I can't remember what I did. I do
remember there were hiccups. Also, it was probably Arch Linux and now
the distro I'm using is Ubuntu 22.04, Lilypond version 2.22.2.

I want to set up point and click with VS Code, ultimately, and I open
the pdf from a terminal emulator with xdg-open (I believe the app that
opens it is called "evince" but it just displays "Document Viewer".

First I updated the `LYEDITOR` to point to VS Code with its required
CLI arguments.

```
~/Workspace/my-lilypond-project$ lilypond main.ly
~/Workspace/my-lilypond-project$ xdg-open main.pdf
~/Workspace/my-lilypond-project$ export LYEDITOR="code --goto
%(file)s:%(line)s:%(column)s"
```

>From there I right-clicked a clickable thing and copied its address to
try it out with the CLI:

```
~/Workspace/my-lilypond-project$ lilypond-invoke-editor
textedit:///home/tjb1982/Workspace/my-lilypond-project/./movement-foo/cello.ly:27:107:108
```

And this worked as expected, so then I went to configure xdg-mime to
handle the `x-scheme-handler/textedit` mimetype as per the docs
[here](https://lilypond.org/doc/v2.25/Documentation/usage/using-gnome-for-point-and-click).

```shell
~/Workspace/my-lilypond-project$ cd /tmp
/tmp$ cat <<_EOF > lilypond-invoke-editor.desktop
[Desktop Entry]
Version=1.0
Name=lilypond-invoke-editor
GenericName=Textedit URI handler
Comment=URI handler for textedit:
Exec=lilypond-invoke-editor %u
Terminal=false
Type=Application
MimeType=x-scheme-handler/textedit;
Categories=Editor
NoDisplay=true
_EOF
/tmp$ xdg-desktop-menu install ./lilypond-invoke-editor.desktop
/tmp$ xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit
/tmp$ cd -
~/Workspace/my-lilypond-project$ lilypond main.ly
~/Workspace/my-lilypond-project$ xdg-open main.pdf
```

>From here, clicking on a clickable item in the pdf results in the
console logging:

```
sh: 1: exec: lilypond-invoke-editor: Permission denied
```

I found the thread
[here](https://lists.gnu.org/archive/html/lilypond-user/2019-02/msg00276.html)
where David Sumbler figured out some required configuration for
apparmor and evince, so I tried to follow the same process. I already
had a file at `/etc/apparmor.d/usr.bin.evince`, so I edited the
`/usr/bin/evince` section of the file like this:

```
/usr/bin/evince {
  ...
  /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
}
```

I ran the parser, double-checked that this is the actual location of
`lilypond-invoke-editor`, and restarted the apparmor service:

```
~$ sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince
~$ echo $?
0
~$ which lilypond-invoke-editor
/usr/local/bin/lilypond-invoke-editor
~$ sudo systemctl restart apparmor
~$ sudo systemctl status apparmor
● apparmor.service - Load AppArmor profiles
     Loaded: loaded (/lib/systemd/system/apparmor.service; enabled;
vendor preset: enabled)
     Active: active (exited) since Fri 2024-03-22 09:12:02 EDT; 1s ago
       Docs: man:apparmor(7)
             https://gitlab.com/apparmor/apparmor/wikis/home/
    Process: 24362 ExecStart=/lib/apparmor/apparmor.systemd reload
(code=exited, status=0/SUCCESS)
   Main PID: 24362 (code=exited, status=0/SUCCESS)
        CPU: 161ms

Mar 22 09:12:02 chester systemd[1]: Starting Load AppArmor profiles...
Mar 22 09:12:02 chester apparmor.systemd[24362]: Restarting AppArmor
Mar 22 09:12:02 chester apparmor.systemd[24362]: Reloading AppArmor profiles
Mar 22 09:12:02 chester apparmor.systemd[24379]: Skipping profile in
/etc/apparmor.d/disable: usr.sbin.rsyslogd
Mar 22 09:12:02 chester systemd[1]: Finished Load AppArmor profiles.
```

This didn't change anything (still getting the permission denied error
when clicking).

I also tried to stop the apparmor service and then reboot

```
~$ sudo systemctl stop apparmor
~$ sudo systemctl disable apparmor
```

This didn't have any effect. What should I try next?

Thanks,
Tom

Reply via email to