mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 05:55:37 -05:00
Customizable date format
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
pragma ComponentBehavior
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property int themeIndex: 0
|
property int themeIndex: 0
|
||||||
@@ -17,7 +15,7 @@ Singleton {
|
|||||||
property real topBarTransparency: 0.75
|
property real topBarTransparency: 0.75
|
||||||
property real topBarWidgetTransparency: 0.85
|
property real topBarWidgetTransparency: 0.85
|
||||||
property real popupTransparency: 0.92
|
property real popupTransparency: 0.92
|
||||||
property real dockTransparency: 1.0
|
property real dockTransparency: 1
|
||||||
property bool use24HourClock: true
|
property bool use24HourClock: true
|
||||||
property bool useFahrenheit: false
|
property bool useFahrenheit: false
|
||||||
property bool nightModeEnabled: false
|
property bool nightModeEnabled: false
|
||||||
@@ -44,29 +42,14 @@ Singleton {
|
|||||||
property bool showWorkspaceIndex: false
|
property bool showWorkspaceIndex: false
|
||||||
property bool showWorkspacePadding: false
|
property bool showWorkspacePadding: false
|
||||||
property bool clockCompactMode: false
|
property bool clockCompactMode: false
|
||||||
|
property string clockDateFormat: "ddd d"
|
||||||
property int mediaSize: 1
|
property int mediaSize: 1
|
||||||
property var topBarLeftWidgets: ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
property var topBarLeftWidgets: ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
||||||
property var topBarCenterWidgets: ["music", "clock", "weather"]
|
property var topBarCenterWidgets: ["music", "clock", "weather"]
|
||||||
property var topBarRightWidgets: ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"]
|
property var topBarRightWidgets: ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"]
|
||||||
|
|
||||||
property alias topBarLeftWidgetsModel: leftWidgetsModel
|
property alias topBarLeftWidgetsModel: leftWidgetsModel
|
||||||
property alias topBarCenterWidgetsModel: centerWidgetsModel
|
property alias topBarCenterWidgetsModel: centerWidgetsModel
|
||||||
property alias topBarRightWidgetsModel: rightWidgetsModel
|
property alias topBarRightWidgetsModel: rightWidgetsModel
|
||||||
|
|
||||||
signal forceTopBarLayoutRefresh
|
|
||||||
signal widgetDataChanged
|
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: leftWidgetsModel
|
|
||||||
}
|
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: centerWidgetsModel
|
|
||||||
}
|
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: rightWidgetsModel
|
|
||||||
}
|
|
||||||
property string appLauncherViewMode: "list"
|
property string appLauncherViewMode: "list"
|
||||||
property string spotlightModalViewMode: "list"
|
property string spotlightModalViewMode: "list"
|
||||||
property string networkPreference: "auto"
|
property string networkPreference: "auto"
|
||||||
@@ -78,7 +61,7 @@ Singleton {
|
|||||||
property bool useOSLogo: false
|
property bool useOSLogo: false
|
||||||
property string osLogoColorOverride: ""
|
property string osLogoColorOverride: ""
|
||||||
property real osLogoBrightness: 0.5
|
property real osLogoBrightness: 0.5
|
||||||
property real osLogoContrast: 1.0
|
property real osLogoContrast: 1
|
||||||
property bool wallpaperDynamicTheming: true
|
property bool wallpaperDynamicTheming: true
|
||||||
property bool weatherEnabled: true
|
property bool weatherEnabled: true
|
||||||
property string fontFamily: "Inter Variable"
|
property string fontFamily: "Inter Variable"
|
||||||
@@ -94,10 +77,8 @@ Singleton {
|
|||||||
property int notificationTimeoutLow: 5000
|
property int notificationTimeoutLow: 5000
|
||||||
property int notificationTimeoutNormal: 5000
|
property int notificationTimeoutNormal: 5000
|
||||||
property int notificationTimeoutCritical: 0
|
property int notificationTimeoutCritical: 0
|
||||||
|
|
||||||
readonly property string defaultFontFamily: "Inter Variable"
|
readonly property string defaultFontFamily: "Inter Variable"
|
||||||
readonly property string defaultMonoFontFamily: "Fira Code"
|
readonly property string defaultMonoFontFamily: "Fira Code"
|
||||||
|
|
||||||
readonly property string _homeUrl: StandardPaths.writableLocation(
|
readonly property string _homeUrl: StandardPaths.writableLocation(
|
||||||
StandardPaths.HomeLocation)
|
StandardPaths.HomeLocation)
|
||||||
readonly property string _configUrl: StandardPaths.writableLocation(
|
readonly property string _configUrl: StandardPaths.writableLocation(
|
||||||
@@ -106,36 +87,8 @@ Singleton {
|
|||||||
"file://") ? _configUrl.substring(
|
"file://") ? _configUrl.substring(
|
||||||
7) : _configUrl
|
7) : _configUrl
|
||||||
|
|
||||||
Timer {
|
signal forceTopBarLayoutRefresh
|
||||||
id: fontCheckTimer
|
signal widgetDataChanged
|
||||||
interval: 3000
|
|
||||||
repeat: false
|
|
||||||
onTriggered: {
|
|
||||||
var availableFonts = Qt.fontFamilies()
|
|
||||||
var missingFonts = []
|
|
||||||
|
|
||||||
if (fontFamily === defaultFontFamily && !availableFonts.includes(
|
|
||||||
defaultFontFamily)) {
|
|
||||||
missingFonts.push(defaultFontFamily)
|
|
||||||
}
|
|
||||||
if (monoFontFamily === defaultMonoFontFamily && !availableFonts.includes(
|
|
||||||
defaultMonoFontFamily)) {
|
|
||||||
missingFonts.push(defaultMonoFontFamily)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (missingFonts.length > 0) {
|
|
||||||
var message = "Missing fonts: " + missingFonts.join(
|
|
||||||
", ") + ". Using system defaults."
|
|
||||||
ToastService.showWarning(message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loadSettings()
|
|
||||||
fontCheckTimer.start()
|
|
||||||
initializeListModels()
|
|
||||||
}
|
|
||||||
|
|
||||||
function initializeListModels() {
|
function initializeListModels() {
|
||||||
updateListModel(leftWidgetsModel, topBarLeftWidgets)
|
updateListModel(leftWidgetsModel, topBarLeftWidgets)
|
||||||
@@ -152,7 +105,8 @@ Singleton {
|
|||||||
if (content && content.trim()) {
|
if (content && content.trim()) {
|
||||||
var settings = JSON.parse(content)
|
var settings = JSON.parse(content)
|
||||||
themeIndex = settings.themeIndex !== undefined ? settings.themeIndex : 0
|
themeIndex = settings.themeIndex !== undefined ? settings.themeIndex : 0
|
||||||
themeIsDynamic = settings.themeIsDynamic !== undefined ? settings.themeIsDynamic : false
|
themeIsDynamic = settings.themeIsDynamic
|
||||||
|
!== undefined ? settings.themeIsDynamic : false
|
||||||
topBarTransparency = settings.topBarTransparency
|
topBarTransparency = settings.topBarTransparency
|
||||||
!== undefined ? (settings.topBarTransparency
|
!== undefined ? (settings.topBarTransparency
|
||||||
> 1 ? settings.topBarTransparency
|
> 1 ? settings.topBarTransparency
|
||||||
@@ -168,17 +122,21 @@ Singleton {
|
|||||||
dockTransparency = settings.dockTransparency
|
dockTransparency = settings.dockTransparency
|
||||||
!== undefined ? (settings.dockTransparency
|
!== undefined ? (settings.dockTransparency
|
||||||
> 1 ? settings.dockTransparency
|
> 1 ? settings.dockTransparency
|
||||||
/ 100 : settings.dockTransparency) : 1.0
|
/ 100 : settings.dockTransparency) : 1
|
||||||
use24HourClock = settings.use24HourClock !== undefined ? settings.use24HourClock : true
|
use24HourClock = settings.use24HourClock
|
||||||
useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false
|
!== undefined ? settings.use24HourClock : true
|
||||||
|
useFahrenheit = settings.useFahrenheit
|
||||||
|
!== undefined ? settings.useFahrenheit : false
|
||||||
nightModeEnabled = settings.nightModeEnabled
|
nightModeEnabled = settings.nightModeEnabled
|
||||||
!== undefined ? settings.nightModeEnabled : false
|
!== undefined ? settings.nightModeEnabled : false
|
||||||
weatherLocation = settings.weatherLocation
|
weatherLocation = settings.weatherLocation
|
||||||
!== undefined ? settings.weatherLocation : "New York, NY"
|
!== undefined ? settings.weatherLocation : "New York, NY"
|
||||||
weatherCoordinates = settings.weatherCoordinates
|
weatherCoordinates = settings.weatherCoordinates
|
||||||
!== undefined ? settings.weatherCoordinates : "40.7128,-74.0060"
|
!== undefined ? settings.weatherCoordinates : "40.7128,-74.0060"
|
||||||
useAutoLocation = settings.useAutoLocation !== undefined ? settings.useAutoLocation : false
|
useAutoLocation = settings.useAutoLocation
|
||||||
weatherEnabled = settings.weatherEnabled !== undefined ? settings.weatherEnabled : true
|
!== undefined ? settings.useAutoLocation : false
|
||||||
|
weatherEnabled = settings.weatherEnabled
|
||||||
|
!== undefined ? settings.weatherEnabled : true
|
||||||
showLauncherButton = settings.showLauncherButton
|
showLauncherButton = settings.showLauncherButton
|
||||||
!== undefined ? settings.showLauncherButton : true
|
!== undefined ? settings.showLauncherButton : true
|
||||||
showWorkspaceSwitcher = settings.showWorkspaceSwitcher
|
showWorkspaceSwitcher = settings.showWorkspaceSwitcher
|
||||||
@@ -192,9 +150,12 @@ Singleton {
|
|||||||
showMemUsage = settings.showMemUsage !== undefined ? settings.showMemUsage : true
|
showMemUsage = settings.showMemUsage !== undefined ? settings.showMemUsage : true
|
||||||
showCpuTemp = settings.showCpuTemp !== undefined ? settings.showCpuTemp : true
|
showCpuTemp = settings.showCpuTemp !== undefined ? settings.showCpuTemp : true
|
||||||
showGpuTemp = settings.showGpuTemp !== undefined ? settings.showGpuTemp : true
|
showGpuTemp = settings.showGpuTemp !== undefined ? settings.showGpuTemp : true
|
||||||
selectedGpuIndex = settings.selectedGpuIndex !== undefined ? settings.selectedGpuIndex : 0
|
selectedGpuIndex = settings.selectedGpuIndex
|
||||||
enabledGpuPciIds = settings.enabledGpuPciIds !== undefined ? settings.enabledGpuPciIds : []
|
!== undefined ? settings.selectedGpuIndex : 0
|
||||||
showSystemTray = settings.showSystemTray !== undefined ? settings.showSystemTray : true
|
enabledGpuPciIds = settings.enabledGpuPciIds
|
||||||
|
!== undefined ? settings.enabledGpuPciIds : []
|
||||||
|
showSystemTray = settings.showSystemTray
|
||||||
|
!== undefined ? settings.showSystemTray : true
|
||||||
showClock = settings.showClock !== undefined ? settings.showClock : true
|
showClock = settings.showClock !== undefined ? settings.showClock : true
|
||||||
showNotificationButton = settings.showNotificationButton
|
showNotificationButton = settings.showNotificationButton
|
||||||
!== undefined ? settings.showNotificationButton : true
|
!== undefined ? settings.showNotificationButton : true
|
||||||
@@ -207,16 +168,23 @@ Singleton {
|
|||||||
!== undefined ? settings.showWorkspacePadding : false
|
!== undefined ? settings.showWorkspacePadding : false
|
||||||
clockCompactMode = settings.clockCompactMode
|
clockCompactMode = settings.clockCompactMode
|
||||||
!== undefined ? settings.clockCompactMode : false
|
!== undefined ? settings.clockCompactMode : false
|
||||||
|
clockDateFormat = settings.clockDateFormat
|
||||||
|
!== undefined ? settings.clockDateFormat : "ddd d"
|
||||||
mediaSize = settings.mediaSize !== undefined ? settings.mediaSize : (settings.mediaCompactMode !== undefined ? (settings.mediaCompactMode ? 0 : 1) : 1)
|
mediaSize = settings.mediaSize !== undefined ? settings.mediaSize : (settings.mediaCompactMode !== undefined ? (settings.mediaCompactMode ? 0 : 1) : 1)
|
||||||
if (settings.topBarWidgetOrder) {
|
if (settings.topBarWidgetOrder) {
|
||||||
topBarLeftWidgets = settings.topBarWidgetOrder.filter(
|
topBarLeftWidgets = settings.topBarWidgetOrder.filter(w => {
|
||||||
w => ["launcherButton", "workspaceSwitcher", "focusedWindow"].includes(
|
return ["launcherButton", "workspaceSwitcher", "focusedWindow"].includes(w)
|
||||||
w))
|
})
|
||||||
topBarCenterWidgets = settings.topBarWidgetOrder.filter(
|
topBarCenterWidgets = settings.topBarWidgetOrder.filter(
|
||||||
w => ["clock", "music", "weather"].includes(w))
|
w => {
|
||||||
|
return ["clock", "music", "weather"].includes(
|
||||||
|
w)
|
||||||
|
})
|
||||||
topBarRightWidgets = settings.topBarWidgetOrder.filter(
|
topBarRightWidgets = settings.topBarWidgetOrder.filter(
|
||||||
w => ["systemTray", "clipboard", "systemResources", "notificationButton", "battery", "controlCenterButton"].includes(
|
w => {
|
||||||
w))
|
return ["systemTray", "clipboard", "systemResources", "notificationButton", "battery", "controlCenterButton"].includes(
|
||||||
|
w)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
var leftWidgets = settings.topBarLeftWidgets
|
var leftWidgets = settings.topBarLeftWidgets
|
||||||
!== undefined ? settings.topBarLeftWidgets : ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
!== undefined ? settings.topBarLeftWidgets : ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
||||||
@@ -224,11 +192,9 @@ Singleton {
|
|||||||
!== undefined ? settings.topBarCenterWidgets : ["music", "clock", "weather"]
|
!== undefined ? settings.topBarCenterWidgets : ["music", "clock", "weather"]
|
||||||
var rightWidgets = settings.topBarRightWidgets
|
var rightWidgets = settings.topBarRightWidgets
|
||||||
!== undefined ? settings.topBarRightWidgets : ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"]
|
!== undefined ? settings.topBarRightWidgets : ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"]
|
||||||
|
|
||||||
topBarLeftWidgets = leftWidgets
|
topBarLeftWidgets = leftWidgets
|
||||||
topBarCenterWidgets = centerWidgets
|
topBarCenterWidgets = centerWidgets
|
||||||
topBarRightWidgets = rightWidgets
|
topBarRightWidgets = rightWidgets
|
||||||
|
|
||||||
updateListModel(leftWidgetsModel, leftWidgets)
|
updateListModel(leftWidgetsModel, leftWidgets)
|
||||||
updateListModel(centerWidgetsModel, centerWidgets)
|
updateListModel(centerWidgetsModel, centerWidgets)
|
||||||
updateListModel(rightWidgetsModel, rightWidgets)
|
updateListModel(rightWidgetsModel, rightWidgets)
|
||||||
@@ -243,11 +209,13 @@ Singleton {
|
|||||||
useOSLogo = settings.useOSLogo !== undefined ? settings.useOSLogo : false
|
useOSLogo = settings.useOSLogo !== undefined ? settings.useOSLogo : false
|
||||||
osLogoColorOverride = settings.osLogoColorOverride
|
osLogoColorOverride = settings.osLogoColorOverride
|
||||||
!== undefined ? settings.osLogoColorOverride : ""
|
!== undefined ? settings.osLogoColorOverride : ""
|
||||||
osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5
|
osLogoBrightness = settings.osLogoBrightness
|
||||||
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1.0
|
!== undefined ? settings.osLogoBrightness : 0.5
|
||||||
|
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1
|
||||||
wallpaperDynamicTheming = settings.wallpaperDynamicTheming
|
wallpaperDynamicTheming = settings.wallpaperDynamicTheming
|
||||||
!== undefined ? settings.wallpaperDynamicTheming : true
|
!== undefined ? settings.wallpaperDynamicTheming : true
|
||||||
fontFamily = settings.fontFamily !== undefined ? settings.fontFamily : defaultFontFamily
|
fontFamily = settings.fontFamily
|
||||||
|
!== undefined ? settings.fontFamily : defaultFontFamily
|
||||||
monoFontFamily = settings.monoFontFamily
|
monoFontFamily = settings.monoFontFamily
|
||||||
!== undefined ? settings.monoFontFamily : defaultMonoFontFamily
|
!== undefined ? settings.monoFontFamily : defaultMonoFontFamily
|
||||||
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal
|
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal
|
||||||
@@ -258,11 +226,16 @@ Singleton {
|
|||||||
showDock = settings.showDock !== undefined ? settings.showDock : false
|
showDock = settings.showDock !== undefined ? settings.showDock : false
|
||||||
dockAutoHide = settings.dockAutoHide !== undefined ? settings.dockAutoHide : false
|
dockAutoHide = settings.dockAutoHide !== undefined ? settings.dockAutoHide : false
|
||||||
cornerRadius = settings.cornerRadius !== undefined ? settings.cornerRadius : 12
|
cornerRadius = settings.cornerRadius !== undefined ? settings.cornerRadius : 12
|
||||||
notificationOverlayEnabled = settings.notificationOverlayEnabled !== undefined ? settings.notificationOverlayEnabled : false
|
notificationOverlayEnabled = settings.notificationOverlayEnabled
|
||||||
topBarAutoHide = settings.topBarAutoHide !== undefined ? settings.topBarAutoHide : false
|
!== undefined ? settings.notificationOverlayEnabled : false
|
||||||
notificationTimeoutLow = settings.notificationTimeoutLow !== undefined ? settings.notificationTimeoutLow : 5000
|
topBarAutoHide = settings.topBarAutoHide
|
||||||
notificationTimeoutNormal = settings.notificationTimeoutNormal !== undefined ? settings.notificationTimeoutNormal : 5000
|
!== undefined ? settings.topBarAutoHide : false
|
||||||
notificationTimeoutCritical = settings.notificationTimeoutCritical !== undefined ? settings.notificationTimeoutCritical : 0
|
notificationTimeoutLow = settings.notificationTimeoutLow
|
||||||
|
!== undefined ? settings.notificationTimeoutLow : 5000
|
||||||
|
notificationTimeoutNormal = settings.notificationTimeoutNormal
|
||||||
|
!== undefined ? settings.notificationTimeoutNormal : 5000
|
||||||
|
notificationTimeoutCritical = settings.notificationTimeoutCritical
|
||||||
|
!== undefined ? settings.notificationTimeoutCritical : 0
|
||||||
applyStoredTheme()
|
applyStoredTheme()
|
||||||
detectAvailableIconThemes()
|
detectAvailableIconThemes()
|
||||||
detectQtTools()
|
detectQtTools()
|
||||||
@@ -311,6 +284,7 @@ Singleton {
|
|||||||
"showWorkspaceIndex": showWorkspaceIndex,
|
"showWorkspaceIndex": showWorkspaceIndex,
|
||||||
"showWorkspacePadding": showWorkspacePadding,
|
"showWorkspacePadding": showWorkspacePadding,
|
||||||
"clockCompactMode": clockCompactMode,
|
"clockCompactMode": clockCompactMode,
|
||||||
|
"clockDateFormat": clockDateFormat,
|
||||||
"mediaSize": mediaSize,
|
"mediaSize": mediaSize,
|
||||||
"topBarLeftWidgets": topBarLeftWidgets,
|
"topBarLeftWidgets": topBarLeftWidgets,
|
||||||
"topBarCenterWidgets": topBarCenterWidgets,
|
"topBarCenterWidgets": topBarCenterWidgets,
|
||||||
@@ -355,22 +329,26 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setClockDateFormat(format) {
|
||||||
|
clockDateFormat = format
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setMediaSize(size) {
|
function setMediaSize(size) {
|
||||||
mediaSize = size
|
mediaSize = size
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyStoredTheme() {
|
function applyStoredTheme() {
|
||||||
if (typeof Theme !== "undefined") {
|
if (typeof Theme !== "undefined")
|
||||||
Theme.switchTheme(themeIndex, themeIsDynamic, false)
|
Theme.switchTheme(themeIndex, themeIsDynamic, false)
|
||||||
} else {
|
else
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (typeof Theme !== "undefined") {
|
if (typeof Theme !== "undefined")
|
||||||
Theme.switchTheme(themeIndex, themeIsDynamic, false)
|
Theme.switchTheme(themeIndex,
|
||||||
}
|
themeIsDynamic, false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function setTheme(index, isDynamic) {
|
function setTheme(index, isDynamic) {
|
||||||
themeIndex = index
|
themeIndex = index
|
||||||
@@ -529,22 +507,22 @@ Singleton {
|
|||||||
var widgetId = typeof order[i] === "string" ? order[i] : order[i].id
|
var widgetId = typeof order[i] === "string" ? order[i] : order[i].id
|
||||||
var enabled = typeof order[i] === "string" ? true : order[i].enabled
|
var enabled = typeof order[i] === "string" ? true : order[i].enabled
|
||||||
var size = typeof order[i] === "string" ? undefined : order[i].size
|
var size = typeof order[i] === "string" ? undefined : order[i].size
|
||||||
var selectedGpuIndex = typeof order[i] === "string" ? undefined : order[i].selectedGpuIndex
|
var selectedGpuIndex = typeof order[i]
|
||||||
|
=== "string" ? undefined : order[i].selectedGpuIndex
|
||||||
var pciId = typeof order[i] === "string" ? undefined : order[i].pciId
|
var pciId = typeof order[i] === "string" ? undefined : order[i].pciId
|
||||||
|
|
||||||
var item = {
|
var item = {
|
||||||
"widgetId": widgetId,
|
"widgetId": widgetId,
|
||||||
"enabled": enabled
|
"enabled": enabled
|
||||||
}
|
}
|
||||||
if (size !== undefined) {
|
if (size !== undefined)
|
||||||
item.size = size
|
item.size = size
|
||||||
}
|
|
||||||
if (selectedGpuIndex !== undefined) {
|
if (selectedGpuIndex !== undefined)
|
||||||
item.selectedGpuIndex = selectedGpuIndex
|
item.selectedGpuIndex = selectedGpuIndex
|
||||||
}
|
|
||||||
if (pciId !== undefined) {
|
if (pciId !== undefined)
|
||||||
item.pciId = pciId
|
item.pciId = pciId
|
||||||
}
|
|
||||||
listModel.append(item)
|
listModel.append(item)
|
||||||
}
|
}
|
||||||
// Emit signal to notify widgets that data has changed
|
// Emit signal to notify widgets that data has changed
|
||||||
@@ -555,15 +533,12 @@ Singleton {
|
|||||||
var defaultLeft = ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
var defaultLeft = ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
||||||
var defaultCenter = ["music", "clock", "weather"]
|
var defaultCenter = ["music", "clock", "weather"]
|
||||||
var defaultRight = ["systemTray", "clipboard", "notificationButton", "battery", "controlCenterButton"]
|
var defaultRight = ["systemTray", "clipboard", "notificationButton", "battery", "controlCenterButton"]
|
||||||
|
|
||||||
topBarLeftWidgets = defaultLeft
|
topBarLeftWidgets = defaultLeft
|
||||||
topBarCenterWidgets = defaultCenter
|
topBarCenterWidgets = defaultCenter
|
||||||
topBarRightWidgets = defaultRight
|
topBarRightWidgets = defaultRight
|
||||||
|
|
||||||
updateListModel(leftWidgetsModel, defaultLeft)
|
updateListModel(leftWidgetsModel, defaultLeft)
|
||||||
updateListModel(centerWidgetsModel, defaultCenter)
|
updateListModel(centerWidgetsModel, defaultCenter)
|
||||||
updateListModel(rightWidgetsModel, defaultRight)
|
updateListModel(rightWidgetsModel, defaultRight)
|
||||||
|
|
||||||
showLauncherButton = true
|
showLauncherButton = true
|
||||||
showWorkspaceSwitcher = true
|
showWorkspaceSwitcher = true
|
||||||
showFocusedWindow = true
|
showFocusedWindow = true
|
||||||
@@ -630,16 +605,13 @@ Singleton {
|
|||||||
updateGtkIconTheme(themeName)
|
updateGtkIconTheme(themeName)
|
||||||
updateQtIconTheme(themeName)
|
updateQtIconTheme(themeName)
|
||||||
saveSettings()
|
saveSettings()
|
||||||
|
|
||||||
if (typeof Theme !== "undefined" && Theme.isDynamicTheme
|
if (typeof Theme !== "undefined" && Theme.isDynamicTheme
|
||||||
&& typeof Colors !== "undefined") {
|
&& typeof Colors !== "undefined")
|
||||||
Colors.generateSystemThemes()
|
Colors.generateSystemThemes()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function updateGtkIconTheme(themeName) {
|
function updateGtkIconTheme(themeName) {
|
||||||
var gtkThemeName = (themeName === "System Default") ? systemDefaultIconTheme : themeName
|
var gtkThemeName = (themeName === "System Default") ? systemDefaultIconTheme : themeName
|
||||||
|
|
||||||
if (gtkThemeName !== "System Default" && gtkThemeName !== "") {
|
if (gtkThemeName !== "System Default" && gtkThemeName !== "") {
|
||||||
var script = "if command -v gsettings >/dev/null 2>&1 && gsettings list-schemas | grep -q org.gnome.desktop.interface; then\n"
|
var script = "if command -v gsettings >/dev/null 2>&1 && gsettings list-schemas | grep -q org.gnome.desktop.interface; then\n"
|
||||||
+ " gsettings set org.gnome.desktop.interface icon-theme '" + gtkThemeName + "'\n" + " echo 'Updated via gsettings'\n" + "elif command -v dconf >/dev/null 2>&1; then\n" + " dconf write /org/gnome/desktop/interface/icon-theme \\\"" + gtkThemeName + "\\\"\n"
|
+ " gsettings set org.gnome.desktop.interface icon-theme '" + gtkThemeName + "'\n" + " echo 'Updated via gsettings'\n" + "elif command -v dconf >/dev/null 2>&1; then\n" + " dconf write /org/gnome/desktop/interface/icon-theme \\\"" + gtkThemeName + "\\\"\n"
|
||||||
@@ -649,14 +621,12 @@ Singleton {
|
|||||||
+ " # Add icon theme setting to [Settings] section or create it\n" + " if grep -q '\\[Settings\\]' \"$settings_file\"; then\n" + " sed -i '/\\[Settings\\]/a gtk-icon-theme-name=" + gtkThemeName + "' \"$settings_file\"\n" + " else\n" + " echo -e '\\n[Settings]\\ngtk-icon-theme-name=" + gtkThemeName
|
+ " # Add icon theme setting to [Settings] section or create it\n" + " if grep -q '\\[Settings\\]' \"$settings_file\"; then\n" + " sed -i '/\\[Settings\\]/a gtk-icon-theme-name=" + gtkThemeName + "' \"$settings_file\"\n" + " else\n" + " echo -e '\\n[Settings]\\ngtk-icon-theme-name=" + gtkThemeName
|
||||||
+ "' >> \"$settings_file\"\n" + " fi\n" + " fi\n" + " else\n" + " # Create new settings.ini file\n" + " echo -e '[Settings]\\ngtk-icon-theme-name=" + gtkThemeName + "' > \"$settings_file\"\n"
|
+ "' >> \"$settings_file\"\n" + " fi\n" + " fi\n" + " else\n" + " # Create new settings.ini file\n" + " echo -e '[Settings]\\ngtk-icon-theme-name=" + gtkThemeName + "' > \"$settings_file\"\n"
|
||||||
+ " fi\n" + " echo \"Updated $settings_file\"\n" + "done\n" + "\n" + "# Clear icon cache and force refresh\n" + "rm -rf ~/.cache/icon-cache ~/.cache/thumbnails 2>/dev/null || true\n" + "# Send SIGHUP to running GTK applications to reload themes (Fedora-specific)\n" + "pkill -HUP -f 'gtk' 2>/dev/null || true\n"
|
+ " fi\n" + " echo \"Updated $settings_file\"\n" + "done\n" + "\n" + "# Clear icon cache and force refresh\n" + "rm -rf ~/.cache/icon-cache ~/.cache/thumbnails 2>/dev/null || true\n" + "# Send SIGHUP to running GTK applications to reload themes (Fedora-specific)\n" + "pkill -HUP -f 'gtk' 2>/dev/null || true\n"
|
||||||
|
|
||||||
Quickshell.execDetached(["sh", "-lc", script])
|
Quickshell.execDetached(["sh", "-lc", script])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateQtIconTheme(themeName) {
|
function updateQtIconTheme(themeName) {
|
||||||
var qtThemeName = (themeName === "System Default") ? "" : themeName
|
var qtThemeName = (themeName === "System Default") ? "" : themeName
|
||||||
|
|
||||||
var home = _shq(root._homeUrl.replace("file://", ""))
|
var home = _shq(root._homeUrl.replace("file://", ""))
|
||||||
if (!qtThemeName) {
|
if (!qtThemeName) {
|
||||||
var revertScript = "remove_icon_theme() {\n"
|
var revertScript = "remove_icon_theme() {\n"
|
||||||
@@ -667,11 +637,9 @@ Singleton {
|
|||||||
+ "/qt6ct/qt6ct.conf\n" + "rm -f " + _configDir + "/environment.d/95-qtct.conf 2>/dev/null || true\n"
|
+ "/qt6ct/qt6ct.conf\n" + "rm -f " + _configDir + "/environment.d/95-qtct.conf 2>/dev/null || true\n"
|
||||||
+ "rm -rf " + home + "/.cache/icon-cache " + home
|
+ "rm -rf " + home + "/.cache/icon-cache " + home
|
||||||
+ "/.cache/thumbnails 2>/dev/null || true\n"
|
+ "/.cache/thumbnails 2>/dev/null || true\n"
|
||||||
|
|
||||||
Quickshell.execDetached(["sh", "-lc", revertScript])
|
Quickshell.execDetached(["sh", "-lc", revertScript])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var script = "mkdir -p " + _configDir + "/qt5ct " + _configDir + "/qt6ct " + _configDir + "/environment.d 2>/dev/null || true\n" + "update_qt_config() {\n" + " local config_file=\"$1\"\n"
|
var script = "mkdir -p " + _configDir + "/qt5ct " + _configDir + "/qt6ct " + _configDir + "/environment.d 2>/dev/null || true\n" + "update_qt_config() {\n" + " local config_file=\"$1\"\n"
|
||||||
+ " local theme_name=\"$2\"\n" + " if [ -f \"$config_file\" ]; then\n" + " if grep -q '^\\[Appearance\\]' \"$config_file\"; then\n" + " awk -v theme=\"$theme_name\" '\n" + " BEGIN { in_appearance = 0; icon_theme_added = 0 }\n" + " /^\\[Appearance\\]/ { in_appearance = 1; print; next }\n" + " /^\\[/ && !/^\\[Appearance\\]/ { \n" + " if (in_appearance && !icon_theme_added) { \n"
|
+ " local theme_name=\"$2\"\n" + " if [ -f \"$config_file\" ]; then\n" + " if grep -q '^\\[Appearance\\]' \"$config_file\"; then\n" + " awk -v theme=\"$theme_name\" '\n" + " BEGIN { in_appearance = 0; icon_theme_added = 0 }\n" + " /^\\[Appearance\\]/ { in_appearance = 1; print; next }\n" + " /^\\[/ && !/^\\[Appearance\\]/ { \n" + " if (in_appearance && !icon_theme_added) { \n"
|
||||||
+ " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n" + " in_appearance = 0; print; next \n" + " }\n" + " in_appearance && /^icon_theme=/ { \n" + " if (!icon_theme_added) { \n" + " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n"
|
+ " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n" + " in_appearance = 0; print; next \n" + " }\n" + " in_appearance && /^icon_theme=/ { \n" + " if (!icon_theme_added) { \n" + " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n"
|
||||||
@@ -679,7 +647,6 @@ Singleton {
|
|||||||
+ " else\n" + " printf '[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" > \"$config_file\"\n" + " fi\n" + "}\n" + "update_qt_config " + _configDir + "/qt5ct/qt5ct.conf " + _shq(
|
+ " else\n" + " printf '[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" > \"$config_file\"\n" + " fi\n" + "}\n" + "update_qt_config " + _configDir + "/qt5ct/qt5ct.conf " + _shq(
|
||||||
qtThemeName) + "\n" + "update_qt_config " + _configDir + "/qt6ct/qt6ct.conf " + _shq(qtThemeName) + "\n"
|
qtThemeName) + "\n" + "update_qt_config " + _configDir + "/qt6ct/qt6ct.conf " + _shq(qtThemeName) + "\n"
|
||||||
+ "rm -rf " + home + "/.cache/icon-cache " + home + "/.cache/thumbnails 2>/dev/null || true\n"
|
+ "rm -rf " + home + "/.cache/icon-cache " + home + "/.cache/thumbnails 2>/dev/null || true\n"
|
||||||
|
|
||||||
Quickshell.execDetached(["sh", "-lc", script])
|
Quickshell.execDetached(["sh", "-lc", script])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,6 +749,48 @@ Singleton {
|
|||||||
return "'" + String(s).replace(/'/g, "'\\''") + "'"
|
return "'" + String(s).replace(/'/g, "'\\''") + "'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
loadSettings()
|
||||||
|
fontCheckTimer.start()
|
||||||
|
initializeListModels()
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: leftWidgetsModel
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: centerWidgetsModel
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: rightWidgetsModel
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: fontCheckTimer
|
||||||
|
|
||||||
|
interval: 3000
|
||||||
|
repeat: false
|
||||||
|
onTriggered: {
|
||||||
|
var availableFonts = Qt.fontFamilies()
|
||||||
|
var missingFonts = []
|
||||||
|
if (fontFamily === defaultFontFamily && !availableFonts.includes(
|
||||||
|
defaultFontFamily))
|
||||||
|
missingFonts.push(defaultFontFamily)
|
||||||
|
|
||||||
|
if (monoFontFamily === defaultMonoFontFamily
|
||||||
|
&& !availableFonts.includes(defaultMonoFontFamily))
|
||||||
|
missingFonts.push(defaultMonoFontFamily)
|
||||||
|
|
||||||
|
if (missingFonts.length > 0) {
|
||||||
|
var message = "Missing fonts: " + missingFonts.join(
|
||||||
|
", ") + ". Using system defaults."
|
||||||
|
ToastService.showWarning(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileView {
|
FileView {
|
||||||
id: settingsFile
|
id: settingsFile
|
||||||
|
|
||||||
@@ -800,20 +809,21 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: systemDefaultDetectionProcess
|
id: systemDefaultDetectionProcess
|
||||||
|
|
||||||
command: ["sh", "-c", "gsettings get org.gnome.desktop.interface icon-theme 2>/dev/null | sed \"s/'//g\" || echo ''"]
|
command: ["sh", "-c", "gsettings get org.gnome.desktop.interface icon-theme 2>/dev/null | sed \"s/'//g\" || echo ''"]
|
||||||
running: false
|
running: false
|
||||||
onExited: exitCode => {
|
onExited: exitCode => {
|
||||||
if (exitCode === 0 && stdout && stdout.length > 0) {
|
if (exitCode === 0 && stdout && stdout.length > 0)
|
||||||
systemDefaultIconTheme = stdout.trim()
|
systemDefaultIconTheme = stdout.trim()
|
||||||
} else {
|
else
|
||||||
systemDefaultIconTheme = ""
|
systemDefaultIconTheme = ""
|
||||||
}
|
|
||||||
iconThemeDetectionProcess.running = true
|
iconThemeDetectionProcess.running = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: iconThemeDetectionProcess
|
id: iconThemeDetectionProcess
|
||||||
|
|
||||||
command: ["sh", "-c", "find /usr/share/icons ~/.local/share/icons ~/.icons -maxdepth 1 -type d 2>/dev/null | sed 's|.*/||' | grep -v '^icons$' | sort -u"]
|
command: ["sh", "-c", "find /usr/share/icons ~/.local/share/icons ~/.icons -maxdepth 1 -type d 2>/dev/null | sed 's|.*/||' | grep -v '^icons$' | sort -u"]
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
@@ -825,11 +835,10 @@ Singleton {
|
|||||||
for (var i = 0; i < themes.length; i++) {
|
for (var i = 0; i < themes.length; i++) {
|
||||||
var theme = themes[i].trim()
|
var theme = themes[i].trim()
|
||||||
if (theme && theme !== "" && theme !== "default"
|
if (theme && theme !== "" && theme !== "default"
|
||||||
&& theme !== "hicolor" && theme !== "locolor") {
|
&& theme !== "hicolor" && theme !== "locolor")
|
||||||
detectedThemes.push(theme)
|
detectedThemes.push(theme)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
availableIconThemes = detectedThemes
|
availableIconThemes = detectedThemes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -837,6 +846,7 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: qtToolsDetectionProcess
|
id: qtToolsDetectionProcess
|
||||||
|
|
||||||
command: ["sh", "-c", "echo -n 'qt5ct:'; command -v qt5ct >/dev/null && echo 'true' || echo 'false'; echo -n 'qt6ct:'; command -v qt6ct >/dev/null && echo 'true' || echo 'false'"]
|
command: ["sh", "-c", "echo -n 'qt5ct:'; command -v qt5ct >/dev/null && echo 'true' || echo 'false'; echo -n 'qt6ct:'; command -v qt6ct >/dev/null && echo 'true' || echo 'false'"]
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
@@ -846,14 +856,13 @@ Singleton {
|
|||||||
var lines = text.trim().split('\n')
|
var lines = text.trim().split('\n')
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
var line = lines[i]
|
var line = lines[i]
|
||||||
if (line.startsWith('qt5ct:')) {
|
if (line.startsWith('qt5ct:'))
|
||||||
qt5ctAvailable = line.split(':')[1] === 'true'
|
qt5ctAvailable = line.split(':')[1] === 'true'
|
||||||
} else if (line.startsWith('qt6ct:')) {
|
else if (line.startsWith('qt6ct:'))
|
||||||
qt6ctAvailable = line.split(':')[1] === 'true'
|
qt6ctAvailable = line.split(':')[1] === 'true'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: mainColumn
|
id: mainColumn
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingXL
|
spacing: Theme.spacingXL
|
||||||
|
|
||||||
@@ -28,7 +29,9 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
sourceComponent: weatherComponent
|
sourceComponent: weatherComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time Format Component
|
// Time Format Component
|
||||||
@@ -39,10 +42,8 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: timeSection.implicitHeight + Theme.spacingL * 2
|
height: timeSection.implicitHeight + Theme.spacingL * 2
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
||||||
Theme.surfaceVariant.b, 0.3)
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
|
||||||
Theme.outline.b, 0.2)
|
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -70,6 +71,7 @@ Item {
|
|||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DankToggle {
|
DankToggle {
|
||||||
@@ -77,14 +79,208 @@ Item {
|
|||||||
text: "24-Hour Format"
|
text: "24-Hour Format"
|
||||||
description: "Use 24-hour time format instead of 12-hour AM/PM"
|
description: "Use 24-hour time format instead of 12-hour AM/PM"
|
||||||
checked: SettingsData.use24HourClock
|
checked: SettingsData.use24HourClock
|
||||||
onToggled: checked => {
|
onToggled: (checked) => {
|
||||||
return SettingsData.setClockFormat(checked)
|
return SettingsData.setClockFormat(checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Date Format"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankDropdown {
|
||||||
|
width: parent.width
|
||||||
|
height: 50
|
||||||
|
text: "Format"
|
||||||
|
description: "Preview: " + Qt.formatDate(new Date(), SettingsData.clockDateFormat)
|
||||||
|
currentValue: {
|
||||||
|
// Find matching preset or show "Custom"
|
||||||
|
const presets = [{
|
||||||
|
"format": "ddd d",
|
||||||
|
"label": "Day Date"
|
||||||
|
}, {
|
||||||
|
"format": "ddd MMM d",
|
||||||
|
"label": "Day Month Date"
|
||||||
|
}, {
|
||||||
|
"format": "MMM d",
|
||||||
|
"label": "Month Date"
|
||||||
|
}, {
|
||||||
|
"format": "M/d",
|
||||||
|
"label": "Numeric (M/D)"
|
||||||
|
}, {
|
||||||
|
"format": "d/M",
|
||||||
|
"label": "Numeric (D/M)"
|
||||||
|
}, {
|
||||||
|
"format": "ddd d MMM yyyy",
|
||||||
|
"label": "Full with Year"
|
||||||
|
}, {
|
||||||
|
"format": "yyyy-MM-dd",
|
||||||
|
"label": "ISO Date"
|
||||||
|
}, {
|
||||||
|
"format": "dddd, MMMM d",
|
||||||
|
"label": "Full Day & Month"
|
||||||
|
}];
|
||||||
|
const match = presets.find((p) => {
|
||||||
|
return p.format === SettingsData.clockDateFormat;
|
||||||
|
});
|
||||||
|
return match ? match.label : "Custom: " + SettingsData.clockDateFormat;
|
||||||
|
}
|
||||||
|
options: ["Day Date", "Day Month Date", "Month Date", "Numeric (M/D)", "Numeric (D/M)", "Full with Year", "ISO Date", "Full Day & Month", "Custom..."]
|
||||||
|
onValueChanged: (value) => {
|
||||||
|
const formatMap = {
|
||||||
|
"Day Date": "ddd d",
|
||||||
|
"Day Month Date": "ddd MMM d",
|
||||||
|
"Month Date": "MMM d",
|
||||||
|
"Numeric (M/D)": "M/d",
|
||||||
|
"Numeric (D/M)": "d/M",
|
||||||
|
"Full with Year": "ddd d MMM yyyy",
|
||||||
|
"ISO Date": "yyyy-MM-dd",
|
||||||
|
"Full Day & Month": "dddd, MMMM d"
|
||||||
|
};
|
||||||
|
if (value === "Custom...") {
|
||||||
|
customFormatInput.visible = true;
|
||||||
|
} else {
|
||||||
|
customFormatInput.visible = false;
|
||||||
|
SettingsData.setClockDateFormat(formatMap[value]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: customFormatInput
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
visible: false
|
||||||
|
placeholderText: "Enter custom format (e.g., ddd MMM d)"
|
||||||
|
text: SettingsData.clockDateFormat
|
||||||
|
onTextChanged: {
|
||||||
|
if (visible && text)
|
||||||
|
SettingsData.setClockDateFormat(text);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: formatHelp.implicitHeight + Theme.spacingM * 2
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2)
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: formatHelp
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingM
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Format Legend"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.primary
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
Column {
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• d - Day (1-31)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• dd - Day (01-31)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• ddd - Day name (Mon)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• dddd - Day name (Monday)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• M - Month (1-12)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• MM - Month (01-12)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• MMM - Month (Jan)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• MMMM - Month (January)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• yy - Year (24)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "• yyyy - Year (2024)"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Weather Component
|
// Weather Component
|
||||||
Component {
|
Component {
|
||||||
id: weatherComponent
|
id: weatherComponent
|
||||||
@@ -93,10 +289,8 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: weatherSection.implicitHeight + Theme.spacingL * 2
|
height: weatherSection.implicitHeight + Theme.spacingL * 2
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
||||||
Theme.surfaceVariant.b, 0.3)
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
|
||||||
Theme.outline.b, 0.2)
|
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -124,6 +318,7 @@ Item {
|
|||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DankToggle {
|
DankToggle {
|
||||||
@@ -131,8 +326,8 @@ Item {
|
|||||||
text: "Enable Weather"
|
text: "Enable Weather"
|
||||||
description: "Show weather information in top bar and centcom center"
|
description: "Show weather information in top bar and centcom center"
|
||||||
checked: SettingsData.weatherEnabled
|
checked: SettingsData.weatherEnabled
|
||||||
onToggled: checked => {
|
onToggled: (checked) => {
|
||||||
return SettingsData.setWeatherEnabled(checked)
|
return SettingsData.setWeatherEnabled(checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,8 +337,8 @@ Item {
|
|||||||
description: "Use Fahrenheit instead of Celsius for temperature"
|
description: "Use Fahrenheit instead of Celsius for temperature"
|
||||||
checked: SettingsData.useFahrenheit
|
checked: SettingsData.useFahrenheit
|
||||||
enabled: SettingsData.weatherEnabled
|
enabled: SettingsData.weatherEnabled
|
||||||
onToggled: checked => {
|
onToggled: (checked) => {
|
||||||
return SettingsData.setTemperatureUnit(checked)
|
return SettingsData.setTemperatureUnit(checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,8 +348,8 @@ Item {
|
|||||||
description: "Allow wttr.in to determine location based on IP address"
|
description: "Allow wttr.in to determine location based on IP address"
|
||||||
checked: SettingsData.useAutoLocation
|
checked: SettingsData.useAutoLocation
|
||||||
enabled: SettingsData.weatherEnabled
|
enabled: SettingsData.weatherEnabled
|
||||||
onToggled: checked => {
|
onToggled: (checked) => {
|
||||||
return SettingsData.setAutoLocation(checked)
|
return SettingsData.setAutoLocation(checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,12 +370,16 @@ Item {
|
|||||||
currentLocation: SettingsData.weatherLocation
|
currentLocation: SettingsData.weatherLocation
|
||||||
placeholderText: "New York, NY"
|
placeholderText: "New York, NY"
|
||||||
onLocationSelected: (displayName, coordinates) => {
|
onLocationSelected: (displayName, coordinates) => {
|
||||||
SettingsData.setWeatherLocation(displayName,
|
SettingsData.setWeatherLocation(displayName, coordinates);
|
||||||
coordinates)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,18 +12,17 @@ Rectangle {
|
|||||||
property var popupTarget: null
|
property var popupTarget: null
|
||||||
property var parentScreen: null
|
property var parentScreen: null
|
||||||
|
|
||||||
signal clockClicked
|
signal clockClicked()
|
||||||
|
|
||||||
width: clockRow.implicitWidth + Theme.spacingS * 2
|
width: clockRow.implicitWidth + Theme.spacingS * 2
|
||||||
height: 30
|
height: 30
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
const baseColor = clockMouseArea.containsMouse ? Theme.primaryHover : Theme.surfaceTextHover
|
const baseColor = clockMouseArea.containsMouse ? Theme.primaryHover : Theme.surfaceTextHover;
|
||||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
||||||
baseColor.a * Theme.widgetTransparency)
|
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
root.currentDate = systemClock.date
|
root.currentDate = systemClock.date;
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -33,9 +32,7 @@ Rectangle {
|
|||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SettingsData.use24HourClock ? Qt.formatTime(root.currentDate,
|
text: SettingsData.use24HourClock ? Qt.formatTime(root.currentDate, "H:mm") : Qt.formatTime(root.currentDate, "h:mm AP")
|
||||||
"H:mm") : Qt.formatTime(
|
|
||||||
root.currentDate, "h:mm AP")
|
|
||||||
font.pixelSize: Theme.fontSizeMedium - 1
|
font.pixelSize: Theme.fontSizeMedium - 1
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@@ -50,12 +47,13 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: Qt.formatDate(root.currentDate, "ddd d")
|
text: Qt.formatDate(root.currentDate, SettingsData.clockDateFormat)
|
||||||
font.pixelSize: Theme.fontSizeMedium - 1
|
font.pixelSize: Theme.fontSizeMedium - 1
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: !SettingsData.clockCompactMode
|
visible: !SettingsData.clockCompactMode
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemClock {
|
SystemClock {
|
||||||
@@ -73,15 +71,13 @@ Rectangle {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (popupTarget && popupTarget.setTriggerPosition) {
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
var globalPos = mapToGlobal(0, 0)
|
var globalPos = mapToGlobal(0, 0);
|
||||||
var currentScreen = parentScreen || Screen
|
var currentScreen = parentScreen || Screen;
|
||||||
var screenX = currentScreen.x || 0
|
var screenX = currentScreen.x || 0;
|
||||||
var relativeX = globalPos.x - screenX
|
var relativeX = globalPos.x - screenX;
|
||||||
popupTarget.setTriggerPosition(relativeX,
|
popupTarget.setTriggerPosition(relativeX, Theme.barHeight + Theme.spacingXS, width, section, currentScreen);
|
||||||
Theme.barHeight + Theme.spacingXS,
|
|
||||||
width, section, currentScreen)
|
|
||||||
}
|
}
|
||||||
root.clockClicked()
|
root.clockClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,5 +86,7 @@ Rectangle {
|
|||||||
duration: Theme.shortDuration
|
duration: Theme.shortDuration
|
||||||
easing.type: Theme.standardEasing
|
easing.type: Theme.standardEasing
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user