adapt Colors.qml to pull in colors from stylix
This commit is contained in:
parent
1d96e74bb6
commit
16343346ab
5 changed files with 98 additions and 86 deletions
84
Colors.qml
84
Colors.qml
|
|
@ -1,26 +1,72 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
QtObject {
|
||||
// --- The Backgrounds (Darkest to Lightest) ---
|
||||
readonly property color base00: "#1e1e2e" // Default Background
|
||||
readonly property color base01: "#181825" // Lighter Background (Status bars, panels)
|
||||
readonly property color base02: "#313244" // Selection Background
|
||||
readonly property color base03: "#45475a" // Comments, Invisibles, line highlighting
|
||||
readonly property color base00: "#" + viewer.base00
|
||||
readonly property color base01: "#" + viewer.base01
|
||||
readonly property color base02: "#" + viewer.base02
|
||||
readonly property color base03: "#" + viewer.base03
|
||||
readonly property color base04: "#" + viewer.base04
|
||||
readonly property color base05: "#" + viewer.base05
|
||||
readonly property color base06: "#" + viewer.base06
|
||||
readonly property color base07: "#" + viewer.base07
|
||||
readonly property color base08: "#" + viewer.base08
|
||||
readonly property color base09: "#" + viewer.base09
|
||||
readonly property color base0A: "#" + viewer.base0A
|
||||
readonly property color base0B: "#" + viewer.base0B
|
||||
readonly property color base0C: "#" + viewer.base0C
|
||||
readonly property color base0D: "#" + viewer.base0D
|
||||
readonly property color base0E: "#" + viewer.base0E
|
||||
readonly property color base0F: "#" + viewer.base0F
|
||||
|
||||
// --- The Foregrounds (Darkest to Lightest) ---
|
||||
readonly property color base04: "#585b70" // Dark Foreground (Used for status bars)
|
||||
readonly property color base05: "#cdd6f4" // Default Foreground, Caret
|
||||
readonly property color base06: "#f5e0dc" // Light Foreground (Rarely used)
|
||||
readonly property color base07: "#b4befe" // Lightest Foreground
|
||||
FileView {
|
||||
id: viewer
|
||||
path: `${Quickshell.env("HOME")}/.config/stylix/palette.json`
|
||||
watchChanges: true
|
||||
onFileChanged: reload()
|
||||
blockLoading: true // colors resolved before first paint, no flash of defaults
|
||||
property alias base00: palette.base00
|
||||
property alias base01: palette.base01
|
||||
property alias base02: palette.base02
|
||||
property alias base03: palette.base03
|
||||
property alias base04: palette.base04
|
||||
property alias base05: palette.base05
|
||||
property alias base06: palette.base06
|
||||
property alias base07: palette.base07
|
||||
property alias base08: palette.base08
|
||||
property alias base09: palette.base09
|
||||
property alias base0A: palette.base0A
|
||||
property alias base0B: palette.base0B
|
||||
property alias base0C: palette.base0C
|
||||
property alias base0D: palette.base0D
|
||||
property alias base0E: palette.base0E
|
||||
property alias base0F: palette.base0F
|
||||
|
||||
// --- The Accent Colors ---
|
||||
readonly property color base08: "#f38ba8" // Red (Variables, errors)
|
||||
readonly property color base09: "#fab387" // Orange (Integers, booleans, constants)
|
||||
readonly property color base0A: "#f9e2af" // Yellow (Classes, search text bg, warnings)
|
||||
readonly property color base0B: "#a6e3a1" // Green (Strings, success states)
|
||||
readonly property color base0C: "#94e2d5" // Cyan (Support, regex, escape chars)
|
||||
readonly property color base0D: "#89b4fa" // Blue (Functions, methods, headings)
|
||||
readonly property color base0E: "#cba6f7" // Purple/Mauve (Keywords, storage, selectors)
|
||||
readonly property color base0F: "#f2cdcd" // Brown/Flamingo (Deprecated, embedded tags)
|
||||
JsonAdapter {
|
||||
id: palette
|
||||
// strings, not colors — QML coerces "#rrggbb" -> color at the readonly props above
|
||||
property string base00
|
||||
property string base01
|
||||
property string base02
|
||||
property string base03
|
||||
property string base04
|
||||
property string base05
|
||||
property string base06
|
||||
property string base07
|
||||
property string base08
|
||||
property string base09
|
||||
property string base0A
|
||||
property string base0B
|
||||
property string base0C
|
||||
property string base0D
|
||||
property string base0E
|
||||
property string base0F
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
48
functions.sh
48
functions.sh
|
|
@ -1,48 +0,0 @@
|
|||
#!/bin/env bash
|
||||
command=$(tinty list | $launcher)
|
||||
walldir=/home/lucy/.walls/
|
||||
qsc() { qs ipc call "$@"; }
|
||||
switch-theme() {
|
||||
case ${1} in
|
||||
fuzzel)
|
||||
choice=$(tinty list | fuzzel -d)
|
||||
tinty apply $choice
|
||||
;;
|
||||
fzf)
|
||||
choice=$(tinty list | fzf)
|
||||
tinty apply $choice
|
||||
;;
|
||||
*)
|
||||
printf "usage: switch-theme <selector>\n<selector can be either fuzzel or fzf\n"
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
switch-wall() {
|
||||
case ${1} in
|
||||
fuzzel)
|
||||
choice=$(ls $walldir | fuzzel -d)
|
||||
if [[ -z $choice ]]; then
|
||||
return
|
||||
fi
|
||||
qsc config setWall $walldir/$choice
|
||||
;;
|
||||
fzf)
|
||||
choice=$(ls $walldir | fzf)
|
||||
if [[ -z $choice ]]; then
|
||||
printf "no wall chosen! \n"
|
||||
return
|
||||
fi
|
||||
printf 'wall choice: %s\n' $choice
|
||||
qsc config setWall $walldir/$choice
|
||||
;;
|
||||
*)
|
||||
printf "usage: switch-wall <selector>\n<selector can be either fuzzel or fzf\n"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# handler for launching the script from non-login shells
|
||||
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
|
||||
"$@"
|
||||
fi
|
||||
|
|
@ -18,15 +18,22 @@ Rectangle {
|
|||
implicitHeight: moduleHeight
|
||||
implicitWidth: batLayout.implicitWidth + 16
|
||||
radius: Config.rounding
|
||||
function batteryIcon() {
|
||||
if (root.charging) { return "\uea33"; }
|
||||
else if(root.percent <= 20) { return "\uea34" }
|
||||
else if(root.percent <= 40) { return "\uea2f" }
|
||||
else if(root.percent <= 60) { return "\uea30" }
|
||||
else if(root.percent <= 80) { return "\uea31" }
|
||||
else if(root.percent >= 80) { return "\uea32" }
|
||||
}
|
||||
|
||||
function batteryIcon(percent, charging) {
|
||||
if (percent <= 15)
|
||||
return charging ? "battery_charging_20" : "battery_alert";
|
||||
if (percent <= 30)
|
||||
return charging ? "battery_charging_30" : "battery_2_bar";
|
||||
if (percent <= 50)
|
||||
return charging ? "battery_charging_50" : "battery_3_bar";
|
||||
if (percent <= 70)
|
||||
return charging ? "battery_charging_60" : "battery_4_bar";
|
||||
if (percent <= 85)
|
||||
return charging ? "battery_charging_80" : "battery_5_bar";
|
||||
if (percent <= 95)
|
||||
return charging ? "battery_charging_90" : "battery_6_bar";
|
||||
return charging ? "battery_charging_full" : "battery_full";
|
||||
}
|
||||
RowLayout {
|
||||
id: batLayout
|
||||
anchors.centerIn: root
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import qs.settings
|
|||
Rectangle {
|
||||
id: root
|
||||
color: clickHandler.containsMouse ? Colors.base02 : Colors.base01
|
||||
property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null
|
||||
property PwNode defaultAudio: Pipewire.ready ? Pipewire.defaultAudioSink : null
|
||||
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
|
||||
radius: Config.rounding
|
||||
required property double moduleHeight
|
||||
|
|
@ -18,16 +18,16 @@ Rectangle {
|
|||
function getVolumeIcon() {
|
||||
let volume = Pipewire.ready ? root.defaultAudio.audio.volume : null;
|
||||
if (root.mute) {
|
||||
return "\uf1c3";
|
||||
return "\ue04f";
|
||||
}
|
||||
if (volume <= 0.33) {
|
||||
return "\u1019d";
|
||||
return "\ue04e";
|
||||
}
|
||||
if (volume <= 0.66) {
|
||||
return "\ueb4f";
|
||||
return "\ue04d";
|
||||
}
|
||||
if (volume >= 0.66) {
|
||||
return "\ueb51";
|
||||
return "\ue050";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,16 @@
|
|||
import qs
|
||||
import qs.settings
|
||||
import QtQuick
|
||||
import qs.widgets
|
||||
|
||||
Text {
|
||||
font.family: "tabler-icons"
|
||||
color: Colors.base07
|
||||
font.pixelSize: Config.iconSize
|
||||
StyledText {
|
||||
property real fill
|
||||
property int grade: 25
|
||||
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pointSize: Config.fontSize
|
||||
font.variableAxes: ({
|
||||
FILL: fill.toFixed(1),
|
||||
GRAD: grade,
|
||||
opsz: 24,
|
||||
wght: 600
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue