Skip to content

Commit 65fd78d

Browse files
committed
toggle album cover
1 parent 00d2d86 commit 65fd78d

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ spotify-lyrics
4747
| Next | <kbd>n</kbd> |
4848
| Prev | <kbd>p</kbd> |
4949
| Update Lyrics | <kbd>d</kbd> |
50+
| Toggle Album Cover | <kbd>i</kbd> |
5051
| Help | <kbd>h</kbd> |
5152
| Quit Program | <kbd>q</kbd> |
5253

spotify_lyrics.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self):
2626
self.home = str(Path.home())
2727
self._current_line = 0
2828
self.changed = True
29+
self.album_hidden = False
2930

3031
self.bus = dbus.SessionBus()
3132
name = dbus.service.BusName('com.spotify_lyrics.line', bus=self.bus)
@@ -147,7 +148,9 @@ def main(self, loop, event, canvas):
147148
wrapped_lines = []
148149
for line in lines:
149150
wrapped_lines.extend(
150-
textwrap.fill(line, columns//2-2).split('\n'))
151+
textwrap.fill(
152+
line, (columns if self.album_hidden
153+
else columns//2-2)).split('\n'))
151154
self.total_lines = len(wrapped_lines)
152155

153156
utils.move_cursor(0, start_row)
@@ -196,6 +199,13 @@ def main(self, loop, event, canvas):
196199
self.spotify.prev()
197200
elif key == 't':
198201
self.spotify.toggle()
202+
elif key == 'i':
203+
self.album_hidden = not self.album_hidden
204+
self.changed = True
205+
if self.album_hidden:
206+
album_cover.visibility = ueberzug.Visibility.INVISIBLE
207+
else:
208+
album_cover.visibility = ueberzug.Visibility.VISIBLE
199209
elif key == 'h':
200210
os.system('clear')
201211
album_cover.visibility = ueberzug.Visibility.INVISIBLE

utils.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,19 @@ def print_help():
9898
print(boldify('''
9999
| Action | Keybinding |
100100
|:-------------------:|:-------------:|
101-
| Scroll Up | <kbd>k</kbd> |
102-
| Scroll Down | <kbd>j</kbd> |
103-
| Beginning of Lyrics | <kbd>gg</kbd> |
104-
| End of Lyrics | <kbd>G</kbd> |
105-
| Edit Lyrics | <kbd>e</kbd> |
106-
| Refresh | <kbd>r</kbd> |
107-
| Toggle | <kbd>t</kbd> |
108-
| Next | <kbd>n</kbd> |
109-
| Prev | <kbd>p</kbd> |
110-
| Update Lyrics | <kbd>d</kbd> |
111-
| Help | <kbd>h</kbd> |
112-
| Quit Program | <kbd>q</kbd> |
101+
| Scroll Up | k |
102+
| Scroll Down | j |
103+
| Beginning of Lyrics | gg |
104+
| End of Lyrics | G |
105+
| Edit Lyrics | e |
106+
| Refresh | r |
107+
| Toggle | t |
108+
| Next | n |
109+
| Prev | p |
110+
| Update Lyrics | d |
111+
| Toggle Album Cover | i |
112+
| Help | h |
113+
| Quit Program | q |
113114
114115
- Edit Lyrics: Open lyrics in `$EDITOR`.
115116
- Refresh: Refresh lyrics and song metadata.

0 commit comments

Comments
 (0)