-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f09e5f9
commit 7e53419
Showing
14 changed files
with
870 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const Gio = imports.gi.Gio; | ||
const Me = imports.misc.extensionUtils.getCurrentExtension(); | ||
|
||
function getSettings () { | ||
let GioSSS = Gio.SettingsSchemaSource; | ||
let schemaSource = GioSSS.new_from_directory( | ||
Me.dir.get_child("schemas").get_path(), | ||
GioSSS.get_default(), | ||
false | ||
); | ||
let schemaObj = schemaSource.lookup( | ||
'org.gnome.shell.extensions.notification-area', true); | ||
if (!schemaObj) { | ||
throw new Error('cannot find schemas'); | ||
} | ||
return new Gio.Settings({ settings_schema : schemaObj }); | ||
} | ||
|
||
var settings = getSettings(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* extension.js | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
*/ | ||
|
||
const St = imports.gi.St; | ||
const Main = imports.ui.main; | ||
const Clutter = imports.gi.Clutter; | ||
|
||
const Me = imports.misc.extensionUtils.getCurrentExtension(); | ||
|
||
const Container = Me.imports.src.container; | ||
const Indicator = Me.imports.src.indicator; | ||
|
||
let notificationArea; | ||
let notificationIndicator; | ||
|
||
|
||
function enable () { | ||
notificationArea = new Container.NotificationArea(); | ||
notificationIndicator = new Indicator.NotificationIndicator(); | ||
|
||
notificationIndicator.connect("button-press-event", () => { | ||
notificationArea._toggleNotificationArea(); | ||
}); | ||
} | ||
|
||
function disable () { | ||
notificationArea.destroy(); | ||
notificationIndicator.destroy(); | ||
} |
1 change: 1 addition & 0 deletions
1
notification-area@fmoreira/icons/notification-empty-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
notification-area@fmoreira/icons/notification-solid-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Notification Area", | ||
"description": "Make a notification in the right like windows 10", | ||
"gettext-domain": "notification-area", | ||
"shell-version": [ | ||
"3.26", | ||
"3.28", | ||
"3.30", | ||
"3.34", | ||
"3.32", | ||
"3.36" | ||
], | ||
"url": "https://github.com/fer-moreira/notificationarea", | ||
"uuid": "notification-area@fmoreira", | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
const Gio = imports.gi.Gio; | ||
const GLib = imports.gi.GLib; | ||
const GObject = imports.gi.GObject; | ||
const Gtk = imports.gi.Gtk; | ||
const Gdk = imports.gi.Gdk; | ||
|
||
const Me = imports.misc.extensionUtils.getCurrentExtension() | ||
const ExtensionUtils = imports.misc.extensionUtils; | ||
|
||
|
||
|
||
var SettingsPrefsWidget = class SettingsPrefsWidget { | ||
constructor () { | ||
this._settings = ExtensionUtils.getSettings('org.gnome.shell.extensions.notification-area'); | ||
|
||
this._builder = new Gtk.Builder(); | ||
// this._builder.set_translation_domain(Me.metadata['gettext-domain']); | ||
this._builder.add_from_file(Me.path + '/settings.ui'); | ||
|
||
this.widget = new Gtk.ScrolledWindow({ hscrollbar_policy: Gtk.PolicyType.NEVER }); | ||
this._notebook = this._builder.get_object('settings_notebook'); | ||
this.widget.add(this._notebook); | ||
|
||
// Set a reasonable initial window height | ||
this.widget.connect('realize', () => { | ||
let window = this.widget.get_toplevel(); | ||
let [default_width, default_height] = window.get_default_size(); | ||
window.resize(default_width, 450); | ||
}); | ||
|
||
this._notification_area_width_timeout = 0; | ||
this._hide_duration_timeout = 0; | ||
this._notification_box_height_timeout = 0; | ||
|
||
this._bindSettings(); | ||
this._builder.connect_signals_full(this._connector.bind(this)); | ||
} | ||
|
||
_connector(builder, object, signal, handler) { | ||
const SignalHandler = { | ||
|
||
// SCALE CHANGES | ||
width_scale_value_changed_cb (scale) { | ||
log(scale); | ||
|
||
if (this._notification_area_width_timeout > 0) | ||
GLib.source_remove(this._notification_area_width_timeout); | ||
|
||
this._notification_area_width_timeout = GLib.timeout_add( | ||
GLib.PRIORITY_DEFAULT, SCALE_UPDATE_TIMEOUT, () => { | ||
this._settings.set_int('notification-area-width', scale.get_value()); | ||
this._notification_area_width_timeout = 0; | ||
return GLib.SOURCE_REMOVE; | ||
}); | ||
}, | ||
duration_scale_value_changed_cb (scale) { | ||
if (this._hide_duration_timeout > 0) | ||
GLib.source_remove(this._hide_duration_timeout); | ||
|
||
this._hide_duration_timeout = GLib.timeout_add( | ||
GLib.PRIORITY_DEFAULT, SCALE_UPDATE_TIMEOUT, () => { | ||
this._settings.set_int('hide-duration', scale.get_value()); | ||
this._hide_duration_timeout = 0; | ||
return GLib.SOURCE_REMOVE; | ||
}); | ||
}, | ||
box_height_scale_value_changed_cb (scale) { | ||
|
||
if (this._notification_box_height_timeout > 0) | ||
GLib.source_remove(this._notification_box_height_timeout); | ||
|
||
this._notification_box_height_timeout = GLib.timeout_add( | ||
GLib.PRIORITY_DEFAULT, SCALE_UPDATE_TIMEOUT, () => { | ||
this._settings.set_int('notification-box-height', scale.get_value()); | ||
this._notification_box_height_timeout = 0; | ||
return GLib.SOURCE_REMOVE; | ||
}); | ||
}, | ||
|
||
// FORMAT | ||
width_scale_value_format (scale, value) { | ||
return value + ' px'; | ||
}, | ||
duration_scale_value_format (scale, value) { | ||
return value + ' ms'; | ||
}, | ||
box_height_scale_value_format (scale, value) { | ||
return value + ' px'; | ||
}, | ||
}; | ||
|
||
object.connect(signal, SignalHandler[handler].bind(this)); | ||
} | ||
|
||
_bindSettings () { | ||
this._builder.get_object('width_scale').set_value(this._settings.get_int('notification-area-width')); | ||
this._builder.get_object('duration_scale').set_value(this._settings.get_int('hide-duration')); | ||
this._builder.get_object('box_height_scale').set_value(this._settings.get_int('notification-box-height')); | ||
} | ||
} | ||
|
||
function init() { | ||
ExtensionUtils.initTranslations(); | ||
} | ||
|
||
function buildPrefsWidget () { | ||
let settings = new SettingsPrefsWidget(); | ||
let widget = settings.widget; | ||
widget.show_all(); | ||
return widget; | ||
} |
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
notification-area@fmoreira/schemas/org.gnome.shell.extensions.notification-area.gschema.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schemalist gettext-domain="gnome-shell-extensions"> | ||
<schema path="/org/gnome/shell/extensions/notification-area/" id="org.gnome.shell.extensions.notification-area" > | ||
<key type="i" name="notification-area-width"> | ||
<default>400</default> | ||
<summary>The notification panel width.</summary> | ||
<description>Notification panel Width.</description> | ||
</key> | ||
|
||
<key type="i" name="hide-duration"> | ||
<default>200</default> | ||
<summary>Animation duration from showing and hiding.</summary> | ||
<description>Transition duration.</description> | ||
</key> | ||
|
||
<key type="i" name="notification-box-height"> | ||
<default>100</default> | ||
<summary>Notification Box height in notification panel</summary> | ||
<description>Notification Box Height.</description> | ||
</key> | ||
</schema> | ||
</schemalist> |
Oops, something went wrong.