night shift checks every interaction to respond to system changes

This commit is contained in:
dragonwocky 2020-09-30 14:43:23 +10:00
parent 904cae5375
commit cacb6554c7

View File

@ -27,6 +27,7 @@ module.exports = {
const observer = new MutationObserver(process); const observer = new MutationObserver(process);
observer.observe(notion_elem, { observer.observe(notion_elem, {
attributes: true, attributes: true,
subtree: true,
}); });
function process(list, observer) { function process(list, observer) {
const mode = `notion-app-inner notion-${ const mode = `notion-app-inner notion-${
@ -34,8 +35,7 @@ module.exports = {
? 'dark' ? 'dark'
: 'light' : 'light'
}-theme`; }-theme`;
if (list[0].target.className !== mode) if (notion_elem.className !== mode) notion_elem.className = mode;
list[0].target.className = mode;
} }
} }
}); });