Replace window realm frame decorations with nicer label decorations

This commit is contained in:
2024-05-06 18:25:56 -04:00
parent c5277c949a
commit 1ee48a7649
16 changed files with 517 additions and 792 deletions

View File

@ -1,7 +1,7 @@
import GObject from 'gi://GObject';
import Shell from 'gi://Shell';
import * as PopupMenu from '../popupMenu.js';
import * as Main from '../main.js';
function _windowAppId(window) {
const tracker = Shell.WindowTracker.get_default();
@ -79,22 +79,20 @@ function windowContextRealmName(window) {
}
}
export function enableFrameItem(window) {
const realms = Shell.Realms.get_default();
const frames = realms.window_frames();
if (!frames.has_frame(window)) {
export function enableLabelItem(window) {
const labelManager = Main.realmManager.labelManager;
if (!labelManager.windowNeedsLabel(window)) {
return null;
}
let enabled = frames.is_frame_enabled(window);
let item = new PopupMenu.PopupMenuItem("Display colored window frame");
let enabled = labelManager.getWindowLabelEnabled(window);
let item = new PopupMenu.PopupMenuItem("Display realm label on window");
if (enabled) {
item.setOrnament(PopupMenu.Ornament.CHECK);
}
item.connect('activate', () => {
let realms = Shell.Realms.get_default();
const frames = realms.window_frames();
frames.set_frame_enabled(window, !enabled);
Main.realmManager.labelManager.setWindowLabelEnabled(window, !enabled);
});
return item;