From e4fadc372d256adf7aa338f974b49e117abb31b3 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Tue, 17 Sep 2024 13:40:50 +0200 Subject: [PATCH] Noise script --- src/bin/noise | 47 ++++++++++++++++++++++++++++++++++++++++ src/completions/_noise | 6 +++++ src/manpages/noise.1.scd | 26 ++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100755 src/bin/noise create mode 100644 src/completions/_noise create mode 100644 src/manpages/noise.1.scd diff --git a/src/bin/noise b/src/bin/noise new file mode 100755 index 0000000..d01cfef --- /dev/null +++ b/src/bin/noise @@ -0,0 +1,47 @@ +#!/usr/bin/env nu + + +def notify [message: string] { + notify-send "Noise" $"($message)" +} + +# Displays the currently playing song +def main [] { + notify (mpc current) +} + +# Skips to next song +def "main next" [] { + mpc next + notify $"Switching to: (mpc current)" +} + +# Moves back a song in the que +def "main prev" [] { + mpc prev + notify $"Switching to: (mpc current)" +} + +# Shuffles the current que +def "main shuffle" [] { + mpc shuffle + notify $"Shuffling que..." +} + +# Stops playing the current que +def "main stop" [] { + mpc stop + notify $"Stopping playback..." +} + +# Starts playing the current que +def "main start" [] { + mpc start + notify $"Starting playback..." +} + +# Toggles playback of the current que +def "main toggle" [] { + mpc toggle + notify $"Toggling playback..." +} diff --git a/src/completions/_noise b/src/completions/_noise new file mode 100644 index 0000000..05e0b70 --- /dev/null +++ b/src/completions/_noise @@ -0,0 +1,6 @@ +#compdef noise _noise + +_arguments -C \ + "1: :(next prev shuffle stop start toggle)" \ + "*::args:->args" +_arguments : $arguments diff --git a/src/manpages/noise.1.scd b/src/manpages/noise.1.scd new file mode 100644 index 0000000..162281b --- /dev/null +++ b/src/manpages/noise.1.scd @@ -0,0 +1,26 @@ +noise(1) + +# NAME + +noise - A script to manage your local MPD instance and send notifications + +# DESCRIPTION + +This is a wrapper around a few *mpc* commands that I want call from my window +manager and still be able to read the output. + +# COMMANDS + +The following commands from *mpc* are wrapped in this script. + +*start* + +*stop* + +*toggle* + +*next* + +*prev* + +*shuffle*