diff --git a/features/dndQuickToggle.js b/features/dndQuickToggle.js index d975fbd..f54243d 100644 --- a/features/dndQuickToggle.js +++ b/features/dndQuickToggle.js @@ -4,6 +4,9 @@ const Me = ExtensionUtils.getCurrentExtension() const featureReloader = Me.imports.libs.featureReloader const { QuickSettings } = Me.imports.libs.gnome const { Indicator } = Me.imports.libs.dndQuickToogleHandler +const { DateMenu } = Me.imports.libs.gnome +const { Gio, GObject } = imports.gi; + var dndQuickToggleFeature = class { load() { @@ -19,12 +22,26 @@ var dndQuickToggleFeature = class { this.dndToggle = new Indicator() QuickSettings._indicators.add_child(this.dndToggle) QuickSettings._addItems(this.dndToggle.quickSettingsItems) + + //remove DND button from datemenu + this.datemenu_dnd = DateMenu.last_child.last_child + this.datemenu_dnd.hide() + this.datemenu_dnd_connection = this.datemenu_dnd.connect("show", () => { this.datemenu_dnd.hide() }) + } unload() { // disable feature reloader featureReloader.disable(this) - + //put back the button to the datemenu + this.datemenu_dnd.disconnect(this.datemenu_dnd_connection) + this.datemenu_dnd_connection = null; + const _settings = new Gio.Settings({ + schema_id: 'org.gnome.desktop.notifications', + }); + if (!_settings.get_boolean('show-banners')){ + this.datemenu_dnd.show(); + } // Remove DND Quick Toggle if (this.dndToggle) { const dndQSItems = this.dndToggle.quickSettingsItems[0] diff --git a/libs/dndQuickToogleHandler.js b/libs/dndQuickToogleHandler.js index ac29b6b..c09e305 100644 --- a/libs/dndQuickToogleHandler.js +++ b/libs/dndQuickToogleHandler.js @@ -1,5 +1,6 @@ const { Gio, GObject } = imports.gi; const { QuickToggle, SystemIndicator } = imports.ui.quickSettings; +const { St } = imports.gi const DndQuickToogle = GObject.registerClass( class DndQuickToogle extends QuickToggle { @@ -41,6 +42,31 @@ class Indicator extends SystemIndicator { _init() { super._init(); + this._indicator = this._addIndicator(); + + this._indicator.icon_name = 'notifications-disabled-symbolic' this.quickSettingsItems.push(new DndQuickToogle()); + + this._settings = new Gio.Settings({ + schema_id: 'org.gnome.desktop.notifications', + }); + + this._changedId = this._settings.connect('changed::show-banners', + () => this._sync()); + + this._sync(); } + + _sync() { + const checked = !this._settings.get_boolean('show-banners'); + if (checked){ + this._indicator.visible = true; + } + else{ + this._indicator.visible = false; + } + + } + + });