1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

workspace: fix rename modal

This commit is contained in:
bbedward
2026-01-23 14:03:02 -05:00
parent b3ea28c5c4
commit d013c3b718
5 changed files with 50 additions and 51 deletions

View File

@@ -781,6 +781,7 @@ Item {
hyprKeybindsModalLoader: hyprKeybindsModalLoader
dankBarRepeater: dankBarRepeater
hyprlandOverviewLoader: hyprlandOverviewLoader
workspaceRenameModalLoader: workspaceRenameModalLoader
}
Variants {

View File

@@ -15,6 +15,7 @@ Item {
required property var hyprKeybindsModalLoader
required property var dankBarRepeater
required property var hyprlandOverviewLoader
required property var workspaceRenameModalLoader
function getFirstBar() {
if (!root.dankBarRepeater || root.dankBarRepeater.count === 0)
@@ -1295,36 +1296,35 @@ Item {
IpcHandler {
function open(): string {
if (!workspaceRenameModalLoader || !workspaceRenameModalLoader.item) {
return "WORKSPACE_RENAME_MODAL_NOT_FOUND";
}
workspaceRenameModalLoader.active = true;
root.workspaceRenameModalLoader.active = true;
if (root.workspaceRenameModalLoader.item) {
const ws = NiriService.workspaces[NiriService.focusedWorkspaceId];
workspaceRenameModalLoader.item.show(ws?.name || "");
root.workspaceRenameModalLoader.item.show(ws?.name || "");
return "WORKSPACE_RENAME_MODAL_OPENED";
}
return "WORKSPACE_RENAME_MODAL_NOT_FOUND";
}
function close(): string {
if (!workspaceRenameModalLoader || !workspaceRenameModalLoader.item) {
return "WORKSPACE_RENAME_MODAL_NOT_FOUND";
}
workspaceRenameModalLoader.item.hide();
if (root.workspaceRenameModalLoader.item) {
root.workspaceRenameModalLoader.item.hide();
return "WORKSPACE_RENAME_MODAL_CLOSED";
}
return "WORKSPACE_RENAME_MODAL_NOT_FOUND";
}
function toggle(): string {
if (!workspaceRenameModalLoader || !workspaceRenameModalLoader.item) {
return "WORKSPACE_RENAME_MODAL_NOT_FOUND";
}
if (workspaceRenameModalLoader.item.shouldBeVisible) {
workspaceRenameModalLoader.item.hide();
root.workspaceRenameModalLoader.active = true;
if (root.workspaceRenameModalLoader.item) {
if (root.workspaceRenameModalLoader.item.visible) {
root.workspaceRenameModalLoader.item.hide();
return "WORKSPACE_RENAME_MODAL_CLOSED";
} else {
workspaceRenameModalLoader.active = true;
}
const ws = NiriService.workspaces[NiriService.focusedWorkspaceId];
workspaceRenameModalLoader.item.show(ws?.name || "");
root.workspaceRenameModalLoader.item.show(ws?.name || "");
return "WORKSPACE_RENAME_MODAL_OPENED";
}
return "WORKSPACE_RENAME_MODAL_NOT_FOUND";
}
target: "workspace-rename"

View File

@@ -12,8 +12,8 @@ FloatingWindow {
objectName: "workspaceRenameModal"
title: I18n.tr("Rename Workspace")
minimumSize: Qt.size(400, 180)
maximumSize: Qt.size(400, 180)
minimumSize: Qt.size(400, 160)
maximumSize: Qt.size(400, 160)
color: Theme.surfaceContainer
visible: false
@@ -45,7 +45,9 @@ FloatingWindow {
onVisibleChanged: {
if (visible) {
Qt.callLater(() => nameInput.forceActiveFocus());
return;
}
nameInput.text = "";
}
FocusScope {
@@ -54,16 +56,11 @@ FloatingWindow {
anchors.fill: parent
focus: true
Keys.onEscapePressed: {
Keys.onEscapePressed: event => {
hide();
event.accepted = true;
}
Keys.onReturnPressed: {
submitAndClose();
event.accepted = true;
}
Column {
id: contentCol
anchors.centerIn: parent
@@ -71,25 +68,25 @@ FloatingWindow {
spacing: Theme.spacingM
Item {
width: parent.width
height: Math.max(headerCol.height, buttonRow.height)
width: contentCol.width
height: Math.max(headerText.height, buttonRow.height)
MouseArea {
anchors.fill: parent
anchors.left: parent.left
anchors.right: buttonRow.left
anchors.rightMargin: Theme.spacingM
height: parent.height
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
Column {
id: headerCol
width: parent.width
}
StyledText {
id: headerText
text: I18n.tr("Enter a new name for this workspace")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceTextMedium
width: parent.width
}
}
anchors.verticalCenter: parent.verticalCenter
width: parent.width - buttonRow.width - Theme.spacingM
}
Row {

View File

@@ -1426,7 +1426,8 @@ Singleton {
return send({
"Action": {
"SetWorkspaceName": {
"name": name
"name": name,
"workspace": null
}
}
});

View File

@@ -1,6 +1,6 @@
/**
* @name dms-midnight
* @description midnight-discord, generated by dms
* @name midnight
* @description A dark, rounded discord theme.
* @author refact0r
* @version 1.6.2
* @invite nz87hXyvcy
@@ -17,7 +17,7 @@
/* customize things here */
:root {
/* font, change to 'gg sans' for default discord font*/
--font: 'figtree';
--font: 'gg sans';
/* top left corner text */
--corner-text: 'Midnight';
@@ -34,11 +34,11 @@
--accent-3: {{colors.primary.default.hex}}; /* accent buttons */
--accent-4: {{colors.surface_bright.default.hex}}; /* accent buttons when hovered */
--accent-5: {{colors.primary_fixed_dim.default.hex}}; /* accent buttons when clicked */
--mention: {{colors.background.default.hex}}; /* mentions & mention messages */
--mention: {{colors.surface.default.hex}}; /* mentions & mention messages */
--mention-hover: {{colors.surface_bright.default.hex}}; /* mentions & mention messages when hovered */
/* text colors */
--text-0: {{colors.background.default.hex}}; /* text on colored elements */
--text-0: {{colors.surface.default.hex}}; /* text on colored elements */
--text-1: {{colors.on_surface.default.hex}}; /* other normally white text */
--text-2: {{colors.on_surface.default.hex}}; /* headings and important text */
--text-3: {{colors.on_surface_variant.default.hex}}; /* normal text */
@@ -46,10 +46,10 @@
--text-5: {{colors.outline.default.hex}}; /* muted channels/chats and timestamps */
/* background and dark colors */
--bg-1: {{colors.primary.default.hex}}; /* dark buttons when clicked */
--bg-2: {{colors.surface_container.default.hex}}; /* dark buttons */
--bg-1: {{colors.surface_variant.default.hex}}; /* dark buttons when clicked */
--bg-2: {{colors.surface_container_high.default.hex}}; /* dark buttons */
--bg-3: {{colors.surface_container_low.default.hex}}; /* spacing, secondary elements */
--bg-4: {{colors.background.default.hex}}; /* main background color */
--bg-4: {{colors.surface.default.hex}}; /* main background color */
--hover: {{colors.surface_bright.default.hex}}; /* channels and buttons when hovered */
--active: {{colors.surface_bright.default.hex}}; /* channels and buttons when clicked or selected */
--message-hover: {{colors.surface_bright.default.hex}}; /* messages when hovered */