1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

use Paths.strip helper everywhere for consistency sake

This commit is contained in:
bbedward
2025-09-17 11:08:51 -04:00
parent 344761df00
commit 02300024cf
7 changed files with 19 additions and 33 deletions

View File

@@ -1,11 +1,11 @@
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import QtCore import QtCore
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Common
import qs.Services import qs.Services
Singleton { Singleton {
@@ -26,7 +26,7 @@ Singleton {
property bool hasTriedDefaultSession: false property bool hasTriedDefaultSession: false
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericStateLocation) readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericStateLocation)
readonly property string _stateDir: _stateUrl.startsWith("file://") ? _stateUrl.substring(7) : _stateUrl readonly property string _stateDir: Paths.strip(_stateUrl)
property int nightModeStartHour: 18 property int nightModeStartHour: 18
property int nightModeStartMinute: 0 property int nightModeStartMinute: 0
property int nightModeEndHour: 6 property int nightModeEndHour: 6

View File

@@ -6,6 +6,7 @@ import QtCore
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Common
import qs.Services import qs.Services
Singleton { Singleton {
@@ -113,7 +114,7 @@ Singleton {
readonly property string defaultMonoFontFamily: "Fira Code" readonly property string defaultMonoFontFamily: "Fira Code"
readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation) readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation)
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation) readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
readonly property string _configDir: _configUrl.startsWith("file://") ? _configUrl.substring(7) : _configUrl readonly property string _configDir: Paths.strip(_configUrl)
signal forceTopBarLayoutRefresh signal forceTopBarLayoutRefresh
signal widgetDataChanged signal widgetDataChanged
@@ -802,7 +803,7 @@ Singleton {
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(Paths.strip(root._homeUrl))
if (!qtThemeName) { if (!qtThemeName) {
// When "System Default" is selected, don't modify the config files at all // When "System Default" is selected, don't modify the config files at all
// This preserves the user's existing qt6ct configuration // This preserves the user's existing qt6ct configuration

View File

@@ -7,6 +7,7 @@ import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Services.UPower import Quickshell.Services.UPower
import qs.Common
import qs.Services import qs.Services
import "StockThemes.js" as StockThemes import "StockThemes.js" as StockThemes
@@ -18,15 +19,9 @@ Singleton {
readonly property string dynamic: "dynamic" readonly property string dynamic: "dynamic"
readonly property string homeDir: { readonly property string homeDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.HomeLocation))
const url = StandardPaths.writableLocation(StandardPaths.HomeLocation).toString() readonly property string configDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation))
return url.startsWith("file://") ? url.substring(7) : url readonly property string shellDir: Paths.strip(Qt.resolvedUrl(".").toString()).replace("/Common/", "")
}
readonly property string configDir: {
const url = StandardPaths.writableLocation(StandardPaths.ConfigLocation).toString()
return url.startsWith("file://") ? url.substring(7) : url
}
readonly property string shellDir: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Common/", "")
readonly property string wallpaperPath: { readonly property string wallpaperPath: {
if (typeof SessionData === "undefined") return "" if (typeof SessionData === "undefined") return ""
@@ -77,11 +72,7 @@ Singleton {
property int colorUpdateTrigger: 0 property int colorUpdateTrigger: 0
property var customThemeData: null property var customThemeData: null
readonly property string stateDir: { readonly property string stateDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.CacheLocation).toString()) + "/dankshell"
const cacheHome = StandardPaths.writableLocation(StandardPaths.CacheLocation).toString()
const path = cacheHome.startsWith("file://") ? cacheHome.substring(7) : cacheHome
return path + "/dankshell"
}
Component.onCompleted: { Component.onCompleted: {
Quickshell.execDetached(["mkdir", "-p", stateDir]) Quickshell.execDetached(["mkdir", "-p", stateDir])

View File

@@ -87,7 +87,7 @@ Item {
var currentWallpaper = SessionData.getMonitorWallpaper(screenName) var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
if (screenName && currentWallpaper && currentWallpaper.startsWith("we:")) { if (screenName && currentWallpaper && currentWallpaper.startsWith("we:")) {
const cacheHome = StandardPaths.writableLocation(StandardPaths.CacheLocation).toString() const cacheHome = StandardPaths.writableLocation(StandardPaths.CacheLocation).toString()
const baseDir = cacheHome.startsWith("file://") ? cacheHome.substring(7) : cacheHome const baseDir = Paths.strip(cacheHome)
const screenshotPath = baseDir + "/dankshell/we_screenshots" + "/" + currentWallpaper.substring(3) + ".jpg" const screenshotPath = baseDir + "/dankshell/we_screenshots" + "/" + currentWallpaper.substring(3) + ".jpg"
return screenshotPath return screenshotPath
} }

View File

@@ -2,6 +2,7 @@ import QtCore
import QtQuick import QtQuick
import Quickshell.Io import Quickshell.Io
import Quickshell import Quickshell
import qs.Common
Item { Item {
id: root id: root
@@ -22,7 +23,7 @@ Item {
onExited: (code) => { onExited: (code) => {
if (pendingSceneId !== "") { if (pendingSceneId !== "") {
const cacheHome = StandardPaths.writableLocation(StandardPaths.CacheLocation).toString() const cacheHome = StandardPaths.writableLocation(StandardPaths.CacheLocation).toString()
const baseDir = cacheHome.startsWith("file://") ? cacheHome.substring(7) : cacheHome const baseDir = Paths.strip(cacheHome)
const outDir = baseDir + "/dankshell/we_screenshots" const outDir = baseDir + "/dankshell/we_screenshots"
const outPath = outDir + "/" + pendingSceneId + ".jpg" const outPath = outDir + "/" + pendingSceneId + ".jpg"

View File

@@ -1,20 +1,16 @@
pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtCore import QtCore
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
pragma Singleton import qs.Common
pragma ComponentBehavior: Bound
Singleton { Singleton {
id: root id: root
readonly property string baseDir: { readonly property string baseDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.GenericStateLocation) + "/DankMaterialShell")
var path = StandardPaths.writableLocation(StandardPaths.GenericStateLocation) + "/DankMaterialShell"
if (path.startsWith("file://")) {
return path.substring(7)
}
return path
}
readonly property string filesDir: baseDir + "/notepad-files" readonly property string filesDir: baseDir + "/notepad-files"
readonly property string metadataPath: baseDir + "/notepad-session.json" readonly property string metadataPath: baseDir + "/notepad-session.json"

View File

@@ -362,10 +362,7 @@ Singleton {
if (!image) { if (!image) {
return "" return ""
} }
if (image.startsWith("file://")) { return Paths.strip(image)
return image.substring(7)
}
return image
} }
readonly property int urgency: notification.urgency readonly property int urgency: notification.urgency
readonly property list<NotificationAction> actions: notification.actions readonly property list<NotificationAction> actions: notification.actions