made the liter happy

This commit is contained in:
Sumner Evans
2020-03-28 22:40:39 -06:00
parent bd48e7667e
commit c9f181a84f

View File

@@ -938,8 +938,8 @@ class SublimeMusicApp(Gtk.Application):
if order_token != self.song_playing_order_token: if order_token != self.song_playing_order_token:
return return
# Add the image to the notification, and re-show the # Add the image to the notification, and re-show
# notification. # the notification.
song_notification.set_image_from_pixbuf( song_notification.set_image_from_pixbuf(
GdkPixbuf.Pixbuf.new_from_file_at_scale( GdkPixbuf.Pixbuf.new_from_file_at_scale(
cover_art_filename, 70, 70, True)) cover_art_filename, 70, 70, True))
@@ -959,7 +959,8 @@ class SublimeMusicApp(Gtk.Application):
self.song_playing_order_token, self.song_playing_order_token,
) )
cover_art_future.add_done_callback( cover_art_future.add_done_callback(
lambda f: on_cover_art_download_complete(*f.result())) lambda f: on_cover_art_download_complete(
*f.result()))
if sys.platform == 'darwin': if sys.platform == 'darwin':
notification_lines = [] notification_lines = []
if song.album: if song.album:
@@ -967,9 +968,17 @@ class SublimeMusicApp(Gtk.Application):
if song.artist: if song.artist:
notification_lines.append(song.artist) notification_lines.append(song.artist)
notification_text = '\n'.join(notification_lines) notification_text = '\n'.join(notification_lines)
os.system(f""" osascript_command = [
osascript -e 'display notification "{notification_text}" with title "{song.title}"' 'display',
""") 'notification',
f'"{notification_text}"',
'with',
'title',
f'"{song.title}"',
]
os.system(
f"osascript -e '{' '.join(osascript_command)}'")
except Exception: except Exception:
logging.warning( logging.warning(
'Unable to display notification. Is a notification ' 'Unable to display notification. Is a notification '