aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-10-16 21:16:31 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-10-16 21:16:31 +0300
commitc015df322ec4fba41d75b5418bd460de42697e07 (patch)
tree20e8184470c2f63b4de62734a2c784d5e22e0920
parent70fc9fd33fa7e7d7cfc2fc62c8b2a4c4a17bb204 (diff)
downloadswayrice-c015df322ec4fba41d75b5418bd460de42697e07.tar.gz
swayrice-c015df322ec4fba41d75b5418bd460de42697e07.zip
Use playerctl/MPRIS for media control
-rwxr-xr-xartix.sh7
-rw-r--r--dotfiles/.config/sway/config18
-rw-r--r--dotfiles/.config/waybar/config12
-rwxr-xr-xdotfiles/.local/bin/lmc13
4 files changed, 31 insertions, 19 deletions
diff --git a/artix.sh b/artix.sh
index e7e8c79..bb26bb7 100755
--- a/artix.sh
+++ b/artix.sh
@@ -74,7 +74,6 @@ pacman -Sy \
gnome-themes-standard \
telegram-desktop \
qt5ct \
- r \
bc \
udisks2 \
dash \
@@ -127,6 +126,8 @@ pacman -Sy \
openntpd \
openntpd-runit \
v4l2loopback-dkms \
+ playerctl \
+ mpv-mpris \
|| exit 1
# Copy system config files
@@ -175,5 +176,7 @@ yay -S --noconfirm \
rofi-lbonn-wayland \
rofi-calc \
rofi-file-browser-extended-git \
- networkmanager-dmenu-git
+ networkmanager-dmenu-git \
+ waybar-mpris-git \
+ mpd-mpris
diff --git a/dotfiles/.config/sway/config b/dotfiles/.config/sway/config
index 93082c3..6c2f5b2 100644
--- a/dotfiles/.config/sway/config
+++ b/dotfiles/.config/sway/config
@@ -56,10 +56,14 @@ exec_always {
exec waybar_launch
# Audio
exec pipewire-restart
+# playerctl daemon for better MPRIS support
+exec playerctld daemon
# Music daemon
exec mpd
+# MPRIS support for MPD
+exec mpd-mpris
# Bluetooth adapter applet
-exec_always blueman-applet
+exec blueman-applet
# Notification handler
exec mako
# Environment variables for cron scripts
@@ -354,11 +358,11 @@ bindsym --to-code {
$mod+XF86AudioLowerVolume exec exremote "lmc down 5"
$mod+XF86AudioMute exec exremote "lmc mute"
- $mod+Ctrl+Shift+F5 exec exremote "mpc seek -10"
+ $mod+Ctrl+Shift+F5 exec exremote "lmc back 5"
$mod+Ctrl+F5 exec exremote "lmc prev"
$mod+Ctrl+F6 exec exremote "lmc toggle"
$mod+Ctrl+F7 exec exremote "lmc next"
- $mod+Ctrl+Shift+F7 exec exremote "mpc seek +10"
+ $mod+Ctrl+Shift+F7 exec exremote "lmc forward 5"
# Remote computer's clipboard
$mod+Ctrl+c exec clipremote copy
@@ -381,13 +385,13 @@ bindsym --to-code --locked {
XF86AudioLowerVolume exec lmc down 5
XF86AudioMute exec lmc mute
- $mod+Shift+F5 exec mpc seek -10
+ $mod+Shift+F5 exec lmc back 5
$mod+F5 exec lmc prev
$mod+F6 exec lmc toggle
$mod+F7 exec lmc next
- $mod+Shift+F7 exec mpc seek +10
- $mod+F8 exec mpc single
- $mod+Shift+F8 exec mpc repeat
+ $mod+Shift+F7 exec lmc forward 5
+ $mod+F8 exec playerctl loop Track
+ $mod+Shift+F8 exec playerctl loop None
}
include "~/.config/sway/`uname -n`"
diff --git a/dotfiles/.config/waybar/config b/dotfiles/.config/waybar/config
index ce0942e..16a6fdb 100644
--- a/dotfiles/.config/waybar/config
+++ b/dotfiles/.config/waybar/config
@@ -1,11 +1,11 @@
-
+// vim: filetype=json
{
"layer": "bottom",
"height": 30,
"modules-left": [
"sway/workspaces",
"sway/mode",
- "mpd",
+ "custom/waybar-mpris",
"pulseaudio"
],
"modules-center": [
@@ -30,6 +30,12 @@
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
+ "custom/waybar-mpris": {
+ "return-type": "json",
+ "exec": "waybar-mpris --position --autofocus --pause=' <span color=\\\"#5b8277\\\"></span>' --play=' <span color=\\\"#b2872f\\\"></span>'",
+ "on-click": "waybar-mpris --send toggle",
+ "on-click-right": "waybar-mpris --send player-next"
+ },
"mpd": {
"format": " {stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon} [{elapsedTime:%M:%S}] {artist} - {title}",
"format-disconnected": " Connection lost ",
@@ -192,7 +198,7 @@
"format": "<span color=\"#5b8277\"></span> {}",
"signal": 7,
"interval": "once",
- "exec": "barpacstatus",
+ "exec": "barpacstatus"
},
"custom/news-status": {
"format": "<span color=\"#5b8277\"></span> {}",
diff --git a/dotfiles/.local/bin/lmc b/dotfiles/.local/bin/lmc
index c740c0c..f1ef8f5 100755
--- a/dotfiles/.local/bin/lmc
+++ b/dotfiles/.local/bin/lmc
@@ -5,13 +5,12 @@ case "$1" in
"down") pamixer --allow-boost -d "$2" || amixer sset Master 2%- ;;
"mute") pamixer --allow-boost -t || amixer sset Master toggle ;;
"truemute") pamixer --allow-boost -m || amixer sset Master mute ;;
- "toggle") mpc toggle ; $newmpd ;;
- "pause") mpc pause ; $newmpd ;;
- "forward") mpc seek +"$2" ; $newmpd ;;
- "back") mpc seek -"$2" ; $newmpd ;;
- "next") mpc next ; $newmpd ;;
- "prev") mpc prev ; $newmpd ;;
- "replay") mpc seek 0% ; $newmpd ;;
+ "toggle") playerctl play-pause;;
+ "pause") playerctl pause;;
+ "forward") playerctl position "$2"+;;
+ "back") playerctl position "$2"-;;
+ "next") playerctl next;;
+ "prev") playerctl previous;;
esac
exit