From ba611b333bbf265e9a71a8680e2187c1d41252b3 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 5 Dec 2020 18:53:35 +0100 Subject: [PATCH] mpd: Listen on socket --- users/simon/modules/mpd.nix | 4 ++++ users/simon/modules/sway.nix | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/users/simon/modules/mpd.nix b/users/simon/modules/mpd.nix index 3493551..1f42916 100644 --- a/users/simon/modules/mpd.nix +++ b/users/simon/modules/mpd.nix @@ -4,6 +4,7 @@ services.mpd = { enable = true; musicDirectory = "~/Music"; + network.listenAddress = "${config.services.mpd.dataDir}/socket"; extraConfig = '' zeroconf_enabled "no" @@ -29,6 +30,9 @@ package = pkgs.ncmpcpp.override { visualizerSupport = true; taglibSupport = false; }; mpdMusicDir = null; # does not work (not of type `null or path') settings = { + # Connection + mpd_host = "${config.services.mpd.dataDir}/socket"; + # Visualizer visualizer_fifo_path = "${config.services.mpd.dataDir}/fifo"; visualizer_in_stereo = "yes"; diff --git a/users/simon/modules/sway.nix b/users/simon/modules/sway.nix index 8b1678f..6a10a0e 100644 --- a/users/simon/modules/sway.nix +++ b/users/simon/modules/sway.nix @@ -332,6 +332,7 @@ lib.mkIf config.sbruder.gui.enable { on-scroll-down = "brightnessctl set 5%-"; }; mpd = { + server = "${config.services.mpd.dataDir}/socket"; format = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} – {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) "; format-disconnected = "Disconnected "; format-stopped = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped "; @@ -339,8 +340,8 @@ lib.mkIf config.sbruder.gui.enable { interval = 2; tooltip-format = "MPD (connected)"; tooltip-format-disconnected = "MPD (disconnected)"; - on-scroll-up = "${pkgs.mpc_cli}/bin/mpc volume +2"; - on-scroll-down = "${pkgs.mpc_cli}/bin/mpc volume -2"; + on-scroll-up = "${pkgs.mpc_cli}/bin/mpc -h ${config.services.mpd.dataDir}/socket volume +2"; + on-scroll-down = "${pkgs.mpc_cli}/bin/mpc -h ${config.services.mpd.dataDir}/socket volume -2"; consume-icons = { on = " "; };