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 hyprKeybindsModalLoader: hyprKeybindsModalLoader
dankBarRepeater: dankBarRepeater dankBarRepeater: dankBarRepeater
hyprlandOverviewLoader: hyprlandOverviewLoader hyprlandOverviewLoader: hyprlandOverviewLoader
workspaceRenameModalLoader: workspaceRenameModalLoader
} }
Variants { Variants {

View File

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

View File

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

View File

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

View File

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