mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 07:22:50 -05:00
weather: fix icons
This commit is contained in:
@@ -760,10 +760,10 @@ Item {
|
|||||||
color: Theme.outline
|
color: Theme.outline
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
DankNFIcon {
|
||||||
id: moonPhase
|
id: moonPhase
|
||||||
text: WeatherService.getMoonPhase(skyBox.currentDate) || ""
|
name: WeatherService.getMoonPhase(skyBox.currentDate) || ""
|
||||||
font.pixelSize: Theme.fontSizeXLarge * 1
|
size: Theme.fontSizeXLarge
|
||||||
color: Theme.withAlpha(Theme.surfaceText, 0.7)
|
color: Theme.withAlpha(Theme.surfaceText, 0.7)
|
||||||
rotation: (WeatherService.getMoonAngle(skyBox.currentDate) || 0) / Math.PI * 180
|
rotation: (WeatherService.getMoonAngle(skyBox.currentDate) || 0) / Math.PI * 180
|
||||||
visible: !!pos
|
visible: !!pos
|
||||||
@@ -783,10 +783,10 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
DankIcon {
|
||||||
id: sun
|
id: sun
|
||||||
text: ""
|
name: "light_mode"
|
||||||
font.pixelSize: Theme.fontSizeXLarge * 1
|
size: Theme.fontSizeXLarge
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
visible: !!pos
|
visible: !!pos
|
||||||
|
|
||||||
|
|||||||
@@ -151,56 +151,15 @@ Singleton {
|
|||||||
return conditions[String(code)] || "Unknown";
|
return conditions[String(code)] || "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
property var moonWeatherIcons: ({
|
property var moonPhaseNames: ["moon_new", "moon_waxing_crescent", "moon_first_quarter", "moon_waxing_gibbous", "moon_full", "moon_waning_gibbous", "moon_last_quarter", "moon_waning_crescent"]
|
||||||
"0": "",
|
|
||||||
"1": "",
|
|
||||||
"2": "",
|
|
||||||
"3": "",
|
|
||||||
"4": "",
|
|
||||||
"5": "",
|
|
||||||
"6": "",
|
|
||||||
"7": "",
|
|
||||||
"8": "",
|
|
||||||
"9": "",
|
|
||||||
"10": "",
|
|
||||||
"11": "",
|
|
||||||
"12": "",
|
|
||||||
"13": "",
|
|
||||||
"14": "",
|
|
||||||
"15": "",
|
|
||||||
"16": "",
|
|
||||||
"17": "",
|
|
||||||
"18": "",
|
|
||||||
"19": "",
|
|
||||||
"20": "",
|
|
||||||
"21": "",
|
|
||||||
"22": "",
|
|
||||||
"23": "",
|
|
||||||
"24": "",
|
|
||||||
"25": "",
|
|
||||||
"26": "",
|
|
||||||
"27": ""
|
|
||||||
})
|
|
||||||
|
|
||||||
property var moonMaterialIcons: ({
|
|
||||||
"0": "",
|
|
||||||
"1": "",
|
|
||||||
"2": "",
|
|
||||||
"3": "",
|
|
||||||
"4": "",
|
|
||||||
"5": "",
|
|
||||||
"6": "",
|
|
||||||
"7": ""
|
|
||||||
})
|
|
||||||
|
|
||||||
function getMoonPhase(date) {
|
function getMoonPhase(date) {
|
||||||
const icons = moonWeatherIcons; // more icons in this set but thinner outline than material icons
|
const phases = moonPhaseNames;
|
||||||
// const icons = moonMaterialIcons
|
const iconCount = phases.length;
|
||||||
const iconCount = Object.keys(icons).length;
|
|
||||||
const moon = SunCalc.getMoonIllumination(date);
|
const moon = SunCalc.getMoonIllumination(date);
|
||||||
const index = ((Math.floor(moon.phase * iconCount + 0.5) % iconCount) + iconCount) % iconCount;
|
const index = ((Math.floor(moon.phase * iconCount + 0.5) % iconCount) + iconCount) % iconCount;
|
||||||
|
|
||||||
return icons[index];
|
return phases[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMoonAngle(date) {
|
function getMoonAngle(date) {
|
||||||
|
|||||||
@@ -14,124 +14,133 @@ Item {
|
|||||||
|
|
||||||
// This is for file browser, particularly - might want another map later for app IDs
|
// This is for file browser, particularly - might want another map later for app IDs
|
||||||
readonly property var iconMap: ({
|
readonly property var iconMap: ({
|
||||||
// --- Distribution logos ---
|
// --- Distribution logos ---
|
||||||
"debian": "\u{f08da}",
|
"debian": "\u{f08da}",
|
||||||
"arch": "\u{f08c7}",
|
"arch": "\u{f08c7}",
|
||||||
"archcraft": "\u{f345}",
|
"archcraft": "\u{f345}",
|
||||||
"guix": "\u{f325}",
|
"guix": "\u{f325}",
|
||||||
"fedora": "\u{f08db}",
|
"fedora": "\u{f08db}",
|
||||||
"nixos": "\u{f1105}",
|
"nixos": "\u{f1105}",
|
||||||
"ubuntu": "\u{f0548}",
|
"ubuntu": "\u{f0548}",
|
||||||
"gentoo": "\u{f08e8}",
|
"gentoo": "\u{f08e8}",
|
||||||
"endeavouros": "\u{f322}",
|
"endeavouros": "\u{f322}",
|
||||||
"manjaro": "\u{f160a}",
|
"manjaro": "\u{f160a}",
|
||||||
"opensuse": "\u{f314}",
|
"opensuse": "\u{f314}",
|
||||||
|
|
||||||
// --- special types ---
|
// --- special types ---
|
||||||
"folder": "\u{F024B}",
|
"folder": "\u{F024B}",
|
||||||
"file": "\u{F0214}",
|
"file": "\u{F0214}",
|
||||||
|
|
||||||
// --- special filenames (no extension) ---
|
// --- special filenames (no extension) ---
|
||||||
"docker": "\u{F0868}",
|
"docker": "\u{F0868}",
|
||||||
"makefile": "\u{F09EE}",
|
"makefile": "\u{F09EE}",
|
||||||
"license": "\u{F09EE}",
|
"license": "\u{F09EE}",
|
||||||
"readme": "\u{F0354}",
|
"readme": "\u{F0354}",
|
||||||
|
|
||||||
// --- programming languages ---
|
// --- programming languages ---
|
||||||
"rs": "\u{F1617}",
|
"rs": "\u{F1617}",
|
||||||
"dart": "\u{e798}",
|
"dart": "\u{e798}",
|
||||||
"go": "\u{F07D3}",
|
"go": "\u{F07D3}",
|
||||||
"py": "\u{F0320}",
|
"py": "\u{F0320}",
|
||||||
"js": "\u{F031E}",
|
"js": "\u{F031E}",
|
||||||
"jsx": "\u{F031E}",
|
"jsx": "\u{F031E}",
|
||||||
"ts": "\u{F06E6}",
|
"ts": "\u{F06E6}",
|
||||||
"tsx": "\u{F06E6}",
|
"tsx": "\u{F06E6}",
|
||||||
"java": "\u{F0B37}",
|
"java": "\u{F0B37}",
|
||||||
"c": "\u{F0671}",
|
"c": "\u{F0671}",
|
||||||
"cpp": "\u{F0672}",
|
"cpp": "\u{F0672}",
|
||||||
"cxx": "\u{F0672}",
|
"cxx": "\u{F0672}",
|
||||||
"h": "\u{F0672}",
|
"h": "\u{F0672}",
|
||||||
"hpp": "\u{F0672}",
|
"hpp": "\u{F0672}",
|
||||||
"cs": "\u{F031B}",
|
"cs": "\u{F031B}",
|
||||||
"html": "\u{e60e}",
|
"html": "\u{e60e}",
|
||||||
"htm": "\u{e60e}",
|
"htm": "\u{e60e}",
|
||||||
"css": "\u{E6b8}",
|
"css": "\u{E6b8}",
|
||||||
"scss": "\u{F031C}",
|
"scss": "\u{F031C}",
|
||||||
"less": "\u{F031C}",
|
"less": "\u{F031C}",
|
||||||
"md": "\u{F0354}",
|
"md": "\u{F0354}",
|
||||||
"markdown": "\u{F0354}",
|
"markdown": "\u{F0354}",
|
||||||
"json": "\u{eb0f}",
|
"json": "\u{eb0f}",
|
||||||
"jsonc": "\u{eb0f}",
|
"jsonc": "\u{eb0f}",
|
||||||
"yaml": "\u{e8eb}",
|
"yaml": "\u{e8eb}",
|
||||||
"yml": "\u{e8eb}",
|
"yml": "\u{e8eb}",
|
||||||
"xml": "\u{F09EE}",
|
"xml": "\u{F09EE}",
|
||||||
"sql": "\u{f1c0}",
|
"sql": "\u{f1c0}",
|
||||||
|
|
||||||
// --- scripts / shells ---
|
// --- scripts / shells ---
|
||||||
"sh": "\u{f0bc1}",
|
"sh": "\u{f0bc1}",
|
||||||
"bash": "\u{f0bc1}",
|
"bash": "\u{f0bc1}",
|
||||||
"zsh": "\u{f0bc1}",
|
"zsh": "\u{f0bc1}",
|
||||||
"fish": "\u{f0bc1}",
|
"fish": "\u{f0bc1}",
|
||||||
"ps1": "\u{f0bc1}",
|
"ps1": "\u{f0bc1}",
|
||||||
"bat": "\u{f0bc1}",
|
"bat": "\u{f0bc1}",
|
||||||
|
|
||||||
// --- data / config ---
|
// --- data / config ---
|
||||||
"toml": "\u{e6b2}",
|
"toml": "\u{e6b2}",
|
||||||
"ini": "\u{F09EE}",
|
"ini": "\u{F09EE}",
|
||||||
"conf": "\u{F09EE}",
|
"conf": "\u{F09EE}",
|
||||||
"cfg": "\u{F09EE}",
|
"cfg": "\u{F09EE}",
|
||||||
"csv": "\u{eefc}",
|
"csv": "\u{eefc}",
|
||||||
"tsv": "\u{F021C}",
|
"tsv": "\u{F021C}",
|
||||||
|
|
||||||
// --- docs / office ---
|
// --- docs / office ---
|
||||||
"pdf": "\u{F0226}",
|
"pdf": "\u{F0226}",
|
||||||
"doc": "\u{F09EE}",
|
"doc": "\u{F09EE}",
|
||||||
"docx": "\u{F09EE}",
|
"docx": "\u{F09EE}",
|
||||||
"rtf": "\u{F09EE}",
|
"rtf": "\u{F09EE}",
|
||||||
"ppt": "\u{F09EE}",
|
"ppt": "\u{F09EE}",
|
||||||
"pptx": "\u{F09EE}",
|
"pptx": "\u{F09EE}",
|
||||||
"log": "\u{F09EE}",
|
"log": "\u{F09EE}",
|
||||||
"xls": "\u{F021C}",
|
"xls": "\u{F021C}",
|
||||||
"xlsx": "\u{F021C}",
|
"xlsx": "\u{F021C}",
|
||||||
|
|
||||||
// --- images ---
|
// --- images ---
|
||||||
"ico": "\u{F021F}",
|
"ico": "\u{F021F}",
|
||||||
|
|
||||||
// --- audio / video ---
|
// --- audio / video ---
|
||||||
"mp3": "\u{e638}",
|
"mp3": "\u{e638}",
|
||||||
"wav": "\u{e638}",
|
"wav": "\u{e638}",
|
||||||
"flac": "\u{e638}",
|
"flac": "\u{e638}",
|
||||||
"ogg": "\u{e638}",
|
"ogg": "\u{e638}",
|
||||||
"mp4": "\u{f0567}",
|
"mp4": "\u{f0567}",
|
||||||
"mkv": "\u{f0567}",
|
"mkv": "\u{f0567}",
|
||||||
"webm": "\u{f0567}",
|
"webm": "\u{f0567}",
|
||||||
"mov": "\u{f0567}",
|
"mov": "\u{f0567}",
|
||||||
|
|
||||||
// --- archives / packages ---
|
// --- archives / packages ---
|
||||||
"zip": "\u{e6aa}",
|
"zip": "\u{e6aa}",
|
||||||
"tar": "\u{f003c}",
|
"tar": "\u{f003c}",
|
||||||
"gz": "\u{f003c}",
|
"gz": "\u{f003c}",
|
||||||
"bz2": "\u{f003c}",
|
"bz2": "\u{f003c}",
|
||||||
"7z": "\u{f003c}",
|
"7z": "\u{f003c}",
|
||||||
|
|
||||||
// --- containers / infra / cloud ---
|
// --- containers / infra / cloud ---
|
||||||
"dockerfile": "\u{F0868}",
|
"dockerfile": "\u{F0868}",
|
||||||
"yml.k8s": "\u{F09EE}",
|
"yml.k8s": "\u{F09EE}",
|
||||||
"yaml.k8s": "\u{F09EE}",
|
"yaml.k8s": "\u{F09EE}",
|
||||||
"tf": "\u{F09EE}",
|
"tf": "\u{F09EE}",
|
||||||
"tfvars": "\u{F09EE}"
|
"tfvars": "\u{F09EE}",
|
||||||
})
|
|
||||||
|
|
||||||
|
// --- moon phases
|
||||||
|
"moon_new": "\u{F0F64}",
|
||||||
|
"moon_waxing_crescent": "\u{F0F67}",
|
||||||
|
"moon_first_quarter": "\u{F0F61}",
|
||||||
|
"moon_waxing_gibbous": "\u{F0F68}",
|
||||||
|
"moon_full": "\u{F0F62}",
|
||||||
|
"moon_waning_gibbous": "\u{F0F66}",
|
||||||
|
"moon_last_quarter": "\u{F0F63}",
|
||||||
|
"moon_waning_crescent": "\u{F0F65}"
|
||||||
|
})
|
||||||
|
|
||||||
readonly property string text: iconMap[name] || iconMap["file"] || ""
|
readonly property string text: iconMap[name] || iconMap["file"] || ""
|
||||||
|
|
||||||
function getIconForFile(fileName) {
|
function getIconForFile(fileName) {
|
||||||
const lowerName = fileName.toLowerCase()
|
const lowerName = fileName.toLowerCase();
|
||||||
if (lowerName.startsWith("dockerfile")) {
|
if (lowerName.startsWith("dockerfile")) {
|
||||||
return "docker"
|
return "docker";
|
||||||
}
|
}
|
||||||
const ext = fileName.split('.').pop()
|
const ext = fileName.split('.').pop();
|
||||||
return ext || ""
|
return ext || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
FontLoader {
|
FontLoader {
|
||||||
|
|||||||
Reference in New Issue
Block a user