even more deltarune
This commit is contained in:
@@ -17,9 +17,9 @@ PanelWindow {
|
||||
right: theme.panelMarginRight
|
||||
}
|
||||
|
||||
// Top layer keeps notifications above normal windows while still usually
|
||||
// below fullscreen overlays. Overlay would be too aggressive here.
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
// Match the media status overlay behavior so notifications stay visible
|
||||
// even when an app is fullscreen.
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.focusable: false
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
WlrLayershell.namespace: "deltarune-quickshell-notifications"
|
||||
|
||||
@@ -2,6 +2,7 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Mpris
|
||||
import ".."
|
||||
|
||||
PanelWindow {
|
||||
id: overlay
|
||||
@@ -22,7 +23,8 @@ PanelWindow {
|
||||
|
||||
color: '#00ffffff'
|
||||
|
||||
visible: true
|
||||
readonly property bool overlayEnabled: Boolean(ShellStateManager.global("shell.mprisOverlayEnabled", true))
|
||||
visible: overlayEnabled
|
||||
|
||||
Repeater {
|
||||
model: Mpris.players
|
||||
|
||||
@@ -19,9 +19,16 @@ QtObject {
|
||||
property bool appUsageLoaded: false
|
||||
property var windowRequests: ({})
|
||||
property var quickSettingsPayload: ({})
|
||||
property var globals: ({
|
||||
"notifications.stackPreviewEnabled": true
|
||||
property var defaultGlobals: ({
|
||||
"notifications.stackPreviewEnabled": true,
|
||||
"shell.mprisOverlayEnabled": true
|
||||
})
|
||||
property var globals: Object.assign({}, defaultGlobals)
|
||||
property string globalsPath: {
|
||||
var homeDir = Quickshell.env("HOME");
|
||||
return homeDir ? homeDir + "/.local/share/deltarunequickshell/globals.json" : "";
|
||||
}
|
||||
property bool globalsLoaded: false
|
||||
|
||||
signal shellOpened
|
||||
signal shellClosed
|
||||
@@ -175,7 +182,17 @@ QtObject {
|
||||
appUsageFile.writeAdapter();
|
||||
}
|
||||
|
||||
function persistGlobals() {
|
||||
if (!globalsLoaded)
|
||||
return;
|
||||
if (!globalsFile || !globalsAdapter)
|
||||
return;
|
||||
globalsAdapter.values = globals || ({});
|
||||
globalsFile.writeAdapter();
|
||||
}
|
||||
|
||||
onAppUsageCountsChanged: persistAppUsage()
|
||||
onGlobalsChanged: persistGlobals()
|
||||
|
||||
property FileView appUsageFile: FileView {
|
||||
id: appUsageFile
|
||||
@@ -199,6 +216,28 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
property FileView globalsFile: FileView {
|
||||
id: globalsFile
|
||||
path: manager.globalsPath
|
||||
watchChanges: true
|
||||
onFileChanged: reload()
|
||||
onLoaded: {
|
||||
var loaded = globalsAdapter && globalsAdapter.values ? globalsAdapter.values : ({});
|
||||
manager.globals = Object.assign({}, manager.defaultGlobals, loaded);
|
||||
manager.globalsLoaded = true;
|
||||
}
|
||||
onLoadFailed: {
|
||||
manager.globals = Object.assign({}, manager.defaultGlobals);
|
||||
manager.globalsLoaded = true;
|
||||
manager.persistGlobals();
|
||||
}
|
||||
|
||||
JsonAdapter {
|
||||
id: globalsAdapter
|
||||
property var values: ({})
|
||||
}
|
||||
}
|
||||
|
||||
function setGlobal(key, value) {
|
||||
var updated = Object.assign({}, globals);
|
||||
updated[key] = value;
|
||||
@@ -206,7 +245,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function global(key, defaultValue) {
|
||||
return globals.hasOwnProperty(key) ? globals[key] : defaultValue;
|
||||
return Object.prototype.hasOwnProperty.call(globals, key) ? globals[key] : defaultValue;
|
||||
}
|
||||
|
||||
function notificationStackPreviewEnabled() {
|
||||
@@ -220,4 +259,16 @@ QtObject {
|
||||
function toggleNotificationStackPreviewEnabled() {
|
||||
setNotificationStackPreviewEnabled(!notificationStackPreviewEnabled());
|
||||
}
|
||||
|
||||
function mprisOverlayEnabled() {
|
||||
return Boolean(global("shell.mprisOverlayEnabled", true));
|
||||
}
|
||||
|
||||
function setMprisOverlayEnabled(enabled) {
|
||||
setGlobal("shell.mprisOverlayEnabled", Boolean(enabled));
|
||||
}
|
||||
|
||||
function toggleMprisOverlayEnabled() {
|
||||
setMprisOverlayEnabled(!mprisOverlayEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ Item {
|
||||
property int activeSelection: 0
|
||||
property bool inBluetoothMenu: false
|
||||
property bool inWallpaperMenu: false
|
||||
property bool inNotificationsMenu: false
|
||||
property bool inShellMenu: false
|
||||
property bool inPowerMenu: false
|
||||
property bool inPowerConfirm: false
|
||||
|
||||
@@ -84,7 +84,7 @@ Item {
|
||||
}
|
||||
|
||||
function currentAction() {
|
||||
if (root.inBluetoothMenu || root.inWallpaperMenu || root.inNotificationsMenu || root.inPowerMenu)
|
||||
if (root.inBluetoothMenu || root.inWallpaperMenu || root.inShellMenu || root.inPowerMenu)
|
||||
return null;
|
||||
return menuLength() > 0 ? menuAt(activeSelection) : null;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ Item {
|
||||
|
||||
property int bluetoothActionIndex: 1
|
||||
property int wallpaperActionIndex: 2
|
||||
property int notificationsActionIndex: 3
|
||||
property int shellActionIndex: 3
|
||||
property int powerActionIndex: 4
|
||||
property int pendingPowerActionIndex: 0
|
||||
property var pendingPowerCommand: []
|
||||
@@ -225,7 +225,7 @@ Item {
|
||||
ent: function () {
|
||||
root.inBluetoothMenu = true;
|
||||
root.inWallpaperMenu = false;
|
||||
root.inNotificationsMenu = false;
|
||||
root.inShellMenu = false;
|
||||
root.isSelected = false;
|
||||
root.activeSelection = 0;
|
||||
root.clampSelection();
|
||||
@@ -239,7 +239,7 @@ Item {
|
||||
ent: function () {
|
||||
root.inWallpaperMenu = true;
|
||||
root.inBluetoothMenu = false;
|
||||
root.inNotificationsMenu = false;
|
||||
root.inShellMenu = false;
|
||||
root.isSelected = false;
|
||||
var currentIndex = root.currentWallpaperIndex();
|
||||
root.activeSelection = currentIndex >= 0 ? currentIndex : 0;
|
||||
@@ -252,9 +252,9 @@ Item {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Notifications",
|
||||
name: "Shell",
|
||||
ent: function () {
|
||||
root.inNotificationsMenu = true;
|
||||
root.inShellMenu = true;
|
||||
root.inBluetoothMenu = false;
|
||||
root.inWallpaperMenu = false;
|
||||
root.inPowerMenu = false;
|
||||
@@ -274,7 +274,7 @@ Item {
|
||||
root.inPowerConfirm = false;
|
||||
root.inBluetoothMenu = false;
|
||||
root.inWallpaperMenu = false;
|
||||
root.inNotificationsMenu = false;
|
||||
root.inShellMenu = false;
|
||||
root.isSelected = false;
|
||||
root.activeSelection = 0;
|
||||
root.pendingPowerActionIndex = 0;
|
||||
@@ -315,7 +315,7 @@ Item {
|
||||
}
|
||||
]
|
||||
|
||||
property var notificationActions: [
|
||||
property var shellActions: [
|
||||
{
|
||||
name: "Stack Preview",
|
||||
ent: function () {
|
||||
@@ -327,10 +327,22 @@ Item {
|
||||
return "ON";
|
||||
return manager.notificationStackPreviewEnabled() ? "ON" : "OFF";
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Media Overlay",
|
||||
ent: function () {
|
||||
if (manager && manager.toggleMprisOverlayEnabled)
|
||||
manager.toggleMprisOverlayEnabled();
|
||||
},
|
||||
getState: function () {
|
||||
if (!manager || !manager.mprisOverlayEnabled)
|
||||
return "ON";
|
||||
return manager.mprisOverlayEnabled() ? "ON" : "OFF";
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
property var menuModel: root.inBluetoothMenu ? Bluetooth.devices : (root.inWallpaperMenu ? wallpaperFolderModel : (root.inNotificationsMenu ? notificationActions : (root.inPowerMenu ? (root.inPowerConfirm ? powerConfirmActions : powerActions) : actions)))
|
||||
property var menuModel: root.inBluetoothMenu ? Bluetooth.devices : (root.inWallpaperMenu ? wallpaperFolderModel : (root.inShellMenu ? shellActions : (root.inPowerMenu ? (root.inPowerConfirm ? powerConfirmActions : powerActions) : actions)))
|
||||
|
||||
FolderListModel {
|
||||
id: wallpaperFolderModel
|
||||
@@ -427,7 +439,7 @@ Item {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.inPowerConfirm ? "CONFIRM" : (root.inPowerMenu ? "POWER" : (root.inBluetoothMenu ? "BLUETOOTH" : (root.inWallpaperMenu ? "WALLPAPER" : (root.inNotificationsMenu ? "NOTIFICATIONS" : "CONFIG"))))
|
||||
text: root.inPowerConfirm ? "CONFIRM" : (root.inPowerMenu ? "POWER" : (root.inBluetoothMenu ? "BLUETOOTH" : (root.inWallpaperMenu ? "WALLPAPER" : (root.inShellMenu ? "SHELL" : "CONFIG"))))
|
||||
font.family: "8bitoperator JVE"
|
||||
font.pixelSize: 71
|
||||
renderType: Text.NativeRendering
|
||||
@@ -561,10 +573,10 @@ Item {
|
||||
const wallpaperPath = wallpaperPathAt(activeSelection);
|
||||
if (wallpaperPath && wallpaperPath.length > 0)
|
||||
root.applyWallpaper(wallpaperPath);
|
||||
} else if (root.inNotificationsMenu) {
|
||||
const notificationAction = menuAt(activeSelection);
|
||||
if (notificationAction && notificationAction.ent)
|
||||
notificationAction.ent();
|
||||
} else if (root.inShellMenu) {
|
||||
const shellAction = menuAt(activeSelection);
|
||||
if (shellAction && shellAction.ent)
|
||||
shellAction.ent();
|
||||
} else if (root.inPowerConfirm) {
|
||||
const confirmAction = menuAt(activeSelection);
|
||||
if (confirmAction && confirmAction.name === "Yes") {
|
||||
@@ -615,10 +627,10 @@ Item {
|
||||
root.pendingPowerCommand = [];
|
||||
root.activeSelection = root.powerActionIndex;
|
||||
root.clampSelection();
|
||||
} else if (root.inNotificationsMenu) {
|
||||
root.inNotificationsMenu = false;
|
||||
} else if (root.inShellMenu) {
|
||||
root.inShellMenu = false;
|
||||
root.isSelected = false;
|
||||
root.activeSelection = root.notificationsActionIndex;
|
||||
root.activeSelection = root.shellActionIndex;
|
||||
root.clampSelection();
|
||||
} else if (root.inBluetoothMenu) {
|
||||
root.inBluetoothMenu = false;
|
||||
@@ -642,7 +654,7 @@ Item {
|
||||
root.isSelected = false;
|
||||
root.inBluetoothMenu = false;
|
||||
root.inWallpaperMenu = false;
|
||||
root.inNotificationsMenu = false;
|
||||
root.inShellMenu = false;
|
||||
root.inPowerMenu = false;
|
||||
root.inPowerConfirm = false;
|
||||
root.pendingPowerActionIndex = 0;
|
||||
|
||||
Reference in New Issue
Block a user