prefs.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
  2. /* exported init, buildPrefsWidget */
  3. import Gtk from 'gi://Gtk'; // will be removed
  4. import Gdk from 'gi://Gdk';
  5. import * as GeneralPreferences from './preferences/generalPage.js';
  6. import * as CustomIconPreferences from './preferences/customIconPage.js';
  7. import {
  8. ExtensionPreferences,
  9. gettext as _
  10. } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
  11. const SettingsKey = {
  12. LEGACY_TRAY_ENABLED: 'legacy-tray-enabled',
  13. ICON_SIZE: 'icon-size',
  14. ICON_OPACITY: 'icon-opacity',
  15. ICON_SATURATION: 'icon-saturation',
  16. ICON_BRIGHTNESS: 'icon-brightness',
  17. ICON_CONTRAST: 'icon-contrast',
  18. TRAY_POS: 'tray-pos',
  19. CUSTOM_ICONS: 'custom-icons',
  20. };
  21. export default class DockPreferences extends ExtensionPreferences {
  22. fillPreferencesWindow(window) {
  23. const iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
  24. if (!iconTheme.get_search_path().includes(`${this.path}/icons`))
  25. iconTheme.add_search_path(`${this.path}/icons`);
  26. const settings = this.getSettings();
  27. const generalPage = new GeneralPreferences.GeneralPage(settings, SettingsKey);
  28. const customIconPage = new CustomIconPreferences.CustomIconPage(settings, SettingsKey);
  29. window.add(generalPage);
  30. window.add(customIconPage);
  31. window.connect('close-request', () => {
  32. window.destroy();
  33. });
  34. }
  35. }