style: conform to editorconfig
This commit is contained in:
parent
e14c15e1ff
commit
1f2baace39
3 changed files with 32 additions and 34 deletions
|
@ -1,5 +1,3 @@
|
||||||
# vim:ft=nu
|
|
||||||
|
|
||||||
use ($nu.default-config-dir | path join 'config/keybindings.nu')
|
use ($nu.default-config-dir | path join 'config/keybindings.nu')
|
||||||
|
|
||||||
# use prompt indicators from starship
|
# use prompt indicators from starship
|
||||||
|
|
|
@ -13,44 +13,44 @@ if (pgrep -x Music | is-empty) {
|
||||||
|
|
||||||
let appleScript = '
|
let appleScript = '
|
||||||
tell application "Music"
|
tell application "Music"
|
||||||
-- set to a fixed string
|
-- set to a fixed string
|
||||||
if player state is playing then
|
if player state is playing then
|
||||||
set _state to "playing"
|
set _state to "playing"
|
||||||
else
|
else
|
||||||
set _state to "paused"
|
set _state to "paused"
|
||||||
end if
|
end if
|
||||||
|
|
||||||
set _albumArtist to ""
|
set _albumArtist to ""
|
||||||
set _trackArtist to ""
|
set _trackArtist to ""
|
||||||
set _name to ""
|
set _name to ""
|
||||||
set _duration to ""
|
set _duration to ""
|
||||||
set _progress to "0,0"
|
set _progress to "0,0"
|
||||||
|
|
||||||
-- allow this to fail when Music hasnt played a track yet
|
-- allow this to fail when Music hasnt played a track yet
|
||||||
try
|
try
|
||||||
set _albumArtist to album artist of current track
|
set _albumArtist to album artist of current track
|
||||||
set _trackArtist to artist of current track
|
set _trackArtist to artist of current track
|
||||||
set _name to name of current track
|
set _name to name of current track
|
||||||
set _duration to duration of current track
|
set _duration to duration of current track
|
||||||
end try
|
end try
|
||||||
|
|
||||||
if _albumArtist is "" or _albumArtist is "Various Artists" then
|
if _albumArtist is "" or _albumArtist is "Various Artists" then
|
||||||
set _artist to _trackArtist
|
set _artist to _trackArtist
|
||||||
else
|
else
|
||||||
set _artist to _albumArtist
|
set _artist to _albumArtist
|
||||||
end if
|
end if
|
||||||
|
|
||||||
-- wrap the progress in a try to handle division by zero
|
-- wrap the progress in a try to handle division by zero
|
||||||
try
|
try
|
||||||
set _progress to player position / _duration
|
set _progress to player position / _duration
|
||||||
end try
|
end try
|
||||||
|
|
||||||
|
|
||||||
set songData to {_state, _artist, _name, _progress}
|
set songData to {_state, _artist, _name, _progress}
|
||||||
|
|
||||||
set output to ""
|
set output to ""
|
||||||
repeat with _item in songData
|
repeat with _item in songData
|
||||||
set output to output & _item & "\n"
|
set output to output & _item & "\n"
|
||||||
end repeat
|
end repeat
|
||||||
end tell'
|
end tell'
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ let appleScript = {|it| '
|
||||||
tell application "Music"
|
tell application "Music"
|
||||||
set _duration to duration of current track
|
set _duration to duration of current track
|
||||||
|
|
||||||
set player position to (' + ($it | into string) + ' * _duration)
|
set player position to (' + ($it | into string) + ' * _duration)
|
||||||
end tell'}
|
end tell'}
|
||||||
|
|
||||||
if ($env.PERCENTAGE? != null) {
|
if ($env.PERCENTAGE? != null) {
|
||||||
|
|
Loading…
Reference in a new issue