repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
quickshell/nuguland/Theme.qml
Rawimport QtQuick
import Quickshell
import Quickshell.Io
Item {
id: theme
property bool lowPowerMode: false
// Nuguland owns selection; retain the existing Nugu state path. Invalid/missing is dark.
readonly property string mode: modeFile.text().trim() === "light" ? "light" : "dark"
// Both palettes, generated by `just quickshell` in nugu/; never edit nugu.json by hand.
readonly property var colors: JSON.parse(paletteFile.text())[mode]
readonly property var content: colors.content
readonly property var ui: colors.ui
readonly property string error: colors.error
readonly property string warning: colors.warning
readonly property string info: colors.info
readonly property string debug: colors.debug
// One spacing scale and one radius per surface level for shared controls.
readonly property int spaceXs: 4
readonly property int spaceSm: 8
readonly property int spaceMd: 12
readonly property int spaceLg: 16
// Controls: buttons, fields, badges, chips, tooltips; icon tiles: the tinted
// square behind an app, item or event icon; cards inside a surface;
// surfaces: popup and overlay windows. Bars, rails and dots are pills or
// circles: half their thickness.
readonly property int radiusControl: 8
readonly property int radiusTile: 9
readonly property int radiusCard: 10
readonly property int radiusSurface: 14
// One family per role and one size per text level: meta for secondary
// lines, body for ordinary text, title for headings; icon glyphs size by
// their role, not by this scale.
readonly property string fontSans: "IBM Plex Sans"
readonly property string fontMono: "IBM Plex Mono"
readonly property string fontIcon: "Symbols Nerd Font Mono"
readonly property int textMeta: 13
readonly property int textBody: 14
readonly property int textTitle: 15
// Smallest pointer target of any control.
readonly property int targetMin: 24
// At most one tooltip shows at a time: a tooltip that becomes wanted emits
// this, and every other wanted tooltip steps back, e.g. hovering a button
// hides the focused button's tooltip.
signal toolTipClaimed(QtObject tip)
// The colour of a service role token; anything unnamed is the ui accent.
function roleColor(role) {
if (role === "warning")
return warning;
if (role === "error")
return error;
if (role === "ui.minor")
return ui.minor;
if (role === "content.accent")
return content.accent;
return ui.accent;
}
function withAlpha(hex, alpha) {
const aa = Math.round(Math.max(0, Math.min(1, alpha)) * 255).toString(16).padStart(2, "0");
return `#${aa}${String(hex).slice(1)}`;
}
visible: false
// Both files apply live: a mode switch or a regenerated palette rebinds every colour.
// Blocking first reads give the first frame its colours; later reads keep the old
// text until the new one has loaded.
FileView {
id: modeFile
path: `${Quickshell.env("XDG_STATE_HOME") || `${Quickshell.env("HOME")}/.local/state`}/nugu/mode`
blockLoading: true
printErrors: false
watchChanges: true
onFileChanged: reload()
}
FileView {
id: paletteFile
path: Qt.resolvedUrl("nugu.json")
blockLoading: true
watchChanges: true
onFileChanged: reload()
}
}