Closed marsjane closed 3 months ago
space_windows_change
should detect the window being closed:
https://felixkratz.github.io/SketchyBar/config/events
untested but something like this may work:
local function update_drawing(drawing)
neteasem:set({
drawing = drawing,
background = {
color = colors.transparent,
border_color = colors.white,
height = 32,
drawing = drawing,
border_width = 1
}
})
end
neteasem:subscribe("media_change", function(env)
if whitelist[env.INFO.app] then
current_app = env.INFO.app
local drawing = (env.INFO.state == "playing" or env.INFO.state == "paused")
update_drawing(drawing)
else
current_app = nil
update_drawing(false)
end
end)
neteasem:subscribe("space_windows_change", function(env)
if current_app and not env.INFO.apps[current_app] then
current_app = nil
update_drawing(false)
end
end)
Thanks for the reply, I test it and think it has one issue that if the space_windows_change happens in other space, the item will also disappear, I think I will use the transparent border as a workaround~
I use the alias-item to display lyrics which is build-in function for neteasemusic app, I use following config:
Now the bug is that: when pc starts, this item is empty which is expected, and when start/pause neteasemusic, the lyric alias item will then show as expect, BUT when I exit the neteasemusic app, the item position will show a blank while box which seems the drawing parameters not update to false as expect, I don't know which part is wrong, can you help? FYI the three print lines can print as expected when I start/pause music, but didn't print anything when I exit neteasemusic app, I guess media_change didn't triggered when the music totally stops(app exit), is it true? If so do you have any good idea to let this item totally disappear when app exit?