mirror of
				https://github.com/notion-enhancer/notion-enhancer.git
				synced 2025-11-04 08:08:08 +11:00 
			
		
		
		
	macos bugfixes: #151 dark mode detection in night shift + adding menubar to extensions menu + padding-left with tabs to give traffic lights space
This commit is contained in:
		
							parent
							
								
									e79685a6e8
								
							
						
					
					
						commit
						cbe505c374
					
				@ -117,6 +117,9 @@ s {
 | 
				
			|||||||
#titlebar .window-buttons-area:empty {
 | 
					#titlebar .window-buttons-area:empty {
 | 
				
			||||||
  display: none;
 | 
					  display: none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					[data-platform='darwin'] #titlebar {
 | 
				
			||||||
 | 
					  height: 2.65em;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* alerts */
 | 
					/* alerts */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -75,6 +75,9 @@ body,
 | 
				
			|||||||
  flex-direction: column;
 | 
					  flex-direction: column;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[data-platform='darwin'] #titlebar {
 | 
				
			||||||
 | 
					  padding-left: 4em;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
#titlebar::before {
 | 
					#titlebar::before {
 | 
				
			||||||
  content: '';
 | 
					  content: '';
 | 
				
			||||||
  position: absolute;
 | 
					  position: absolute;
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,8 @@ const store = require('../../pkg/store.js'),
 | 
				
			|||||||
  { toKeyEvent } = require('keyboardevent-from-electron-accelerator');
 | 
					  { toKeyEvent } = require('keyboardevent-from-electron-accelerator');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
window['__start'] = async () => {
 | 
					window['__start'] = async () => {
 | 
				
			||||||
 | 
					  document.body.setAttribute('data-platform', process.platform);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // mod loader
 | 
					  // mod loader
 | 
				
			||||||
  const modules = helpers.getEnhancements();
 | 
					  const modules = helpers.getEnhancements();
 | 
				
			||||||
  if (modules.loaded.length)
 | 
					  if (modules.loaded.length)
 | 
				
			||||||
 | 
				
			|||||||
@ -972,6 +972,8 @@ module.exports = (store, __exports) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    window['__start'] = () => {
 | 
					    window['__start'] = () => {
 | 
				
			||||||
      document.head.innerHTML += `<link rel="stylesheet" href="${__dirname}/css/tabs.css" />`;
 | 
					      document.head.innerHTML += `<link rel="stylesheet" href="${__dirname}/css/tabs.css" />`;
 | 
				
			||||||
 | 
					      document.body.setAttribute('data-platform', process.platform);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const modules = getEnhancements();
 | 
					      const modules = getEnhancements();
 | 
				
			||||||
      for (let mod of modules.loaded) {
 | 
					      for (let mod of modules.loaded) {
 | 
				
			||||||
        for (let font of mod.fonts || []) {
 | 
					        for (let font of mod.fonts || []) {
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,7 @@ module.exports = {
 | 
				
			|||||||
  name: 'night shift',
 | 
					  name: 'night shift',
 | 
				
			||||||
  desc:
 | 
					  desc:
 | 
				
			||||||
    'sync dark/light theme with the system (overrides normal theme setting).',
 | 
					    'sync dark/light theme with the system (overrides normal theme setting).',
 | 
				
			||||||
  version: '0.1.1',
 | 
					  version: '0.1.2',
 | 
				
			||||||
  author: 'dragonwocky',
 | 
					  author: 'dragonwocky',
 | 
				
			||||||
  hacks: {
 | 
					  hacks: {
 | 
				
			||||||
    'renderer/preload.js'(store, __exports) {
 | 
					    'renderer/preload.js'(store, __exports) {
 | 
				
			||||||
@ -23,19 +23,22 @@ module.exports = {
 | 
				
			|||||||
          const notion_elem = document.querySelector('.notion-app-inner');
 | 
					          const notion_elem = document.querySelector('.notion-app-inner');
 | 
				
			||||||
          if (!notion_elem) return;
 | 
					          if (!notion_elem) return;
 | 
				
			||||||
          clearInterval(attempt_interval);
 | 
					          clearInterval(attempt_interval);
 | 
				
			||||||
          process([{ target: notion_elem }]);
 | 
					          handle([{ target: notion_elem }]);
 | 
				
			||||||
          const observer = new MutationObserver(process);
 | 
					          const observer = new MutationObserver(handle);
 | 
				
			||||||
          observer.observe(notion_elem, {
 | 
					          observer.observe(notion_elem, {
 | 
				
			||||||
            attributes: true,
 | 
					            attributes: true,
 | 
				
			||||||
            subtree: true,
 | 
					            subtree: true,
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
          function process(list, observer) {
 | 
					          function handle(list, observer) {
 | 
				
			||||||
            const mode = `notion-app-inner notion-${
 | 
					            const mode = `notion-app-inner notion-${
 | 
				
			||||||
              window.matchMedia('(prefers-color-scheme: dark)').matches
 | 
					              window.matchMedia('(prefers-color-scheme: dark)').matches
 | 
				
			||||||
                ? 'dark'
 | 
					                ? 'dark'
 | 
				
			||||||
                : 'light'
 | 
					                : 'light'
 | 
				
			||||||
            }-theme`;
 | 
					            }-theme`;
 | 
				
			||||||
            if (notion_elem.className !== mode) notion_elem.className = mode;
 | 
					            if (notion_elem.className !== mode) notion_elem.className = mode;
 | 
				
			||||||
 | 
					            window
 | 
				
			||||||
 | 
					              .matchMedia('(prefers-color-scheme: dark)')
 | 
				
			||||||
 | 
					              .addEventListener('change', handle);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user