From 02615e1f8e5a4f6e019c7623dcff7d6038f989a0 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sun, 29 Aug 2021 14:35:10 -0400 Subject: [PATCH] Store prefered search type in user settings --- README.md | 6 ++---- init.lua | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b00b7bd..8f53a6c 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,10 @@

-A spotlight-like search for spotify, allow searching albums, artists, playlists and tracks and playing the selected item on Spotify client for macOS: +A spotlight-like search for spotify, allows searching albums, artists, playlists and tracks and playing the selected item on Spotify client for macOS: screenrecord -Note that after restarting hammerspoon the default search type will be reset to tracks. - # Installation This app uses Spotify's search API, so you need to create a developer account in order to use it, go to [Developer Dashboard](https://developer.spotify.com/dashboard/) and register, then create a client id and a secret. @@ -25,7 +23,7 @@ This app uses Spotify's search API, so you need to create a developer account in - install [Hammerspoon](http://www.hammerspoon.org/) - a powerfull automation tool for OS X - Manually: - Download the [latest release](https://github.com/Hammerspoon/hammerspoon/releases/tag/0.9.87), and drag Hammerspoon.app from your Downloads folder to Applications. + Download the [latest release](hhttps://github.com/Hammerspoon/hammerspoon/releases/latest), and drag Hammerspoon.app from your Downloads folder to Applications. - Homebrew: ```brew install hammerspoon --cask``` diff --git a/init.lua b/init.lua index 9a1d971..dd093b6 100644 --- a/init.lua +++ b/init.lua @@ -139,9 +139,10 @@ function obj:init() { id = "track", selectable = true, image = hs.image.imageFromPath(obj.iconPath .. '/musical-note.png'):template(true)}, }):canCustomize(true) :autosaves(true) - :selectedItem("track") + :selectedItem(hs.settings.get("spotify-search-and-play_selectedItem") or "track") :sizeMode("small") :setCallback(function(toolbar, chooser, identifier) + hs.settings.set('spotify-search-and-play_selectedItem', identifier) self.item_type_to_search = identifier self:queryChangedCallback() end)