1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-16 17:22:45 -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
@@ -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();