Skip to content

Commit e321332

Browse files
committed
Notification History + Other tweaks
1 parent 16da2f6 commit e321332

File tree

9 files changed

+288
-165
lines changed

9 files changed

+288
-165
lines changed

modules/cavalcade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ def __init__(self, mode=None, **kwargs):
235235

236236
def get_spectrum_box(self):
237237
# Get the spectrum box
238-
box = Overlay(h_align='center', v_align='center')
239-
box.set_size_request(150, 40)
238+
box = Overlay(name="cavalcade", h_align='center', v_align='center')
239+
box.set_size_request(180, 40)
240240
box.add_overlay(self.draw.area)
241241
return box
242242

modules/icons.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
night_off: str = ""
7979
notifications_off: str = ""
8080

81+
notifications_clear: str = "";
82+
8183
# Bluetooth
8284
bluetooth_connected: str = ""
8385
bluetooth_disconnected: str = ""

modules/notifications.py

Lines changed: 182 additions & 99 deletions
Large diffs are not rendered by default.

modules/player.py

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,20 @@ def _update_switcher_for_player(self, player_name):
381381
btn.add(new_label)
382382
new_label.show_all()
383383
return False
384-
384+
385385

386386
class PlayerSmall(CenterBox):
387387
def __init__(self):
388-
super().__init__(orientation="h", h_align="fill", v_align="center")
388+
super().__init__(name="player-small", orientation="h", h_align="fill", v_align="center")
389389
self._show_artist = False # toggle flag
390+
self._display_options = ["cavalcade", "title", "artist"]
391+
self._display_index = 0
392+
self._current_display = "cavalcade"
390393

391394
self.mpris_icon = Button(
392395
name="compact-mpris-icon",
396+
h_align="center",
397+
v_align="center",
393398
child=Label(name="compact-mpris-icon-label", markup=icons.disc)
394399
)
395400
# Remove scroll events; instead, add button press events.
@@ -405,10 +410,14 @@ def __init__(self):
405410
self.mpris_label = Label(
406411
name="compact-mpris-label",
407412
label="Nothing Playing",
408-
ellipsization="end"
413+
ellipsization="end",
414+
max_chars_width=26,
415+
h_align="center",
409416
)
410417
self.mpris_button = Button(
411418
name="compact-mpris-button",
419+
h_align="center",
420+
v_align="center",
412421
child=Label(name="compact-mpris-button-label", markup=icons.play)
413422
)
414423
self.mpris_button.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
@@ -426,12 +435,12 @@ def __init__(self):
426435
v_align="center",
427436
v_expand=False,
428437
children=[
429-
self.mpris_label,
430438
self.cavalcade_box,
439+
self.mpris_label,
431440
]
432441
)
433-
self.center_stack.set_visible_child(self.cavalcade_box)
434-
442+
self.center_stack.set_visible_child(self.cavalcade_box) # default to cavalcade
443+
435444
# Create additional compact view.
436445
self.mpris_small = CenterBox(
437446
name="compact-mpris",
@@ -441,16 +450,11 @@ def __init__(self):
441450
v_align="center",
442451
v_expand=False,
443452
start_children=self.mpris_icon,
444-
center_children=self.mpris_label,
453+
center_children=self.center_stack, # Changed to center_stack to handle stack switching
445454
end_children=self.mpris_button,
446455
)
447-
448-
self.mpris_small_overlay = Overlay()
449-
self.mpris_small_overlay.add(self.center_stack)
450-
self.mpris_small_overlay.add_overlay(self.mpris_small)
451-
452-
453-
self.add(self.mpris_small_overlay)
456+
457+
self.add(self.mpris_small)
454458

455459
self.mpris_manager = MprisPlayerManager()
456460
self.mpris_player = None
@@ -475,49 +479,57 @@ def _apply_mpris_properties(self):
475479
self.mpris_label.set_text("Nothing Playing")
476480
self.mpris_button.get_child().set_markup(icons.stop)
477481
self.mpris_icon.get_child().set_markup(icons.disc)
482+
if self._current_display != "cavalcade":
483+
self.center_stack.set_visible_child(self.mpris_label) # if was title or artist, keep showing label
484+
else:
485+
self.center_stack.set_visible_child(self.cavalcade_box) # default to cavalcade if no player
478486
return
479487

480488
mp = self.mpris_player
481489

