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:
@@ -1,11 +1,11 @@
|
||||
pragma Singleton
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Singleton {
|
||||
@@ -26,7 +26,7 @@ Singleton {
|
||||
|
||||
property bool hasTriedDefaultSession: false
|
||||
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 nightModeStartMinute: 0
|
||||
property int nightModeEndHour: 6
|
||||
|
||||
@@ -6,6 +6,7 @@ import QtCore
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Singleton {
|
||||
@@ -113,7 +114,7 @@ Singleton {
|
||||
readonly property string defaultMonoFontFamily: "Fira Code"
|
||||
readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation)
|
||||
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 widgetDataChanged
|
||||
@@ -802,7 +803,7 @@ Singleton {
|
||||
|
||||
function updateQtIconTheme(themeName) {
|
||||
var qtThemeName = (themeName === "System Default") ? "" : themeName
|
||||
var home = _shq(root._homeUrl.replace("file://", ""))
|
||||
var home = _shq(Paths.strip(root._homeUrl))
|
||||
if (!qtThemeName) {
|
||||
// When "System Default" is selected, don't modify the config files at all
|
||||
// This preserves the user's existing qt6ct configuration
|
||||
|
||||
@@ -7,6 +7,7 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.UPower
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import "StockThemes.js" as StockThemes
|
||||
|
||||
@@ -18,15 +19,9 @@ Singleton {
|
||||
|
||||
readonly property string dynamic: "dynamic"
|
||||
|
||||
readonly property string homeDir: {
|
||||
const url = StandardPaths.writableLocation(StandardPaths.HomeLocation).toString()
|
||||
return url.startsWith("file://") ? url.substring(7) : url
|
||||
}
|
||||
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 homeDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.HomeLocation))
|
||||
readonly property string configDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation))
|
||||
readonly property string shellDir: Paths.strip(Qt.resolvedUrl(".").toString()).replace("/Common/", "")
|
||||
readonly property string wallpaperPath: {
|
||||
if (typeof SessionData === "undefined") return ""
|
||||
|
||||
@@ -77,11 +72,7 @@ Singleton {
|
||||
property int colorUpdateTrigger: 0
|
||||
property var customThemeData: null
|
||||
|
||||
readonly property string stateDir: {
|
||||
const cacheHome = StandardPaths.writableLocation(StandardPaths.CacheLocation).toString()
|
||||
const path = cacheHome.startsWith("file://") ? cacheHome.substring(7) : cacheHome
|
||||
return path + "/dankshell"
|
||||
}
|
||||
readonly property string stateDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.CacheLocation).toString()) + "/dankshell"
|
||||
|
||||
Component.onCompleted: {
|
||||
Quickshell.execDetached(["mkdir", "-p", stateDir])
|
||||
|
||||
@@ -87,7 +87,7 @@ Item {
|
||||
var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
|
||||
if (screenName && currentWallpaper && currentWallpaper.startsWith("we:")) {
|
||||
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"
|
||||
return screenshotPath
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import QtCore
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -22,7 +23,7 @@ Item {
|
||||
onExited: (code) => {
|
||||
if (pendingSceneId !== "") {
|
||||
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 outPath = outDir + "/" + pendingSceneId + ".jpg"
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtCore
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
import qs.Common
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property string baseDir: {
|
||||
var path = StandardPaths.writableLocation(StandardPaths.GenericStateLocation) + "/DankMaterialShell"
|
||||
if (path.startsWith("file://")) {
|
||||
return path.substring(7)
|
||||
}
|
||||
return path
|
||||
}
|
||||
readonly property string baseDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.GenericStateLocation) + "/DankMaterialShell")
|
||||
readonly property string filesDir: baseDir + "/notepad-files"
|
||||
readonly property string metadataPath: baseDir + "/notepad-session.json"
|
||||
|
||||
|
||||
@@ -362,10 +362,7 @@ Singleton {
|
||||
if (!image) {
|
||||
return ""
|
||||
}
|
||||
if (image.startsWith("file://")) {
|
||||
return image.substring(7)
|
||||
}
|
||||
return image
|
||||
return Paths.strip(image)
|
||||
}
|
||||
readonly property int urgency: notification.urgency
|
||||
readonly property list<NotificationAction> actions: notification.actions
|
||||
|
||||
Reference in New Issue
Block a user