Noise script

This commit is contained in:
Nox Sluijtman 2024-09-17 13:40:50 +02:00
parent 8251d8e6e8
commit e4fadc372d
3 changed files with 79 additions and 0 deletions

47
src/bin/noise Executable file
View file

@ -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..."
}

6
src/completions/_noise Normal file
View file

@ -0,0 +1,6 @@
#compdef noise _noise
_arguments -C \
"1: :(next prev shuffle stop start toggle)" \
"*::args:->args"
_arguments : $arguments

26
src/manpages/noise.1.scd Normal file
View file

@ -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*