482-
# Toggle between title and artist.
483-
text = (mp.artist if self._show_artist and mp.artist
484-
else (mp.title if mp.title and mp.title.strip()
485-
else "Nothing Playing"))
486-
self.mpris_label.set_text(text)
487-
488490
# Choose icon based on player name.
489491
player_name = mp.player_name.lower() if hasattr(mp, "player_name") and mp.player_name else ""
490492
icon_markup = get_player_icon_markup_by_name(player_name)
491493
self.mpris_icon.get_child().set_markup(icon_markup)
492494
self.update_play_pause_icon()
493495

496+
if self._current_display == "title":
497+
text = (mp.title if mp.title and mp.title.strip() else "Nothing Playing")
498+
self.mpris_label.set_text(text)
499+
self.center_stack.set_visible_child(self.mpris_label)
500+
elif self._current_display == "artist":
501+
text = (mp.artist if mp.artist else "Nothing Playing")
502+
self.mpris_label.set_text(text)
503+
self.center_stack.set_visible_child(self.mpris_label)
504+
else: # default cavalcade
505+
self.center_stack.set_visible_child(self.cavalcade_box)
506+
507+
494508
def _on_icon_button_press(self, widget, event):
495509
from gi.repository import Gdk
496510
if event.type == Gdk.EventType.BUTTON_PRESS:
497-
if event.button == 3:
498-
self.center_stack.set_visible_child(self.cavalcade_box)
499-
if event.button == 2:
500-
self.center_stack.set_visible_child(self.mpris_label)
501511
players = self.mpris_manager.players
502512
if not players:
503513
return True
504514

515+
if event.button == 2: # Middle-click: cycle display
516+
self._display_index = (self._display_index + 1) % len(self._display_options)
517+
self._current_display = self._display_options[self._display_index]
518+
self._apply_mpris_properties() # Re-apply to update label/cavalcade
519+
return True
520+
505521
# Cambiar de reproductor según el botón presionado.
506-
if event.button == 1: # Left-click: reproductor anterior
522+
if event.button == 1: # Left-click: next player
507523
self.current_index = (self.current_index + 1) % len(players)
508-
elif event.button == 3: # Right-click: reproductor siguiente
509-
#self.current_index = (self.current_index + 1) % len(players)
510-
self.center_stack.set_visible_child(self.cavalcade_box)
511-
elif event.button == 2: # Middle-click: toggle entre title y artist
512-
self._on_icon_clicked(widget)
513-
self.center_stack.set_visible_child(self.mpris_label)
514-
return True
524+
elif event.button == 3: # Right-click: previous player
525+
self.current_index = (self.current_index - 1) % len(players)
526+
if self.current_index < 0:
527+
self.current_index = len(players) - 1
515528

516529
mp_new = MprisPlayer(players[self.current_index])
517530
self.mpris_player = mp_new
518-
# Conectar el evento "changed" para que se actualice el botón de play/pausa
531+
# Conectar el evento "changed" para que se actualice
519532
self.mpris_player.connect("changed", self._on_mpris_changed)
520-
# Se remueve el reinicio de self._show_artist para que la selección (artist/title) persista
521533
self._apply_mpris_properties()
522534
return True # Se consume el evento
523535
return True
@@ -545,17 +557,8 @@ def _restore_play_pause_icon(self):
545557
self.update_play_pause_icon()
546558
return False
547559

548-
def _on_icon_clicked(self, widget):
549-
if not self.mpris_player:
550-
return
551-
# Toggle between showing title and artist.
552-
self._show_artist = not self._show_artist
553-
text = (self.mpris_player.artist if self._show_artist and self.mpris_player.artist
554-
else (self.mpris_player.title if self.mpris_player.title and self.mpris_player.title.strip()
555-
else "Nothing Playing"))
556-
self.mpris_label.set_text(text)
557-
558-
self.center_stack.set_visible_child(self.mpris_label)
560+
def _on_icon_clicked(self, widget): # No longer used, logic moved to _on_icon_button_press
561+
pass
559562

