From 1f2baace398ccae32c1a0f2fd76a98453dfeb72f Mon Sep 17 00:00:00 2001 From: winston Date: Sun, 28 Jul 2024 20:56:21 +0200 Subject: [PATCH] style: conform to editorconfig --- home/apps/nu/config.nu | 2 - home/apps/sketchybar/plugins/music.nu | 62 +++++++++++----------- home/apps/sketchybar/plugins/music_jump.nu | 2 +- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/home/apps/nu/config.nu b/home/apps/nu/config.nu index 3a37903..6161a2b 100644 --- a/home/apps/nu/config.nu +++ b/home/apps/nu/config.nu @@ -1,5 +1,3 @@ -# vim:ft=nu - use ($nu.default-config-dir | path join 'config/keybindings.nu') # use prompt indicators from starship diff --git a/home/apps/sketchybar/plugins/music.nu b/home/apps/sketchybar/plugins/music.nu index c5f4fae..433b6e3 100755 --- a/home/apps/sketchybar/plugins/music.nu +++ b/home/apps/sketchybar/plugins/music.nu @@ -13,44 +13,44 @@ if (pgrep -x Music | is-empty) { let appleScript = ' tell application "Music" - -- set to a fixed string - if player state is playing then - set _state to "playing" - else - set _state to "paused" - end if + -- set to a fixed string + if player state is playing then + set _state to "playing" + else + set _state to "paused" + end if - set _albumArtist to "" - set _trackArtist to "" - set _name to "" - set _duration to "" - set _progress to "0,0" + set _albumArtist to "" + set _trackArtist to "" + set _name to "" + set _duration to "" + set _progress to "0,0" - -- allow this to fail when Music hasnt played a track yet - try - set _albumArtist to album artist of current track - set _trackArtist to artist of current track - set _name to name of current track - set _duration to duration of current track - end try + -- allow this to fail when Music hasnt played a track yet + try + set _albumArtist to album artist of current track + set _trackArtist to artist of current track + set _name to name of current track + set _duration to duration of current track + end try - if _albumArtist is "" or _albumArtist is "Various Artists" then - set _artist to _trackArtist - else - set _artist to _albumArtist - end if + if _albumArtist is "" or _albumArtist is "Various Artists" then + set _artist to _trackArtist + else + set _artist to _albumArtist + end if - -- wrap the progress in a try to handle division by zero - try - set _progress to player position / _duration - end try + -- wrap the progress in a try to handle division by zero + try + set _progress to player position / _duration + end try - set songData to {_state, _artist, _name, _progress} + set songData to {_state, _artist, _name, _progress} - set output to "" - repeat with _item in songData - set output to output & _item & "\n" + set output to "" + repeat with _item in songData + set output to output & _item & "\n" end repeat end tell' diff --git a/home/apps/sketchybar/plugins/music_jump.nu b/home/apps/sketchybar/plugins/music_jump.nu index f8c7bf4..fc4e50d 100755 --- a/home/apps/sketchybar/plugins/music_jump.nu +++ b/home/apps/sketchybar/plugins/music_jump.nu @@ -4,7 +4,7 @@ let appleScript = {|it| ' tell application "Music" 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'} if ($env.PERCENTAGE? != null) {