1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-17 00:25:21 -04:00

fix(Notepad): clean up edge cases & updated popout handling

This commit is contained in:
purian23
2026-06-14 22:15:34 -04:00
parent db56c8d74d
commit 2026ba5bd2
5 changed files with 98 additions and 50 deletions
+5
View File
@@ -1096,6 +1096,11 @@ Item {
edgeGap: SettingsData.notepadEffectiveEdgeGap
slideEdge: SettingsData.notepadSlideoutSide
onIsVisibleChanged: {
if (isVisible)
PopoutService.notepadPopout?.hide();
}
content: Component {
Notepad {
slideout: notepadSlideout
+4
View File
@@ -386,6 +386,10 @@ Item {
}
function close(): string {
if (SettingsData.notepadDefaultMode === "popout") {
PopoutService.notepadPopout?.hide();
return "NOTEPAD_CLOSE_SUCCESS";
}
var instance = getActiveNotepadInstance();
if (instance) {
instance.hide();
+13 -9
View File
@@ -317,16 +317,20 @@ Item {
}
}
RowLayout {
id: bannerActions
Item {
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight
Layout.preferredHeight: 32
Row {
id: bannerActions
anchors.right: parent.right
spacing: Theme.spacingS
readonly property real available: parent.width
StyledRect {
readonly property real actionWidth: Math.min(keepText.implicitWidth + Theme.spacingM * 2, Math.max(104, (bannerActions.width - bannerActions.spacing) / 2))
Layout.preferredWidth: actionWidth
Layout.preferredHeight: 32
width: Math.min(keepText.implicitWidth + Theme.spacingM * 2, Math.max(104, (bannerActions.available - bannerActions.spacing) / 2))
height: 32
radius: Theme.cornerRadius
color: "transparent"
border.color: Theme.outlineMedium
@@ -352,9 +356,8 @@ Item {
}
StyledRect {
readonly property real actionWidth: Math.min(reloadText.implicitWidth + Theme.spacingM * 2, Math.max(116, (bannerActions.width - bannerActions.spacing) / 2))
Layout.preferredWidth: actionWidth
Layout.preferredHeight: 32
width: Math.min(reloadText.implicitWidth + Theme.spacingM * 2, Math.max(116, (bannerActions.available - bannerActions.spacing) / 2))
height: 32
radius: Theme.cornerRadius
color: Theme.primary
@@ -380,6 +383,7 @@ Item {
}
}
}
}
Column {
anchors.top: conflictBanner.bottom
@@ -37,6 +37,9 @@ FloatingWindow {
}
}
// A compositor close (e.g. niri close-window)
onClosed: win.visible = false
Item {
anchors.fill: parent
+32
View File
@@ -789,12 +789,41 @@ Singleton {
networkInfoModal?.close();
}
function closeNotepadSlideouts() {
for (var i = 0; i < notepadSlideouts.length; i++) {
if (notepadSlideouts[i] && notepadSlideouts[i].isVisible)
notepadSlideouts[i].hide();
}
}
function openNotepadSlideout() {
notepadPopout?.hide();
if (notepadSlideouts.length > 0) {
notepadSlideouts[0]?.show();
}
}
// Keep the notepad in a single presentation for default modes
Connections {
target: SettingsData
function onNotepadDefaultModeChanged() {
if (SettingsData.notepadDefaultMode === "popout") {
var hadSlideout = false;
for (var i = 0; i < root.notepadSlideouts.length; i++) {
if (root.notepadSlideouts[i] && root.notepadSlideouts[i].isVisible) {
hadSlideout = true;
root.notepadSlideouts[i].hide();
}
}
if (hadSlideout)
root.openNotepadPopout();
} else if (root.notepadPopout && root.notepadPopout.visible) {
root.notepadPopout.hide();
root.openNotepadSlideout();
}
}
}
function openNotepad() {
if (SettingsData.notepadDefaultMode === "popout") {
openNotepadPopout();
@@ -828,6 +857,7 @@ Singleton {
property bool _notepadPopoutWantsOpen: false
function openNotepadPopout() {
closeNotepadSlideouts();
if (notepadPopout) {
notepadPopout.show();
} else if (notepadPopoutLoader) {
@@ -845,6 +875,8 @@ Singleton {
function toggleNotepadPopout() {
if (notepadPopout) {
if (!notepadPopout.visible)
closeNotepadSlideouts();
notepadPopout.toggle();
} else {
openNotepadPopout();