diff --git a/data/org.gnome.shell.extensions.panel-osd.gschema.xml.in b/data/org.gnome.shell.extensions.panel-osd.gschema.xml.in
index 01e49e4..7017da0 100644
--- a/data/org.gnome.shell.extensions.panel-osd.gschema.xml.in
+++ b/data/org.gnome.shell.extensions.panel-osd.gschema.xml.in
@@ -4,5 +4,9 @@
50.0
<_summary>Horizontal position of notification.
+
+ 0.0
+ <_summary>Vertical position of notification.
+
diff --git a/data/panel-osd-settings.ui b/data/panel-osd-settings.ui
index 3a21162..55e1c8a 100644
--- a/data/panel-osd-settings.ui
+++ b/data/panel-osd-settings.ui
@@ -7,6 +7,11 @@
0.10000000000000001
2
+
diff --git a/data/stylesheet.css b/data/stylesheet.css
index afc0da3..8660847 100644
--- a/data/stylesheet.css
+++ b/data/stylesheet.css
@@ -1,3 +1,9 @@
-.jrlnotification {
+.jrlnotification_top {
border-radius: 0px 0px 10px 10px;
}
+.jrlnotification_bottom {
+ border-radius: 10px 10px 0px 0px;
+}
+.jrlnotification {
+ border-radius: 10px 10px 10px 10px;
+}
diff --git a/src/extension.js b/src/extension.js
index 2293366..7c91981 100644
--- a/src/extension.js
+++ b/src/extension.js
@@ -25,6 +25,7 @@ const EXTENSIONDIR = Me.dir.get_path();
const PANEL_OSD_SETTINGS_SCHEMA = 'org.gnome.shell.extensions.panel-osd';
const PANEL_OSD_X_POS_KEY = 'x-pos';
+const PANEL_OSD_Y_POS_KEY = 'y-pos';
@@ -79,6 +80,12 @@ let getX_position = function() {
return Settings.get_double(PANEL_OSD_X_POS_KEY);
}
+let gety_position = function() {
+ if (!Settings)
+ loadConfig();
+ return Settings.get_double(PANEL_OSD_Y_POS_KEY);
+}
+
/*
* Copied from MessageTray._showNotification()
@@ -114,7 +121,10 @@ let extensionShowNotification = function () {
this._notificationWidget.opacity = 0;
// JRL changes begin
//this._notificationWidget.y = 0;
- this._notificationWidget.y = -global.screen_height;
+ let yTop = -global.screen_height;
+ let yBottom = 0;
+
+ this._notificationWidget.y = (yTop - yBottom) * gety_position() / 100 + yBottom;
// JRL changes end
@@ -170,12 +180,19 @@ let extensionHideNotification = function(animate) {
this._notification.disconnect(this._notificationExpandedId);
this._notificationExpandedId = 0;
}
+ // JRL changes begin
+ let yPos;
+ if (gety_position() < 50)
+ yPos = this.actor.height;
+ else
+ yPos = -global.screen_height;
+ // JRL changes end
if (ExtensionUtils.versionCheck(['3.6'], Config.PACKAGE_VERSION)) {
if (this._notificationRemoved) {
// JRL changes begin
//this._notificationWidget.y = this.actor.height;
- this._notificationWidget.y = -global.screen_height;
+ this._notificationWidget.y = yPos;
// JRL changes end
this._notificationWidget.opacity = 0;
this._notificationState = State.HIDDEN;
@@ -184,7 +201,7 @@ let extensionHideNotification = function(animate) {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
// JRL changes begin
//{ y: this.actor.height,
- { y: -global.screen_height,
+ { y: yPos,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
@@ -219,7 +236,7 @@ let extensionHideNotification = function(animate) {
Tweener.removeTweens(this._notificationWidget);
// JRL changes begin
//this._notificationWidget.y = this.actor.height;
- this._notificationWidget.y = -global.screen_height;
+ this._notificationWidget.y = yPos;
// JRL changes end
this._notificationWidget.opacity = 0;
this._notificationState = State.HIDDEN;
@@ -228,7 +245,7 @@ let extensionHideNotification = function(animate) {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
// JRL changes begin
//{ y: this.actor.height,
- { y: -global.screen_height,
+ { y: yPos,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
@@ -252,7 +269,7 @@ let extensionHideNotification = function(animate) {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
// JRL changes begin
//{ y: this.actor.height,
- { y: -global.screen_height,
+ { y: yPos,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
@@ -264,7 +281,7 @@ let extensionHideNotification = function(animate) {
Tweener.removeTweens(this._notificationWidget);
// JRL changes begin
//this._notificationWidget.y = this.actor.height;
- this._notificationWidget.y = -global.screen_height;
+ this._notificationWidget.y = yPos;
// JRL changes end
this._notificationWidget.opacity = 0;
this._notificationState = State.HIDDEN;
@@ -286,7 +303,16 @@ let extensionHideNotification = function(animate) {
let extensionUpdateShowingNotification = function() {
// JRL changes begin
// add own class-name to change border-radius, otherwise the changed value remains after switching off the extension
- this._notification._table.add_style_class_name('jrlnotification');
+ this._notification._table.remove_style_class_name('jrlnotification');
+ this._notification._table.remove_style_class_name('jrlnotification_top');
+ this._notification._table.remove_style_class_name('jrlnotification_bottom');
+ if (gety_position() <= 0.1)
+ this._notification._table.add_style_class_name('jrlnotification_bottom');
+ else if (gety_position() >= 99.9)
+ this._notification._table.add_style_class_name('jrlnotification_top');
+ else
+ this._notification._table.add_style_class_name('jrlnotification');
+
// JRL changes end
this._notification.acknowledged = true;
if (ExtensionUtils.versionCheck(['3.6'], Config.PACKAGE_VERSION)) {
@@ -310,9 +336,12 @@ let extensionUpdateShowingNotification = function() {
// top bar.
// "hide top panel" keeps the height and just moves the panel out of the visible area, so using
// the panels-height is not enough.
- let yPos = panel.y + panel.height - global.screen_height;
- if (yPos < (-global.screen_height))
- yPos = -global.screen_height;
+ let yTop = panel.y + panel.height - global.screen_height;
+ if (yTop < (-global.screen_height))
+ yTop = -global.screen_height;
+ let yBottom = -this._notificationWidget.height;
+
+ let yPos = (yTop - yBottom) * gety_position() / 100 + yBottom;
//
this._notificationWidget.x = (global.screen_width - this._notificationWidget.width) * (getX_position() - 50) / 50 ;
// JRL changes end
@@ -352,9 +381,12 @@ let extensionUpdateShowingNotification = function() {
let extensiononNotificationExpanded = function() {
// JRL changes begin
//let expandedY = - this._notificationWidget.height;
- let expandedY = panel.y + panel.height - global.screen_height;
- if (expandedY < (-global.screen_height))
- expandedY = -global.screen_height;
+ let yTop = panel.y + panel.height - global.screen_height;
+ if (yTop < (-global.screen_height))
+ yTop = -global.screen_height;
+ let yBottom = -this._notificationWidget.height;
+
+ let expandedY = (yTop - yBottom) * gety_position() / 100 + yBottom;
// JRL changes end
this._closeButton.show();
@@ -391,7 +423,11 @@ function enable() {
function disable() {
// remove our style, in case we just show a notification, otherwise the radius is drawn incorrect
if(Main.messageTray._notification)
+ {
Main.messageTray._notification._table.remove_style_class_name('jrlnotification');
+ Main.messageTray._notification._table.remove_style_class_name('jrlnotification_top');
+ Main.messageTray._notification._table.remove_style_class_name('jrlnotification_bottom');
+ }
// reset x-position
notificationWidget.x = originalNotificationWidgetX;
Main.messageTray._showNotification = originalShowNotification;
diff --git a/src/prefs.js b/src/prefs.js
index 6c0beb1..6f7ceec 100644
--- a/src/prefs.js
+++ b/src/prefs.js
@@ -15,6 +15,7 @@ const EXTENSIONDIR = Me.dir.get_path();
const PANEL_OSD_SETTINGS_SCHEMA = 'org.gnome.shell.extensions.panel-osd';
const PANEL_OSD_X_POS_KEY = 'x-pos';
+const PANEL_OSD_Y_POS_KEY = 'y-pos';
const PanelOsdPrefsWidget = new GObject.Class({
Name: 'PanelOsdExtension.Prefs.Widget',
@@ -52,8 +53,24 @@ const PanelOsdPrefsWidget = new GObject.Class({
}));
+ this.y_scale = this.Window.get_object("scale-y-pos");
+ this.y_scale.set_value(this.y_position);
+ // prevent from continously updating the value
+ this.yScaleTimeout = undefined;
+ this.y_scale.connect("value-changed", Lang.bind(this, function(slider) {
+
+ if (this.yScaleTimeout != undefined)
+ Mainloop.source_remove(this.yScaleTimeout);
+ this.yScaleTimeout = Mainloop.timeout_add(250, Lang.bind(this, function() {
+ this.y_position = slider.get_value();
+ return false;
+ }));
+
+ }));
+
this.Window.get_object("button-reset").connect("clicked", Lang.bind(this, function() {
- this.x_scale.set_value(50);;
+ this.x_scale.set_value(50);
+ this.y_scale.set_value(0);
}));
@@ -73,6 +90,18 @@ const PanelOsdPrefsWidget = new GObject.Class({
if (!this.Settings)
this.loadConfig();
this.Settings.set_double(PANEL_OSD_X_POS_KEY, v);
+ },
+
+ get y_position() {
+ if (!this.Settings)
+ this.loadConfig();
+ return this.Settings.get_double(PANEL_OSD_Y_POS_KEY);
+ },
+
+ set y_position(v) {
+ if (!this.Settings)
+ this.loadConfig();
+ this.Settings.set_double(PANEL_OSD_Y_POS_KEY, v);
}
});