From d013c3b7183f7d2563bf1d3fe1e08f64f0102a38 Mon Sep 17 00:00:00 2001 From: bbedward Date: Fri, 23 Jan 2026 14:03:02 -0500 Subject: [PATCH] workspace: fix rename modal --- quickshell/DMSShell.qml | 1 + quickshell/DMSShellIPC.qml | 38 ++++++++++---------- quickshell/Modals/WorkspaceRenameModal.qml | 41 ++++++++++------------ quickshell/Services/NiriService.qml | 3 +- quickshell/matugen/templates/vesktop.css | 18 +++++----- 5 files changed, 50 insertions(+), 51 deletions(-) diff --git a/quickshell/DMSShell.qml b/quickshell/DMSShell.qml index ca881e0c..6af23e8d 100644 --- a/quickshell/DMSShell.qml +++ b/quickshell/DMSShell.qml @@ -781,6 +781,7 @@ Item { hyprKeybindsModalLoader: hyprKeybindsModalLoader dankBarRepeater: dankBarRepeater hyprlandOverviewLoader: hyprlandOverviewLoader + workspaceRenameModalLoader: workspaceRenameModalLoader } Variants { diff --git a/quickshell/DMSShellIPC.qml b/quickshell/DMSShellIPC.qml index abfc82c5..4d7786a5 100644 --- a/quickshell/DMSShellIPC.qml +++ b/quickshell/DMSShellIPC.qml @@ -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"; + root.workspaceRenameModalLoader.active = true; + if (root.workspaceRenameModalLoader.item) { + const ws = NiriService.workspaces[NiriService.focusedWorkspaceId]; + root.workspaceRenameModalLoader.item.show(ws?.name || ""); + return "WORKSPACE_RENAME_MODAL_OPENED"; } - workspaceRenameModalLoader.active = true; - const ws = NiriService.workspaces[NiriService.focusedWorkspaceId]; - 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"; + if (root.workspaceRenameModalLoader.item) { + root.workspaceRenameModalLoader.item.hide(); + return "WORKSPACE_RENAME_MODAL_CLOSED"; } - 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(); - return "WORKSPACE_RENAME_MODAL_CLOSED"; - } else { - workspaceRenameModalLoader.active = true; + root.workspaceRenameModalLoader.active = true; + if (root.workspaceRenameModalLoader.item) { + if (root.workspaceRenameModalLoader.item.visible) { + root.workspaceRenameModalLoader.item.hide(); + return "WORKSPACE_RENAME_MODAL_CLOSED"; + } 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" diff --git a/quickshell/Modals/WorkspaceRenameModal.qml b/quickshell/Modals/WorkspaceRenameModal.qml index 7b1301de..f4c0fa2b 100644 --- a/quickshell/Modals/WorkspaceRenameModal.qml +++ b/quickshell/Modals/WorkspaceRenameModal.qml @@ -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 { - text: I18n.tr("Enter a new name for this workspace") - font.pixelSize: Theme.fontSizeMedium - color: Theme.surfaceTextMedium - width: parent.width - } - } + StyledText { + id: headerText + text: I18n.tr("Enter a new name for this workspace") + font.pixelSize: Theme.fontSizeMedium + color: Theme.surfaceTextMedium + anchors.verticalCenter: parent.verticalCenter + width: parent.width - buttonRow.width - Theme.spacingM } Row { diff --git a/quickshell/Services/NiriService.qml b/quickshell/Services/NiriService.qml index 2d53ebf5..7bbda983 100644 --- a/quickshell/Services/NiriService.qml +++ b/quickshell/Services/NiriService.qml @@ -1426,7 +1426,8 @@ Singleton { return send({ "Action": { "SetWorkspaceName": { - "name": name + "name": name, + "workspace": null } } }); diff --git a/quickshell/matugen/templates/vesktop.css b/quickshell/matugen/templates/vesktop.css index f8a50ac2..b72b9cdb 100644 --- a/quickshell/matugen/templates/vesktop.css +++ b/quickshell/matugen/templates/vesktop.css @@ -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,13 +17,13 @@ /* 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'; /* color of status indicators and window controls */ - --online-indicator: {{colors.inverse_primary.default.hex}}; /* change to #23a55a for default green */ + --online-indicator: {{colors.inverse_primary.default.hex}}; /* change to #23a55a for default green */ --dnd-indicator: {{colors.error.default.hex}}; /* change to #f13f43 for default red */ --idle-indicator: {{colors.tertiary_container.default.hex}}; /* change to #f0b232 for default yellow */ --streaming-indicator: {{colors.on_primary.default.hex}}; /* change to #593695 for default purple */ @@ -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 */