🐛 fix(notifications): ensure notification history consistency and ignore specific apps

This commit is contained in:
sankalp committed 2025-07-07 12:40:45 +05:45
1 parent 70dc0e97e2
commit 13290d38ba
7 files changed
+172 -61

No files matched your search

+2 -3
View File
@@ -41,12 +41,11 @@ DOCK_THEME = "Pills"
def load_config():
"""Load the configuration from config.json"""
config_path = os.path.expanduser(f"~/{APP_NAME_CAP}/config/assets/config.json")
config = {}
if os.path.exists(config_path):
if os.path.exists(CONFIG_FILE):
try:
with open(config_path, "r") as f:
with open(CONFIG_FILE, "r") as f:
config = json.load(f)
except Exception as e:
print(f"Error loading config: {e}")
+3 -1
View File
@@ -58,7 +58,7 @@ DEFAULTS = {
"dock_notifications_visible": True,
"dock_applications_visible": True,
"dock_language_visible": True,
'dock_hide_special_workspace': True,
"dock_hide_special_workspace": True,
"workspace_nums": False,
"workspace_use_chinese_numerals": False,
"workspace_dots": False,
@@ -71,4 +71,6 @@ DEFAULTS = {
"gpu": False,
},
"metrics_disks": ["/"],
"limited_apps_history": ["Spotify"],
"history_ignored_apps": ["Modus"],
}
+89 -12
View File
@@ -662,6 +662,63 @@ class HyprConfGUI(Window):
)
system_grid.attach(note_label, 2, row, 2, 1)
# Notifications app lists section
notifications_header = Label(
markup="<b>Notification Settings</b>", h_align="start"
)
vbox.add(notifications_header)
notif_grid = Gtk.Grid()
notif_grid.set_column_spacing(20)
notif_grid.set_row_spacing(10)
notif_grid.set_margin_start(10)
notif_grid.set_margin_top(5)
notif_grid.set_margin_bottom(15)
vbox.add(notif_grid)
# Limited Apps History
limited_apps_label = Label(
label="Limited Apps History:", h_align="start", v_align="center"
)
notif_grid.attach(limited_apps_label, 0, 0, 1, 1)
limited_apps_list = bind_vars.get("limited_apps_history", ["Spotify"])
limited_apps_text = ", ".join(f'"{app}"' for app in limited_apps_list)
self.limited_apps_entry = Entry(
text=limited_apps_text,
tooltip_text='Enter app names separated by commas, e.g: "Spotify", "Discord"',
h_expand=True,
)
notif_grid.attach(self.limited_apps_entry, 1, 0, 1, 1)
limited_apps_hint = Label(
markup='<small>Apps with limited notification history (format: "App1", "App2")</small>',
h_align="start",
)
notif_grid.attach(limited_apps_hint, 0, 1, 2, 1)
# History Ignored Apps
ignored_apps_label = Label(
label="History Ignored Apps:", h_align="start", v_align="center"
)
notif_grid.attach(ignored_apps_label, 0, 2, 1, 1)
ignored_apps_list = bind_vars.get("history_ignored_apps", ["Modus"])
ignored_apps_text = ", ".join(f'"{app}"' for app in ignored_apps_list)
self.ignored_apps_entry = Entry(
text=ignored_apps_text,
tooltip_text='Enter app names separated by commas, e.g: "Modus", "Screenshot"',
h_expand=True,
)
notif_grid.attach(self.ignored_apps_entry, 1, 2, 1, 1)
ignored_apps_hint = Label(
markup='<small>Apps whose notifications are ignored in history (format: "App1", "App2")</small>',
h_align="start",
)
notif_grid.attach(ignored_apps_hint, 0, 3, 2, 1)
metrics_header = Label(markup="<b>System Metrics Options</b>", h_align="start")
vbox.add(metrics_header)
metrics_grid = Gtk.Grid(
@@ -771,18 +828,6 @@ class HyprConfGUI(Window):
repo_box.add(repo_link)
vbox.add(repo_box)
# def on_kofi_clicked(_):
# import webbrowser
# webbrowser.open("https://github.com/S4NKALP")
# kofi_btn = Button(
# label="Support on Ko-Fi ❤️",
# on_clicked=on_kofi_clicked,
# tooltip_text="Support S4NKALP on Ko-Fi",
# style="margin-top: 18px; min-width: 160px;",
# )
# vbox.add(kofi_btn)
vbox.add(Box(v_expand=True))
return vbox
@@ -919,6 +964,29 @@ class HyprConfGUI(Window):
and isinstance(child.get_children()[0], Entry)
]
# Parse notification app lists
def parse_app_list(text):
"""Parse comma-separated app names with quotes"""
if not text.strip():
return []
apps = []
for app in text.split(","):
app = app.strip()
if app.startswith('"') and app.endswith('"'):
app = app[1:-1]
elif app.startswith("'") and app.endswith("'"):
app = app[1:-1]
if app:
apps.append(app)
return apps
current_bind_vars_snapshot["limited_apps_history"] = parse_app_list(
self.limited_apps_entry.get_text()
)
current_bind_vars_snapshot["history_ignored_apps"] = parse_app_list(
self.ignored_apps_entry.get_text()
)
selected_icon_path = self.selected_face_icon
replace_lock = self.lock_switch and self.lock_switch.get_active()
replace_idle = self.idle_switch and self.idle_switch.get_active()
@@ -1188,6 +1256,15 @@ class HyprConfGUI(Window):
for p in DEFAULTS.get("metrics_disks", ["/"]):
self._add_disk_edit_entry_func(p)
# Reset notification app lists
limited_apps_list = DEFAULTS.get("limited_apps_history", ["Spotify"])
limited_apps_text = ", ".join(f'"{app}"' for app in limited_apps_list)
self.limited_apps_entry.set_text(limited_apps_text)
ignored_apps_list = DEFAULTS.get("history_ignored_apps", ["Hyprshot"])
ignored_apps_text = ", ".join(f'"{app}"' for app in ignored_apps_list)
self.ignored_apps_entry.set_text(ignored_apps_text)
self._update_panel_position_sensitivity()
self.selected_face_icon = None