termusic icon indicating copy to clipboard operation
termusic copied to clipboard

[Feature request] CLI options for media control

Open Dazaisan99 opened this issue 3 years ago • 6 comments

Please keep in mind that I have just started using the software.

I'm coming from mocp and I'm just missing one feature from what I had before, more command line handling.

The thing you could do with mocp was type

mocp -f
mocp -G

And mocp would skip to the next song, or pause / unpause it.

It would be nice to have something like that in termusic, from the command line, such as :

termusic --next / -n
termusic --toggle-pause / -T

I also would be useful for WM users, as it allows to map keybindings to control the music player, as I could do with mocp.

BTW : termusic is awesome so far !

Dazaisan99 avatar Jan 03 '23 08:01 Dazaisan99

Thanks for your great feedback. About the function, seems it need a separate daemon running, to accept the command from another thread. It'll need a server/client structure, thus it could take some time. But I'll keep it in the todo list. Currently, the function you requested can be achieved through mpris. I'll list what I'm doing right now:

  1. I'm running leftwm, a window manager written in rust. I use polybar, and I setup a widget with mpris player.
  2. In this widget, I can click to pause, double click to skip to next song etc.
  3. It's possible to configure hotkey for it I think, but I haven't tried.

tramhao avatar Jan 05 '23 07:01 tramhao

Thanks for the reply ! It works like a charm.

For those wondering how to use your WM like me to control it :

  1. Install MPRIS (see https://wiki.archlinux.org/title/MPRIS)
  2. Configure your WM accordingly, for example, BSPWM would be
alt + {Left, Right, Down}
    playerctl {previous, next, play-pause}

Thanks again !

Dazaisan99 avatar Jan 05 '23 16:01 Dazaisan99

No big deal and thanks for the detail explanation.

tramhao avatar Jan 06 '23 14:01 tramhao

With 0.7.11 this should be possible now, right? I was thinking of giving a PR for this a shot, but probably won't have time for it in the next couple weeks. @tramhao do you already have plans on implementing this? If not I might look into it after summer.

VuiMuich avatar Jul 26 '23 07:07 VuiMuich

from my understanding this could now be added quite easily, but there are some questions to answer first:

  • where to add this, the termusic(-tui) binary or the termusic-server(server) binary?
  • what style should the commands be
    • should the commands be arguments (bin --pause), or
    • should the command be subcommands (bin pause)
  • should multiple commands / actions be allowed at once (bin --play --volume 50) (this would exclude the "subcommand" route, because clap is not able to handle that to my knowledge)

hasezoey avatar Jan 15 '24 17:01 hasezoey