Compare commits
114 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e4183488d9 | |||
| b02e43d84c | |||
| 8ed3b72a56 | |||
| a929cf9370 | |||
| a5343c33ec | |||
| 8efd73c50e | |||
| d5f617b3e2 | |||
| d1ff099200 | |||
| 6bbc329e7b | |||
| ed31f08f2f | |||
| ed60502f10 | |||
| 0fa592a516 | |||
| cb7b8e7c5a | |||
| f27b239f55 | |||
| 7f192d0208 | |||
| eff6f6ef88 | |||
| a6131bd00b | |||
| e864d0d1cc | |||
| 930595003d | |||
| 51df22adcf | |||
| 6ff6eb2c22 | |||
| 6bee46bf1a | |||
| f4347d240a | |||
| 81b8ad4499 | |||
| aeee81a82c | |||
| fcefdc3271 | |||
| 7a017c1e76 | |||
| b2455f0ecd | |||
| 573aba17d7 | |||
| 2117c42d74 | |||
| 5edffcd859 | |||
| d8b526a715 | |||
| a5b6871562 | |||
| deb6031381 | |||
| 486cb59aff | |||
| de9a3df7bd | |||
| db131fc7da | |||
| 80c6656c4f | |||
| a5a3523df8 | |||
| 06acd9ff25 | |||
| 1a1d45d9e4 | |||
| 1d3775b3d1 | |||
| 15c83db793 | |||
| cc021589b8 | |||
| 5e316d37cb | |||
| 28dbb47937 | |||
| 619de9d5ee | |||
| 561b8aeb03 | |||
| 4286fd1bcc | |||
| 3bb0897bc1 | |||
| 12eedcf6f7 | |||
| 08d382facc | |||
| d9ae9a023a | |||
| 96a1de92db | |||
| cc2f46b837 | |||
| 9f25047e24 | |||
| fb66afbf71 | |||
| 365fa6abc9 | |||
| d7a824f35f | |||
| 0d8e412220 | |||
| 991f6ef508 | |||
| 37f03f5e2e | |||
| b4a4ff0a06 | |||
| de8876bd5e | |||
| 5ad272e628 | |||
| 3b22582752 | |||
| e734fcbd21 | |||
| 435879c121 | |||
| ed81650f55 | |||
| 1276a880de | |||
| 584016c291 | |||
| 41664b152c | |||
| 8957c277a1 | |||
| 8b9be8f120 | |||
| d3b687df8b | |||
| df463177e7 | |||
| 62af36ebfa | |||
| c5246b7415 | |||
| d39c1fd685 | |||
| 665a7fbbcb | |||
| a4987d03b8 | |||
| c477f10bfb | |||
| 2ae0f368b9 | |||
| ac33058086 | |||
| c7a08aaf74 | |||
| 8c1d6d88cf | |||
| 33b16681c6 | |||
| 3c51716268 | |||
| e5421b6cc6 | |||
| f1e7ae1010 | |||
| 10fe907c83 | |||
| ae9809caba | |||
| c95d197c5c | |||
| ae8749b7e1 | |||
| 84a548c0b9 | |||
| f047cb0baf | |||
| 28494941e1 | |||
| b70059ac4d | |||
| eb567c1120 | |||
| b1eb9b9080 | |||
| a0b6535210 | |||
| 9a9b3afa31 | |||
| 59bc054ef6 | |||
| 57e9dfe722 | |||
| f17a519c38 | |||
| 8223ca9739 | |||
| fe20c27b60 | |||
| 5ba59d1096 | |||
| 0ad1e9bbc1 | |||
| 5ea14f063f | |||
| 3cc3d03f0b | |||
| 057e5bb0c1 | |||
| 07fc66765d | |||
| daa7b9b6ab |
-12
@@ -1,12 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2011 Giovanni Campagna <gcampagna@src.gnome.org>
|
|
||||||
# SPDX-FileCopyrightText: 2023 Florian Müllner <fmuellner@gnome.org>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
po/gnome-shell-extensions.pot
|
|
||||||
zip-files/
|
|
||||||
*~
|
|
||||||
*.patch
|
|
||||||
*.sw?
|
|
||||||
.buildconfig
|
|
||||||
.vscode
|
|
||||||
@@ -1,17 +1,22 @@
|
|||||||
46.alpha
|
45.2
|
||||||
========
|
====
|
||||||
* workspace-indicator: Fix initial preview visibility [Florian; !280, !292]
|
|
||||||
* screenshot-window-sizer: Fix cycling between sizes backwards [Florian; !284]
|
|
||||||
* Add back overview in Classic session [Florian; !287]
|
|
||||||
* Allow running Classic session headless [Jonas; !289]
|
|
||||||
* window-list: Fix buttons not being clickable at the screen edge
|
* window-list: Fix buttons not being clickable at the screen edge
|
||||||
[Florian; !291]
|
[Florian; !291]
|
||||||
* Add system-monitor extension [Florian; !277]
|
* window-list: Really fix initial preview visibility [Florian; !292]
|
||||||
* Fixed crash [Florian; !290]
|
* workspace-indicator: Really fix initial preview visibility [Florian; !292]
|
||||||
* Misc. bug fixes and cleanups [Florian; !276, !275, !278, !281, !286, !288]
|
* Misc. bug fixes and cleanups [Florian; !290]
|
||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
Jonas Ådahl, Florian Müllner
|
Florian Müllner
|
||||||
|
|
||||||
|
45.1
|
||||||
|
====
|
||||||
|
* workspace-indicator: Fix initial preview visibility [Florian; !280]
|
||||||
|
* screenshot-window-sizer: Fix cycling between sizes backwards [Florian; !284]
|
||||||
|
* Misc. bug fixes and cleanups [Florian; !276, !275, !278, !281]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Florian Müllner
|
||||||
|
|
||||||
Translators:
|
Translators:
|
||||||
Kristjan SCHMIDT [eo], Brage Fuglseth [nb]
|
Kristjan SCHMIDT [eo], Brage Fuglseth [nb]
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"parentMode": "user",
|
"parentMode": "user",
|
||||||
"colorScheme": "force-light",
|
"colorScheme": "force-light",
|
||||||
|
"hasOverview": false,
|
||||||
"showWelcomeDialog": false,
|
"showWelcomeDialog": false,
|
||||||
"enabledExtensions": [@CLASSIC_EXTENSIONS@],
|
"enabledExtensions": [@CLASSIC_EXTENSIONS@],
|
||||||
"panel": { "left": ["activities"],
|
"panel": { "left": [],
|
||||||
"center": [],
|
"center": [],
|
||||||
"right": ["a11y", "keyboard", "dateMenu", "quickSettings"]
|
"right": ["a11y", "keyboard", "dateMenu", "quickSettings"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,3 @@ TryExec=gnome-session
|
|||||||
Type=Application
|
Type=Application
|
||||||
DesktopNames=GNOME-Classic;GNOME;
|
DesktopNames=GNOME-Classic;GNOME;
|
||||||
X-GDM-SessionRegisters=true
|
X-GDM-SessionRegisters=true
|
||||||
X-GDM-CanRunHeadless=true
|
|
||||||
|
|||||||
@@ -6,4 +6,3 @@ TryExec=gnome-session
|
|||||||
Type=Application
|
Type=Application
|
||||||
DesktopNames=GNOME-Classic;GNOME;
|
DesktopNames=GNOME-Classic;GNOME;
|
||||||
X-GDM-SessionRegisters=true
|
X-GDM-SessionRegisters=true
|
||||||
X-GDM-CanRunHeadless=true
|
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ for f in $extensiondir/*; do
|
|||||||
cp $srcdir/NEWS $srcdir/COPYING $f
|
cp $srcdir/NEWS $srcdir/COPYING $f
|
||||||
sources=(NEWS COPYING $(cd $f; ls *.js))
|
sources=(NEWS COPYING $(cd $f; ls *.js))
|
||||||
|
|
||||||
[ -d $f/icons ] && sources+=(icons)
|
|
||||||
|
|
||||||
[ -f $schema ] || unset schema
|
[ -f $schema ] || unset schema
|
||||||
|
|
||||||
gnome-extensions pack ${sources[@]/#/--extra-source=} \
|
gnome-extensions pack ${sources[@]/#/--extra-source=} \
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class DesktopTarget extends EventEmitter {
|
|||||||
this._desktopDestroyedId = 0;
|
this._desktopDestroyedId = 0;
|
||||||
|
|
||||||
this._windowAddedId =
|
this._windowAddedId =
|
||||||
global.window_group.connect('child-added',
|
global.window_group.connect('actor-added',
|
||||||
this._onWindowAdded.bind(this));
|
this._onWindowAdded.bind(this));
|
||||||
|
|
||||||
global.get_window_actors().forEach(a => {
|
global.get_window_actors().forEach(a => {
|
||||||
@@ -399,7 +399,7 @@ class ApplicationsButton extends PanelMenu.Button {
|
|||||||
y_align: Clutter.ActorAlign.CENTER,
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add_child(this._label);
|
this.add_actor(this._label);
|
||||||
this.name = 'panelApplications';
|
this.name = 'panelApplications';
|
||||||
this.label_actor = this._label;
|
this.label_actor = this._label;
|
||||||
|
|
||||||
@@ -568,13 +568,13 @@ class ApplicationsButton extends PanelMenu.Button {
|
|||||||
this.leftBox.add_child(this.categoriesScrollBox);
|
this.leftBox.add_child(this.categoriesScrollBox);
|
||||||
|
|
||||||
this.applicationsBox = new St.BoxLayout({vertical: true});
|
this.applicationsBox = new St.BoxLayout({vertical: true});
|
||||||
this.applicationsScrollBox.set_child(this.applicationsBox);
|
this.applicationsScrollBox.add_actor(this.applicationsBox);
|
||||||
this.categoriesBox = new St.BoxLayout({vertical: true});
|
this.categoriesBox = new St.BoxLayout({vertical: true});
|
||||||
this.categoriesScrollBox.set_child(this.categoriesBox);
|
this.categoriesScrollBox.add_actor(this.categoriesBox);
|
||||||
|
|
||||||
this.mainBox.add_child(this.leftBox);
|
this.mainBox.add(this.leftBox);
|
||||||
this.mainBox.add_child(this.applicationsScrollBox);
|
this.mainBox.add_child(this.applicationsScrollBox);
|
||||||
section.actor.add_child(this.mainBox);
|
section.actor.add_actor(this.mainBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
_display() {
|
_display() {
|
||||||
@@ -586,7 +586,7 @@ class ApplicationsButton extends PanelMenu.Button {
|
|||||||
this._tree.load_sync();
|
this._tree.load_sync();
|
||||||
let root = this._tree.get_root_directory();
|
let root = this._tree.get_root_directory();
|
||||||
let categoryMenuItem = new CategoryMenuItem(this, null);
|
let categoryMenuItem = new CategoryMenuItem(this, null);
|
||||||
this.categoriesBox.add_child(categoryMenuItem);
|
this.categoriesBox.add_actor(categoryMenuItem);
|
||||||
let iter = root.iter();
|
let iter = root.iter();
|
||||||
let nextType;
|
let nextType;
|
||||||
while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
|
while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
|
||||||
@@ -602,7 +602,7 @@ class ApplicationsButton extends PanelMenu.Button {
|
|||||||
this._loadCategory(categoryId, dir);
|
this._loadCategory(categoryId, dir);
|
||||||
if (this.applicationsByCategory[categoryId].length > 0) {
|
if (this.applicationsByCategory[categoryId].length > 0) {
|
||||||
categoryMenuItem = new CategoryMenuItem(this, dir);
|
categoryMenuItem = new CategoryMenuItem(this, dir);
|
||||||
this.categoriesBox.add_child(categoryMenuItem);
|
this.categoriesBox.add_actor(categoryMenuItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +615,7 @@ class ApplicationsButton extends PanelMenu.Button {
|
|||||||
if (c._delegate instanceof PopupMenu.PopupSeparatorMenuItem)
|
if (c._delegate instanceof PopupMenu.PopupSeparatorMenuItem)
|
||||||
c._delegate.destroy();
|
c._delegate.destroy();
|
||||||
else
|
else
|
||||||
this.applicationsBox.remove_child(c);
|
this.applicationsBox.remove_actor(c);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (dir)
|
if (dir)
|
||||||
@@ -638,7 +638,7 @@ class ApplicationsButton extends PanelMenu.Button {
|
|||||||
this._applicationsButtons.set(app, item);
|
this._applicationsButtons.set(app, item);
|
||||||
}
|
}
|
||||||
if (!item.get_parent())
|
if (!item.get_parent())
|
||||||
this.applicationsBox.add_child(item);
|
this.applicationsBox.add_actor(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
|
|||||||
style_class: 'button',
|
style_class: 'button',
|
||||||
});
|
});
|
||||||
ejectButton.connect('clicked', this._eject.bind(this));
|
ejectButton.connect('clicked', this._eject.bind(this));
|
||||||
this.add_child(ejectButton);
|
this.add(ejectButton);
|
||||||
|
|
||||||
this.hide();
|
this.hide();
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class PlacesMenu extends PanelMenu.Button {
|
|||||||
y_expand: true,
|
y_expand: true,
|
||||||
y_align: Clutter.ActorAlign.CENTER,
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
});
|
});
|
||||||
this.add_child(label);
|
this.add_actor(label);
|
||||||
|
|
||||||
this.placesManager = new PlacesManager();
|
this.placesManager = new PlacesManager();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default class ScreenshotWindowSizerExtension extends Extension {
|
|||||||
_flashMessage(message) {
|
_flashMessage(message) {
|
||||||
if (!this._text) {
|
if (!this._text) {
|
||||||
this._text = new St.Label({style_class: 'screenshot-sizer-message'});
|
this._text = new St.Label({style_class: 'screenshot-sizer-message'});
|
||||||
Main.uiGroup.add_child(this._text);
|
Main.uiGroup.add_actor(this._text);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._text.remove_all_transitions();
|
this._text.remove_all_transitions();
|
||||||
|
|||||||
@@ -1,480 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2023 Florian Müllner <fmuellner@gnome.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Clutter from 'gi://Clutter';
|
|
||||||
import Gio from 'gi://Gio';
|
|
||||||
import GLib from 'gi://GLib';
|
|
||||||
import GObject from 'gi://GObject';
|
|
||||||
import GTop from 'gi://GTop';
|
|
||||||
import Pango from 'gi://Pango';
|
|
||||||
import Shell from 'gi://Shell';
|
|
||||||
import St from 'gi://St';
|
|
||||||
|
|
||||||
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
|
|
||||||
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
|
|
||||||
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
|
||||||
|
|
||||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
|
||||||
|
|
||||||
const THRESHOLD_HIGH = 0.80;
|
|
||||||
|
|
||||||
// adapted from load-graph.cpp in gnome-system-monitor
|
|
||||||
/**
|
|
||||||
* @param {string} str
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
function strHash(str) {
|
|
||||||
let hash = 0xcbf29ce484222325n;
|
|
||||||
|
|
||||||
for (const c of str)
|
|
||||||
hash = (hash * 0x00000100000001B3n) ^ BigInt(c.codePointAt(0));
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
class StatSection extends St.BoxLayout {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(iconName, accessibleName) {
|
|
||||||
super({
|
|
||||||
style_class: 'system-monitor-stat-section',
|
|
||||||
accessibleName,
|
|
||||||
});
|
|
||||||
|
|
||||||
const ext = Extension.lookupByURL(import.meta.url);
|
|
||||||
const file =
|
|
||||||
ext.dir.resolve_relative_path(`icons/${iconName}.svg`);
|
|
||||||
|
|
||||||
this._icon = new St.Icon({
|
|
||||||
style_class: 'system-monitor-stat-section-icon',
|
|
||||||
gicon: new Gio.FileIcon({file}),
|
|
||||||
});
|
|
||||||
this.add_child(this._icon);
|
|
||||||
|
|
||||||
this.label = new St.Label({
|
|
||||||
style_class: 'system-monitor-stat-section-label',
|
|
||||||
y_align: Clutter.ActorAlign.CENTER,
|
|
||||||
});
|
|
||||||
this.label.clutter_text.set({
|
|
||||||
ellipsize: Pango.EllipsizeMode.NONE,
|
|
||||||
x_align: Clutter.ActorAlign.CENTER,
|
|
||||||
});
|
|
||||||
this.add_child(this.label);
|
|
||||||
|
|
||||||
this.connect('destroy', () => this._clearTimeout());
|
|
||||||
this.connect('notify::visible', () => this._sync());
|
|
||||||
this._sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
_ensureTimeout() {
|
|
||||||
if (this._updateId)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this._updateId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1,
|
|
||||||
() => {
|
|
||||||
this._update();
|
|
||||||
return GLib.SOURCE_CONTINUE;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_clearTimeout() {
|
|
||||||
if (this._updateId)
|
|
||||||
GLib.source_remove(this._updateId);
|
|
||||||
delete this._updateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
_sync() {
|
|
||||||
if (this.visible)
|
|
||||||
this._ensureTimeout();
|
|
||||||
else
|
|
||||||
this._clearTimeout();
|
|
||||||
|
|
||||||
if (this.visible)
|
|
||||||
this._update();
|
|
||||||
}
|
|
||||||
|
|
||||||
_update() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LoadStatSection extends StatSection {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
#formatter = new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'percent',
|
|
||||||
});
|
|
||||||
|
|
||||||
_getLoadValue() {
|
|
||||||
}
|
|
||||||
|
|
||||||
_update() {
|
|
||||||
const load = this._getLoadValue();
|
|
||||||
this.label.text = this.#formatter.format(load);
|
|
||||||
|
|
||||||
if (load >= THRESHOLD_HIGH)
|
|
||||||
this.add_style_class_name('high-usage');
|
|
||||||
else
|
|
||||||
this.remove_style_class_name('high-usage');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CpuSection extends LoadStatSection {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
#prevCpu = new GTop.glibtop_cpu();
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super('processor-symbolic', _('CPU stats'));
|
|
||||||
}
|
|
||||||
|
|
||||||
_getLoadValue() {
|
|
||||||
const cpu = new GTop.glibtop_cpu();
|
|
||||||
GTop.glibtop_get_cpu(cpu);
|
|
||||||
|
|
||||||
const total = cpu.total - this.#prevCpu.total;
|
|
||||||
const user = cpu.user - this.#prevCpu.user;
|
|
||||||
const sys = cpu.sys - this.#prevCpu.sys;
|
|
||||||
const nice = cpu.nice - this.#prevCpu.nice;
|
|
||||||
|
|
||||||
this.#prevCpu = cpu;
|
|
||||||
|
|
||||||
return (user + sys + nice) / Math.max(total, 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MemSection extends LoadStatSection {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super('memory-symbolic', _('Memory stats'));
|
|
||||||
}
|
|
||||||
|
|
||||||
_getLoadValue() {
|
|
||||||
const mem = new GTop.glibtop_mem();
|
|
||||||
GTop.glibtop_get_mem(mem);
|
|
||||||
|
|
||||||
const {user, total} = mem;
|
|
||||||
return user / Math.max(total, 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SwapSection extends LoadStatSection {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super('swap-symbolic', _('Swap stats'));
|
|
||||||
}
|
|
||||||
|
|
||||||
_getLoadValue() {
|
|
||||||
const swap = new GTop.glibtop_swap();
|
|
||||||
GTop.glibtop_get_swap(swap);
|
|
||||||
|
|
||||||
const {used, total} = swap;
|
|
||||||
return used / Math.max(total, 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NetStatSection extends StatSection {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
#formats = [{
|
|
||||||
factor: 1000,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'kilobyte',
|
|
||||||
maximumFractionDigits: 1,
|
|
||||||
minimumFractionDigits: 1,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 10,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'kilobyte',
|
|
||||||
maximumFractionDigits: 0,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 1000,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'megabyte',
|
|
||||||
maximumFractionDigits: 1,
|
|
||||||
minimumFractionDigits: 1,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 1000 * 10,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'megabyte',
|
|
||||||
maximumFractionDigits: 0,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 1000 * 1000,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'gigabyte',
|
|
||||||
maximumFractionDigits: 1,
|
|
||||||
minimumFractionDigits: 1,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 1000 * 1000 * 10,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'gigabyte',
|
|
||||||
maximumFractionDigits: 0,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 1000 * 1000 * 1000,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'terabyte',
|
|
||||||
maximumFractionDigits: 1,
|
|
||||||
minimumFractionDigits: 1,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 1000 * 1000 * 1000 * 10,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'terabyte',
|
|
||||||
maximumFractionDigits: 0,
|
|
||||||
}),
|
|
||||||
}, {
|
|
||||||
factor: 1000 * 1000 * 1000 * 1000 * 1000,
|
|
||||||
formatter: new Intl.NumberFormat(undefined, {
|
|
||||||
style: 'unit',
|
|
||||||
unit: 'petabyte',
|
|
||||||
maximumFractionDigits: 1,
|
|
||||||
minimumFractionDigits: 1,
|
|
||||||
}),
|
|
||||||
}];
|
|
||||||
|
|
||||||
#lastBytes = 0;
|
|
||||||
#lastHash = 0;
|
|
||||||
#lastTime = 0;
|
|
||||||
|
|
||||||
_getBytes(_netload) {
|
|
||||||
}
|
|
||||||
|
|
||||||
_getFormat(bytes) {
|
|
||||||
for (let i = 1; i < this.#formats.length; i++) {
|
|
||||||
if (bytes < this.#formats.at(i).factor)
|
|
||||||
return this.#formats.at(i - 1);
|
|
||||||
}
|
|
||||||
return this.#formats.at(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_update() {
|
|
||||||
const FLAG_LOOPBACK = 1 << 4; // GTop sucks
|
|
||||||
|
|
||||||
const netlist = new GTop.glibtop_netlist();
|
|
||||||
const ifnames = GTop.glibtop_get_netlist(netlist);
|
|
||||||
|
|
||||||
let bytes = 0;
|
|
||||||
let hash = 1n;
|
|
||||||
|
|
||||||
for (const ifname of ifnames) {
|
|
||||||
const netload = new GTop.glibtop_netload();
|
|
||||||
GTop.glibtop_get_netload(netload, ifname);
|
|
||||||
|
|
||||||
if (netload.if_flags & FLAG_LOOPBACK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bytes += this._getBytes(netload);
|
|
||||||
hash += strHash(ifname);
|
|
||||||
}
|
|
||||||
|
|
||||||
const time = GLib.get_monotonic_time();
|
|
||||||
|
|
||||||
let dbytes = 0;
|
|
||||||
|
|
||||||
// Skip calculation if new data is less than old (interface
|
|
||||||
// removed, counters reset, ...) or if it is the first time
|
|
||||||
if (bytes >= this.#lastBytes &&
|
|
||||||
hash === this.#lastHash &&
|
|
||||||
this.#lastTime !== 0) {
|
|
||||||
const dtime = (time - this.#lastTime) / GLib.USEC_PER_SEC;
|
|
||||||
dbytes = (bytes - this.#lastBytes) / dtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#lastBytes = bytes;
|
|
||||||
this.#lastTime = time;
|
|
||||||
this.#lastHash = hash;
|
|
||||||
|
|
||||||
const {factor, formatter} = this._getFormat(dbytes);
|
|
||||||
this.label.text = formatter.format(dbytes / factor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UploadSection extends NetStatSection {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super('upload-symbolic', _('Upload stats'));
|
|
||||||
}
|
|
||||||
|
|
||||||
_getBytes(netload) {
|
|
||||||
return netload.bytes_out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DownloadSection extends NetStatSection {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super('download-symbolic', _('Download stats'));
|
|
||||||
}
|
|
||||||
|
|
||||||
_getBytes(netload) {
|
|
||||||
return netload.bytes_in;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Indicator extends PanelMenu.Button {
|
|
||||||
static {
|
|
||||||
GObject.registerClass(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(settings) {
|
|
||||||
super(0.5, _('System stats'));
|
|
||||||
|
|
||||||
this._settings = settings;
|
|
||||||
this.connect('destroy',
|
|
||||||
() => (this._settings = null));
|
|
||||||
|
|
||||||
const box = new St.BoxLayout({
|
|
||||||
styleClass: 'system-monitor-stat-sections',
|
|
||||||
});
|
|
||||||
|
|
||||||
this.add_child(box);
|
|
||||||
|
|
||||||
this._placeholder = new St.Icon({
|
|
||||||
styleClass: 'system-status-icon system-monitor-placeholder',
|
|
||||||
});
|
|
||||||
box.add_child(this._placeholder);
|
|
||||||
|
|
||||||
this._cpuSection = new CpuSection();
|
|
||||||
this._settings.bind('show-cpu',
|
|
||||||
this._cpuSection, 'visible',
|
|
||||||
Gio.SettingsBindFlags.GET);
|
|
||||||
box.add_child(this._cpuSection);
|
|
||||||
|
|
||||||
this._memSection = new MemSection();
|
|
||||||
this._settings.bind('show-memory',
|
|
||||||
this._memSection, 'visible',
|
|
||||||
Gio.SettingsBindFlags.GET);
|
|
||||||
box.add_child(this._memSection);
|
|
||||||
|
|
||||||
this._swapSection = new SwapSection();
|
|
||||||
this._settings.bind('show-swap',
|
|
||||||
this._swapSection, 'visible',
|
|
||||||
Gio.SettingsBindFlags.GET);
|
|
||||||
box.add_child(this._swapSection);
|
|
||||||
|
|
||||||
this._ulSection = new UploadSection();
|
|
||||||
this._settings.bind('show-upload',
|
|
||||||
this._ulSection, 'visible',
|
|
||||||
Gio.SettingsBindFlags.GET);
|
|
||||||
box.add_child(this._ulSection);
|
|
||||||
|
|
||||||
this._dlSection = new DownloadSection();
|
|
||||||
this._settings.bind('show-download',
|
|
||||||
this._dlSection, 'visible',
|
|
||||||
Gio.SettingsBindFlags.GET);
|
|
||||||
box.add_child(this._dlSection);
|
|
||||||
|
|
||||||
this.menu.addMenuItem(
|
|
||||||
new PopupMenu.PopupSeparatorMenuItem(_('Show')));
|
|
||||||
|
|
||||||
this._cpuItem = this.menu.addAction(_('CPU'),
|
|
||||||
() => this._toggleSettings('show-cpu'));
|
|
||||||
this._memItem = this.menu.addAction(_('Memory'),
|
|
||||||
() => this._toggleSettings('show-memory'));
|
|
||||||
this._swapItem = this.menu.addAction(_('Swap'),
|
|
||||||
() => this._toggleSettings('show-swap'));
|
|
||||||
this._ulItem = this.menu.addAction(_('Upload'),
|
|
||||||
() => this._toggleSettings('show-upload'));
|
|
||||||
this._dlItem = this.menu.addAction(_('Download'),
|
|
||||||
() => this._toggleSettings('show-download'));
|
|
||||||
|
|
||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
|
||||||
|
|
||||||
this._appMenuItem = this.menu.addAction(_('Open System Monitor'),
|
|
||||||
() => this._openSystemMonitor());
|
|
||||||
|
|
||||||
const appSystem = Shell.AppSystem.get_default();
|
|
||||||
appSystem.connectObject('installed-changed',
|
|
||||||
() => this._updateSystemMonitorApp(), this);
|
|
||||||
this._updateSystemMonitorApp();
|
|
||||||
|
|
||||||
this._settings.connectObject('changed',
|
|
||||||
() => this._sync(), this);
|
|
||||||
this._sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateSystemMonitorApp() {
|
|
||||||
const appSystem = Shell.AppSystem.get_default();
|
|
||||||
this._systemMonitorApp =
|
|
||||||
appSystem.lookup_app('gnome-system-monitor.desktop');
|
|
||||||
this._placeholder.gicon = this._systemMonitorApp?.icon ?? null;
|
|
||||||
this.visible = this._systemMonitorApp != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
_openSystemMonitor() {
|
|
||||||
this._systemMonitorApp.activate();
|
|
||||||
Main.overview.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
_toggleSettings(key) {
|
|
||||||
this._settings.set_boolean(key, !this._settings.get_boolean(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
_sync() {
|
|
||||||
this._cpuItem.setOrnament(this._settings.get_boolean('show-cpu')
|
|
||||||
? PopupMenu.Ornament.CHECK
|
|
||||||
: PopupMenu.Ornament.NONE);
|
|
||||||
this._memItem.setOrnament(this._settings.get_boolean('show-memory')
|
|
||||||
? PopupMenu.Ornament.CHECK
|
|
||||||
: PopupMenu.Ornament.NONE);
|
|
||||||
this._swapItem.setOrnament(this._settings.get_boolean('show-swap')
|
|
||||||
? PopupMenu.Ornament.CHECK
|
|
||||||
: PopupMenu.Ornament.NONE);
|
|
||||||
this._ulItem.setOrnament(this._settings.get_boolean('show-upload')
|
|
||||||
? PopupMenu.Ornament.CHECK
|
|
||||||
: PopupMenu.Ornament.NONE);
|
|
||||||
this._dlItem.setOrnament(this._settings.get_boolean('show-download')
|
|
||||||
? PopupMenu.Ornament.CHECK
|
|
||||||
: PopupMenu.Ornament.NONE);
|
|
||||||
|
|
||||||
this._placeholder.visible =
|
|
||||||
this._settings.list_keys().every(key => !this._settings.get_boolean(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class SystemMonitorExtension extends Extension {
|
|
||||||
enable() {
|
|
||||||
this._indicator = new Indicator(this.getSettings());
|
|
||||||
Main.panel.addToStatusArea(this.uuid, this._indicator);
|
|
||||||
}
|
|
||||||
|
|
||||||
disable() {
|
|
||||||
this._indicator.destroy();
|
|
||||||
this._indicator = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<filter id="a" height="100%" width="100%" x="0%" y="0%">
|
|
||||||
<feColorMatrix color-interpolation-filters="sRGB" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
|
|
||||||
</filter>
|
|
||||||
<mask id="b">
|
|
||||||
<g filter="url(#a)">
|
|
||||||
<path d="m -1.6 -1.6 h 19.2 v 19.2 h -19.2 z" fill-opacity="0.5"/>
|
|
||||||
</g>
|
|
||||||
</mask>
|
|
||||||
<clipPath id="c">
|
|
||||||
<path d="m 0 0 h 1600 v 1200 h -1600 z"/>
|
|
||||||
</clipPath>
|
|
||||||
<mask id="d">
|
|
||||||
<g filter="url(#a)">
|
|
||||||
<path d="m -1.6 -1.6 h 19.2 v 19.2 h -19.2 z" fill-opacity="0.7"/>
|
|
||||||
</g>
|
|
||||||
</mask>
|
|
||||||
<clipPath id="e">
|
|
||||||
<path d="m 0 0 h 1600 v 1200 h -1600 z"/>
|
|
||||||
</clipPath>
|
|
||||||
<mask id="f">
|
|
||||||
<g filter="url(#a)">
|
|
||||||
<path d="m -1.6 -1.6 h 19.2 v 19.2 h -19.2 z" fill-opacity="0.35"/>
|
|
||||||
</g>
|
|
||||||
</mask>
|
|
||||||
<clipPath id="g">
|
|
||||||
<path d="m 0 0 h 1600 v 1200 h -1600 z"/>
|
|
||||||
</clipPath>
|
|
||||||
<g mask="url(#b)">
|
|
||||||
<g clip-path="url(#c)" transform="matrix(1 0 0 1 -920 -120)">
|
|
||||||
<path d="m 550 182 c -0.351562 0.003906 -0.695312 0.101562 -1 0.28125 v 3.4375 c 0.304688 0.179688 0.648438 0.277344 1 0.28125 c 1.105469 0 2 -0.894531 2 -2 s -0.894531 -2 -2 -2 z m 0 5 c -0.339844 0 -0.679688 0.058594 -1 0.175781 v 6.824219 h 4 v -4 c 0 -1.65625 -1.34375 -3 -3 -3 z m 0 0"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g mask="url(#d)">
|
|
||||||
<g clip-path="url(#e)" transform="matrix(1 0 0 1 -920 -120)">
|
|
||||||
<path d="m 569 182 v 4 c 1.105469 0 2 -0.894531 2 -2 s -0.894531 -2 -2 -2 z m 0 5 v 7 h 3 v -4 c 0 -1.65625 -1.34375 -3 -3 -3 z m 0 0"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g mask="url(#f)">
|
|
||||||
<g clip-path="url(#g)" transform="matrix(1 0 0 1 -920 -120)">
|
|
||||||
<path d="m 573 182.269531 v 3.449219 c 0.613281 -0.355469 0.996094 -1.007812 1 -1.71875 c 0 -0.714844 -0.382812 -1.375 -1 -1.730469 z m 0 4.90625 v 6.824219 h 2 v -4 c 0 -1.269531 -0.800781 -2.402344 -2 -2.824219 z m 0 0"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<path d="m 7.984375 1 c -0.550781 0 -1 0.449219 -1 1 v 8.585938 l -2.292969 -2.292969 c -0.1875 -0.1875 -0.441406 -0.292969 -0.707031 -0.292969 s -0.519531 0.105469 -0.707031 0.292969 c -0.390625 0.390625 -0.390625 1.023437 0 1.414062 l 4 4 c 0.390625 0.390625 1.023437 0.390625 1.414062 0 l 4 -4 c 0.390625 -0.390625 0.390625 -1.023437 0 -1.414062 s -1.023437 -0.390625 -1.414062 0 l -2.292969 2.292969 v -8.585938 c 0 -0.550781 -0.445313 -1 -1 -1 z m 0 0"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -1,3 +0,0 @@
|
|||||||
SPDX-FileCopyrightText: Icon Development Kit
|
|
||||||
|
|
||||||
SPDX-License-Identifier: CC0-1.0
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 3 2 c -1.660156 0 -3 1.339844 -3 3 v 4 c 0 1.660156 1.339844 3 3 3 h 10 c 1.660156 0 3 -1.339844 3 -3 v -4 c 0 -1.660156 -1.339844 -3 -3 -3 z m 0 2 h 10 c 0.554688 0 1 0.445312 1 1 v 4 c 0 0.554688 -0.445312 1 -1 1 h -10 c -0.554688 0 -1 -0.445312 -1 -1 v -4 c 0 -0.554688 0.445312 -1 1 -1 z m 0 0"/><path d="m 2 10 h 12 v 4 h -12 z m 0 0"/><g fill-opacity="0.501961"><path d="m 4 5 h 2 v 4 h -2 z m 0 0"/><path d="m 7 5 h 2 v 4 h -2 z m 0 0"/><path d="m 10 5 h 2 v 4 h -2 z m 0 0"/></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 631 B |
@@ -1,3 +0,0 @@
|
|||||||
SPDX-FileCopyrightText: Icon Development Kit
|
|
||||||
|
|
||||||
SPDX-License-Identifier: CC0-1.0
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 5 5 h 6 v 6 h -6 z m 0 0"/><path d="m 13 5 h 3 v 1 h -3 z m 0 0"/><path d="m 13 7 h 3 v 1 h -3 z m 0 0"/><path d="m 13 9 h 3 v 1 h -3 z m 0 0"/><path d="m 0 6 h 3 v 1 h -3 z m 0 0"/><path d="m 0 8 h 3 v 1 h -3 z m 0 0"/><path d="m 0 10 h 3 v 1 h -3 z m 0 0"/><path d="m 5 0 h 1 v 3 h -1 z m 0 0"/><path d="m 7 0 h 1 v 3 h -1 z m 0 0"/><path d="m 9 0 h 1 v 3 h -1 z m 0 0"/><path d="m 10 13 h 1 v 3 h -1 z m 0 0"/><path d="m 8 13 h 1 v 3 h -1 z m 0 0"/><path d="m 6 13 h 1 v 3 h -1 z m 0 0"/><path d="m 5 2 c -1.644531 0 -3 1.355469 -3 3 v 6 c 0 1.644531 1.355469 3 3 3 h 6 c 1.644531 0 3 -1.355469 3 -3 v -6 c 0 -1.644531 -1.355469 -3 -3 -3 z m 0 2 h 6 c 0.570312 0 1 0.429688 1 1 v 6 c 0 0.570312 -0.429688 1 -1 1 h -6 c -0.570312 0 -1 -0.429688 -1 -1 v -6 c 0 -0.570312 0.429688 -1 1 -1 z m 0 0"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 943 B |
@@ -1,3 +0,0 @@
|
|||||||
SPDX-FileCopyrightText: Icon Development Kit
|
|
||||||
|
|
||||||
SPDX-License-Identifier: CC0-1.0
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 5 7 c -0.308594 0 -0.613281 0.089844 -0.8125 0.28125 l -3.59375 3.71875 l 3.65625 3.71875 c 0.199219 0.191406 0.441406 0.28125 0.75 0.28125 h 1 v -1 c 0 -0.257812 -0.128906 -0.527344 -0.3125 -0.71875 l -1.28125 -1.28125 h 4.59375 c 0.527344 0.007812 1 -0.472656 1 -1 s -0.472656 -1.007812 -1 -1 h -4.625 l 1.21875 -1.28125 c 0.183594 -0.191406 0.40625 -0.460938 0.40625 -0.71875 v -1 z m 0 0"/><path d="m 11 9 c 0.308594 0 0.613281 -0.089844 0.8125 -0.28125 l 3.59375 -3.71875 l -3.65625 -3.71875 c -0.199219 -0.191406 -0.441406 -0.28125 -0.75 -0.28125 h -1 v 1 c 0 0.257812 0.128906 0.527344 0.3125 0.71875 l 1.28125 1.28125 h -4.59375 c -0.527344 -0.007812 -1 0.472656 -1 1 s 0.472656 1.007812 1 1 h 4.625 l -1.21875 1.28125 c -0.183594 0.191406 -0.40625 0.460938 -0.40625 0.71875 v 1 z m 0 0"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 941 B |
@@ -1,3 +0,0 @@
|
|||||||
SPDX-FileCopyrightText: Icon Development Kit
|
|
||||||
|
|
||||||
SPDX-License-Identifier: CC0-1.0
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<filter id="a" height="100%" width="100%" x="0%" y="0%">
|
|
||||||
<feColorMatrix color-interpolation-filters="sRGB" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
|
|
||||||
</filter>
|
|
||||||
<mask id="b">
|
|
||||||
<g filter="url(#a)">
|
|
||||||
<path d="m -1.6 -1.6 h 19.2 v 19.2 h -19.2 z" fill-opacity="0.5"/>
|
|
||||||
</g>
|
|
||||||
</mask>
|
|
||||||
<clipPath id="c">
|
|
||||||
<path d="m 0 0 h 1600 v 1200 h -1600 z"/>
|
|
||||||
</clipPath>
|
|
||||||
<mask id="d">
|
|
||||||
<g filter="url(#a)">
|
|
||||||
<path d="m -1.6 -1.6 h 19.2 v 19.2 h -19.2 z" fill-opacity="0.7"/>
|
|
||||||
</g>
|
|
||||||
</mask>
|
|
||||||
<clipPath id="e">
|
|
||||||
<path d="m 0 0 h 1600 v 1200 h -1600 z"/>
|
|
||||||
</clipPath>
|
|
||||||
<mask id="f">
|
|
||||||
<g filter="url(#a)">
|
|
||||||
<path d="m -1.6 -1.6 h 19.2 v 19.2 h -19.2 z" fill-opacity="0.35"/>
|
|
||||||
</g>
|
|
||||||
</mask>
|
|
||||||
<clipPath id="g">
|
|
||||||
<path d="m 0 0 h 1600 v 1200 h -1600 z"/>
|
|
||||||
</clipPath>
|
|
||||||
<g mask="url(#b)">
|
|
||||||
<g clip-path="url(#c)" transform="matrix(1 0 0 1 -900 -120)">
|
|
||||||
<path d="m 550 182 c -0.351562 0.003906 -0.695312 0.101562 -1 0.28125 v 3.4375 c 0.304688 0.179688 0.648438 0.277344 1 0.28125 c 1.105469 0 2 -0.894531 2 -2 s -0.894531 -2 -2 -2 z m 0 5 c -0.339844 0 -0.679688 0.058594 -1 0.175781 v 6.824219 h 4 v -4 c 0 -1.65625 -1.34375 -3 -3 -3 z m 0 0"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g mask="url(#d)">
|
|
||||||
<g clip-path="url(#e)" transform="matrix(1 0 0 1 -900 -120)">
|
|
||||||
<path d="m 569 182 v 4 c 1.105469 0 2 -0.894531 2 -2 s -0.894531 -2 -2 -2 z m 0 5 v 7 h 3 v -4 c 0 -1.65625 -1.34375 -3 -3 -3 z m 0 0"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g mask="url(#f)">
|
|
||||||
<g clip-path="url(#g)" transform="matrix(1 0 0 1 -900 -120)">
|
|
||||||
<path d="m 573 182.269531 v 3.449219 c 0.613281 -0.355469 0.996094 -1.007812 1 -1.71875 c 0 -0.714844 -0.382812 -1.375 -1 -1.730469 z m 0 4.90625 v 6.824219 h 2 v -4 c 0 -1.269531 -0.800781 -2.402344 -2 -2.824219 z m 0 0"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<path d="m 8.015625 15 c 0.550781 0 1 -0.449219 1 -1 v -8.585938 l 2.292969 2.292969 c 0.1875 0.1875 0.441406 0.292969 0.707031 0.292969 s 0.519531 -0.105469 0.707031 -0.292969 c 0.390625 -0.390625 0.390625 -1.023437 0 -1.414062 l -4 -4 c -0.390625 -0.390625 -1.023437 -0.390625 -1.414062 0 l -4 4 c -0.390625 0.390625 -0.390625 1.023437 0 1.414062 s 1.023437 0.390625 1.414062 0 l 2.292969 -2.292969 v 8.585938 c 0 0.550781 0.445313 1 1 1 z m 0 0"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -1,3 +0,0 @@
|
|||||||
SPDX-FileCopyrightText: Icon Development Kit
|
|
||||||
|
|
||||||
SPDX-License-Identifier: CC0-1.0
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2017 Florian Müllner <fmuellner@gnome.org>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
extension_data += configure_file(
|
|
||||||
input: metadata_name + '.in',
|
|
||||||
output: metadata_name,
|
|
||||||
configuration: metadata_conf
|
|
||||||
)
|
|
||||||
|
|
||||||
extension_data += files('stylesheet.css')
|
|
||||||
extension_schemas += files('schemas/' + metadata_conf.get('gschemaname') + '.gschema.xml')
|
|
||||||
|
|
||||||
install_subdir('icons', install_dir: join_paths(extensiondir, uuid))
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"extension-id": "@extension_id@",
|
|
||||||
"uuid": "@uuid@",
|
|
||||||
"settings-schema": "@gschemaname@",
|
|
||||||
"gettext-domain": "@gettext_domain@",
|
|
||||||
"name": "System Monitor",
|
|
||||||
"description": "Monitor system from the top bar",
|
|
||||||
"shell-version": [ "@shell_current@" ],
|
|
||||||
"url": "@url@"
|
|
||||||
}
|
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
<!--
|
|
||||||
SPDX-FileCopyrightText: 2023 Florian Müllner <fmuellner@gnome.org>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
-->
|
|
||||||
|
|
||||||
<schemalist gettext-domain="gnome-shell-extensions">
|
|
||||||
<schema id="org.gnome.shell.extensions.system-monitor"
|
|
||||||
path="/org/gnome/shell/extensions/system-monitor/">
|
|
||||||
<key name="show-cpu" type="b">
|
|
||||||
<default>true</default>
|
|
||||||
<summary>Show CPU usage</summary>
|
|
||||||
</key>
|
|
||||||
<key name="show-memory" type="b">
|
|
||||||
<default>true</default>
|
|
||||||
<summary>Show memory usage</summary>
|
|
||||||
</key>
|
|
||||||
<key name="show-swap" type="b">
|
|
||||||
<default>true</default>
|
|
||||||
<summary>Show swap usage</summary>
|
|
||||||
</key>
|
|
||||||
<key name="show-upload" type="b">
|
|
||||||
<default>true</default>
|
|
||||||
<summary>Show upload</summary>
|
|
||||||
</key>
|
|
||||||
<key name="show-download" type="b">
|
|
||||||
<default>true</default>
|
|
||||||
<summary>Show download</summary>
|
|
||||||
</key>
|
|
||||||
</schema>
|
|
||||||
</schemalist>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2023 Florian Müllner <fmuellner@gnome.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
.system-monitor-stat-section {
|
|
||||||
padding: 0 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.system-monitor-stat-section-icon {icon-size: 1.08em;}
|
|
||||||
.system-monitor-stat-section-label {
|
|
||||||
min-width: 3.0em;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
.system-monitor-placeholder {-st-icon-style: symbolic;}
|
|
||||||
|
|
||||||
.panel-button .high-usage {color: #ff7800;}
|
|
||||||
@@ -17,8 +17,10 @@ import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/ex
|
|||||||
|
|
||||||
import * as DND from 'resource:///org/gnome/shell/ui/dnd.js';
|
import * as DND from 'resource:///org/gnome/shell/ui/dnd.js';
|
||||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||||
|
import * as Overview from 'resource:///org/gnome/shell/ui/overview.js';
|
||||||
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
||||||
|
|
||||||
|
import {WindowPicker, WindowPickerToggle} from './windowPicker.js';
|
||||||
import {WorkspaceIndicator} from './workspaceIndicator.js';
|
import {WorkspaceIndicator} from './workspaceIndicator.js';
|
||||||
|
|
||||||
const ICON_TEXTURE_SIZE = 24;
|
const ICON_TEXTURE_SIZE = 24;
|
||||||
@@ -121,10 +123,10 @@ class WindowTitle extends St.BoxLayout {
|
|||||||
this._metaWindow = metaWindow;
|
this._metaWindow = metaWindow;
|
||||||
|
|
||||||
this._icon = new St.Bin({style_class: 'window-button-icon'});
|
this._icon = new St.Bin({style_class: 'window-button-icon'});
|
||||||
this.add_child(this._icon);
|
this.add(this._icon);
|
||||||
this.label_actor = new St.Label({y_align: Clutter.ActorAlign.CENTER});
|
this.label_actor = new St.Label({y_align: Clutter.ActorAlign.CENTER});
|
||||||
this.label_actor.clutter_text.single_line_mode = true;
|
this.label_actor.clutter_text.single_line_mode = true;
|
||||||
this.add_child(this.label_actor);
|
this.add(this.label_actor);
|
||||||
|
|
||||||
this._textureCache = St.TextureCache.get_default();
|
this._textureCache = St.TextureCache.get_default();
|
||||||
this._textureCache.connectObject('icon-theme-changed',
|
this._textureCache.connectObject('icon-theme-changed',
|
||||||
@@ -410,7 +412,7 @@ class WindowButton extends BaseButton {
|
|||||||
this._onMenuStateChanged.bind(this));
|
this._onMenuStateChanged.bind(this));
|
||||||
this._contextMenu.actor.hide();
|
this._contextMenu.actor.hide();
|
||||||
this._contextMenuManager.addMenu(this._contextMenu);
|
this._contextMenuManager.addMenu(this._contextMenu);
|
||||||
Main.uiGroup.add_child(this._contextMenu.actor);
|
Main.uiGroup.add_actor(this._contextMenu.actor);
|
||||||
|
|
||||||
global.display.connectObject('notify::focus-window',
|
global.display.connectObject('notify::focus-window',
|
||||||
() => this._updateStyle(), this);
|
() => this._updateStyle(), this);
|
||||||
@@ -536,25 +538,25 @@ class AppButton extends BaseButton {
|
|||||||
this._singleWindowTitle = new St.Bin({
|
this._singleWindowTitle = new St.Bin({
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
});
|
});
|
||||||
stack.add_child(this._singleWindowTitle);
|
stack.add_actor(this._singleWindowTitle);
|
||||||
|
|
||||||
this._multiWindowTitle = new St.BoxLayout({
|
this._multiWindowTitle = new St.BoxLayout({
|
||||||
style_class: 'window-button-box',
|
style_class: 'window-button-box',
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
});
|
});
|
||||||
stack.add_child(this._multiWindowTitle);
|
stack.add_actor(this._multiWindowTitle);
|
||||||
|
|
||||||
this._icon = new St.Bin({
|
this._icon = new St.Bin({
|
||||||
style_class: 'window-button-icon',
|
style_class: 'window-button-icon',
|
||||||
child: app.create_icon_texture(ICON_TEXTURE_SIZE),
|
child: app.create_icon_texture(ICON_TEXTURE_SIZE),
|
||||||
});
|
});
|
||||||
this._multiWindowTitle.add_child(this._icon);
|
this._multiWindowTitle.add(this._icon);
|
||||||
|
|
||||||
let label = new St.Label({
|
let label = new St.Label({
|
||||||
text: app.get_name(),
|
text: app.get_name(),
|
||||||
y_align: Clutter.ActorAlign.CENTER,
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
});
|
});
|
||||||
this._multiWindowTitle.add_child(label);
|
this._multiWindowTitle.add(label);
|
||||||
this._multiWindowTitle.label_actor = label;
|
this._multiWindowTitle.label_actor = label;
|
||||||
|
|
||||||
this._menuManager = new PopupMenu.PopupMenuManager(this);
|
this._menuManager = new PopupMenu.PopupMenuManager(this);
|
||||||
@@ -564,13 +566,13 @@ class AppButton extends BaseButton {
|
|||||||
this._menu.actor.hide();
|
this._menu.actor.hide();
|
||||||
this._menu.connect('activate', this._onMenuActivate.bind(this));
|
this._menu.connect('activate', this._onMenuActivate.bind(this));
|
||||||
this._menuManager.addMenu(this._menu);
|
this._menuManager.addMenu(this._menu);
|
||||||
Main.uiGroup.add_child(this._menu.actor);
|
Main.uiGroup.add_actor(this._menu.actor);
|
||||||
|
|
||||||
this._appContextMenu = new AppContextMenu(this);
|
this._appContextMenu = new AppContextMenu(this);
|
||||||
this._appContextMenu.connect('open-state-changed',
|
this._appContextMenu.connect('open-state-changed',
|
||||||
this._onMenuStateChanged.bind(this));
|
this._onMenuStateChanged.bind(this));
|
||||||
this._appContextMenu.actor.hide();
|
this._appContextMenu.actor.hide();
|
||||||
Main.uiGroup.add_child(this._appContextMenu.actor);
|
Main.uiGroup.add_actor(this._appContextMenu.actor);
|
||||||
|
|
||||||
this._textureCache = St.TextureCache.get_default();
|
this._textureCache = St.TextureCache.get_default();
|
||||||
this._textureCache.connectObject('icon-theme-changed', () => {
|
this._textureCache.connectObject('icon-theme-changed', () => {
|
||||||
@@ -635,7 +637,7 @@ class AppButton extends BaseButton {
|
|||||||
this._windowContextMenu = new WindowContextMenu(this, this.metaWindow);
|
this._windowContextMenu = new WindowContextMenu(this, this.metaWindow);
|
||||||
this._windowContextMenu.connect(
|
this._windowContextMenu.connect(
|
||||||
'open-state-changed', this._onMenuStateChanged.bind(this));
|
'open-state-changed', this._onMenuStateChanged.bind(this));
|
||||||
Main.uiGroup.add_child(this._windowContextMenu.actor);
|
Main.uiGroup.add_actor(this._windowContextMenu.actor);
|
||||||
this._windowContextMenu.actor.hide();
|
this._windowContextMenu.actor.hide();
|
||||||
this._contextMenuManager.addMenu(this._windowContextMenu);
|
this._contextMenuManager.addMenu(this._windowContextMenu);
|
||||||
}
|
}
|
||||||
@@ -680,7 +682,7 @@ class AppButton extends BaseButton {
|
|||||||
for (let i = 0; i < windows.length; i++) {
|
for (let i = 0; i < windows.length; i++) {
|
||||||
let windowTitle = new WindowTitle(windows[i]);
|
let windowTitle = new WindowTitle(windows[i]);
|
||||||
let item = new PopupMenu.PopupBaseMenuItem();
|
let item = new PopupMenu.PopupBaseMenuItem();
|
||||||
item.add_child(windowTitle);
|
item.add_actor(windowTitle);
|
||||||
item._window = windows[i];
|
item._window = windows[i];
|
||||||
this._menu.addMenuItem(item);
|
this._menu.addMenuItem(item);
|
||||||
}
|
}
|
||||||
@@ -726,7 +728,13 @@ class WindowList extends St.Widget {
|
|||||||
this._monitor = monitor;
|
this._monitor = monitor;
|
||||||
|
|
||||||
let box = new St.BoxLayout({x_expand: true, y_expand: true});
|
let box = new St.BoxLayout({x_expand: true, y_expand: true});
|
||||||
this.add_child(box);
|
this.add_actor(box);
|
||||||
|
|
||||||
|
let toggle = new WindowPickerToggle();
|
||||||
|
box.add_actor(toggle);
|
||||||
|
|
||||||
|
toggle.connect('notify::checked',
|
||||||
|
this._updateWindowListVisibility.bind(this));
|
||||||
|
|
||||||
let layout = new Clutter.BoxLayout({homogeneous: true});
|
let layout = new Clutter.BoxLayout({homogeneous: true});
|
||||||
this._windowList = new St.Widget({
|
this._windowList = new St.Widget({
|
||||||
@@ -747,7 +755,7 @@ class WindowList extends St.Widget {
|
|||||||
this._windowList.connect('scroll-event', this._onScrollEvent.bind(this));
|
this._windowList.connect('scroll-event', this._onScrollEvent.bind(this));
|
||||||
|
|
||||||
let indicatorsBox = new St.BoxLayout({x_align: Clutter.ActorAlign.END});
|
let indicatorsBox = new St.BoxLayout({x_align: Clutter.ActorAlign.END});
|
||||||
box.add_child(indicatorsBox);
|
box.add(indicatorsBox);
|
||||||
|
|
||||||
this._workspaceIndicator = new WorkspaceIndicator();
|
this._workspaceIndicator = new WorkspaceIndicator();
|
||||||
indicatorsBox.add_child(this._workspaceIndicator.container);
|
indicatorsBox.add_child(this._workspaceIndicator.container);
|
||||||
@@ -875,6 +883,20 @@ class WindowList extends St.Widget {
|
|||||||
this._workspaceIndicator.visible = hasWorkspaces && workspacesOnMonitor;
|
this._workspaceIndicator.visible = hasWorkspaces && workspacesOnMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_updateWindowListVisibility() {
|
||||||
|
const {windowPicker} = Extension.lookupByURL(import.meta.url);
|
||||||
|
const visible = !windowPicker.visible;
|
||||||
|
|
||||||
|
this._windowList.ease({
|
||||||
|
opacity: visible ? 255 : 0,
|
||||||
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
|
duration: Overview.ANIMATION_TIME,
|
||||||
|
});
|
||||||
|
|
||||||
|
this._windowList.reactive = visible;
|
||||||
|
this._windowList.get_children().forEach(c => (c.reactive = visible));
|
||||||
|
}
|
||||||
|
|
||||||
_getPreferredUngroupedWindowListWidth() {
|
_getPreferredUngroupedWindowListWidth() {
|
||||||
if (this._windowList.get_n_children() === 0)
|
if (this._windowList.get_n_children() === 0)
|
||||||
return this._windowList.get_preferred_width(-1)[1];
|
return this._windowList.get_preferred_width(-1)[1];
|
||||||
@@ -1084,6 +1106,7 @@ export default class WindowListExtension extends Extension {
|
|||||||
super(metadata);
|
super(metadata);
|
||||||
|
|
||||||
this._windowLists = null;
|
this._windowLists = null;
|
||||||
|
this._hideOverviewOrig = Main.overview.hide;
|
||||||
}
|
}
|
||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
@@ -1096,6 +1119,13 @@ export default class WindowListExtension extends Extension {
|
|||||||
Main.layoutManager.connectObject('monitors-changed',
|
Main.layoutManager.connectObject('monitors-changed',
|
||||||
() => this._buildWindowLists(), this);
|
() => this._buildWindowLists(), this);
|
||||||
|
|
||||||
|
this.windowPicker = new WindowPicker();
|
||||||
|
|
||||||
|
Main.overview.hide = () => {
|
||||||
|
this.windowPicker.close();
|
||||||
|
this._hideOverviewOrig.call(Main.overview);
|
||||||
|
};
|
||||||
|
|
||||||
this._buildWindowLists();
|
this._buildWindowLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1124,6 +1154,11 @@ export default class WindowListExtension extends Extension {
|
|||||||
windowList.destroy();
|
windowList.destroy();
|
||||||
});
|
});
|
||||||
this._windowLists = null;
|
this._windowLists = null;
|
||||||
|
|
||||||
|
this.windowPicker.destroy();
|
||||||
|
delete this.windowPicker;
|
||||||
|
|
||||||
|
Main.overview.hide = this._hideOverviewOrig;
|
||||||
}
|
}
|
||||||
|
|
||||||
someWindowListContains(actor) {
|
someWindowListContains(actor) {
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ extension_data += files(
|
|||||||
'stylesheet-light.css'
|
'stylesheet-light.css'
|
||||||
)
|
)
|
||||||
|
|
||||||
extension_sources += files('prefs.js', 'workspaceIndicator.js')
|
extension_sources += files('prefs.js', 'windowPicker.js', 'workspaceIndicator.js')
|
||||||
extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
|
extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
spacing: 4px;
|
spacing: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.window-button > StWidget {
|
.window-button > StWidget,
|
||||||
|
.window-picker-toggle > StWidget {
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
background-color: #1d1d1d;
|
background-color: #1d1d1d;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@@ -45,7 +46,8 @@
|
|||||||
max-width: 18.75em;
|
max-width: 18.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.window-button:hover > StWidget {
|
.window-button:hover > StWidget,
|
||||||
|
.window-picker-toggle:hover > StWidget {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #303030;
|
background-color: #303030;
|
||||||
}
|
}
|
||||||
@@ -56,12 +58,14 @@
|
|||||||
background-color: #3f3f3f;
|
background-color: #3f3f3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
.window-button.focused > StWidget {
|
.window-button.focused > StWidget,
|
||||||
|
.window-picker-toggle:checked > StWidget {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #3f3f3f;
|
background-color: #3f3f3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
.window-button.focused:active > StWidget {
|
.window-button.focused:active > StWidget,
|
||||||
|
.window-picker-toggle:checked:active > StWidget {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #3f3f3f;
|
background-color: #3f3f3f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
height: 2.5em;
|
height: 2.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-panel .window-button > StWidget {
|
.bottom-panel .window-button > StWidget,
|
||||||
|
.bottom-panel .window-picker-toggle > StWidget {
|
||||||
color: #2e3436;
|
color: #2e3436;
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
@@ -28,7 +29,8 @@
|
|||||||
max-width: 18.75em;
|
max-width: 18.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-panel .window-button:hover > StWidget {
|
.bottom-panel .window-button:hover > StWidget,
|
||||||
|
.bottom-panel .window-picker-toggle:hover > StWidget {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +39,8 @@
|
|||||||
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
|
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-panel .window-button.focused > StWidget {
|
.bottom-panel .window-button.focused > StWidget,
|
||||||
|
.bottom-panel .window-picker-toggle:checked > StWidget {
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
|
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,342 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2019 Florian Müllner <fmuellner@gnome.org>
|
||||||
|
// SPDX-FileCopyrightText: 2019 Marco Trevisan (Treviño) <mail@3v1n0.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
import Clutter from 'gi://Clutter';
|
||||||
|
import GObject from 'gi://GObject';
|
||||||
|
import Shell from 'gi://Shell';
|
||||||
|
import St from 'gi://St';
|
||||||
|
|
||||||
|
import {Extension, InjectionManager} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||||
|
import * as Layout from 'resource:///org/gnome/shell/ui/layout.js';
|
||||||
|
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||||
|
import {WorkspacesDisplay} from 'resource:///org/gnome/shell/ui/workspacesView.js';
|
||||||
|
import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js';
|
||||||
|
|
||||||
|
import {VIGNETTE_BRIGHTNESS} from 'resource:///org/gnome/shell/ui/lightbox.js';
|
||||||
|
import {
|
||||||
|
SIDE_CONTROLS_ANIMATION_TIME,
|
||||||
|
OverviewAdjustment,
|
||||||
|
ControlsState
|
||||||
|
} from 'resource:///org/gnome/shell/ui/overviewControls.js';
|
||||||
|
|
||||||
|
class MyWorkspacesDisplay extends WorkspacesDisplay {
|
||||||
|
static {
|
||||||
|
GObject.registerClass(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(controls, overviewAdjustment) {
|
||||||
|
let workspaceManager = global.workspace_manager;
|
||||||
|
|
||||||
|
const workspaceAdjustment = new St.Adjustment({
|
||||||
|
value: workspaceManager.get_active_workspace_index(),
|
||||||
|
lower: 0,
|
||||||
|
page_increment: 1,
|
||||||
|
page_size: 1,
|
||||||
|
step_increment: 0,
|
||||||
|
upper: workspaceManager.n_workspaces,
|
||||||
|
});
|
||||||
|
|
||||||
|
super(controls, workspaceAdjustment, overviewAdjustment);
|
||||||
|
|
||||||
|
this._windowPicker = controls;
|
||||||
|
|
||||||
|
this._workspaceAdjustment = workspaceAdjustment;
|
||||||
|
this._workspaceAdjustment.actor = this;
|
||||||
|
|
||||||
|
workspaceManager.connectObject('notify::n-workspaces',
|
||||||
|
() => this._updateAdjustment(), this);
|
||||||
|
|
||||||
|
this.add_constraint(
|
||||||
|
new Layout.MonitorConstraint({
|
||||||
|
primary: true,
|
||||||
|
work_area: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareToEnterOverview(...args) {
|
||||||
|
if (!this._scrollEventId) {
|
||||||
|
this._scrollEventId = this._windowPicker.connect('scroll-event',
|
||||||
|
this._onScrollEvent.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
super.prepareToEnterOverview(...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
vfunc_hide(...args) {
|
||||||
|
if (this._scrollEventId > 0)
|
||||||
|
this._windowPicker.disconnect(this._scrollEventId);
|
||||||
|
this._scrollEventId = 0;
|
||||||
|
|
||||||
|
super.vfunc_hide(...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateAdjustment() {
|
||||||
|
let workspaceManager = global.workspace_manager;
|
||||||
|
this._workspaceAdjustment.set({
|
||||||
|
upper: workspaceManager.n_workspaces,
|
||||||
|
value: workspaceManager.get_active_workspace_index(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class WindowPicker extends Clutter.Actor {
|
||||||
|
static [GObject.signals] = {
|
||||||
|
'open-state-changed': {param_types: [GObject.TYPE_BOOLEAN]},
|
||||||
|
};
|
||||||
|
|
||||||
|
static {
|
||||||
|
GObject.registerClass(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super({reactive: true});
|
||||||
|
|
||||||
|
this._visible = false;
|
||||||
|
this._modal = false;
|
||||||
|
|
||||||
|
this._stageKeyPressId = 0;
|
||||||
|
|
||||||
|
this._adjustment = new OverviewAdjustment(this);
|
||||||
|
|
||||||
|
this._injectionManager = new InjectionManager();
|
||||||
|
this.connect('destroy', this._onDestroy.bind(this));
|
||||||
|
|
||||||
|
global.bind_property('screen-width',
|
||||||
|
this, 'width',
|
||||||
|
GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
global.bind_property('screen-height',
|
||||||
|
this, 'height',
|
||||||
|
GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
|
||||||
|
this._workspacesDisplay = new MyWorkspacesDisplay(this, this._adjustment);
|
||||||
|
this.add_child(this._workspacesDisplay);
|
||||||
|
|
||||||
|
Main.uiGroup.insert_child_below(this, global.window_group);
|
||||||
|
|
||||||
|
if (!Main.sessionMode.hasOverview) {
|
||||||
|
this._injectBackgroundShade();
|
||||||
|
|
||||||
|
global.display.connectObject('overlay-key', () => {
|
||||||
|
if (!this._visible)
|
||||||
|
this.open();
|
||||||
|
else
|
||||||
|
this.close();
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_injectBackgroundShade() {
|
||||||
|
const backgroundProto = Workspace.WorkspaceBackground.prototype;
|
||||||
|
this._injectionManager.overrideMethod(backgroundProto, '_updateBorderRadius',
|
||||||
|
() => {
|
||||||
|
return function () {};
|
||||||
|
});
|
||||||
|
this._injectionManager.overrideMethod(backgroundProto, 'vfunc_allocate',
|
||||||
|
() => {
|
||||||
|
/* eslint-disable no-invalid-this */
|
||||||
|
return function (box) {
|
||||||
|
this.set_allocation(box);
|
||||||
|
|
||||||
|
const themeNode = this.get_theme_node();
|
||||||
|
const contentBox = themeNode.get_content_box(box);
|
||||||
|
|
||||||
|
this._bin.allocate(contentBox);
|
||||||
|
|
||||||
|
const [contentWidth, contentHeight] = contentBox.get_size();
|
||||||
|
const monitor = Main.layoutManager.monitors[this._monitorIndex];
|
||||||
|
const xRatio = contentWidth / this._workarea.width;
|
||||||
|
const yRatio = contentHeight / this._workarea.height;
|
||||||
|
|
||||||
|
const right = area => area.x + area.width;
|
||||||
|
const bottom = area => area.y + area.height;
|
||||||
|
|
||||||
|
const offsets = {
|
||||||
|
left: xRatio * (this._workarea.x - monitor.x),
|
||||||
|
right: xRatio * (right(monitor) - right(this._workarea)),
|
||||||
|
top: yRatio * (this._workarea.y - monitor.y),
|
||||||
|
bottom: yRatio * (bottom(monitor) - bottom(this._workarea)),
|
||||||
|
};
|
||||||
|
|
||||||
|
contentBox.set_origin(-offsets.left, -offsets.top);
|
||||||
|
contentBox.set_size(
|
||||||
|
offsets.left + contentWidth + offsets.right,
|
||||||
|
offsets.top + contentHeight + offsets.bottom);
|
||||||
|
this._backgroundGroup.allocate(contentBox);
|
||||||
|
};
|
||||||
|
/* eslint-enable */
|
||||||
|
});
|
||||||
|
this._injectionManager.overrideMethod(backgroundProto, 'vfunc_parent_set',
|
||||||
|
() => {
|
||||||
|
/* eslint-disable no-invalid-this */
|
||||||
|
return function () {
|
||||||
|
setTimeout(() => {
|
||||||
|
const parent = this.get_parent();
|
||||||
|
if (!parent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
parent._overviewAdjustment.connectObject('notify::value', () => {
|
||||||
|
const {value: progress} = parent._overviewAdjustment;
|
||||||
|
const brightness = 1 - (1 - VIGNETTE_BRIGHTNESS) * progress;
|
||||||
|
for (const bg of this._backgroundGroup ?? []) {
|
||||||
|
bg.content.set({
|
||||||
|
vignette: true,
|
||||||
|
brightness,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/* eslint-enable */
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get visible() {
|
||||||
|
return this._visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
open() {
|
||||||
|
if (this._visible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._visible = true;
|
||||||
|
|
||||||
|
if (!this._syncGrab())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._fakeOverviewVisible(true);
|
||||||
|
this._workspacesDisplay.prepareToEnterOverview();
|
||||||
|
Main.overview._animationInProgress = true;
|
||||||
|
|
||||||
|
this._adjustment.value = ControlsState.HIDDEN;
|
||||||
|
this._adjustment.ease(ControlsState.WINDOW_PICKER, {
|
||||||
|
duration: SIDE_CONTROLS_ANIMATION_TIME,
|
||||||
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
|
onComplete: () => (Main.overview._animationInProgress = false),
|
||||||
|
});
|
||||||
|
|
||||||
|
this._stageKeyPressId = global.stage.connect('key-press-event',
|
||||||
|
(a, event) => {
|
||||||
|
let sym = event.get_key_symbol();
|
||||||
|
if (sym === Clutter.KEY_Escape) {
|
||||||
|
this.close();
|
||||||
|
return Clutter.EVENT_STOP;
|
||||||
|
}
|
||||||
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.emit('open-state-changed', this._visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
if (!this._visible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._visible = false;
|
||||||
|
|
||||||
|
if (!this._syncGrab())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._workspacesDisplay.prepareToLeaveOverview();
|
||||||
|
|
||||||
|
Main.overview._animationInProgress = true;
|
||||||
|
this._adjustment.ease(ControlsState.HIDDEN, {
|
||||||
|
duration: SIDE_CONTROLS_ANIMATION_TIME,
|
||||||
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
|
onComplete: () => {
|
||||||
|
Main.overview._animationInProgress = false;
|
||||||
|
this._workspacesDisplay.hide();
|
||||||
|
this._fakeOverviewVisible(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
global.stage.disconnect(this._stageKeyPressId);
|
||||||
|
this._stageKeyPressId = 0;
|
||||||
|
|
||||||
|
this.emit('open-state-changed', this._visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
getWorkspacesBoxForState() {
|
||||||
|
return this.allocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
_fakeOverviewVisible(visible) {
|
||||||
|
// Fake overview state for WorkspacesDisplay
|
||||||
|
Main.overview._visible = visible;
|
||||||
|
|
||||||
|
// Hide real windows
|
||||||
|
Main.layoutManager._inOverview = visible;
|
||||||
|
Main.layoutManager._updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
_syncGrab() {
|
||||||
|
if (this._visible) {
|
||||||
|
if (this._modal)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
const grab = Main.pushModal(global.stage, {
|
||||||
|
actionMode: Shell.ActionMode.OVERVIEW,
|
||||||
|
});
|
||||||
|
if (grab.get_seat_state() !== Clutter.GrabState.NONE) {
|
||||||
|
this._grab = grab;
|
||||||
|
this._modal = true;
|
||||||
|
} else {
|
||||||
|
Main.popModal(grab);
|
||||||
|
this.hide();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (this._modal) {
|
||||||
|
Main.popModal(this._grab);
|
||||||
|
this._modal = false;
|
||||||
|
this._grab = null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_onDestroy() {
|
||||||
|
this._injectionManager.clear();
|
||||||
|
|
||||||
|
if (this._stageKeyPressId)
|
||||||
|
global.stage.disconnect(this._stageKeyPressId);
|
||||||
|
this._stageKeyPressId = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class WindowPickerToggle extends St.Button {
|
||||||
|
static {
|
||||||
|
GObject.registerClass(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
let iconBin = new St.Widget({
|
||||||
|
layout_manager: new Clutter.BinLayout(),
|
||||||
|
});
|
||||||
|
iconBin.add_child(new St.Icon({
|
||||||
|
icon_name: 'focus-windows-symbolic',
|
||||||
|
icon_size: 16,
|
||||||
|
x_expand: true,
|
||||||
|
y_expand: true,
|
||||||
|
x_align: Clutter.ActorAlign.CENTER,
|
||||||
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
|
}));
|
||||||
|
super({
|
||||||
|
style_class: 'window-picker-toggle',
|
||||||
|
child: iconBin,
|
||||||
|
visible: !Main.sessionMode.hasOverview,
|
||||||
|
toggle_mode: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const {windowPicker} = Extension.lookupByURL(import.meta.url);
|
||||||
|
this.connect('notify::checked', () => {
|
||||||
|
if (this.checked)
|
||||||
|
windowPicker.open();
|
||||||
|
else
|
||||||
|
windowPicker.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
windowPicker.connect('open-state-changed', () => {
|
||||||
|
this.checked = windowPicker.visible;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -261,7 +261,7 @@ export class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
x_expand: true,
|
x_expand: true,
|
||||||
y_expand: true,
|
y_expand: true,
|
||||||
});
|
});
|
||||||
this.add_child(container);
|
this.add_actor(container);
|
||||||
|
|
||||||
let workspaceManager = global.workspace_manager;
|
let workspaceManager = global.workspace_manager;
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ export class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
y_expand: true,
|
y_expand: true,
|
||||||
child: this._statusLabel,
|
child: this._statusLabel,
|
||||||
});
|
});
|
||||||
container.add_child(this._statusBin);
|
container.add_actor(this._statusBin);
|
||||||
|
|
||||||
this._thumbnailsBox = new St.BoxLayout({
|
this._thumbnailsBox = new St.BoxLayout({
|
||||||
style_class: 'workspaces-box',
|
style_class: 'workspaces-box',
|
||||||
@@ -283,7 +283,7 @@ export class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
});
|
});
|
||||||
this._thumbnailsBox.connect('scroll-event',
|
this._thumbnailsBox.connect('scroll-event',
|
||||||
this._onScrollEvent.bind(this));
|
this._onScrollEvent.bind(this));
|
||||||
container.add_child(this._thumbnailsBox);
|
container.add_actor(this._thumbnailsBox);
|
||||||
|
|
||||||
this._workspacesItems = [];
|
this._workspacesItems = [];
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ export class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
|
|
||||||
for (let i = 0; i < workspaceManager.n_workspaces; i++) {
|
for (let i = 0; i < workspaceManager.n_workspaces; i++) {
|
||||||
let thumb = new WorkspaceThumbnail(i);
|
let thumb = new WorkspaceThumbnail(i);
|
||||||
this._thumbnailsBox.add_child(thumb);
|
this._thumbnailsBox.add_actor(thumb);
|
||||||
}
|
}
|
||||||
this._updateActiveThumbnail();
|
this._updateActiveThumbnail();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default class Extension {
|
|||||||
style_class: 'extension-windowsNavigator-window-tooltip',
|
style_class: 'extension-windowsNavigator-window-tooltip',
|
||||||
visible: false,
|
visible: false,
|
||||||
});
|
});
|
||||||
this.add_child(this._tip);
|
this.add_actor(this._tip);
|
||||||
|
|
||||||
this.connect('notify::scale-x', () => {
|
this.connect('notify::scale-x', () => {
|
||||||
this._tip.set_scale(1 / this.scale_x, 1 / this.scale_x);
|
this._tip.set_scale(1 / this.scale_x, 1 / this.scale_x);
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
x_expand: true,
|
x_expand: true,
|
||||||
y_expand: true,
|
y_expand: true,
|
||||||
});
|
});
|
||||||
this.add_child(container);
|
this.add_actor(container);
|
||||||
|
|
||||||
let workspaceManager = global.workspace_manager;
|
let workspaceManager = global.workspace_manager;
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
text: this._labelText(),
|
text: this._labelText(),
|
||||||
});
|
});
|
||||||
|
|
||||||
container.add_child(this._statusLabel);
|
container.add_actor(this._statusLabel);
|
||||||
|
|
||||||
this._thumbnailsBox = new St.BoxLayout({
|
this._thumbnailsBox = new St.BoxLayout({
|
||||||
style_class: 'panel-workspace-indicator-box',
|
style_class: 'panel-workspace-indicator-box',
|
||||||
@@ -282,7 +282,7 @@ class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
reactive: true,
|
reactive: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
container.add_child(this._thumbnailsBox);
|
container.add_actor(this._thumbnailsBox);
|
||||||
|
|
||||||
this._workspacesItems = [];
|
this._workspacesItems = [];
|
||||||
this._workspaceSection = new PopupMenu.PopupMenuSection();
|
this._workspaceSection = new PopupMenu.PopupMenuSection();
|
||||||
@@ -405,7 +405,7 @@ class WorkspaceIndicator extends PanelMenu.Button {
|
|||||||
|
|
||||||
for (let i = 0; i < workspaceManager.n_workspaces; i++) {
|
for (let i = 0; i < workspaceManager.n_workspaces; i++) {
|
||||||
let thumb = new WorkspaceThumbnail(i);
|
let thumb = new WorkspaceThumbnail(i);
|
||||||
this._thumbnailsBox.add_child(thumb);
|
this._thumbnailsBox.add_actor(thumb);
|
||||||
}
|
}
|
||||||
this._updateActiveThumbnail();
|
this._updateActiveThumbnail();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -3,7 +3,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
project('gnome-shell-extensions',
|
project('gnome-shell-extensions',
|
||||||
version: '46.alpha',
|
version: '45.2',
|
||||||
meson_version: '>= 0.58.0',
|
meson_version: '>= 0.58.0',
|
||||||
license: 'GPL2+'
|
license: 'GPL2+'
|
||||||
)
|
)
|
||||||
@@ -42,7 +42,6 @@ default_extensions += [
|
|||||||
'drive-menu',
|
'drive-menu',
|
||||||
'light-style',
|
'light-style',
|
||||||
'screenshot-window-sizer',
|
'screenshot-window-sizer',
|
||||||
'system-monitor',
|
|
||||||
'windowsNavigator',
|
'windowsNavigator',
|
||||||
'workspace-indicator'
|
'workspace-indicator'
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user