Closed vslavkin closed 1 month ago
Update: it fails with all the playerctl (music) commands
would you mind sending a PR? I'm not sure we should add a dependency to playerctl because desktop-environment can be used with any command.
Sure, I'll try to do it.
Well, I spend quite a bit of time with this. Getting the output of an async shell command or a process isn't exactly easy. This is what worked:
(defun desktop-environment--process-filter (command msg)
"Start a process of COMMAND and message MSG."
(let ((proc (start-process-shell-command "desktop-environment-music" nil command)))
(set-process-filter proc (lambda (proc line) (message "%s" msg)))))
Not my favourite approach. We could continue going this way, or ignore the output of playerctl (like playerctl.el). I couldn't get it to work with a function as filter that is passed as argument instead of the msg. I'm still unsure about why doesn't emacs detect that the playerctl command has finished. I guess it could be a problem of playerctl, but its unlikely.
I have actually tried and things work fine for me, without any change. I'm using playerctl 2.4.1.
Can you please try:
$ playerctl --version
$ which playerctl
thank you
In my arch laptop, I've:
$ playerctl --version
v2.4.1
$ which playerctl
/usr/bin/playerctl
I've a desktop with nixos, so I'll check the output as soon as I'm able to
And for nix I have the same version and
$ which playerctl
/home/vslavkin/.nix-profile/bin/playerctl
Because that's how nix works.
I have no clue what is going on for you, I'm sorry. I'm also using nix.
And for nix I have the same version
can you reproduce the problem on both computers?
Yeah, with the override it "works", but it doesn't give me the output of the command (for when there's no player, etc) and I would have to override all the other commands. In both systems it blocks emacs.
Well, tried with emacs -Q (as I shoul've) and it works. I just though that if it didn't even work with M-!, it would change a lot if I did it with -Q I guess. Sorry to bother.
Yeah, after researching a bit, the problem seems to be when using emms. I can play-pause other media, but when pausing the emms music that is executing in the current emacs, it blocks and doesn't work if I don't do it async. Can you reproduce this behaviour @DamienCassou ?
I'm using mpdel and not emms to play my music.
Thanks for your help, I'll look into mpdel!
Throwing that command blocks emacs. I think it's because it's waiting for an output but the command doesn't output anything. I solved it temporarly using the following override:
It would be good to show the status right after. The code of playerctl.el might be worth a look, even this package could use that one for the playerctl part.