560563
def update_play_pause_icon(self):
561564
if self.mpris_player and self.mpris_player.playback_status == "playing":
@@ -583,10 +586,13 @@ def on_player_appeared(self, manager, player):
583586
def on_player_vanished(self, manager, player_name):
584587
players = self.mpris_manager.players
585588
if players and self.mpris_player and self.mpris_player.player_name == player_name:
586-
self.current_index = self.current_index % len(players)
587-
new_player = MprisPlayer(players[self.current_index])
588-
self.mpris_player = new_player
589-
self.mpris_player.connect("changed", self._on_mpris_changed)
589+
if players: # Check if players is not empty after vanishing
590+
self.current_index = self.current_index % len(players)
591+
new_player = MprisPlayer(players[self.current_index])
592+
self.mpris_player = new_player
593+
self.mpris_player.connect("changed", self._on_mpris_changed)
594+
else:
595+
self.mpris_player = None # No players left
590596
elif not players:
591597
self.mpris_player = None
592-
self._apply_mpris_properties()
598+
self._apply_mpris_properties()

scripts/screenrecord.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ OUTPUT_FILE="$SAVE_DIR/$(date +%Y-%m-%d-%H-%M-%S).mp4"
3131

3232
# Iniciar la grabación
3333
notify-send -a "Ax-Shell" "🔴 Recording started"
34-
gpu-screen-recorder -w portal -q ultra -ac opus -cr full -f 60 -o "$OUTPUT_FILE"
34+
gpu-screen-recorder -w portal -q ultra -a default_output -ac opus -cr full -f 60 -o "$OUTPUT_FILE"

styles/notch.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
#notch-compact {
8585
font-weight: bold;
8686
transition: all 0.5s cubic-bezier(0.5, 0.25, 0, 1.25);
87-
padding: 0 10px;
87+
padding: 10px;
8888
}
8989

9090
#notch-corner-left {

styles/notifications.css

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
#notification-action-buttons button.start-action {
1+
#action-button {
22
border-radius: 20px;
3-
}
4-
5-
#notification-action-buttons button {
63
background-color: var(--surface);
74
padding: 8px;
85
}
96

10-
#notification-action-buttons button:hover {
7+
#action-button:hover {
118
background-color: var(--surface-bright);
129
}
1310

14-
#notification-action-buttons button:active {
11+
#action-button:active {
1512
background-color: var(--primary);
1613
}
1714

18-
#notification-action-buttons button:active #button-label {
15+
#action-button:active #button-label {
1916
color: var(--shadow);
2017
}
2118

@@ -149,4 +146,35 @@
149146

150147
#notification-timestamp {
151148
color: var(--surface-bright);
149+
}
150+
151+
#notification-history-header {
152+
border-radius: 12px;
153+
border: 2px solid var(--surface);
154+
padding: 4px;
155+
}
156+
157+
#nhh {
158+
font-weight: bold;
159+
}
160+
161+
#nhh-button {
162+
border-radius: 8px;
163+
background-color: var(--surface);
164+
padding: 4px;
165+
}
166+
167+
#nhh-button-label {
168+
color: var(--error-dim);
169+
font-size: 20px;
170+
}
171+
172+
#dnd-label {
173+
font-size: 20px;
174+
margin-left: 4px;
175+
}
176+
177+
#no-notifications-label {
178+
font-size: 96px;
179+
color: var(--surface);
152180
}

styles/player.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@
8888
#player-switcher.stack-switcher > *:checked:hover label {
8989
font-size: 24px;
9090
color: var(--foreground);
91-
}
91+
}

styles/wallpapers.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
}
2727

2828
/* Customize the overall switch appearance */
29-
#matugen-switcher {
29+
#matugen-switcher, #dnd-switch {
3030
min-width: 40px;
3131
min-height: 20px;
3232
background-color: var(--surface);
@@ -36,7 +36,7 @@
3636
}
3737

3838
/* Style the switch's slider */
39-
#matugen-switcher slider {
39+
#matugen-switcher slider, #dnd-switch slider {
4040
background-color: var(--primary);
4141
border-radius: 16px;
4242
min-width: 20px;
@@ -45,15 +45,19 @@
4545
}
4646

4747
/* When the switch is active (checked) */
48-
#matugen-switcher:checked {
48+
#matugen-switcher:checked, #dnd-switch:checked {
4949
background-color: var(--primary);
5050
}
5151

5252
/* Optional: additional styling for the slider when active */
53-
#matugen-switcher:checked slider {
53+
#matugen-switcher:checked slider, #dnd-switch:checked slider {
5454
background-color: var(--shadow);
5555
}
5656

57+
#matugen-switcher:checked image, #dnd-switch:checked image {
58+
color: var(--shadow);
59+
}
60+
5761
#mat-label {
5862
font-size: 24px;
5963
margin-left: 4px;

0 commit comments

Comments
 (0)