Host option
This commit is contained in:
parent
0258ac69a7
commit
2d671ea750
|
@ -1,47 +1,52 @@
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
|
|
||||||
|
let configPath = $"($env.XDG_CONFIG_HOME? | default $"($env.HOME)/.config")/irs.toml"
|
||||||
|
let config = if ($configPath | path exists) { open $configPath }
|
||||||
|
|
||||||
|
let mpdHost = $config.noise.host? | default 'localhost:6600'
|
||||||
|
|
||||||
def notify [message: string] {
|
def notify [message: string] {
|
||||||
do { mpc -f "%file%" current | xargs -I{} mpc albumart {} } | save -f /tmp/mpc_current.png
|
do { mpc --host $mpdHost -f "%file%" current | xargs -I{} mpc --host $mpdHost albumart {} } | save -f /tmp/mpc_current.png
|
||||||
notify-send "Noise" $"($message)" -i /tmp/mpc_current.png
|
notify-send "Noise" $"($message)" -i /tmp/mpc_current.png
|
||||||
}
|
}
|
||||||
|
|
||||||
# Displays the currently playing song
|
# Displays the currently playing song
|
||||||
def main [] {
|
def main [] {
|
||||||
notify (mpc current)
|
notify (mpc --host $mpdHost current)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Skips to next song
|
# Skips to next song
|
||||||
def "main next" [] {
|
def "main next" [] {
|
||||||
mpc next
|
mpc --host $mpdHost next
|
||||||
notify $"Switching to:\n(mpc current)"
|
notify $"Switching to:\n(mpc --host $mpdHost current)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Moves back a song in the que
|
# Moves back a song in the que
|
||||||
def "main prev" [] {
|
def "main prev" [] {
|
||||||
mpc prev
|
mpc --host $mpdHost prev
|
||||||
notify $"Switching to:\n(mpc current)"
|
notify $"Switching to:\n(mpc --host $mpdHost current)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Shuffles the current que
|
# Shuffles the current que
|
||||||
def "main shuffle" [] {
|
def "main shuffle" [] {
|
||||||
mpc shuffle
|
mpc --host $mpdHost shuffle
|
||||||
notify $"Shuffling que..."
|
notify $"Shuffling que..."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stops playing the current que
|
# Stops playing the current que
|
||||||
def "main stop" [] {
|
def "main stop" [] {
|
||||||
mpc stop
|
mpc --host $mpdHost stop
|
||||||
notify $"Stopping playback of:\n(mpc toggle)"
|
notify $"Stopping playback of:\n(mpc --host $mpdHost toggle)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Starts playing the current que
|
# Starts playing the current que
|
||||||
def "main start" [] {
|
def "main start" [] {
|
||||||
mpc start
|
mpc --host $mpdHost start
|
||||||
notify $"Starting playback of:\n(mpc toggle)"
|
notify $"Starting playback of:\n(mpc --host $mpdHost toggle)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Toggles playback of the current que
|
# Toggles playback of the current que
|
||||||
def "main toggle" [] {
|
def "main toggle" [] {
|
||||||
mpc toggle
|
mpc --host $mpdHost toggle
|
||||||
notify $"Toggling playback of:\n(mpc current)"
|
notify $"Toggling playback of:\n(mpc --host $mpdHost current)"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue