1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-16 09:12:47 -04:00

text: change default rendering back to Qt

This commit is contained in:
bbedward
2026-05-15 09:45:10 -04:00
parent 0a892a4a9e
commit 1c1ab1c7d5
50 changed files with 520 additions and 496 deletions
+1 -1
View File
@@ -497,7 +497,7 @@ Singleton {
property int fontWeight: Font.Normal
property real fontScale: 1.0
property real dankBarFontScale: 1.0
property int textRenderType: SettingsData.TextRenderType.Native
property int textRenderType: SettingsData.TextRenderType.Qt
property int textRenderQuality: SettingsData.TextRenderQuality.Default
property bool notepadUseMonospace: true
+1 -1
View File
@@ -242,7 +242,7 @@ var SPEC = {
monoFontFamily: { def: "Fira Code" },
fontWeight: { def: 400 },
fontScale: { def: 1.0 },
textRenderType: { def: 1 },
textRenderType: { def: 0 },
textRenderQuality: { def: 0 },
notepadUseMonospace: { def: true },
+2 -2
View File
@@ -29,7 +29,7 @@ DankModal {
confirmButtonText = "Confirm";
cancelButtonText = "Cancel";
confirmButtonColor = Theme.primary;
onConfirm = onConfirmCallback || ((text) => {});
onConfirm = onConfirmCallback || (text => {});
onCancel = onCancelCallback || (() => {});
selectedButton = -1;
keyboardNavigation = false;
@@ -44,7 +44,7 @@ DankModal {
confirmButtonText = options.confirmText || "Confirm";
cancelButtonText = options.cancelText || "Cancel";
confirmButtonColor = options.confirmColor || Theme.primary;
onConfirm = options.onConfirm || ((text) => {});
onConfirm = options.onConfirm || (text => {});
onCancel = options.onCancel || (() => {});
selectedButton = -1;
keyboardNavigation = false;
@@ -70,7 +70,7 @@ Rectangle {
materialIconSizeAdjustment: root.computedIconSize * 0.3
}
Text {
StyledText {
width: parent.width
text: root.item?._hName ?? root.item?.name ?? ""
textFormat: root.item?._hRich ? Text.RichText : Text.PlainText
@@ -95,7 +95,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
height: nameText.implicitHeight + (subText.visible ? subText.height + 2 : 0)
Text {
StyledText {
id: nameText
anchors.left: parent.left
anchors.right: parent.right
@@ -128,7 +128,7 @@ Rectangle {
return e.endsWith("…") ? e.length - 1 : e.length;
}
Text {
StyledText {
id: subText
anchors.left: parent.left
anchors.right: parent.right
@@ -72,7 +72,9 @@ Rectangle {
readonly property var iconMap: {
const cats = root.controller?.appCategories ?? [];
const m = {};
cats.forEach(c => { m[c] = AppSearchService.getCategoryIcon(c); });
cats.forEach(c => {
m[c] = AppSearchService.getCategoryIcon(c);
});
return m;
}
@@ -137,7 +139,9 @@ Rectangle {
dim: false
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
background: Rectangle { color: "transparent" }
background: Rectangle {
color: "transparent"
}
contentItem: Rectangle {
radius: Theme.cornerRadius
@@ -114,7 +114,7 @@ Rectangle {
color: Theme.withAlpha(Theme.surfaceContainer, 0.85)
visible: root.item?.name?.length > 0
Text {
StyledText {
id: labelText
anchors.fill: parent
anchors.margins: Theme.spacingXS
@@ -13,7 +13,7 @@ Row {
property bool pathEditMode: false
property bool pathInputHasFocus: false
signal navigateUp()
signal navigateUp
signal navigateTo(string path)
signal pathInputFocusChanged(bool hasFocus)
@@ -80,9 +80,9 @@ Row {
anchors.fill: parent
cursorShape: Qt.IBeamCursor
onClicked: {
pathEditMode = true
pathInput.text = currentPath.replace("file://", "")
Qt.callLater(() => pathInput.forceActiveFocus())
pathEditMode = true;
pathInput.text = currentPath.replace("file://", "");
Qt.callLater(() => pathInput.forceActiveFocus());
}
}
}
@@ -94,22 +94,22 @@ Row {
topPadding: Theme.spacingXS
bottomPadding: Theme.spacingXS
onAccepted: {
const newPath = text.trim()
const newPath = text.trim();
if (newPath !== "") {
navigation.navigateTo(newPath)
navigation.navigateTo(newPath);
}
pathEditMode = false
pathEditMode = false;
}
Keys.onEscapePressed: {
pathEditMode = false
pathEditMode = false;
}
Keys.onDownPressed: {
pathEditMode = false
pathEditMode = false;
}
onActiveFocusChanged: {
navigation.pathInputFocusChanged(activeFocus)
navigation.pathInputFocusChanged(activeFocus);
if (!activeFocus && pathEditMode) {
pathEditMode = false
pathEditMode = false;
}
}
}
@@ -9,17 +9,17 @@ Item {
property string pendingFilePath: ""
signal confirmed(string filePath)
signal cancelled()
signal cancelled
visible: showDialog
focus: showDialog
Keys.onEscapePressed: {
cancelled()
cancelled();
}
Keys.onReturnPressed: {
confirmed(pendingFilePath)
confirmed(pendingFilePath);
}
Rectangle {
@@ -30,7 +30,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
cancelled()
cancelled();
}
}
}
@@ -92,7 +92,7 @@ Item {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
cancelled()
cancelled();
}
}
}
@@ -117,7 +117,7 @@ Item {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
confirmed(pendingFilePath)
confirmed(pendingFilePath);
}
}
}
@@ -29,15 +29,15 @@ Row {
Component.onCompleted: {
if (saveMode)
Qt.callLater(() => {
forceActiveFocus()
})
forceActiveFocus();
});
}
onAccepted: {
if (text.trim() !== "") {
var basePath = currentPath.replace(/^file:\/\//, '')
var fullPath = basePath + "/" + text.trim()
fullPath = fullPath.replace(/\/+/g, '/')
saveRequested(fullPath)
var basePath = currentPath.replace(/^file:\/\//, '');
var fullPath = basePath + "/" + text.trim();
fullPath = fullPath.replace(/\/+/g, '/');
saveRequested(fullPath);
}
}
}
@@ -63,10 +63,10 @@ Row {
enabled: fileNameInput.text.trim() !== ""
onClicked: {
if (fileNameInput.text.trim() !== "") {
var basePath = currentPath.replace(/^file:\/\//, '')
var fullPath = basePath + "/" + fileNameInput.text.trim()
fullPath = fullPath.replace(/\/+/g, '/')
saveRequested(fullPath)
var basePath = currentPath.replace(/^file:\/\//, '');
var fullPath = basePath + "/" + fileNameInput.text.trim();
fullPath = fullPath.replace(/\/+/g, '/');
saveRequested(fullPath);
}
}
}
@@ -36,19 +36,24 @@ StyledRect {
}
Repeater {
model: [{
model: [
{
"name": "Name",
"value": "name"
}, {
},
{
"name": "Size",
"value": "size"
}, {
},
{
"name": "Modified",
"value": "modified"
}, {
},
{
"name": "Type",
"value": "type"
}]
}
]
StyledRect {
width: sortColumn?.width ?? 0
@@ -83,8 +88,8 @@ StyledRect {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
sortMenu.sortBySelected(modelData?.value ?? "name")
sortMenu.visible = false
sortMenu.sortBySelected(modelData?.value ?? "name");
sortMenu.visible = false;
}
}
}
@@ -136,8 +141,8 @@ StyledRect {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
sortMenu.sortOrderSelected(true)
sortMenu.visible = false
sortMenu.sortOrderSelected(true);
sortMenu.visible = false;
}
}
}
@@ -174,8 +179,8 @@ StyledRect {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
sortMenu.sortOrderSelected(false)
sortMenu.visible = false
sortMenu.sortOrderSelected(false);
sortMenu.visible = false;
}
}
}
+3 -9
View File
@@ -142,13 +142,7 @@ DankModal {
let shouldContinue = false;
for (let j = 0; j < lowerQueryWords.length; j++) {
const word = lowerQueryWords[j];
if (!(
word.length === 0 ||
keyLower.includes(word) ||
descLower.includes(word) ||
catLower.includes(word) ||
actionLower.includes(word)
)) {
if (!(word.length === 0 || keyLower.includes(word) || descLower.includes(word) || catLower.includes(word) || actionLower.includes(word))) {
shouldContinue = true;
break;
}
@@ -181,7 +175,7 @@ DankModal {
return processed;
}
property var categories: generateCategories("");
property var categories: generateCategories("")
function estimateCategoryHeight(catName) {
const catData = categories[catName];
@@ -196,7 +190,7 @@ DankModal {
return 40 + bindCount * 28;
}
property var categoryKeys: Object.keys(categories);
property var categoryKeys: Object.keys(categories)
function distributeCategories(cols) {
const columns = [];
+97 -89
View File
@@ -21,18 +21,18 @@ DankModal {
property var filteredSessions: []
function updateFilteredSessions() {
var filtered = []
var lowerSearch = searchText.trim().toLowerCase()
var filtered = [];
var lowerSearch = searchText.trim().toLowerCase();
for (var i = 0; i < MuxService.sessions.length; i++) {
var session = MuxService.sessions[i]
var session = MuxService.sessions[i];
if (lowerSearch.length > 0 && !session.name.toLowerCase().includes(lowerSearch))
continue
filtered.push(session)
continue;
filtered.push(session);
}
filteredSessions = filtered
filteredSessions = filtered;
if (selectedIndex >= filteredSessions.length) {
selectedIndex = Math.max(0, filteredSessions.length - 1)
selectedIndex = Math.max(0, filteredSessions.length - 1);
}
}
@@ -41,7 +41,7 @@ DankModal {
Connections {
target: MuxService
function onSessionsChanged() {
updateFilteredSessions()
updateFilteredSessions();
}
}
@@ -53,35 +53,35 @@ DankModal {
function toggle() {
if (shouldBeVisible) {
hide()
hide();
} else {
show()
show();
}
}
function show() {
open()
selectedIndex = -1
searchText = ""
MuxService.refreshSessions()
shouldHaveFocus = true
open();
selectedIndex = -1;
searchText = "";
MuxService.refreshSessions();
shouldHaveFocus = true;
Qt.callLater(() => {
if (muxPanel && muxPanel.searchField) {
muxPanel.searchField.forceActiveFocus();
}
})
});
}
function hide() {
close()
selectedIndex = -1
searchText = ""
close();
selectedIndex = -1;
searchText = "";
}
function attachToSession(name) {
MuxService.attachToSession(name)
hide()
MuxService.attachToSession(name);
hide();
}
function renameSession(name) {
@@ -90,9 +90,9 @@ DankModal {
message: I18n.tr("Enter a new name for session \"%1\"").arg(name),
initialText: name,
onConfirm: function (newName) {
MuxService.renameSession(name, newName)
MuxService.renameSession(name, newName);
}
})
});
}
function killSession(name) {
@@ -102,9 +102,9 @@ DankModal {
confirmText: I18n.tr("Kill"),
confirmColor: Theme.primary,
onConfirm: function () {
MuxService.killSession(name)
MuxService.killSession(name);
}
})
});
}
function createNewSession() {
@@ -112,25 +112,25 @@ DankModal {
title: I18n.tr("New Session"),
message: I18n.tr("Please write a name for your new %1 session").arg(MuxService.displayName),
onConfirm: function (name) {
MuxService.createSession(name)
hide()
MuxService.createSession(name);
hide();
}
})
});
}
function selectNext() {
selectedIndex = Math.min(selectedIndex + 1, filteredSessions.length - 1)
selectedIndex = Math.min(selectedIndex + 1, filteredSessions.length - 1);
}
function selectPrevious() {
selectedIndex = Math.max(selectedIndex - 1, -1)
selectedIndex = Math.max(selectedIndex - 1, -1);
}
function activateSelected() {
if (selectedIndex === -1) {
createNewSession()
createNewSession();
} else if (selectedIndex >= 0 && selectedIndex < filteredSessions.length) {
attachToSession(filteredSessions[selectedIndex].name)
attachToSession(filteredSessions[selectedIndex].name);
}
}
@@ -155,18 +155,18 @@ DankModal {
IpcHandler {
function open(): string {
muxModal.show()
return "MUX_OPEN_SUCCESS"
muxModal.show();
return "MUX_OPEN_SUCCESS";
}
function close(): string {
muxModal.hide()
return "MUX_CLOSE_SUCCESS"
muxModal.hide();
return "MUX_CLOSE_SUCCESS";
}
function toggle(): string {
muxModal.toggle()
return "MUX_TOGGLE_SUCCESS"
muxModal.toggle();
return "MUX_TOGGLE_SUCCESS";
}
target: "mux"
@@ -175,18 +175,18 @@ DankModal {
// Backwards compatibility
IpcHandler {
function open(): string {
muxModal.show()
return "TMUX_OPEN_SUCCESS"
muxModal.show();
return "TMUX_OPEN_SUCCESS";
}
function close(): string {
muxModal.hide()
return "TMUX_CLOSE_SUCCESS"
muxModal.hide();
return "TMUX_CLOSE_SUCCESS";
}
function toggle(): string {
muxModal.toggle()
return "TMUX_TOGGLE_SUCCESS"
muxModal.toggle();
return "TMUX_TOGGLE_SUCCESS";
}
target: "tmux"
@@ -248,33 +248,31 @@ DankModal {
property alias searchField: searchField
Keys.onPressed: event => {
if ((event.key === Qt.Key_J && (event.modifiers & Qt.ControlModifier)) ||
(event.key === Qt.Key_Down)) {
selectNext()
event.accepted = true
} else if ((event.key === Qt.Key_K && (event.modifiers & Qt.ControlModifier)) ||
(event.key === Qt.Key_Up)) {
selectPrevious()
event.accepted = true
if ((event.key === Qt.Key_J && (event.modifiers & Qt.ControlModifier)) || (event.key === Qt.Key_Down)) {
selectNext();
event.accepted = true;
} else if ((event.key === Qt.Key_K && (event.modifiers & Qt.ControlModifier)) || (event.key === Qt.Key_Up)) {
selectPrevious();
event.accepted = true;
} else if (event.key === Qt.Key_N && (event.modifiers & Qt.ControlModifier)) {
createNewSession()
event.accepted = true
createNewSession();
event.accepted = true;
} else if (event.key === Qt.Key_R && (event.modifiers & Qt.ControlModifier)) {
if (MuxService.supportsRename && selectedIndex >= 0 && selectedIndex < filteredSessions.length) {
renameSession(filteredSessions[selectedIndex].name)
renameSession(filteredSessions[selectedIndex].name);
}
event.accepted = true
event.accepted = true;
} else if (event.key === Qt.Key_D && (event.modifiers & Qt.ControlModifier)) {
if (selectedIndex >= 0 && selectedIndex < filteredSessions.length) {
killSession(filteredSessions[selectedIndex].name)
killSession(filteredSessions[selectedIndex].name);
}
event.accepted = true
event.accepted = true;
} else if (event.key === Qt.Key_Escape) {
hide()
event.accepted = true
hide();
event.accepted = true;
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
activateSelected()
event.accepted = true
activateSelected();
event.accepted = true;
}
}
@@ -307,12 +305,8 @@ DankModal {
text: {
const total = MuxService.sessions.length;
const filtered = muxModal.filteredSessions.length;
const activePart = total === 1
? I18n.tr("%1 active session").arg(total)
: I18n.tr("%1 active sessions").arg(total);
const filteredPart = filtered === 1
? I18n.tr("%1 filtered").arg(filtered)
: I18n.tr("%1 filtered").arg(filtered);
const activePart = total === 1 ? I18n.tr("%1 active session").arg(total) : I18n.tr("%1 active sessions").arg(total);
const filteredPart = filtered === 1 ? I18n.tr("%1 filtered").arg(filtered) : I18n.tr("%1 filtered").arg(filtered);
return activePart + ", " + filteredPart;
}
font.pixelSize: Theme.fontSizeMedium
@@ -340,8 +334,8 @@ DankModal {
keyForwardTargets: [muxPanel]
onTextEdited: {
muxModal.searchText = text
muxModal.selectedIndex = 0
muxModal.searchText = text;
muxModal.selectedIndex = 0;
}
}
@@ -350,8 +344,7 @@ DankModal {
width: parent.width
height: 56
radius: Theme.cornerRadius
color: muxModal.selectedIndex === -1 ? Theme.primaryContainer :
(newMouse.containsMouse ? Theme.surfaceContainerHigh : Theme.surfaceContainer)
color: muxModal.selectedIndex === -1 ? Theme.primaryContainer : (newMouse.containsMouse ? Theme.surfaceContainerHigh : Theme.surfaceContainer)
RowLayout {
anchors.fill: parent
@@ -428,8 +421,7 @@ DankModal {
width: parent.width
height: 64
radius: Theme.cornerRadius
color: muxModal.selectedIndex === index ? Theme.primaryContainer :
(sessionMouse.containsMouse ? Theme.surfaceContainerHigh : "transparent")
color: muxModal.selectedIndex === index ? Theme.primaryContainer : (sessionMouse.containsMouse ? Theme.surfaceContainerHigh : "transparent")
MouseArea {
id: sessionMouse
@@ -476,13 +468,11 @@ DankModal {
StyledText {
text: {
var parts = []
var parts = [];
if (modelData.windows !== "N/A")
parts.push(modelData.windows === 1
? I18n.tr("%1 window").arg(modelData.windows)
: I18n.tr("%1 windows").arg(modelData.windows))
parts.push(modelData.attached ? I18n.tr("attached") : I18n.tr("detached"))
return parts.join(" \u2022 ")
parts.push(modelData.windows === 1 ? I18n.tr("%1 window").arg(modelData.windows) : I18n.tr("%1 windows").arg(modelData.windows));
parts.push(modelData.attached ? I18n.tr("attached") : I18n.tr("detached"));
return parts.join(" \u2022 ");
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
@@ -533,7 +523,7 @@ DankModal {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
muxModal.killSession(modelData.name)
muxModal.killSession(modelData.name);
}
}
}
@@ -587,15 +577,33 @@ DankModal {
Repeater {
model: {
var shortcuts = [
{ key: "↑↓", label: I18n.tr("Navigate") },
{ key: "↵", label: I18n.tr("Attach") },
{ key: "^N", label: I18n.tr("New") },
{ key: "^D", label: I18n.tr("Kill") },
{ key: "Esc", label: I18n.tr("Close") }
]
{
key: "↑↓",
label: I18n.tr("Navigate")
},
{
key: "↵",
label: I18n.tr("Attach")
},
{
key: "^N",
label: I18n.tr("New")
},
{
key: "^D",
label: I18n.tr("Kill")
},
{
key: "Esc",
label: I18n.tr("Close")
}
];
if (MuxService.supportsRename)
shortcuts.splice(3, 0, { key: "^R", label: I18n.tr("Rename") })
return shortcuts
shortcuts.splice(3, 0, {
key: "^R",
label: I18n.tr("Rename")
});
return shortcuts;
}
delegate: Row {
+2 -2
View File
@@ -68,7 +68,7 @@ DankModal {
if (response.error) {
ToastService.showError(I18n.tr("Failed to remove QR code at %1: %2").arg(path).arg(JSON.stringify(response.error)));
}
})
});
}
LazyLoader {
@@ -90,7 +90,7 @@ DankModal {
const fileName = cleanPath.split('/').pop();
const fileUrl = "file://" + cleanPath;
copyQrCodeProcess.exec(["cp", root.normalQrCodePath, cleanPath, "-f"])
copyQrCodeProcess.exec(["cp", root.normalQrCodePath, cleanPath, "-f"]);
}
Process {
@@ -13,7 +13,10 @@ PluginComponent {
const result = [];
for (const id in allProfiles) {
if (allProfiles[id].name)
result.push({ id: id, name: allProfiles[id].name });
result.push({
id: id,
name: allProfiles[id].name
});
}
return result;
}
@@ -1,5 +1,4 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Widgets
@@ -39,13 +38,15 @@ Row {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
root.currentSize = modelData
root.sizeChanged(modelData)
root.currentSize = modelData;
root.sizeChanged(modelData);
}
}
Behavior on color {
ColorAnimation { duration: Theme.shortDuration }
ColorAnimation {
duration: Theme.shortDuration
}
}
}
}
@@ -17,30 +17,44 @@ StyledText {
font.pixelSize: {
switch (style) {
case Typography.Style.Title: return Theme.fontSizeXLarge
case Typography.Style.Subtitle: return Theme.fontSizeLarge
case Typography.Style.Body: return Theme.fontSizeMedium
case Typography.Style.Caption: return Theme.fontSizeSmall
case Typography.Style.Button: return Theme.fontSizeSmall
default: return Theme.fontSizeMedium
case Typography.Style.Title:
return Theme.fontSizeXLarge;
case Typography.Style.Subtitle:
return Theme.fontSizeLarge;
case Typography.Style.Body:
return Theme.fontSizeMedium;
case Typography.Style.Caption:
return Theme.fontSizeSmall;
case Typography.Style.Button:
return Theme.fontSizeSmall;
default:
return Theme.fontSizeMedium;
}
}
font.weight: {
switch (style) {
case Typography.Style.Title: return Font.Bold
case Typography.Style.Subtitle: return Font.Medium
case Typography.Style.Body: return Font.Normal
case Typography.Style.Caption: return Font.Normal
case Typography.Style.Button: return Font.Medium
default: return Font.Normal
case Typography.Style.Title:
return Font.Bold;
case Typography.Style.Subtitle:
return Font.Medium;
case Typography.Style.Body:
return Font.Normal;
case Typography.Style.Caption:
return Font.Normal;
case Typography.Style.Button:
return Font.Medium;
default:
return Font.Normal;
}
}
color: {
switch (style) {
case Typography.Style.Caption: return Theme.surfaceVariantText
default: return Theme.surfaceText
case Typography.Style.Caption:
return Theme.surfaceVariantText;
default:
return Theme.surfaceText;
}
}
}
@@ -741,7 +741,7 @@ BasePill {
}
}
Text {
StyledText {
anchors.centerIn: parent
visible: !iconImg.visible && !coreIcon.visible && !Paths.isSteamApp(appItem.appId)
text: {
@@ -1,5 +1,4 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Modules.Plugins
import qs.Services
@@ -11,7 +10,7 @@ BasePill {
property bool layoutPopupVisible: false
property var popoutTarget: null
signal toggleLayoutPopup()
signal toggleLayoutPopup
visible: CompositorService.isDwl && DwlService.dwlAvailable
@@ -20,27 +19,27 @@ BasePill {
property int currentLayoutIndex: outputState?.layout || 0
readonly property var layoutIcons: ({
"CT": "view_compact",
"G": "grid_view",
"K": "layers",
"M": "fullscreen",
"RT": "view_sidebar",
"S": "view_carousel",
"T": "view_quilt",
"VG": "grid_on",
"VK": "view_day",
"VS": "scrollable_header",
"VT": "clarify"
})
"CT": "view_compact",
"G": "grid_view",
"K": "layers",
"M": "fullscreen",
"RT": "view_sidebar",
"S": "view_carousel",
"T": "view_quilt",
"VG": "grid_on",
"VK": "view_day",
"VS": "scrollable_header",
"VT": "clarify"
})
function getLayoutIcon(symbol) {
return layoutIcons[symbol] || "view_quilt"
return layoutIcons[symbol] || "view_quilt";
}
Connections {
target: DwlService
function onStateChanged() {
outputState = parentScreen ? DwlService.getOutputState(parentScreen.name) : null
outputState = parentScreen ? DwlService.getOutputState(parentScreen.name) : null;
}
}
@@ -94,17 +93,17 @@ BasePill {
}
onClicked: {
toggleLayoutPopup()
toggleLayoutPopup();
}
onRightClicked: {
if (!parentScreen || !DwlService.dwlAvailable || DwlService.layouts.length === 0) {
return
return;
}
const currentIndex = layout.currentLayoutIndex
const nextIndex = (currentIndex + 1) % DwlService.layouts.length
const currentIndex = layout.currentLayoutIndex;
const nextIndex = (currentIndex + 1) % DwlService.layouts.length;
DwlService.setLayout(parentScreen.name, nextIndex)
DwlService.setLayout(parentScreen.name, nextIndex);
}
}
@@ -131,12 +131,17 @@ BasePill {
if (root.diskUsagePercent === undefined || root.diskUsagePercent === null || root.diskUsagePercent === 0) {
return "--";
}
if (!root.selectedMount) return "--";
if (!root.selectedMount)
return "--";
switch (root.diskUsageMode) {
case 1: return root.selectedMount.size || "--";
case 2: return root.selectedMount.avail || "--";
case 3: return (root.selectedMount.avail || "--") + " / " + (root.selectedMount.size || "--");
default: return root.diskUsagePercent.toFixed(0);
case 1:
return root.selectedMount.size || "--";
case 2:
return root.selectedMount.avail || "--";
case 3:
return (root.selectedMount.avail || "--") + " / " + (root.selectedMount.size || "--");
default:
return root.diskUsagePercent.toFixed(0);
}
}
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
@@ -185,12 +190,17 @@ BasePill {
if (root.diskUsagePercent === undefined || root.diskUsagePercent === null || root.diskUsagePercent === 0) {
return "--%";
}
if (!root.selectedMount) return "--%";
if (!root.selectedMount)
return "--%";
switch (root.diskUsageMode) {
case 1: return root.selectedMount.size || "--";
case 2: return root.selectedMount.avail || "--";
case 3: return (root.selectedMount.avail || "--") + " / " + (root.selectedMount.size || "--");
default: return root.diskUsagePercent.toFixed(0) + "%";
case 1:
return root.selectedMount.size || "--";
case 2:
return root.selectedMount.avail || "--";
case 3:
return (root.selectedMount.avail || "--") + " / " + (root.selectedMount.size || "--");
default:
return root.diskUsagePercent.toFixed(0) + "%";
}
}
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
@@ -204,10 +214,13 @@ BasePill {
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
text: {
switch (root.diskUsageMode) {
case 3: return "888.8G / 888.8G";
case 1:
case 2: return "888.8G";
default: return "100%";
case 3:
return "888.8G / 888.8G";
case 1:
case 2:
return "888.8G";
default:
return "100%";
}
}
}
@@ -132,9 +132,7 @@ BasePill {
const focusedWin = NiriService.windows.find(w => w.is_focused);
if (!focusedWin)
return false;
const screenWsIds = new Set(
NiriService.allWorkspaces.filter(ws => ws.output === parentScreen.name).map(ws => ws.id)
);
const screenWsIds = new Set(NiriService.allWorkspaces.filter(ws => ws.output === parentScreen.name).map(ws => ws.id));
return screenWsIds.has(focusedWin.workspace_id);
}
@@ -211,7 +209,7 @@ BasePill {
visible: root.isVerticalOrientation && activeWindow && activeWindow.appId && appIcon.status !== Image.Ready && Paths.isSteamApp(activeWindow.appId)
}
Text {
StyledText {
anchors.centerIn: parent
visible: root.isVerticalOrientation && activeWindow && activeWindow.appId && appIcon.status !== Image.Ready && !Paths.isSteamApp(activeWindow.appId)
text: {
@@ -1,8 +1,6 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Modules.Plugins
import qs.Modules.ProcessList
import qs.Services
import qs.Widgets
@@ -11,21 +9,21 @@ BasePill {
function formatNetworkSpeed(bytesPerSec) {
if (bytesPerSec < 1024) {
return bytesPerSec.toFixed(0) + " B/s"
return bytesPerSec.toFixed(0) + " B/s";
} else if (bytesPerSec < 1024 * 1024) {
return (bytesPerSec / 1024).toFixed(1) + " KB/s"
return (bytesPerSec / 1024).toFixed(1) + " KB/s";
} else if (bytesPerSec < 1024 * 1024 * 1024) {
return (bytesPerSec / (1024 * 1024)).toFixed(1) + " MB/s"
return (bytesPerSec / (1024 * 1024)).toFixed(1) + " MB/s";
} else {
return (bytesPerSec / (1024 * 1024 * 1024)).toFixed(1) + " GB/s"
return (bytesPerSec / (1024 * 1024 * 1024)).toFixed(1) + " GB/s";
}
}
Component.onCompleted: {
DgopService.addRef(["network"])
DgopService.addRef(["network"]);
}
Component.onDestruction: {
DgopService.removeRef(["network"])
DgopService.removeRef(["network"]);
}
content: Component {
@@ -48,10 +46,12 @@ BasePill {
StyledText {
text: {
const rate = DgopService.networkRxRate
if (rate < 1024) return rate.toFixed(0)
if (rate < 1024 * 1024) return (rate / 1024).toFixed(0) + "K"
return (rate / (1024 * 1024)).toFixed(0) + "M"
const rate = DgopService.networkRxRate;
if (rate < 1024)
return rate.toFixed(0);
if (rate < 1024 * 1024)
return (rate / 1024).toFixed(0) + "K";
return (rate / (1024 * 1024)).toFixed(0) + "M";
}
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
color: Theme.info
@@ -60,10 +60,12 @@ BasePill {
StyledText {
text: {
const rate = DgopService.networkTxRate
if (rate < 1024) return rate.toFixed(0)
if (rate < 1024 * 1024) return (rate / 1024).toFixed(0) + "K"
return (rate / (1024 * 1024)).toFixed(0) + "M"
const rate = DgopService.networkTxRate;
if (rate < 1024)
return rate.toFixed(0);
if (rate < 1024 * 1024)
return (rate / 1024).toFixed(0) + "K";
return (rate / (1024 * 1024)).toFixed(0) + "M";
}
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
color: Theme.error
@@ -316,7 +316,7 @@ BasePill {
visible: !iconImg.visible && Paths.isSteamApp(effectiveAppId)
}
Text {
StyledText {
anchors.centerIn: parent
visible: !iconImg.visible && !Paths.isSteamApp(effectiveAppId)
text: {
@@ -570,7 +570,7 @@ BasePill {
visible: !iconImg.visible && Paths.isSteamApp(effectiveAppId)
}
Text {
StyledText {
anchors.centerIn: parent
visible: !iconImg.visible && !Paths.isSteamApp(effectiveAppId)
text: {
@@ -428,7 +428,7 @@ BasePill {
}
}
Text {
StyledText {
anchors.centerIn: parent
visible: !iconImg.visible
text: {
@@ -649,7 +649,7 @@ BasePill {
}
}
Text {
StyledText {
anchors.centerIn: parent
visible: !inlineIconImg.visible
text: {
@@ -783,7 +783,7 @@ BasePill {
}
}
Text {
StyledText {
anchors.centerIn: parent
visible: !iconImg.visible
text: {
@@ -1290,7 +1290,7 @@ BasePill {
}
}
Text {
StyledText {
anchors.centerIn: parent
visible: !menuIconImg.visible
text: {
@@ -16,9 +16,11 @@ BasePill {
content: Component {
Item {
implicitWidth: {
if (!SettingsData.weatherEnabled) return 0
if (root.isVerticalOrientation) return root.widgetThickness - root.horizontalPadding * 2
return Math.min(100 - root.horizontalPadding * 2, weatherRow.implicitWidth)
if (!SettingsData.weatherEnabled)
return 0;
if (root.isVerticalOrientation)
return root.widgetThickness - root.horizontalPadding * 2;
return Math.min(100 - root.horizontalPadding * 2, weatherRow.implicitWidth);
}
implicitHeight: root.isVerticalOrientation ? weatherColumn.implicitHeight : (root.widgetThickness - root.horizontalPadding * 2)
@@ -1691,7 +1691,7 @@ Item {
anchors.bottom: parent.bottom
z: 2
Text {
StyledText {
anchors.centerIn: parent
text: modelData.count
font.pixelSize: root.appIconSize * 0.44
@@ -1860,7 +1860,7 @@ Item {
anchors.bottom: parent.bottom
z: 2
Text {
StyledText {
anchors.centerIn: parent
text: modelData.count
font.pixelSize: root.appIconSize * 0.44
@@ -1,5 +1,4 @@
import QtQuick
import QtQuick.Effects
import Quickshell
import qs.Common
import qs.Widgets
@@ -22,11 +21,11 @@ Card {
StyledText {
text: {
if (SettingsData.use24HourClock) {
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0)
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0);
} else {
const hours = systemClock?.date?.getHours()
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours
return String(display).padStart(2, '0').charAt(0)
const hours = systemClock?.date?.getHours();
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
return String(display).padStart(2, '0').charAt(0);
}
}
font.pixelSize: 48
@@ -39,11 +38,11 @@ Card {
StyledText {
text: {
if (SettingsData.use24HourClock) {
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1)
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1);
} else {
const hours = systemClock?.date?.getHours()
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours
return String(display).padStart(2, '0').charAt(1)
const hours = systemClock?.date?.getHours();
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
return String(display).padStart(2, '0').charAt(1);
}
}
font.pixelSize: 48
@@ -1,6 +1,4 @@
import QtQuick
import QtQuick.Effects
import QtQuick.Shapes
import Quickshell.Services.Mpris
import qs.Common
import qs.Services
@@ -10,24 +8,25 @@ Card {
id: root
clip: false
signal clicked()
signal clicked
property MprisPlayer activePlayer: MprisController.activePlayer
property real currentPosition: activePlayer?.positionSupported ? activePlayer.position : 0
property real displayPosition: currentPosition
readonly property real ratio: {
if (!activePlayer || activePlayer.length <= 0) return 0
const pos = displayPosition % Math.max(1, activePlayer.length)
const calculatedRatio = pos / activePlayer.length
return Math.max(0, Math.min(1, calculatedRatio))
if (!activePlayer || activePlayer.length <= 0)
return 0;
const pos = displayPosition % Math.max(1, activePlayer.length);
const calculatedRatio = pos / activePlayer.length;
return Math.max(0, Math.min(1, calculatedRatio));
}
onActivePlayerChanged: {
if (activePlayer?.positionSupported) {
currentPosition = Qt.binding(() => activePlayer?.position || 0)
currentPosition = Qt.binding(() => activePlayer?.position || 0);
} else {
currentPosition = 0
currentPosition = 0;
}
}
@@ -126,73 +125,73 @@ Card {
spacing: Theme.spacingS
anchors.centerIn: parent
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: prevArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: prevArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
DankIcon {
anchors.centerIn: parent
name: "skip_previous"
size: 14
color: Theme.surfaceText
DankIcon {
anchors.centerIn: parent
name: "skip_previous"
size: 14
color: Theme.surfaceText
}
MouseArea {
id: prevArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: MprisController.previousOrRewind()
}
}
MouseArea {
id: prevArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: MprisController.previousOrRewind()
}
}
Rectangle {
id: playPauseButton
width: 32
height: 32
radius: 16
color: Theme.primary
Rectangle {
id: playPauseButton
width: 32
height: 32
radius: 16
color: Theme.primary
DankIcon {
anchors.centerIn: parent
name: activePlayer?.playbackState === MprisPlaybackState.Playing ? "pause" : "play_arrow"
size: 16
color: Theme.background
}
DankIcon {
anchors.centerIn: parent
name: activePlayer?.playbackState === MprisPlaybackState.Playing ? "pause" : "play_arrow"
size: 16
color: Theme.background
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.togglePlaying()
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.togglePlaying()
}
}
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: nextArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: nextArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
DankIcon {
anchors.centerIn: parent
name: "skip_next"
size: 14
color: Theme.surfaceText
}
DankIcon {
anchors.centerIn: parent
name: "skip_next"
size: 14
color: Theme.surfaceText
MouseArea {
id: nextArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.next()
}
}
MouseArea {
id: nextArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.next()
}
}
}
}
}
+1 -5
View File
@@ -538,11 +538,7 @@ Item {
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: wallpaperFolderModel.count > 0
? (wallpaperFolderModel.count === 1
? I18n.tr("%1 wallpaper • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages)
: I18n.tr("%1 wallpapers • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages))
: I18n.tr("No wallpapers")
text: wallpaperFolderModel.count > 0 ? (wallpaperFolderModel.count === 1 ? I18n.tr("%1 wallpaper • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages) : I18n.tr("%1 wallpapers • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages)) : I18n.tr("No wallpapers")
font.pixelSize: 14
color: Theme.surfaceText
opacity: 0.7
+1 -1
View File
@@ -505,7 +505,7 @@ Item {
border.width: 1
border.color: Theme.primarySelected
Text {
StyledText {
anchors.centerIn: parent
text: {
if (!appData || !appData.appId) {
@@ -19,10 +19,13 @@ DankActionButton {
DankIcon {
anchors.centerIn: parent
name: {
if (parent.text === "keyboard_hide") return "keyboard_hide"
if (parent.text === "Backspace") return "backspace"
if (parent.text === "Enter") return "keyboard_return"
return ""
if (parent.text === "keyboard_hide")
return "keyboard_hide";
if (parent.text === "Backspace")
return "backspace";
if (parent.text === "Enter")
return "keyboard_return";
return "";
}
size: 20
color: Theme.surfaceText
+3 -3
View File
@@ -34,7 +34,7 @@ Item {
target: slideout
enabled: slideout !== null
function onAboutToHide() {
textEditor.autoSaveToSession()
textEditor.autoSaveToSession();
}
}
@@ -213,8 +213,8 @@ Item {
}
onEscapePressed: {
textEditor.autoSaveToSession()
root.hideRequested()
textEditor.autoSaveToSession();
root.hideRequested();
}
onSettingsRequested: {
+48 -51
View File
@@ -71,27 +71,27 @@ Column {
repeat: false
onTriggered: {
if (NotepadStorageService.tabs.length > 1) {
delegateItem.longPressing = true
delegateItem.longPressing = true;
}
}
}
readonly property real shiftOffset: {
if (root.draggedIndex < 0)
return 0
return 0;
if (index === root.draggedIndex)
return 0
var dragIdx = root.draggedIndex
var dropIdx = root.dropTargetIndex
var myIdx = index
var shiftAmount = root.tabItemSize
return 0;
var dragIdx = root.draggedIndex;
var dropIdx = root.dropTargetIndex;
var myIdx = index;
var shiftAmount = root.tabItemSize;
if (dropIdx < 0)
return 0
return 0;
if (dragIdx < dropIdx && myIdx > dragIdx && myIdx <= dropIdx)
return -shiftAmount
return -shiftAmount;
if (dragIdx > dropIdx && myIdx >= dropIdx && myIdx < dragIdx)
return shiftAmount
return 0
return shiftAmount;
return 0;
}
width: tabWidth
@@ -140,11 +140,11 @@ Column {
id: tabText
width: parent.width - (tabCloseButton.visible ? tabCloseButton.width + Theme.spacingXS : 0)
text: {
var prefix = ""
var prefix = "";
if (hasUnsavedChangesForTab(modelData)) {
prefix = "● "
prefix = "● ";
}
return prefix + (modelData.title || "Untitled")
return prefix + (modelData.title || "Untitled");
}
font.pixelSize: Theme.fontSizeSmall
color: isActive ? Theme.primary : Theme.surfaceText
@@ -202,68 +202,65 @@ Column {
onPressed: mouse => {
if (mouse.button === Qt.LeftButton && NotepadStorageService.tabs.length > 1) {
delegateItem.dragStartPos = Qt.point(mouse.x, mouse.y)
longPressTimer.start()
delegateItem.dragStartPos = Qt.point(mouse.x, mouse.y);
longPressTimer.start();
}
}
onReleased: mouse => {
longPressTimer.stop()
var wasDragging = delegateItem.dragging
var didReorder = wasDragging && delegateItem.targetIndex >= 0 && delegateItem.targetIndex !== delegateItem.originalIndex
longPressTimer.stop();
var wasDragging = delegateItem.dragging;
var didReorder = wasDragging && delegateItem.targetIndex >= 0 && delegateItem.targetIndex !== delegateItem.originalIndex;
if (didReorder) {
root.suppressShiftAnimation = true
NotepadStorageService.reorderTab(delegateItem.originalIndex, delegateItem.targetIndex)
root.suppressShiftAnimation = true;
NotepadStorageService.reorderTab(delegateItem.originalIndex, delegateItem.targetIndex);
}
delegateItem.longPressing = false
delegateItem.dragging = false
delegateItem.dragAxisOffset = 0
delegateItem.targetIndex = -1
delegateItem.originalIndex = -1
root.draggedIndex = -1
root.dropTargetIndex = -1
delegateItem.longPressing = false;
delegateItem.dragging = false;
delegateItem.dragAxisOffset = 0;
delegateItem.targetIndex = -1;
delegateItem.originalIndex = -1;
root.draggedIndex = -1;
root.dropTargetIndex = -1;
if (didReorder) {
Qt.callLater(() => {
root.suppressShiftAnimation = false
})
root.suppressShiftAnimation = false;
});
}
if (wasDragging || mouse.button !== Qt.LeftButton)
return
root.tabSwitched(index)
return;
root.tabSwitched(index);
}
onPositionChanged: mouse => {
if (delegateItem.longPressing && !delegateItem.dragging) {
var distance = Math.sqrt(Math.pow(mouse.x - delegateItem.dragStartPos.x, 2) + Math.pow(mouse.y - delegateItem.dragStartPos.y, 2))
var distance = Math.sqrt(Math.pow(mouse.x - delegateItem.dragStartPos.x, 2) + Math.pow(mouse.y - delegateItem.dragStartPos.y, 2));
if (distance > 5) {
delegateItem.dragging = true
delegateItem.targetIndex = index
delegateItem.originalIndex = index
root.draggedIndex = index
root.dropTargetIndex = index
delegateItem.dragging = true;
delegateItem.targetIndex = index;
delegateItem.originalIndex = index;
root.draggedIndex = index;
root.dropTargetIndex = index;
}
}
if (!delegateItem.dragging)
return
return;
var axisOffset = mouse.x - delegateItem.dragStartPos.x;
delegateItem.dragAxisOffset = axisOffset;
var axisOffset = mouse.x - delegateItem.dragStartPos.x
delegateItem.dragAxisOffset = axisOffset
var itemSize = root.tabItemSize
var rawSlot = axisOffset / itemSize
var slotOffset = rawSlot >= 0
? Math.floor(rawSlot + 0.4)
: Math.ceil(rawSlot - 0.4)
var tabCount = NotepadStorageService.tabs.length
var newTargetIndex = Math.max(0, Math.min(tabCount - 1, delegateItem.originalIndex + slotOffset))
var itemSize = root.tabItemSize;
var rawSlot = axisOffset / itemSize;
var slotOffset = rawSlot >= 0 ? Math.floor(rawSlot + 0.4) : Math.ceil(rawSlot - 0.4);
var tabCount = NotepadStorageService.tabs.length;
var newTargetIndex = Math.max(0, Math.min(tabCount - 1, delegateItem.originalIndex + slotOffset));
if (newTargetIndex !== delegateItem.targetIndex) {
delegateItem.targetIndex = newTargetIndex
root.dropTargetIndex = newTargetIndex
delegateItem.targetIndex = newTargetIndex;
root.dropTargetIndex = newTargetIndex;
}
}
}
@@ -465,7 +465,7 @@ Column {
width: 32
height: measuringText.contentHeight
Text {
StyledText {
id: measuringText
width: textArea.width - textArea.leftPadding - textArea.rightPadding
text: modelData || " "
@@ -719,7 +719,7 @@ Column {
contentWidth: width - 11
contentHeight: previewText.paintedHeight + Theme.spacingM * 2
Text {
StyledText {
id: previewText
width: parent.width - Theme.spacingM
padding: Theme.spacingM
@@ -718,7 +718,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
Text {
StyledText {
text: root.gridEnabled ? I18n.tr("Grid: ON", "Widget grid snap status") : I18n.tr("Grid: OFF", "Widget grid snap status")
font.pixelSize: Theme.fontSizeSmall
font.family: Theme.fontFamily
@@ -733,7 +733,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
Text {
StyledText {
text: root.gridSize + "px"
font.pixelSize: Theme.fontSizeSmall
font.family: Theme.fontFamily
@@ -748,7 +748,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
Text {
StyledText {
text: I18n.tr("G: grid • Z/X: size", "Widget grid keyboard hints")
font.pixelSize: Theme.fontSizeSmall
font.family: Theme.fontFamily
+13 -13
View File
@@ -16,38 +16,38 @@ Column {
spacing: Theme.spacingM
Component.onCompleted: {
const settings = findSettings()
const settings = findSettings();
if (settings) {
items = settings.loadValue(settingKey, defaultValue)
items = settings.loadValue(settingKey, defaultValue);
}
}
onItemsChanged: {
const settings = findSettings()
const settings = findSettings();
if (settings) {
settings.saveValue(settingKey, items)
settings.saveValue(settingKey, items);
}
}
function findSettings() {
let item = parent
let item = parent;
while (item) {
if (item.saveValue !== undefined && item.loadValue !== undefined) {
return item
return item;
}
item = item.parent
item = item.parent;
}
return null
return null;
}
function addItem(item) {
items = items.concat([item])
items = items.concat([item]);
}
function removeItem(index) {
const newItems = items.slice()
newItems.splice(index, 1)
items = newItems
const newItems = items.slice();
newItems.splice(index, 1);
items = newItems;
}
StyledText {
@@ -123,7 +123,7 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.removeItem(index)
root.removeItem(index);
}
}
}
@@ -18,47 +18,47 @@ Column {
property bool isLoading: false
Component.onCompleted: {
loadValue()
loadValue();
}
function loadValue() {
const settings = findSettings()
const settings = findSettings();
if (settings) {
isLoading = true
items = settings.loadValue(settingKey, defaultValue)
isLoading = false
isLoading = true;
items = settings.loadValue(settingKey, defaultValue);
isLoading = false;
}
}
onItemsChanged: {
if (isLoading) {
return
return;
}
const settings = findSettings()
const settings = findSettings();
if (settings) {
settings.saveValue(settingKey, items)
settings.saveValue(settingKey, items);
}
}
function findSettings() {
let item = parent
let item = parent;
while (item) {
if (item.saveValue !== undefined && item.loadValue !== undefined) {
return item
return item;
}
item = item.parent
item = item.parent;
}
return null
return null;
}
function addItem(item) {
items = items.concat([item])
items = items.concat([item]);
}
function removeItem(index) {
const newItems = items.slice()
newItems.splice(index, 1)
items = newItems
const newItems = items.slice();
newItems.splice(index, 1);
items = newItems;
}
StyledText {
@@ -110,11 +110,11 @@ Column {
placeholderText: modelData.placeholder || ""
Component.onCompleted: {
inputRow.inputFields.push(this)
inputRow.inputFields.push(this);
}
Keys.onReturnPressed: {
addButton.clicked()
addButton.clicked();
}
}
}
@@ -126,32 +126,32 @@ Column {
text: I18n.tr("Add")
onClicked: {
let newItem = {}
let hasValue = false
let newItem = {};
let hasValue = false;
for (let i = 0; i < root.fields.length; i++) {
const field = root.fields[i]
const input = inputRow.inputFields[i]
const value = input.text.trim()
const field = root.fields[i];
const input = inputRow.inputFields[i];
const value = input.text.trim();
if (value !== "") {
hasValue = true
hasValue = true;
}
if (field.required && value === "") {
return
return;
}
newItem[field.id] = value || (field.default || "")
newItem[field.id] = value || (field.default || "");
}
if (hasValue) {
root.addItem(newItem)
root.addItem(newItem);
for (let i = 0; i < inputRow.inputFields.length; i++) {
inputRow.inputFields[i].text = ""
inputRow.inputFields[i].text = "";
}
if (inputRow.inputFields.length > 0) {
inputRow.inputFields[0].forceActiveFocus()
inputRow.inputFields[0].forceActiveFocus();
}
}
}
@@ -200,13 +200,13 @@ Column {
required property var modelData
text: {
const field = modelData
const item = itemRow.itemData
const field = modelData;
const item = itemRow.itemData;
if (!field || !field.id || !item) {
return ""
return "";
}
const value = item[field.id]
return value || ""
const value = item[field.id];
return value || "";
}
color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
@@ -239,7 +239,7 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.removeItem(index)
root.removeItem(index);
}
}
}
+10 -10
View File
@@ -20,32 +20,32 @@ Column {
spacing: Theme.spacingS
function loadValue() {
const settings = findSettings()
const settings = findSettings();
if (settings && settings.pluginService) {
value = settings.loadValue(settingKey, defaultValue)
value = settings.loadValue(settingKey, defaultValue);
}
}
Component.onCompleted: {
loadValue()
loadValue();
}
onValueChanged: {
const settings = findSettings()
const settings = findSettings();
if (settings) {
settings.saveValue(settingKey, value)
settings.saveValue(settingKey, value);
}
}
function findSettings() {
let item = parent
let item = parent;
while (item) {
if (item.saveValue !== undefined && item.loadValue !== undefined) {
return item
return item;
}
item = item.parent
item = item.parent;
}
return null
return null;
}
StyledText {
@@ -75,7 +75,7 @@ Column {
wheelEnabled: false
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
onSliderValueChanged: newValue => {
root.value = newValue
root.value = newValue;
}
}
}
+14 -13
View File
@@ -17,35 +17,36 @@ Row {
property bool isInitialized: false
function loadValue() {
const settings = findSettings()
const settings = findSettings();
if (settings && settings.pluginService) {
const loadedValue = settings.loadValue(settingKey, defaultValue)
value = loadedValue
isInitialized = true
const loadedValue = settings.loadValue(settingKey, defaultValue);
value = loadedValue;
isInitialized = true;
}
}
Component.onCompleted: {
Qt.callLater(loadValue)
Qt.callLater(loadValue);
}
onValueChanged: {
if (!isInitialized) return
const settings = findSettings()
if (!isInitialized)
return;
const settings = findSettings();
if (settings) {
settings.saveValue(settingKey, value)
settings.saveValue(settingKey, value);
}
}
function findSettings() {
let item = parent
let item = parent;
while (item) {
if (item.saveValue !== undefined && item.loadValue !== undefined) {
return item
return item;
}
item = item.parent
item = item.parent;
}
return null
return null;
}
Column {
@@ -75,7 +76,7 @@ Row {
anchors.verticalCenter: parent.verticalCenter
checked: root.value
onToggled: isChecked => {
root.value = isChecked
root.value = isChecked;
}
}
}
+1 -1
View File
@@ -171,7 +171,7 @@ Item {
}
}
Text {
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: "DANK LINUX"
font.pixelSize: parent.compactLogo ? 32 : 48
@@ -390,11 +390,9 @@ Item {
}
StyledText {
text: DisplayConfigState.allOutputs[modelData]?.connected
? I18n.tr("Connected") : I18n.tr("Disconnected")
text: DisplayConfigState.allOutputs[modelData]?.connected ? I18n.tr("Connected") : I18n.tr("Disconnected")
font.pixelSize: Theme.fontSizeSmall
color: DisplayConfigState.allOutputs[modelData]?.connected
? Theme.success : Theme.surfaceVariantText
color: DisplayConfigState.allOutputs[modelData]?.connected ? Theme.success : Theme.surfaceVariantText
}
}
}
@@ -2,12 +2,10 @@ pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Modals.Common
import qs.Modals.FileBrowser
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets
+1 -4
View File
@@ -7,10 +7,7 @@ import qs.Modules.Settings.Widgets
Item {
id: root
readonly property var muxTypeOptions: [
"tmux",
"zellij"
]
readonly property var muxTypeOptions: ["tmux", "zellij"]
DankFlickable {
anchors.fill: parent
+2 -2
View File
@@ -23,7 +23,8 @@ FocusScope {
function updateFilteredPlugins() {
var query = searchQuery.toLowerCase();
filteredPlugins = PluginService.availablePluginsList.filter(plugin => {
if (!query) return true;
if (!query)
return true;
var name = (plugin.name || "").toLowerCase();
var desc = (plugin.description || "").toLowerCase();
var author = (plugin.author || "").toLowerCase();
@@ -31,7 +32,6 @@ FocusScope {
});
}
Connections {
target: PluginService
function onAvailablePluginsListChanged() {
@@ -251,17 +251,7 @@ Item {
settingKey: "fontWeight"
text: I18n.tr("Font Weight")
description: I18n.tr("Select font weight for UI text")
options: [
I18n.tr("Thin"),
I18n.tr("Extra Light"),
I18n.tr("Light"),
I18n.tr("Regular"),
I18n.tr("Medium"),
I18n.tr("Demi Bold"),
I18n.tr("Bold"),
I18n.tr("Extra Bold"),
I18n.tr("Black")
]
options: [I18n.tr("Thin"), I18n.tr("Extra Light"), I18n.tr("Light"), I18n.tr("Regular"), I18n.tr("Medium"), I18n.tr("Demi Bold"), I18n.tr("Bold"), I18n.tr("Extra Bold"), I18n.tr("Black")]
currentValue: {
switch (SettingsData.fontWeight) {
case Font.Thin:
@@ -441,13 +431,11 @@ Item {
height: 1
color: Theme.outline
opacity: 0.15
visible: SettingsData.textRenderType === SettingsData.TextRenderType.Qt
}
Item {
width: parent.width
height: visible ? qualityGroup.implicitHeight + qualityLabel.implicitHeight + Theme.spacingS : 0
visible: SettingsData.textRenderType === SettingsData.TextRenderType.Qt
height: qualityGroup.implicitHeight + qualityLabel.implicitHeight + Theme.spacingS
clip: true
StyledText {
@@ -223,7 +223,7 @@ Item {
onClicked: {
if (root.draggingTargetWorkspace === -1) {
root.overviewOpen = false;
HyplandService.focusWorkspace(workspaceValue)
HyplandService.focusWorkspace(workspaceValue);
}
}
}
@@ -352,7 +352,7 @@ Item {
root.draggingTargetWorkspace = -1;
if (targetWorkspace !== -1 && targetWorkspace !== windowData?.workspace.id) {
HyprlandService.moveToWorkspace(targetWorkspace, windowData?.address, false)
HyprlandService.moveToWorkspace(targetWorkspace, windowData?.address, false);
Qt.callLater(() => {
Hyprland.refreshToplevels();
Hyprland.refreshWorkspaces();
-2
View File
@@ -1,8 +1,6 @@
import QtQuick
import Quickshell
import Quickshell.Widgets
import qs.Common
import qs.Services
Item {
id: root
+12 -6
View File
@@ -1,4 +1,3 @@
import QtCore
import QtQuick
import qs.Common
@@ -27,7 +26,6 @@ Column {
readonly property bool effectiveIncrementEnabled: root.onIncrement ? root.incrementEnabled : false
readonly property bool effectiveDecrementEnabled: root.onDecrement ? root.decrementEnabled : false
width: Math.max(buttonSize * 2, root.implicitWidth + horizontalPadding * 2)
spacing: 4
@@ -38,20 +36,27 @@ Column {
iconSize: root.iconSize
buttonSize: root.buttonSize
iconName: root.incrementIconName
onClicked: if (typeof root.onIncrement === 'function') root.onIncrement()
onClicked: if (typeof root.onIncrement === 'function')
root.onIncrement()
tooltipText: root.incrementTooltipText
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
Item { width: 5; height: 1 }
Item {
width: 5
height: 1
}
StyledText {
isMonospace: true
text: root.text
font.pixelSize: root.textSize
color: root.textColor
}
Item { width: 5; height: 1 }
Item {
width: 5
height: 1
}
}
DankActionButton {
@@ -61,7 +66,8 @@ Column {
iconSize: root.iconSize
buttonSize: root.buttonSize
iconName: root.decrementIconName
onClicked: if (typeof root.onDecrement === 'function') root.onDecrement()
onClicked: if (typeof root.onDecrement === 'function')
root.onDecrement()
tooltipText: root.decrementTooltipText
}
}
+3 -2
View File
@@ -1,6 +1,5 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Wayland
import qs.Common
@@ -29,7 +28,9 @@ PanelWindow {
function show() {
mappedVisible = true;
Qt.callLater(() => { isVisible = true; });
Qt.callLater(() => {
isVisible = true;
});
}
function hide() {
+8 -8
View File
@@ -50,21 +50,21 @@ PanelWindow {
margins {
left: {
const screenWidth = targetScreen?.width ?? Screen.width
const screenWidth = targetScreen?.width ?? Screen.width;
if (alignLeft) {
return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX)))
return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX)));
} else if (alignRight) {
return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX - implicitWidth)))
return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX - implicitWidth)));
} else {
return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX - implicitWidth / 2)))
return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX - implicitWidth / 2)));
}
}
top: {
const screenHeight = targetScreen?.height ?? Screen.height
const screenHeight = targetScreen?.height ?? Screen.height;
if (alignLeft || alignRight) {
return Math.round(Math.max(Theme.spacingS, Math.min(screenHeight - implicitHeight - Theme.spacingS, targetY - implicitHeight / 2)))
return Math.round(Math.max(Theme.spacingS, Math.min(screenHeight - implicitHeight - Theme.spacingS, targetY - implicitHeight / 2)));
} else {
return Math.round(Math.max(Theme.spacingS, Math.min(screenHeight - implicitHeight - Theme.spacingS, targetY)))
return Math.round(Math.max(Theme.spacingS, Math.min(screenHeight - implicitHeight - Theme.spacingS, targetY)));
}
}
}
@@ -76,7 +76,7 @@ PanelWindow {
border.width: 1
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
Text {
StyledText {
id: textContent
anchors.centerIn: parent