После того, как я в течение некоторого времени гуглил, я не смог (-.-) найти решение для этого:
Я хочу сказать, чтобы мой стандартный (как указано в настройках) музыкальный / видео плеер проигрывался / останавливался / далее через терминал. Но с глобальной командой, а не с "/ usr / bin / banshee --next", например.
Вот что я нашел до сих пор: X86AudioNext (клавиши клавиатуры), xmodmap (организация клавиш клавиатуры).
На ваш вопрос нет общего ответа, поскольку музыкальные проигрыватели могут реализовывать все, что захотят.
Однако проигрыватели по умолчанию для Ubuntu реализуют интерфейс mpris2 (если они интегрированы в звуковое меню). Поэтому ими можно управлять через командную строку.
Один из возможных сценариев для использования здесь: Pympris .
Вы можете запустить его так:
mpris2-remote.py play
mpris2-remote.py stop
mpris2-remote. py next
blockquote>Если вы предпочитаете что-то более простое, вы можете посмотреть определение mpris2 здесь .
В качестве альтернативы вы можете эмулировать мультимедийные клавиши GNOME, как вы уже написали в своем вопросе.
Этот вопрос очень старый, но, похоже, он получает много просмотров, поэтому я поделюсь другим решением, которое сработало для меня.
Установите программу playerctl
. Он также предоставляет средства для управления проигрывателем через MPRIS, но доступен в репозиториях Ubuntu.
playerctl --help
Usage:
playerctl [OPTION…] COMMAND - Controller for media players
For players supporting the MPRIS D-Bus specification
Help Options:
-h, --help Show help options
Application Options:
-p, --player=NAME A comma separated list of names of players to control (default: the first available player)
-a, --all-players Select all available players to be controlled
-i, --ignore-player=IGNORE A comma separated list of names of players to ignore.
-f, --format A format string for printing properties and metadata
-F, --follow Block and append the query to output when it changes for the most recently updated player.
-l, --list-all List the names of running players that can be controlled
-v, --version Print version information
Available Commands:
play Command the player to play
pause Command the player to pause
play-pause Command the player to toggle between play/pause
stop Command the player to stop
next Command the player to skip to the next track
previous Command the player to skip to the previous track
position [OFFSET][+/-] Command the player to go to the position or seek forward/backward OFFSET in seconds
volume [LEVEL][+/-] Print or set the volume to LEVEL from 0.0 to 1.0
status Get the play status of the player
metadata [KEY...] Print metadata information for the current track. If KEY is passed,
print only those values. KEY may be artist,title, album, or any key found in the metadata.
open [URI] Command for the player to open given URI.
URI can be either file path or remote URL.
loop [STATUS] Print or set the loop status.
Can be "None", "Track", or "Playlist".
shuffle [STATUS] Print or set the shuffle status.
Can be "On" or "Off".