Making it work with gnome 45
This commit is contained in:
committed by
Marcin Jakubowski
parent
65534f40cb
commit
48dacf2ffc
+14
-4
@@ -26,11 +26,16 @@ import St from 'gi://St';
|
||||
|
||||
import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
import MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js';
|
||||
import { MessageTray } from 'resource:///org/gnome/shell/ui/messageTray.js';
|
||||
import * as Utils from './utils.js';
|
||||
|
||||
const BannerBin = Main.messageTray._bannerBin;
|
||||
import {NOTIFICATION_TIMEOUT, HIDE_TIMEOUT, LONGER_HIDE_TIMEOUT, IDLE_TIME, State, Urgency } from 'resource:///org/gnome/shell/ui/messageTray.js';
|
||||
import { State, Urgency } from 'resource:///org/gnome/shell/ui/messageTray.js';
|
||||
|
||||
const NOTIFICATION_TIMEOUT = 4000;
|
||||
const HIDE_TIMEOUT = 200;
|
||||
const LONGER_HIDE_TIMEOUT = 600;
|
||||
const IDLE_TIME = 1000;
|
||||
|
||||
let ANIMATION_TIME = 200;
|
||||
let ANIMATION_DIRECTION = 2;
|
||||
@@ -47,7 +52,11 @@ function patcher(obj, live, method, original, patch) {
|
||||
eval(`${live}.${method} = ${newBody}`);
|
||||
}
|
||||
|
||||
const getMessageTraySize = () => ({ width, height } = Main.layoutManager.getWorkAreaForMonitor(global.display.get_primary_monitor()));
|
||||
const getMessageTraySize = () => {
|
||||
var width, height;
|
||||
var { width, height } = Main.layoutManager.getWorkAreaForMonitor(global.display.get_primary_monitor());
|
||||
return {width, height};
|
||||
}
|
||||
|
||||
const originalShow = MessageTray.prototype._showNotification;
|
||||
const originalHide = MessageTray.prototype._hideNotification;
|
||||
@@ -160,7 +169,8 @@ const always_minimize_patch = {
|
||||
};
|
||||
|
||||
export default class NotificationExtension extends Extension {
|
||||
constructor() {
|
||||
constructor(metadata) {
|
||||
super(metadata);
|
||||
this._previous_y_align = BannerBin.get_y_align();
|
||||
this._previous_x_align = BannerBin.get_x_align();
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"description": "Configure notification banner position and animation to your liking",
|
||||
"uuid": "notification-banner-reloaded@marcinjakubowski.github.com",
|
||||
"shell-version": [
|
||||
"45",
|
||||
"45"
|
||||
],
|
||||
"url": "https://github.com/marcinjakubowski/notification-position-reloaded",
|
||||
"settings-schema": "org.gnome.shell.extensions.notification-banner-reloaded"
|
||||
|
||||
@@ -46,7 +46,23 @@ function init() {
|
||||
}
|
||||
|
||||
export default class NotificationExtensionPreferences extends ExtensionPreferences {
|
||||
constructor() {
|
||||
constructor(metadata) {
|
||||
super(metadata);
|
||||
}
|
||||
|
||||
getPreferencesWidget() {
|
||||
let frame = new Gtk.Box();
|
||||
let widget = new Preferences(this.getSettings());
|
||||
addBox(frame, widget.main);
|
||||
if (frame.show_all)
|
||||
frame.show_all();
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
class Preferences{
|
||||
constructor(settings) {
|
||||
this.settings = settings
|
||||
this.main = new Gtk.Grid({
|
||||
margin_top: 10,
|
||||
margin_bottom: 10,
|
||||
@@ -164,7 +180,6 @@ export default class NotificationExtensionPreferences extends ExtensionPreferenc
|
||||
addRow(animationTimeLabel, this.animationTime);
|
||||
addRow(alwaysMinimizeLabel, this.alwaysMinimize);
|
||||
|
||||
const settings = this.getSettings();
|
||||
settings.bind(Utils.PrefFields.ANCHOR_HORIZONTAL, this.anchorHorizontal, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind(Utils.PrefFields.ANCHOR_VERTICAL, this.anchorVertical, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind(Utils.PrefFields.PADDING_HORIZONTAL, this.paddingHorizontal, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
@@ -186,13 +201,3 @@ export default class NotificationExtensionPreferences extends ExtensionPreferenc
|
||||
return liststore;
|
||||
}
|
||||
};
|
||||
|
||||
function buildPrefsWidget() {
|
||||
let frame = new Gtk.Box();
|
||||
let widget = new Preferences();
|
||||
addBox(frame, widget.main);
|
||||
if (frame.show_all)
|
||||
frame.show_all();
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user