mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-06 05:28:29 -04:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e0af52d5b | |||
| e1b6427929 | |||
| 47bf6a8dfd | |||
| 84ac36295f | |||
| ca839487de | |||
| dabbec1dce | |||
| bd4d35d215 | |||
| cfdacd3ea3 |
@@ -15,7 +15,11 @@ Singleton {
|
||||
function openModal(modal) {
|
||||
PopoutManager.screenshotActive = false;
|
||||
const screenName = modal.effectiveScreen?.name ?? "unknown";
|
||||
currentModalsByScreen[screenName] = modal;
|
||||
var next = {};
|
||||
for (var k in currentModalsByScreen)
|
||||
next[k] = currentModalsByScreen[k];
|
||||
next[screenName] = modal;
|
||||
currentModalsByScreen = next;
|
||||
modalChanged();
|
||||
Qt.callLater(() => {
|
||||
if (!modal.allowStacking)
|
||||
@@ -34,7 +38,12 @@ Singleton {
|
||||
function closeModal(modal) {
|
||||
const screenName = modal.effectiveScreen?.name ?? "unknown";
|
||||
if (currentModalsByScreen[screenName] === modal) {
|
||||
delete currentModalsByScreen[screenName];
|
||||
var next = {};
|
||||
for (var k in currentModalsByScreen) {
|
||||
if (k !== screenName)
|
||||
next[k] = currentModalsByScreen[k];
|
||||
}
|
||||
currentModalsByScreen = next;
|
||||
modalChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,18 @@ Singleton {
|
||||
activeTrayMenus = newMenus
|
||||
}
|
||||
|
||||
function closeHoverMenus() {
|
||||
for (const screenName in activeTrayMenus) {
|
||||
const menu = activeTrayMenus[screenName]
|
||||
if (!menu || menu.openedByHover !== true) continue
|
||||
if (typeof menu.close === "function") {
|
||||
menu.close()
|
||||
} else if (menu.showMenu !== undefined) {
|
||||
menu.showMenu = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function closeAllMenus() {
|
||||
for (const screenName in activeTrayMenus) {
|
||||
const menu = activeTrayMenus[screenName]
|
||||
|
||||
@@ -7,6 +7,7 @@ Item {
|
||||
|
||||
property string source: ""
|
||||
property int glyphSize: 14
|
||||
property bool badgeVisible: true
|
||||
|
||||
readonly property var sourceAsset: ({
|
||||
"flatpak": "../../assets/package-sources/flatpak.svg",
|
||||
@@ -17,7 +18,7 @@ Item {
|
||||
|
||||
readonly property string assetPath: sourceAsset[source] || ""
|
||||
|
||||
visible: SettingsData.dankLauncherV2ShowSourceBadges && assetPath.length > 0
|
||||
visible: badgeVisible && SettingsData.dankLauncherV2ShowSourceBadges && assetPath.length > 0
|
||||
implicitWidth: glyphSize
|
||||
implicitHeight: glyphSize
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ Rectangle {
|
||||
anchors.margins: Theme.spacingXS
|
||||
source: root.item?.type === "app" ? (root.item.source || "") : ""
|
||||
glyphSize: 16
|
||||
visible: !root.isSelected && !!source
|
||||
badgeVisible: !root.isSelected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ Item {
|
||||
_closeHoverNotepad();
|
||||
activeHoverTrigger = "";
|
||||
PopoutManager.dismissHoverPopoutForScreen(barWindow?.screen);
|
||||
TrayMenuManager.closeAllMenus();
|
||||
TrayMenuManager.closeHoverMenus();
|
||||
}
|
||||
|
||||
function _beginSupersededCloseForActive() {
|
||||
|
||||
@@ -1484,6 +1484,7 @@ BasePill {
|
||||
property bool isVertical: false
|
||||
property var axis: null
|
||||
property bool showMenu: false
|
||||
property bool openedByHover: false
|
||||
property var menuHandle: null
|
||||
|
||||
ListModel {
|
||||
@@ -1493,7 +1494,8 @@ BasePill {
|
||||
return entryStack.count ? entryStack.get(entryStack.count - 1).handle : null;
|
||||
}
|
||||
|
||||
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj) {
|
||||
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj, byHover) {
|
||||
openedByHover = byHover === true;
|
||||
trayItem = item;
|
||||
anchorItem = anchor;
|
||||
parentScreen = screen;
|
||||
@@ -2084,7 +2086,7 @@ BasePill {
|
||||
}
|
||||
}
|
||||
|
||||
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj) {
|
||||
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj, byHover) {
|
||||
if (!screen)
|
||||
return;
|
||||
if (currentTrayMenu) {
|
||||
@@ -2099,7 +2101,7 @@ BasePill {
|
||||
currentTrayMenu = trayMenuComponent.createObject(null);
|
||||
if (!currentTrayMenu)
|
||||
return;
|
||||
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj);
|
||||
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj, byHover === true);
|
||||
}
|
||||
|
||||
function _trayLayoutRoot() {
|
||||
@@ -2147,7 +2149,7 @@ BasePill {
|
||||
if (!hit?.trayItem?.hasMenu)
|
||||
return false;
|
||||
const anchor = hit.children?.length > 0 ? hit.children[0] : hit;
|
||||
showForTrayItem(hit.trayItem, anchor, parentScreen, isAtBottom, isVerticalOrientation, axis);
|
||||
showForTrayItem(hit.trayItem, anchor, parentScreen, isAtBottom, isVerticalOrientation, axis, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ Column {
|
||||
id: sharedTooltip
|
||||
}
|
||||
|
||||
Component.onDestruction: sharedTooltip.hide()
|
||||
|
||||
signal itemEnabledChanged(string sectionId, string itemId, bool enabled)
|
||||
signal itemOrderChanged(string sectionId, var orderedIds)
|
||||
signal addWidget(string sectionId)
|
||||
@@ -1215,6 +1217,7 @@ Column {
|
||||
iconSize: 18
|
||||
iconColor: Theme.error
|
||||
onClicked: {
|
||||
sharedTooltip.hide();
|
||||
root.removeWidget(root.sectionId, index);
|
||||
}
|
||||
onEntered: {
|
||||
|
||||
@@ -143,7 +143,7 @@ Singleton {
|
||||
|
||||
function sendAlert(title, message, isWarning, category, notificationType) {
|
||||
if (notificationType === 1) {
|
||||
Quickshell.execDetached(["notify-send", "-u", isWarning ? "critical" : "normal", "-a", "DMS", "-i", isWarning ? "battery-caution" : "battery-charging", title, message]);
|
||||
Quickshell.execDetached(["notify-send", "-u", isWarning ? "critical" : "normal", "-a", "DMS", "-i", isWarning ? "material:battery_alert" : "material:battery_charging_full", title, message]);
|
||||
} else {
|
||||
if (isWarning) {
|
||||
ToastService.showWarning(title, message, "", category);
|
||||
@@ -157,7 +157,7 @@ Singleton {
|
||||
if (isCharging && batteryLevel >= SettingsData.batteryChargeLimit) {
|
||||
if (!_hasNotifiedChargeLimit && SettingsData.batteryNotifyChargeLimit) {
|
||||
_hasNotifiedChargeLimit = true;
|
||||
sendAlert(I18n.tr("Charge Limit Reached"), I18n.tr("Battery has charged to your set limit of %1%").arg(SettingsData.batteryChargeLimit), false, "battery-charge-limit", SettingsData.batteryChargeLimitNotificationType);
|
||||
sendAlert(I18n.tr("Charge Limit Reached"), I18n.tr("Battery has charged to your set limit of %1%").arg(SettingsData.batteryChargeLimit), false, "material:battery_profile", SettingsData.batteryChargeLimitNotificationType);
|
||||
}
|
||||
} else if (!isCharging || batteryLevel < SettingsData.batteryChargeLimit - 2) {
|
||||
_hasNotifiedChargeLimit = false;
|
||||
@@ -173,7 +173,7 @@ Singleton {
|
||||
if (isCriticalBattery) {
|
||||
if (!_hasNotifiedCriticalBattery && SettingsData.batteryNotifyCritical) {
|
||||
_hasNotifiedCriticalBattery = true;
|
||||
sendAlert(I18n.tr("Critical Battery"), I18n.tr("Battery is at %1% - Connect charger immediately!").arg(batteryLevel), true, "battery-critical", SettingsData.batteryCriticalNotificationType);
|
||||
sendAlert(I18n.tr("Critical Battery"), I18n.tr("Battery is at %1% - Connect charger immediately!").arg(batteryLevel), true, "material:battery_alert", SettingsData.batteryCriticalNotificationType);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ Singleton {
|
||||
if (isLowBattery) {
|
||||
if (!_hasNotifiedLowBattery && SettingsData.batteryNotifyLow) {
|
||||
_hasNotifiedLowBattery = true;
|
||||
sendAlert(I18n.tr("Low Battery"), I18n.tr("Battery is at %1% - Consider charging soon").arg(batteryLevel), true, "battery-low", SettingsData.batteryLowNotificationType);
|
||||
sendAlert(I18n.tr("Low Battery"), I18n.tr("Battery is at %1% - Consider charging soon").arg(batteryLevel), true, "material:battery_0_bar", SettingsData.batteryLowNotificationType);
|
||||
}
|
||||
|
||||
if (SettingsData.batteryAutoPowerSaver && PowerProfileWatcher.available) {
|
||||
@@ -230,6 +230,27 @@ Singleton {
|
||||
|
||||
applyPowerProfile();
|
||||
|
||||
if (isPluggedIn) {
|
||||
const dismissLow = SettingsData.batteryLowNotificationType === 1 && SettingsData.notificationTimeoutNormal === 0;
|
||||
const dismissCritical = SettingsData.batteryCriticalNotificationType === 1 && SettingsData.notificationTimeoutCritical === 0;
|
||||
|
||||
if (dismissLow || dismissCritical) {
|
||||
const lowSummary = I18n.tr("Low Battery");
|
||||
const criticalSummary = I18n.tr("Critical Battery");
|
||||
|
||||
for (const w of NotificationService.visibleNotifications) {
|
||||
if (!w || !w.notification)
|
||||
continue;
|
||||
|
||||
const summary = w.notification.summary;
|
||||
|
||||
if ((dismissLow && summary === lowSummary) || (dismissCritical && summary === criticalSummary)) {
|
||||
NotificationService.dismissNotification(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
previousPluggedState = isPluggedIn;
|
||||
}
|
||||
|
||||
|
||||
@@ -388,6 +388,8 @@ Singleton {
|
||||
const binds = bindsData[cat];
|
||||
for (var i = 0; i < binds.length; i++) {
|
||||
const bind = binds[i];
|
||||
if (currentProvider === "hyprland" && bind.action && bind.action.startsWith("exec "))
|
||||
bind.action = "spawn " + bind.action.slice(5);
|
||||
const targetCat = Actions.isDmsAction(bind.action) ? "DMS" : cat;
|
||||
if (!processed[targetCat])
|
||||
processed[targetCat] = [];
|
||||
|
||||
@@ -168,7 +168,7 @@ Singleton {
|
||||
}
|
||||
|
||||
function isIdle(player: MprisPlayer): bool {
|
||||
return player && player.playbackState === MprisPlaybackState.Stopped && !player.trackTitle && !player.trackArtist;
|
||||
return player && player.playbackState === MprisPlaybackState.Stopped;
|
||||
}
|
||||
|
||||
// Known "<title> | <App>" suffixes stripped for matching only; display keeps the full title
|
||||
|
||||
@@ -105,9 +105,11 @@ PanelWindow {
|
||||
|
||||
readonly property bool slideoutBlurActive: root.visible && BlurService.enabled && Theme.connectedSurfaceBlurEnabled
|
||||
|
||||
readonly property string _slideoutScreenName: modelData?.name ?? ""
|
||||
|
||||
WlrLayershell.layer: (!suppressOverlayLayer && (triggerUsesOverlayLayer || CompositorService.framePeerSurfacesUseOverlayForScreen(modelData))) ? WlrLayershell.Overlay : WlrLayershell.Top
|
||||
WlrLayershell.exclusiveZone: 0
|
||||
WlrLayershell.keyboardFocus: isVisible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
WlrLayershell.keyboardFocus: isVisible && !ModalManager.currentModalsByScreen[_slideoutScreenName] ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
readonly property real dpr: CompositorService.getScreenScale(root.screen)
|
||||
readonly property real alignedWidth: Theme.px(expandable && expandedWidth ? expandedWidthValue : slideoutWidth, dpr)
|
||||
|
||||
@@ -869,7 +869,7 @@ Item {
|
||||
|
||||
readonly property var tooltipTexts: ({
|
||||
"dms": I18n.tr("DMS shell actions (launcher, clipboard, etc.)"),
|
||||
"compositor": I18n.tr("Niri compositor actions (focus, move, etc.)"),
|
||||
"compositor": I18n.tr("Compositor actions (focus, move, etc.)", "keybind action type tooltip"),
|
||||
"spawn": I18n.tr("Run a program (e.g., firefox, kitty)"),
|
||||
"shell": I18n.tr("Run a shell command (e.g., notify-send)")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user