mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
migrate default font family props to Theme
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,8 +11,8 @@ Singleton {
|
||||
id: root
|
||||
|
||||
readonly property string configPath: {
|
||||
const greetCfgDir = Quickshell.env("DMS_GREET_CFG_DIR") || "/etc/greetd/.dms"
|
||||
return greetCfgDir + "/settings.json"
|
||||
const greetCfgDir = Quickshell.env("DMS_GREET_CFG_DIR") || "/etc/greetd/.dms";
|
||||
return greetCfgDir + "/settings.json";
|
||||
}
|
||||
|
||||
property string currentThemeName: "blue"
|
||||
@@ -44,64 +44,61 @@ Singleton {
|
||||
property int animationSpeed: 2
|
||||
property string wallpaperFillMode: "Fill"
|
||||
|
||||
readonly property string defaultFontFamily: "Inter Variable"
|
||||
readonly property string defaultMonoFontFamily: "Fira Code"
|
||||
|
||||
function parseSettings(content) {
|
||||
try {
|
||||
if (content && content.trim()) {
|
||||
const settings = JSON.parse(content)
|
||||
currentThemeName = settings.currentThemeName !== undefined ? settings.currentThemeName : "blue"
|
||||
customThemeFile = settings.customThemeFile !== undefined ? settings.customThemeFile : ""
|
||||
matugenScheme = settings.matugenScheme !== undefined ? settings.matugenScheme : "scheme-tonal-spot"
|
||||
use24HourClock = settings.use24HourClock !== undefined ? settings.use24HourClock : true
|
||||
showSeconds = settings.showSeconds !== undefined ? settings.showSeconds : false
|
||||
useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false
|
||||
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false
|
||||
weatherLocation = settings.weatherLocation !== undefined ? settings.weatherLocation : "New York, NY"
|
||||
weatherCoordinates = settings.weatherCoordinates !== undefined ? settings.weatherCoordinates : "40.7128,-74.0060"
|
||||
useAutoLocation = settings.useAutoLocation !== undefined ? settings.useAutoLocation : false
|
||||
weatherEnabled = settings.weatherEnabled !== undefined ? settings.weatherEnabled : true
|
||||
iconTheme = settings.iconTheme !== undefined ? settings.iconTheme : "System Default"
|
||||
useOSLogo = settings.useOSLogo !== undefined ? settings.useOSLogo : false
|
||||
osLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : ""
|
||||
osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5
|
||||
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1
|
||||
fontFamily = settings.fontFamily !== undefined ? settings.fontFamily : defaultFontFamily
|
||||
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily
|
||||
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal
|
||||
fontScale = settings.fontScale !== undefined ? settings.fontScale : 1.0
|
||||
cornerRadius = settings.cornerRadius !== undefined ? settings.cornerRadius : 12
|
||||
widgetBackgroundColor = settings.widgetBackgroundColor !== undefined ? settings.widgetBackgroundColor : "sch"
|
||||
lockDateFormat = settings.lockDateFormat !== undefined ? settings.lockDateFormat : ""
|
||||
lockScreenShowPowerActions = settings.lockScreenShowPowerActions !== undefined ? settings.lockScreenShowPowerActions : true
|
||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({})
|
||||
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : 2
|
||||
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill"
|
||||
settingsLoaded = true
|
||||
const settings = JSON.parse(content);
|
||||
currentThemeName = settings.currentThemeName !== undefined ? settings.currentThemeName : "blue";
|
||||
customThemeFile = settings.customThemeFile !== undefined ? settings.customThemeFile : "";
|
||||
matugenScheme = settings.matugenScheme !== undefined ? settings.matugenScheme : "scheme-tonal-spot";
|
||||
use24HourClock = settings.use24HourClock !== undefined ? settings.use24HourClock : true;
|
||||
showSeconds = settings.showSeconds !== undefined ? settings.showSeconds : false;
|
||||
useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false;
|
||||
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false;
|
||||
weatherLocation = settings.weatherLocation !== undefined ? settings.weatherLocation : "New York, NY";
|
||||
weatherCoordinates = settings.weatherCoordinates !== undefined ? settings.weatherCoordinates : "40.7128,-74.0060";
|
||||
useAutoLocation = settings.useAutoLocation !== undefined ? settings.useAutoLocation : false;
|
||||
weatherEnabled = settings.weatherEnabled !== undefined ? settings.weatherEnabled : true;
|
||||
iconTheme = settings.iconTheme !== undefined ? settings.iconTheme : "System Default";
|
||||
useOSLogo = settings.useOSLogo !== undefined ? settings.useOSLogo : false;
|
||||
osLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : "";
|
||||
osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5;
|
||||
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1;
|
||||
fontFamily = settings.fontFamily !== undefined ? settings.fontFamily : Theme.defaultFontFamily;
|
||||
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : Theme.defaultMonoFontFamily;
|
||||
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal;
|
||||
fontScale = settings.fontScale !== undefined ? settings.fontScale : 1.0;
|
||||
cornerRadius = settings.cornerRadius !== undefined ? settings.cornerRadius : 12;
|
||||
widgetBackgroundColor = settings.widgetBackgroundColor !== undefined ? settings.widgetBackgroundColor : "sch";
|
||||
lockDateFormat = settings.lockDateFormat !== undefined ? settings.lockDateFormat : "";
|
||||
lockScreenShowPowerActions = settings.lockScreenShowPowerActions !== undefined ? settings.lockScreenShowPowerActions : true;
|
||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({});
|
||||
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : 2;
|
||||
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill";
|
||||
settingsLoaded = true;
|
||||
|
||||
if (typeof Theme !== "undefined") {
|
||||
if (currentThemeName === "custom" && customThemeFile) {
|
||||
Theme.loadCustomThemeFromFile(customThemeFile)
|
||||
Theme.loadCustomThemeFromFile(customThemeFile);
|
||||
}
|
||||
Theme.applyGreeterTheme(currentThemeName)
|
||||
Theme.applyGreeterTheme(currentThemeName);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Failed to parse greetd settings:", e)
|
||||
console.warn("Failed to parse greetd settings:", e);
|
||||
}
|
||||
}
|
||||
|
||||
function getEffectiveLockDateFormat() {
|
||||
return lockDateFormat && lockDateFormat.length > 0 ? lockDateFormat : Locale.LongFormat
|
||||
return lockDateFormat && lockDateFormat.length > 0 ? lockDateFormat : Locale.LongFormat;
|
||||
}
|
||||
|
||||
function getFilteredScreens(componentId) {
|
||||
const prefs = screenPreferences && screenPreferences[componentId] || ["all"]
|
||||
const prefs = screenPreferences && screenPreferences[componentId] || ["all"];
|
||||
if (prefs.includes("all")) {
|
||||
return Quickshell.screens
|
||||
return Quickshell.screens;
|
||||
}
|
||||
return Quickshell.screens.filter(screen => prefs.includes(screen.name))
|
||||
return Quickshell.screens.filter(screen => prefs.includes(screen.name));
|
||||
}
|
||||
|
||||
FileView {
|
||||
@@ -113,7 +110,7 @@ Singleton {
|
||||
watchChanges: false
|
||||
printErrors: true
|
||||
onLoaded: {
|
||||
parseSettings(settingsFile.text())
|
||||
parseSettings(settingsFile.text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ Item {
|
||||
var fontName = availableFonts[i];
|
||||
if (fontName.startsWith("."))
|
||||
continue;
|
||||
if (fontName === SettingsData.defaultFontFamily)
|
||||
if (fontName === Theme.defaultFontFamily)
|
||||
continue;
|
||||
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function (match, suffix) {
|
||||
return match;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Modals
|
||||
import qs.Modals.FileBrowser
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -19,47 +16,44 @@ Item {
|
||||
property bool fontsEnumerated: false
|
||||
|
||||
function enumerateFonts() {
|
||||
var fonts = []
|
||||
var availableFonts = Qt.fontFamilies()
|
||||
var fonts = [];
|
||||
var availableFonts = Qt.fontFamilies();
|
||||
|
||||
for (var i = 0; i < availableFonts.length; i++) {
|
||||
var fontName = availableFonts[i]
|
||||
var fontName = availableFonts[i];
|
||||
if (fontName.startsWith("."))
|
||||
continue
|
||||
fonts.push(fontName)
|
||||
continue;
|
||||
fonts.push(fontName);
|
||||
}
|
||||
fonts.sort()
|
||||
fonts.unshift("Default")
|
||||
cachedFontFamilies = fonts
|
||||
fonts.sort();
|
||||
fonts.unshift("Default");
|
||||
cachedFontFamilies = fonts;
|
||||
|
||||
var monoFonts = []
|
||||
var monoFonts = [];
|
||||
for (var j = 0; j < availableFonts.length; j++) {
|
||||
var fontName2 = availableFonts[j]
|
||||
var fontName2 = availableFonts[j];
|
||||
if (fontName2.startsWith("."))
|
||||
continue
|
||||
|
||||
var lowerName = fontName2.toLowerCase()
|
||||
if (lowerName.includes("mono") || lowerName.includes("code") ||
|
||||
lowerName.includes("console") || lowerName.includes("terminal") ||
|
||||
lowerName.includes("courier") || lowerName.includes("jetbrains") ||
|
||||
lowerName.includes("fira") || lowerName.includes("hack") ||
|
||||
lowerName.includes("source code") || lowerName.includes("cascadia")) {
|
||||
monoFonts.push(fontName2)
|
||||
continue;
|
||||
var lowerName = fontName2.toLowerCase();
|
||||
if (lowerName.includes("mono") || lowerName.includes("code") || lowerName.includes("console") || lowerName.includes("terminal") || lowerName.includes("courier") || lowerName.includes("jetbrains") || lowerName.includes("fira") || lowerName.includes("hack") || lowerName.includes("source code") || lowerName.includes("cascadia")) {
|
||||
monoFonts.push(fontName2);
|
||||
}
|
||||
}
|
||||
monoFonts.sort()
|
||||
monoFonts.unshift("Default")
|
||||
cachedMonoFamilies = monoFonts
|
||||
monoFonts.sort();
|
||||
monoFonts.unshift("Default");
|
||||
cachedMonoFamilies = monoFonts;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!fontsEnumerated) {
|
||||
enumerateFonts()
|
||||
fontsEnumerated = true
|
||||
enumerateFonts();
|
||||
fontsEnumerated = true;
|
||||
}
|
||||
SettingsData.detectAvailableIconThemes()
|
||||
cachedIconThemes = SettingsData.availableIconThemes
|
||||
cachedMatugenSchemes = Theme.availableMatugenSchemes.map(function (option) { return option.label })
|
||||
SettingsData.detectAvailableIconThemes();
|
||||
cachedIconThemes = SettingsData.availableIconThemes;
|
||||
cachedMatugenSchemes = Theme.availableMatugenSchemes.map(function (option) {
|
||||
return option.label;
|
||||
});
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
@@ -74,15 +68,13 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
|
||||
// Theme Color
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: themeSection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
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: 0
|
||||
|
||||
Column {
|
||||
@@ -119,11 +111,11 @@ Item {
|
||||
StyledText {
|
||||
text: {
|
||||
if (Theme.currentTheme === Theme.dynamic) {
|
||||
return "Current Theme: Dynamic"
|
||||
return "Current Theme: Dynamic";
|
||||
} else if (Theme.currentThemeCategory === "catppuccin") {
|
||||
return "Current Theme: Catppuccin " + Theme.getThemeColors(Theme.currentThemeName).name
|
||||
return "Current Theme: Catppuccin " + Theme.getThemeColors(Theme.currentThemeName).name;
|
||||
} else {
|
||||
return "Current Theme: " + Theme.getThemeColors(Theme.currentThemeName).name
|
||||
return "Current Theme: " + Theme.getThemeColors(Theme.currentThemeName).name;
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
@@ -135,15 +127,15 @@ Item {
|
||||
StyledText {
|
||||
text: {
|
||||
if (Theme.currentTheme === Theme.dynamic) {
|
||||
return "Material colors generated from wallpaper"
|
||||
return "Material colors generated from wallpaper";
|
||||
}
|
||||
if (Theme.currentThemeCategory === "catppuccin") {
|
||||
return "Soothing pastel theme based on Catppuccin"
|
||||
return "Soothing pastel theme based on Catppuccin";
|
||||
}
|
||||
if (Theme.currentTheme === Theme.custom) {
|
||||
return "Custom theme loaded from JSON file"
|
||||
return "Custom theme loaded from JSON file";
|
||||
}
|
||||
return "Material Design inspired color themes"
|
||||
return "Material Design inspired color themes";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
@@ -154,17 +146,19 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Column {
|
||||
spacing: Theme.spacingM
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
DankButtonGroup {
|
||||
property int currentThemeIndex: {
|
||||
if (Theme.currentTheme === Theme.dynamic) return 2
|
||||
if (Theme.currentThemeName === "custom") return 3
|
||||
if (Theme.currentThemeCategory === "catppuccin") return 1
|
||||
return 0
|
||||
if (Theme.currentTheme === Theme.dynamic)
|
||||
return 2;
|
||||
if (Theme.currentThemeName === "custom")
|
||||
return 3;
|
||||
if (Theme.currentThemeCategory === "catppuccin")
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
property int pendingThemeIndex: -1
|
||||
|
||||
@@ -173,29 +167,35 @@ Item {
|
||||
selectionMode: "single"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return
|
||||
pendingThemeIndex = index
|
||||
if (!selected)
|
||||
return;
|
||||
pendingThemeIndex = index;
|
||||
}
|
||||
onAnimationCompleted: {
|
||||
if (pendingThemeIndex === -1) return
|
||||
if (pendingThemeIndex === -1)
|
||||
return;
|
||||
switch (pendingThemeIndex) {
|
||||
case 0: Theme.switchThemeCategory("generic", "blue"); break
|
||||
case 1: Theme.switchThemeCategory("catppuccin", "cat-mauve"); break
|
||||
case 2:
|
||||
if (ToastService.wallpaperErrorStatus === "matugen_missing")
|
||||
ToastService.showError("matugen not found - install matugen package for dynamic theming")
|
||||
else if (ToastService.wallpaperErrorStatus === "error")
|
||||
ToastService.showError("Wallpaper processing failed - check wallpaper path")
|
||||
else
|
||||
Theme.switchTheme(Theme.dynamic, true, true)
|
||||
break
|
||||
case 3:
|
||||
if (Theme.currentThemeName !== "custom") {
|
||||
Theme.switchTheme("custom", true, true)
|
||||
}
|
||||
break
|
||||
case 0:
|
||||
Theme.switchThemeCategory("generic", "blue");
|
||||
break;
|
||||
case 1:
|
||||
Theme.switchThemeCategory("catppuccin", "cat-mauve");
|
||||
break;
|
||||
case 2:
|
||||
if (ToastService.wallpaperErrorStatus === "matugen_missing")
|
||||
ToastService.showError("matugen not found - install matugen package for dynamic theming");
|
||||
else if (ToastService.wallpaperErrorStatus === "error")
|
||||
ToastService.showError("Wallpaper processing failed - check wallpaper path");
|
||||
else
|
||||
Theme.switchTheme(Theme.dynamic, true, true);
|
||||
break;
|
||||
case 3:
|
||||
if (Theme.currentThemeName !== "custom") {
|
||||
Theme.switchTheme("custom", true, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
pendingThemeIndex = -1
|
||||
pendingThemeIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Theme.switchTheme(themeName)
|
||||
Theme.switchTheme(themeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Theme.switchTheme(themeName)
|
||||
Theme.switchTheme(themeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Theme.switchTheme(themeName)
|
||||
Theme.switchTheme(themeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Theme.switchTheme(themeName)
|
||||
Theme.switchTheme(themeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,16 +525,16 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
name: {
|
||||
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|
||||
return "error"
|
||||
return "error";
|
||||
else
|
||||
return "palette"
|
||||
return "palette";
|
||||
}
|
||||
size: Theme.iconSizeLarge
|
||||
color: {
|
||||
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|
||||
return Theme.error
|
||||
return Theme.error;
|
||||
else
|
||||
return Theme.surfaceVariantText
|
||||
return Theme.surfaceVariantText;
|
||||
}
|
||||
visible: !Theme.wallpaperPath
|
||||
}
|
||||
@@ -548,13 +548,13 @@ Item {
|
||||
StyledText {
|
||||
text: {
|
||||
if (ToastService.wallpaperErrorStatus === "error")
|
||||
return "Wallpaper Error"
|
||||
return "Wallpaper Error";
|
||||
else if (ToastService.wallpaperErrorStatus === "matugen_missing")
|
||||
return "Matugen Missing"
|
||||
return "Matugen Missing";
|
||||
else if (Theme.wallpaperPath)
|
||||
return Theme.wallpaperPath.split('/').pop()
|
||||
return Theme.wallpaperPath.split('/').pop();
|
||||
else
|
||||
return "No wallpaper selected"
|
||||
return "No wallpaper selected";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
@@ -566,20 +566,20 @@ Item {
|
||||
StyledText {
|
||||
text: {
|
||||
if (ToastService.wallpaperErrorStatus === "error")
|
||||
return "Wallpaper processing failed"
|
||||
return "Wallpaper processing failed";
|
||||
else if (ToastService.wallpaperErrorStatus === "matugen_missing")
|
||||
return "Install matugen package for dynamic theming"
|
||||
return "Install matugen package for dynamic theming";
|
||||
else if (Theme.wallpaperPath)
|
||||
return Theme.wallpaperPath
|
||||
return Theme.wallpaperPath;
|
||||
else
|
||||
return "Dynamic colors from wallpaper"
|
||||
return "Dynamic colors from wallpaper";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: {
|
||||
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|
||||
return Theme.error
|
||||
return Theme.error;
|
||||
else
|
||||
return Theme.surfaceVariantText
|
||||
return Theme.surfaceVariantText;
|
||||
}
|
||||
elide: Text.ElideMiddle
|
||||
maximumLineCount: 2
|
||||
@@ -599,10 +599,10 @@ Item {
|
||||
opacity: enabled ? 1 : 0.4
|
||||
onValueChanged: value => {
|
||||
for (var i = 0; i < Theme.availableMatugenSchemes.length; i++) {
|
||||
var option = Theme.availableMatugenSchemes[i]
|
||||
var option = Theme.availableMatugenSchemes[i];
|
||||
if (option.label === value) {
|
||||
SettingsData.setMatugenScheme(option.value)
|
||||
break
|
||||
SettingsData.setMatugenScheme(option.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -610,8 +610,8 @@ Item {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
var scheme = Theme.getMatugenScheme(SettingsData.matugenScheme)
|
||||
return scheme.description + " (" + scheme.value + ")"
|
||||
var scheme = Theme.getMatugenScheme(SettingsData.matugenScheme);
|
||||
return scheme.description + " (" + scheme.value + ")";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
@@ -673,8 +673,7 @@ Item {
|
||||
height: transparencySection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
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: 0
|
||||
|
||||
Column {
|
||||
@@ -736,9 +735,12 @@ Item {
|
||||
id: widgetColorModeGroup
|
||||
property int currentColorModeIndex: {
|
||||
switch (SettingsData.widgetColorMode) {
|
||||
case "default": return 0
|
||||
case "colorful": return 1
|
||||
default: return 0
|
||||
case "default":
|
||||
return 0;
|
||||
case "colorful":
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,9 +750,10 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return
|
||||
const colorModeOptions = ["default", "colorful"]
|
||||
SettingsData.set("widgetColorMode", colorModeOptions[index])
|
||||
if (!selected)
|
||||
return;
|
||||
const colorModeOptions = ["default", "colorful"];
|
||||
SettingsData.set("widgetColorMode", colorModeOptions[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -790,11 +793,16 @@ Item {
|
||||
id: widgetColorGroup
|
||||
property int currentColorIndex: {
|
||||
switch (SettingsData.widgetBackgroundColor) {
|
||||
case "sth": return 0
|
||||
case "s": return 1
|
||||
case "sc": return 2
|
||||
case "sch": return 3
|
||||
default: return 0
|
||||
case "sth":
|
||||
return 0;
|
||||
case "s":
|
||||
return 1;
|
||||
case "sc":
|
||||
return 2;
|
||||
case "sch":
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,9 +820,10 @@ Item {
|
||||
spacing: 1
|
||||
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return
|
||||
const colorOptions = ["sth", "s", "sc", "sch"]
|
||||
SettingsData.set("widgetBackgroundColor", colorOptions[index])
|
||||
if (!selected)
|
||||
return;
|
||||
const colorOptions = ["sth", "s", "sc", "sch"];
|
||||
SettingsData.set("widgetBackgroundColor", colorOptions[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -842,8 +851,7 @@ Item {
|
||||
DankSlider {
|
||||
width: parent.width
|
||||
height: 24
|
||||
value: Math.round(
|
||||
SettingsData.popupTransparency * 100)
|
||||
value: Math.round(SettingsData.popupTransparency * 100)
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
unit: ""
|
||||
@@ -851,9 +859,8 @@ Item {
|
||||
wheelEnabled: false
|
||||
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
onSliderValueChanged: newValue => {
|
||||
SettingsData.set("popupTransparency",
|
||||
newValue / 100)
|
||||
}
|
||||
SettingsData.set("popupTransparency", newValue / 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -886,9 +893,8 @@ Item {
|
||||
wheelEnabled: false
|
||||
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
onSliderValueChanged: newValue => {
|
||||
SettingsData.setCornerRadius(
|
||||
newValue)
|
||||
}
|
||||
SettingsData.setCornerRadius(newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -930,7 +936,7 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: SettingsData.modalDarkenBackground
|
||||
onToggled: checked => {
|
||||
SettingsData.set("modalDarkenBackground", checked)
|
||||
SettingsData.set("modalDarkenBackground", checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -942,8 +948,7 @@ Item {
|
||||
height: fontSection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
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: 0
|
||||
|
||||
Column {
|
||||
@@ -977,21 +982,21 @@ Item {
|
||||
text: I18n.tr("Font Family")
|
||||
description: I18n.tr("Select system font family")
|
||||
currentValue: {
|
||||
if (SettingsData.fontFamily === SettingsData.defaultFontFamily)
|
||||
return "Default"
|
||||
if (SettingsData.fontFamily === Theme.defaultFontFamily)
|
||||
return "Default";
|
||||
else
|
||||
return SettingsData.fontFamily || "Default"
|
||||
return SettingsData.fontFamily || "Default";
|
||||
}
|
||||
enableFuzzySearch: true
|
||||
popupWidthOffset: 100
|
||||
maxPopupHeight: 400
|
||||
options: cachedFontFamilies
|
||||
onValueChanged: value => {
|
||||
if (value.startsWith("Default"))
|
||||
SettingsData.set("fontFamily", SettingsData.defaultFontFamily)
|
||||
else
|
||||
SettingsData.set("fontFamily", value)
|
||||
}
|
||||
if (value.startsWith("Default"))
|
||||
SettingsData.set("fontFamily", Theme.defaultFontFamily);
|
||||
else
|
||||
SettingsData.set("fontFamily", value);
|
||||
}
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
@@ -1000,64 +1005,64 @@ Item {
|
||||
currentValue: {
|
||||
switch (SettingsData.fontWeight) {
|
||||
case Font.Thin:
|
||||
return "Thin"
|
||||
return "Thin";
|
||||
case Font.ExtraLight:
|
||||
return "Extra Light"
|
||||
return "Extra Light";
|
||||
case Font.Light:
|
||||
return "Light"
|
||||
return "Light";
|
||||
case Font.Normal:
|
||||
return "Regular"
|
||||
return "Regular";
|
||||
case Font.Medium:
|
||||
return "Medium"
|
||||
return "Medium";
|
||||
case Font.DemiBold:
|
||||
return "Demi Bold"
|
||||
return "Demi Bold";
|
||||
case Font.Bold:
|
||||
return "Bold"
|
||||
return "Bold";
|
||||
case Font.ExtraBold:
|
||||
return "Extra Bold"
|
||||
return "Extra Bold";
|
||||
case Font.Black:
|
||||
return "Black"
|
||||
return "Black";
|
||||
default:
|
||||
return "Regular"
|
||||
return "Regular";
|
||||
}
|
||||
}
|
||||
options: ["Thin", "Extra Light", "Light", "Regular", "Medium", "Demi Bold", "Bold", "Extra Bold", "Black"]
|
||||
onValueChanged: value => {
|
||||
var weight
|
||||
switch (value) {
|
||||
case "Thin":
|
||||
weight = Font.Thin
|
||||
break
|
||||
case "Extra Light":
|
||||
weight = Font.ExtraLight
|
||||
break
|
||||
case "Light":
|
||||
weight = Font.Light
|
||||
break
|
||||
case "Regular":
|
||||
weight = Font.Normal
|
||||
break
|
||||
case "Medium":
|
||||
weight = Font.Medium
|
||||
break
|
||||
case "Demi Bold":
|
||||
weight = Font.DemiBold
|
||||
break
|
||||
case "Bold":
|
||||
weight = Font.Bold
|
||||
break
|
||||
case "Extra Bold":
|
||||
weight = Font.ExtraBold
|
||||
break
|
||||
case "Black":
|
||||
weight = Font.Black
|
||||
break
|
||||
default:
|
||||
weight = Font.Normal
|
||||
break
|
||||
}
|
||||
SettingsData.set("fontWeight", weight)
|
||||
}
|
||||
var weight;
|
||||
switch (value) {
|
||||
case "Thin":
|
||||
weight = Font.Thin;
|
||||
break;
|
||||
case "Extra Light":
|
||||
weight = Font.ExtraLight;
|
||||
break;
|
||||
case "Light":
|
||||
weight = Font.Light;
|
||||
break;
|
||||
case "Regular":
|
||||
weight = Font.Normal;
|
||||
break;
|
||||
case "Medium":
|
||||
weight = Font.Medium;
|
||||
break;
|
||||
case "Demi Bold":
|
||||
weight = Font.DemiBold;
|
||||
break;
|
||||
case "Bold":
|
||||
weight = Font.Bold;
|
||||
break;
|
||||
case "Extra Bold":
|
||||
weight = Font.ExtraBold;
|
||||
break;
|
||||
case "Black":
|
||||
weight = Font.Black;
|
||||
break;
|
||||
default:
|
||||
weight = Font.Normal;
|
||||
break;
|
||||
}
|
||||
SettingsData.set("fontWeight", weight);
|
||||
}
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
@@ -1065,20 +1070,20 @@ Item {
|
||||
description: I18n.tr("Select monospace font for process list and technical displays")
|
||||
currentValue: {
|
||||
if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily)
|
||||
return "Default"
|
||||
return "Default";
|
||||
|
||||
return SettingsData.monoFontFamily || "Default"
|
||||
return SettingsData.monoFontFamily || "Default";
|
||||
}
|
||||
enableFuzzySearch: true
|
||||
popupWidthOffset: 100
|
||||
maxPopupHeight: 400
|
||||
options: cachedMonoFamilies
|
||||
onValueChanged: value => {
|
||||
if (value === "Default")
|
||||
SettingsData.set("monoFontFamily", SettingsData.defaultMonoFontFamily)
|
||||
else
|
||||
SettingsData.set("monoFontFamily", value)
|
||||
}
|
||||
if (value === "Default")
|
||||
SettingsData.set("monoFontFamily", SettingsData.defaultMonoFontFamily);
|
||||
else
|
||||
SettingsData.set("monoFontFamily", value);
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -1126,8 +1131,8 @@ Item {
|
||||
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
iconColor: Theme.surfaceText
|
||||
onClicked: {
|
||||
var newScale = Math.max(1.0, SettingsData.fontScale - 0.05)
|
||||
SettingsData.set("fontScale", newScale)
|
||||
var newScale = Math.max(1.0, SettingsData.fontScale - 0.05);
|
||||
SettingsData.set("fontScale", newScale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1136,15 +1141,12 @@ Item {
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
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: 0
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: (SettingsData.fontScale * 100).toFixed(
|
||||
0) + "%"
|
||||
text: (SettingsData.fontScale * 100).toFixed(0) + "%"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -1159,9 +1161,8 @@ Item {
|
||||
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
iconColor: Theme.surfaceText
|
||||
onClicked: {
|
||||
var newScale = Math.min(2.0,
|
||||
SettingsData.fontScale + 0.05)
|
||||
SettingsData.set("fontScale", newScale)
|
||||
var newScale = Math.min(2.0, SettingsData.fontScale + 0.05);
|
||||
SettingsData.set("fontScale", newScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1174,8 +1175,7 @@ Item {
|
||||
height: applicationsSection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
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: 0
|
||||
|
||||
Column {
|
||||
@@ -1211,7 +1211,7 @@ Item {
|
||||
description: I18n.tr("Sync dark mode with settings portals for system-wide theme hints")
|
||||
checked: SettingsData.syncModeWithPortal
|
||||
onToggled: checked => {
|
||||
return SettingsData.set("syncModeWithPortal", checked)
|
||||
return SettingsData.set("syncModeWithPortal", checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1221,7 +1221,7 @@ Item {
|
||||
description: I18n.tr("Force terminal applications to always use dark color schemes")
|
||||
checked: SettingsData.terminalsAlwaysDark
|
||||
onToggled: checked => {
|
||||
return SettingsData.set("terminalsAlwaysDark", checked)
|
||||
return SettingsData.set("terminalsAlwaysDark", checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1231,10 +1231,8 @@ Item {
|
||||
width: parent.width
|
||||
height: warningText.implicitHeight + Theme.spacingM * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.warning.r, Theme.warning.g,
|
||||
Theme.warning.b, 0.12)
|
||||
border.color: Qt.rgba(Theme.warning.r, Theme.warning.g,
|
||||
Theme.warning.b, 0.3)
|
||||
color: Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.12)
|
||||
border.color: Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.3)
|
||||
border.width: 0
|
||||
|
||||
Row {
|
||||
@@ -1266,8 +1264,7 @@ Item {
|
||||
height: iconThemeSection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
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: 0
|
||||
|
||||
Column {
|
||||
@@ -1299,13 +1296,11 @@ Item {
|
||||
maxPopupHeight: 236
|
||||
options: cachedIconThemes
|
||||
onValueChanged: value => {
|
||||
SettingsData.setIconTheme(value)
|
||||
if (Quickshell.env("QT_QPA_PLATFORMTHEME") != "gtk3" &&
|
||||
Quickshell.env("QT_QPA_PLATFORMTHEME") != "qt6ct" &&
|
||||
Quickshell.env("QT_QPA_PLATFORMTHEME_QT6") != "qt6ct") {
|
||||
ToastService.showError("Missing Environment Variables", "You need to set either:\nQT_QPA_PLATFORMTHEME=gtk3 OR\nQT_QPA_PLATFORMTHEME=qt6ct\nas environment variables, and then restart the shell.\n\nqt6ct requires qt6ct-kde to be installed.")
|
||||
}
|
||||
}
|
||||
SettingsData.setIconTheme(value);
|
||||
if (Quickshell.env("QT_QPA_PLATFORMTHEME") != "gtk3" && Quickshell.env("QT_QPA_PLATFORMTHEME") != "qt6ct" && Quickshell.env("QT_QPA_PLATFORMTHEME_QT6") != "qt6ct") {
|
||||
ToastService.showError("Missing Environment Variables", "You need to set either:\nQT_QPA_PLATFORMTHEME=gtk3 OR\nQT_QPA_PLATFORMTHEME=qt6ct\nas environment variables, and then restart the shell.\n\nqt6ct requires qt6ct-kde to be installed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1317,8 +1312,7 @@ Item {
|
||||
height: systemThemingSection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
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: 0
|
||||
visible: Theme.matugenAvailable
|
||||
|
||||
@@ -1446,7 +1440,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,14 +1450,14 @@ Item {
|
||||
showHiddenFiles: true
|
||||
|
||||
function selectCustomTheme() {
|
||||
shouldBeVisible = true
|
||||
shouldBeVisible = true;
|
||||
}
|
||||
|
||||
onFileSelected: function(filePath) {
|
||||
onFileSelected: function (filePath) {
|
||||
if (filePath.endsWith(".json")) {
|
||||
SettingsData.set("customThemeFile", filePath)
|
||||
Theme.switchTheme("custom")
|
||||
close()
|
||||
SettingsData.set("customThemeFile", filePath);
|
||||
Theme.switchTheme("custom");
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Text {
|
||||
property bool isMonospace: false
|
||||
@@ -16,13 +15,13 @@ Text {
|
||||
}
|
||||
|
||||
readonly property string resolvedFontFamily: {
|
||||
const requestedFont = isMonospace ? Theme.monoFontFamily : Theme.fontFamily
|
||||
const defaultFont = isMonospace ? "Fira Code" : "Inter Variable"
|
||||
const requestedFont = isMonospace ? Theme.monoFontFamily : Theme.fontFamily;
|
||||
const defaultFont = isMonospace ? Theme.defaultMonoFontFamily : Theme.defaultFontFamily;
|
||||
|
||||
if (requestedFont === defaultFont) {
|
||||
return isMonospace ? firaCodeFont.name : interFont.name
|
||||
return isMonospace ? firaCodeFont.name : interFont.name;
|
||||
}
|
||||
return requestedFont
|
||||
return requestedFont;
|
||||
}
|
||||
|
||||
readonly property var standardAnimation: {
|
||||
@@ -47,4 +46,4 @@ Text {
|
||||
easing.bezierCurve: standardAnimation["easing.bezierCurve"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,19 +6,19 @@ TextMetrics {
|
||||
property bool isMonospace: false
|
||||
|
||||
readonly property string resolvedFontFamily: {
|
||||
const requestedFont = isMonospace ? SettingsData.monoFontFamily : SettingsData.fontFamily
|
||||
const defaultFont = isMonospace ? SettingsData.defaultMonoFontFamily : SettingsData.defaultFontFamily
|
||||
const requestedFont = isMonospace ? SettingsData.monoFontFamily : SettingsData.fontFamily;
|
||||
const defaultFont = isMonospace ? Theme.defaultMonoFontFamily : Theme.defaultFontFamily;
|
||||
|
||||
if (requestedFont === defaultFont) {
|
||||
const availableFonts = Qt.fontFamilies()
|
||||
const availableFonts = Qt.fontFamilies();
|
||||
if (!availableFonts.includes(requestedFont)) {
|
||||
return isMonospace ? "Monospace" : "DejaVu Sans"
|
||||
return isMonospace ? "Monospace" : "DejaVu Sans";
|
||||
}
|
||||
}
|
||||
return requestedFont
|
||||
return requestedFont;
|
||||
}
|
||||
|
||||
font.pixelSize: Appearance.fontSize.normal
|
||||
font.family: resolvedFontFamily
|
||||
font.weight: SettingsData.fontWeight
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user