Add native notifications with OSD-style banners and a Control Center module
glassMxrph now owns org.freedesktop.Notifications. Banners drop out of the bar like the OSD; Control Center stacks history per app like macOS Notification Center. Do Not Disturb lives in the shell and falls back to SwayNC while another daemon holds the bus name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d7f0498ba0
commit
395de70b26
17 files changed
+1132
-13
No files matched your search
@@ -40,13 +40,24 @@ class Providers(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):system.action({'options':OPTIONS,'action':'power','value':'suspend'})
|
||||
run.assert_not_called()
|
||||
def test_dnd_never_activates_notification_daemon(self):
|
||||
with patch.object(system,'run',return_value='{"type":"b","data":[true]}') as run:
|
||||
self.assertTrue(system.notifications()['enabled'])
|
||||
with patch.object(system,'run',side_effect=['{"type":"u","data":[1]}','{"type":"b","data":[true]}']) as run:
|
||||
state=system.notifications()
|
||||
self.assertTrue(state['enabled']);self.assertEqual(state['provider'],'swaync')
|
||||
args=run.call_args.args[0]
|
||||
self.assertIn('--auto-start=no',args);self.assertEqual(args[-1],'GetDnd')
|
||||
with patch.object(system,'notifications',return_value={'available':True}),patch.object(system,'snapshot',return_value={}),patch.object(system,'run') as run:
|
||||
with patch.object(system,'notifications',return_value={'available':True,'provider':'swaync'}),patch.object(system,'snapshot',return_value={}),patch.object(system,'run') as run:
|
||||
system.action({'options':OPTIONS,'action':'dnd','value':False})
|
||||
self.assertIn('--auto-start=no',run.call_args.args[0]);self.assertEqual(run.call_args.args[0][-3:],['SetDnd','b','false'])
|
||||
def test_shell_owned_notifications_keep_dnd_in_the_shell(self):
|
||||
with patch.object(system,'run',return_value='{"type":"u","data":[%d]}'%system.os.getppid()) as run:
|
||||
self.assertEqual(system.notifications(),{'available':True,'provider':'shell'})
|
||||
self.assertEqual(run.call_count,1)
|
||||
with patch.object(system,'notifications',return_value={'available':True,'provider':'shell'}),patch.object(system,'run') as run:
|
||||
with self.assertRaises(ValueError):system.action({'options':OPTIONS,'action':'dnd','value':True})
|
||||
run.assert_not_called()
|
||||
def test_missing_notification_server_is_reported(self):
|
||||
with patch.object(system,'run',side_effect=ValueError('NameHasNoOwner')):
|
||||
self.assertFalse(system.notifications()['available'])
|
||||
def test_cli_errors_are_json(self):
|
||||
p=subprocess.run([sys.executable,str(ROOT/'quickshell/helpers/system.py'),'{"op":"unknown"}'],capture_output=True,text=True)
|
||||
self.assertFalse(json.loads(p.stdout)['ok']);self.assertEqual(p.returncode,1);self.assertEqual(p.stderr,'')
|
||||
|
||||
Reference in new issue
Block a user