Presets (theme/presets.py): named snapshots of the whole palette, saved/loaded/ deleted from a new bookmark button on the theme widget. Stored outside the repo in ~/.local/share/quickshell/theme-presets/ (JSON, per-machine data, same precedent as the wallpaper history). A built-in Default entry can't be overwritten or deleted. Wiring that up exposed a real gap: the bar's own colors were hand-matched hardcoded QML literals, not actually driven by theme/colors.toml, and opacity wasn't themeable anywhere yet. Fixed both: - colors.toml gains bar_color/pill_color/popup_color (paired with the existing *_opacity floats) plus generic opacity support in render.py (--set now accepts a 0-1 float, not just #rrggbb) - Bar.qml now fetches the palette via render.py --dump and rebinds every matching hardcoded hex literal (accent, foreground, color1/2/3/5/6/8/12, the bar/pill/popup backgrounds, the logo tint and the bar's bottom border) to it; kitty's background_opacity is template-driven instead of a second hardcoded line fighting the themed one - both the bar and the widget listen on their own Quickshell IPC target (render.py/presets.py ping both after every change) so edits reload with no restart, matching the "instant" promise the color editor already had - the theme widget's color popup gained a slider + matching color swatch per surface (Bar/Pills/Popups/Terminal) below the existing role list, and its role labels now say what each color actually paints instead of "Color N" (verified against the templates and Bar.qml's literals, not guessed) with unused roles honestly marked as such - the CPU pill's icon color is deliberately hardcoded again after this - it coincidentally shared color12's hex value with the help icon/detail text, so theming color12 was recoloring it too Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
2205 lines
99 KiB
QML
2205 lines
99 KiB
QML
import QtQuick
|
||
import QtQuick.Layouts
|
||
import Quickshell
|
||
import Quickshell.Io
|
||
import Quickshell.Wayland
|
||
import Quickshell.Hyprland
|
||
import Quickshell.Services.SystemTray
|
||
import Quickshell.Services.Mpris
|
||
|
||
Variants {
|
||
id: root
|
||
model: Quickshell.screens
|
||
|
||
readonly property bool isGerman: Qt.locale().name.startsWith("de")
|
||
readonly property string logoutLabel: isGerman ? "Abmelden" : "Logout"
|
||
readonly property string restartLabel: isGerman ? "Neustart" : "Restart"
|
||
readonly property string shutdownLabel: isGerman ? "Herunterfahren" : "Shutdown"
|
||
|
||
property bool windowSwitcherOpen: false
|
||
property bool helpOpen: false
|
||
|
||
// Bar/pill/popup opacity from theme/colors.toml - defaults match what was hardcoded
|
||
// here before theming picked these up, so nothing changes until a fetch lands.
|
||
property real barOpacity: 0.18
|
||
property real pillOpacity: 0.85
|
||
property real popupOpacity: 0.90
|
||
|
||
// Bar colors from theme/colors.toml - defaults match what was hardcoded as literal hex
|
||
// strings throughout this file before theming picked them up (see README's Theming
|
||
// section for exactly which role paints what). Keyed exactly like colors.toml so the
|
||
// fetch below can copy straight across.
|
||
property var palette: ({
|
||
accent: "#1793d1", foreground: "#c0caf5",
|
||
color1: "#f7768e", color2: "#a6e3a1", color3: "#f9e2af",
|
||
color5: "#cba6f7", color6: "#89dceb", color8: "#565f89", color12: "#7aa2f7",
|
||
bar_color: "#12131b", pill_color: "#1a1b26", popup_color: "#1a1b26",
|
||
})
|
||
|
||
// "#rrggbb" + 0-1 alpha -> "#aarrggbb", so bar/pill/popup backgrounds can have both an
|
||
// editable color *and* an editable opacity instead of a fixed base tint.
|
||
function argb(hex, alpha) {
|
||
var a = Math.round(Math.max(0, Math.min(1, alpha)) * 255).toString(16).padStart(2, "0")
|
||
return "#" + a + hex.slice(1)
|
||
}
|
||
|
||
// Kept in sync with the Hotkeys section of README.md by hand: Hyprland's Lua config binds
|
||
// everything through one opaque "__lua" dispatcher, so hyprctl binds -j can't recover a
|
||
// human-readable action for any of them - there's nothing meaningful left to auto-fetch.
|
||
readonly property var keybindGroups: [
|
||
{
|
||
cat: isGerman ? "Apps" : "Apps", items: [
|
||
{ keys: "Mod + Return", en: "Terminal (Kitty)", de: "Terminal (Kitty)" },
|
||
{ keys: "Mod + W", en: "Browser (Zen)", de: "Browser (Zen)" },
|
||
{ keys: "Mod + N", en: "File manager (Dolphin)", de: "Dateimanager (Dolphin)" },
|
||
{ keys: "Mod + Space", en: "App launcher (Rofi)", de: "App-Starter (Rofi)" },
|
||
{ keys: "Mod + Shift + P", en: "Spotify", de: "Spotify" },
|
||
{ keys: "Mod + Shift + C", en: "Discord", de: "Discord" },
|
||
{ keys: "Mod + Shift + S", en: "Steam", de: "Steam" },
|
||
{ keys: "Mod + Shift + T", en: "btop (in terminal)", de: "btop (im Terminal)" },
|
||
{ keys: "Mod + Alt + C", en: "Qalculate", de: "Qalculate" },
|
||
{ keys: "Mod + C", en: "Clipboard history (cliphist + Rofi)", de: "Zwischenablage-Verlauf (cliphist + Rofi)" },
|
||
]
|
||
},
|
||
{
|
||
cat: isGerman ? "Bar" : "Bar", items: [
|
||
{ keys: "Mod + Shift + A", en: "Toggle the window switcher", de: "Fenster-Umschalter öffnen/schließen" },
|
||
{ keys: "Mod + Shift + H", en: "Toggle this keybinds panel", de: "Dieses Tastenkombinations-Panel öffnen/schließen" },
|
||
]
|
||
},
|
||
{
|
||
cat: isGerman ? "Fenster" : "Windows", items: [
|
||
{ keys: "Mod + Q", en: "Close active window", de: "Aktives Fenster schließen" },
|
||
{ keys: "Mod + Shift + E", en: "Exit Hyprland", de: "Hyprland beenden" },
|
||
{ keys: "Mod + F", en: "Toggle fullscreen", de: "Vollbild umschalten" },
|
||
{ keys: "Mod + V", en: "Toggle floating", de: "Schwebemodus umschalten" },
|
||
{ keys: "Mod + P", en: "Toggle pseudotiling", de: "Pseudo-Tiling umschalten" },
|
||
{ keys: "Mod + ←/→/K/J", en: "Move focus", de: "Fokus bewegen" },
|
||
{ keys: "Mod + Shift + ←/→/↑/↓", en: "Move window", de: "Fenster verschieben" },
|
||
{ keys: "Mod + Ctrl + H/L/K/J", en: "Resize active window", de: "Aktives Fenster skalieren" },
|
||
{ keys: "Mod + LMB drag", en: "Move window", de: "Fenster verschieben" },
|
||
{ keys: "Mod + RMB drag", en: "Resize window", de: "Fenster skalieren" },
|
||
]
|
||
},
|
||
{
|
||
cat: isGerman ? "Workspaces" : "Workspaces", items: [
|
||
{ keys: "Mod + 1…9", en: "Switch to workspace 1–9", de: "Zu Workspace 1–9 wechseln" },
|
||
{ keys: "Mod + Shift + 1…9", en: "Move window to workspace 1–9", de: "Fenster zu Workspace 1–9 verschieben" },
|
||
{ keys: "Mod + Scroll", en: "Next/previous workspace", de: "Nächster/vorheriger Workspace" },
|
||
]
|
||
},
|
||
{
|
||
cat: isGerman ? "Screenshots" : "Screenshots", items: [
|
||
{ keys: "Print", en: "Region screenshot → clipboard", de: "Bereichs-Screenshot → Zwischenablage" },
|
||
{ keys: "Shift + Print", en: "Region screenshot → file", de: "Bereichs-Screenshot → Datei" },
|
||
]
|
||
},
|
||
{
|
||
cat: isGerman ? "Medien / Audio" : "Media / audio", items: [
|
||
{ keys: "XF86AudioRaiseVolume/Lower", en: "Volume up/down", de: "Lautstärke rauf/runter" },
|
||
{ keys: "XF86AudioMute", en: "Mute", de: "Stummschalten" },
|
||
{ keys: "XF86AudioMicMute", en: "Mute mic", de: "Mikro stummschalten" },
|
||
{ keys: "XF86MonBrightnessUp/Down", en: "Brightness up/down", de: "Helligkeit rauf/runter" },
|
||
{ keys: "XF86AudioPlay/Next/Prev", en: "Media playback control", de: "Medienwiedergabe steuern" },
|
||
]
|
||
},
|
||
]
|
||
|
||
function fmtRate(kbps) {
|
||
return kbps >= 1024 ? (kbps / 1024).toFixed(1) + " MB/s" : Math.round(kbps) + " KB/s"
|
||
}
|
||
|
||
// Network throughput, speedtest-style: decimal bit units (1 KB/s = 8000 bit/s), not binary bytes.
|
||
function fmtBitrate(kbps) {
|
||
var bits = kbps * 1024 * 8
|
||
if (bits >= 1000000000) return (bits / 1000000000).toFixed(2) + " Gbit/s"
|
||
if (bits >= 1000000) return (bits / 1000000).toFixed(1) + " Mbit/s"
|
||
if (bits >= 1000) return (bits / 1000).toFixed(0) + " Kbit/s"
|
||
return Math.round(bits) + " bit/s"
|
||
}
|
||
|
||
function isoWeek(d) {
|
||
let date = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
||
let day = (date.getUTCDay() + 6) % 7;
|
||
date.setUTCDate(date.getUTCDate() - day + 3);
|
||
let firstThursday = date.getTime();
|
||
date.setUTCMonth(0, 1);
|
||
if (date.getUTCDay() !== 4) {
|
||
date.setUTCMonth(0, 1 + ((4 - date.getUTCDay()) + 7) % 7);
|
||
}
|
||
return 1 + Math.round((firstThursday - date.getTime()) / (7 * 86400000));
|
||
}
|
||
|
||
function buildCalendar(year, month, today) {
|
||
const firstOfMonth = new Date(year, month, 1);
|
||
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
||
const leading = (firstOfMonth.getDay() + 6) % 7;
|
||
|
||
let cells = [];
|
||
for (let i = 0; i < leading; i++) cells.push(null);
|
||
for (let d = 1; d <= daysInMonth; d++) cells.push(d);
|
||
while (cells.length % 7 !== 0) cells.push(null);
|
||
|
||
let weeksArr = [];
|
||
for (let i = 0; i < cells.length; i += 7) {
|
||
let weekCells = cells.slice(i, i + 7);
|
||
let refDay = weekCells.find(c => c !== null) || 1;
|
||
let refDate = new Date(year, month, refDay);
|
||
weeksArr.push({
|
||
weekNum: root.isoWeek(refDate),
|
||
days: weekCells.map(c => ({
|
||
day: c,
|
||
isToday: c !== null && year === today.getFullYear() && month === today.getMonth() && c === today.getDate()
|
||
}))
|
||
});
|
||
}
|
||
return weeksArr;
|
||
}
|
||
|
||
PanelWindow {
|
||
id: bar
|
||
required property var modelData
|
||
screen: modelData
|
||
|
||
anchors { top: true; left: true; right: true }
|
||
implicitHeight: 34
|
||
exclusionMode: ExclusionMode.Auto
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "bar"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
readonly property var workspaceIds: modelData.name === "DP-1" ? [1, 2, 3, 4, 9] : [5, 6, 7, 8]
|
||
readonly property var activeToplevel: Hyprland.activeToplevel
|
||
readonly property string titleText: (activeToplevel && activeToplevel.monitor && activeToplevel.monitor.name === modelData.name) ? activeToplevel.title : ""
|
||
|
||
// Prefer whichever MPRIS player (Spotify, a browser tab playing
|
||
// YT Music, etc.) is actually playing; fall back to the first one
|
||
// so a paused track still shows.
|
||
readonly property var activePlayer: {
|
||
var players = Mpris.players.values
|
||
for (var i = 0; i < players.length; i++) {
|
||
if (players[i].isPlaying) return players[i]
|
||
}
|
||
return players.length > 0 ? players[0] : null
|
||
}
|
||
|
||
Loader {
|
||
active: modelData === Quickshell.screens[0]
|
||
sourceComponent: IpcHandler {
|
||
target: "windowswitcher"
|
||
|
||
function toggle(): void {
|
||
root.windowSwitcherOpen = !root.windowSwitcherOpen
|
||
}
|
||
}
|
||
}
|
||
|
||
Loader {
|
||
active: modelData === Quickshell.screens[0]
|
||
sourceComponent: IpcHandler {
|
||
target: "help"
|
||
|
||
function toggle(): void {
|
||
root.helpOpen = !root.helpOpen
|
||
}
|
||
}
|
||
}
|
||
|
||
Loader {
|
||
active: modelData === Quickshell.screens[0]
|
||
sourceComponent: Item {
|
||
Process {
|
||
id: themeDump
|
||
command: ["python3", "/home/nico/.config/theme/render.py", "--dump"]
|
||
stdout: StdioCollector { id: themeDumpCollector }
|
||
onExited: {
|
||
try {
|
||
var c = JSON.parse(themeDumpCollector.text)
|
||
if ("bar_opacity" in c) root.barOpacity = c.bar_opacity
|
||
if ("pill_opacity" in c) root.pillOpacity = c.pill_opacity
|
||
if ("popup_opacity" in c) root.popupOpacity = c.popup_opacity
|
||
var p = {}
|
||
for (var key in root.palette) p[key] = (key in c) ? c[key] : root.palette[key]
|
||
root.palette = p
|
||
} catch (e) {}
|
||
}
|
||
}
|
||
|
||
IpcHandler {
|
||
target: "theme"
|
||
|
||
function changed(): void {
|
||
themeDump.running = true
|
||
}
|
||
}
|
||
|
||
Timer { interval: 300; running: true; repeat: false; onTriggered: themeDump.running = true }
|
||
}
|
||
}
|
||
|
||
property string hovered: ""
|
||
property bool menuOpen: false
|
||
property bool calendarOpen: false
|
||
property bool notifOpen: false
|
||
property var notifList: []
|
||
property bool taskbarMode: false
|
||
property bool clockHovering: false
|
||
property bool netHovering: false
|
||
property bool showCpuTemp: false
|
||
property bool showGpuTemp: false
|
||
property bool showPublicIp: false
|
||
property var diskMounts: []
|
||
property int diskIndex: 0
|
||
readonly property var currentDisk: diskMounts.length > diskIndex
|
||
? diskMounts[diskIndex]
|
||
: { path: "/", pct: diskPct, total: diskTotal, used: diskUsed, avail: diskAvail, device: "", readKBps: 0, writeKBps: 0 }
|
||
|
||
// ---- stats ----
|
||
property int cpuPct: 0
|
||
property int memPct: 0
|
||
property real memUsed: 0
|
||
property real memTotal: 0
|
||
property int diskPct: 0
|
||
property real diskTotal: 0
|
||
property real diskUsed: 0
|
||
property real diskAvail: 0
|
||
property string load1: "0.00"
|
||
property string load5: "0.00"
|
||
property string load15: "0.00"
|
||
property string tempC: "NA"
|
||
readonly property bool tempAvailable: tempC !== "NA"
|
||
readonly property bool tempCritical: tempAvailable && parseInt(tempC) >= 80
|
||
property var perCore: []
|
||
property string gpuUtil: "NA"
|
||
property string gpuTemp: "NA"
|
||
property string gpuMemUsed: "NA"
|
||
property string gpuMemTotal: "NA"
|
||
readonly property bool gpuAvailable: gpuUtil !== "NA"
|
||
|
||
// ---- network ----
|
||
property string connType: ""
|
||
property string connName: ""
|
||
property string netDevice: ""
|
||
property real netRxKBps: 0
|
||
property real netTxKBps: 0
|
||
property real netPrevT: 0
|
||
property real netPrevRx: 0
|
||
property real netPrevTx: 0
|
||
property string localIp: ""
|
||
property string publicIp: ""
|
||
property bool publicIpLoading: false
|
||
|
||
// ---- volume ----
|
||
property int volumePct: 0
|
||
property bool volumeMuted: false
|
||
|
||
// ---- clock ----
|
||
property var now: new Date()
|
||
property int viewYear: now.getFullYear()
|
||
property int viewMonth: now.getMonth()
|
||
property var weeks: root.buildCalendar(viewYear, viewMonth, now)
|
||
|
||
Timer {
|
||
interval: 1000
|
||
running: true
|
||
repeat: true
|
||
onTriggered: bar.now = new Date()
|
||
}
|
||
|
||
Process {
|
||
id: statsProc
|
||
command: ["bash", "/home/nico/.config/quickshell/default/scripts/stats.sh"]
|
||
stdout: StdioCollector { id: statsCollector }
|
||
onExited: {
|
||
var p = statsCollector.text.trim().split("|")
|
||
if (p.length < 12) return
|
||
bar.cpuPct = parseInt(p[0]) || 0
|
||
bar.memPct = parseInt(p[1]) || 0
|
||
bar.memUsed = parseFloat(p[2]) || 0
|
||
bar.memTotal = parseFloat(p[3]) || 0
|
||
bar.diskPct = parseInt(p[4]) || 0
|
||
bar.diskTotal = parseFloat(p[5]) || 0
|
||
bar.diskUsed = parseFloat(p[6]) || 0
|
||
bar.diskAvail = parseFloat(p[7]) || 0
|
||
bar.load1 = p[8]
|
||
bar.load5 = p[9]
|
||
bar.load15 = p[10]
|
||
bar.tempC = p[11]
|
||
bar.perCore = p.length > 12 && p[12] !== "" ? p[12].split(",").map(Number) : []
|
||
if (p.length > 17 && p[17] !== "") {
|
||
bar.diskMounts = p[17].split(";").map(function (m) {
|
||
var f = m.split(",")
|
||
return {
|
||
path: f[0], pct: parseInt(f[1]) || 0, total: parseFloat(f[2]) || 0,
|
||
used: parseFloat(f[3]) || 0, avail: parseFloat(f[4]) || 0, device: f[5] || "",
|
||
readKBps: parseFloat(f[6]) || 0, writeKBps: parseFloat(f[7]) || 0
|
||
}
|
||
})
|
||
if (bar.diskIndex >= bar.diskMounts.length) bar.diskIndex = 0
|
||
}
|
||
if (p.length > 16) {
|
||
bar.gpuUtil = p[13]
|
||
bar.gpuTemp = p[14]
|
||
bar.gpuMemUsed = p[15]
|
||
bar.gpuMemTotal = p[16]
|
||
}
|
||
}
|
||
}
|
||
|
||
Timer { interval: 100; running: true; repeat: false; onTriggered: statsProc.running = true }
|
||
Timer { interval: 1000; running: true; repeat: true; onTriggered: statsProc.running = true }
|
||
|
||
Component {
|
||
id: bellComp
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: (bellArea.containsMouse || bar.notifOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: bar.notifList.length > 0 ? "\uf0f3" : "\uf0a2"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 14
|
||
color: (bellArea.containsMouse || bar.notifOpen) ? "#0f111a" : (bar.notifList.length > 0 ? root.palette.accent : root.palette.color8)
|
||
}
|
||
|
||
Rectangle {
|
||
visible: bar.notifList.length > 0
|
||
anchors { top: parent.top; right: parent.right; topMargin: -3; rightMargin: -3 }
|
||
width: Math.max(14, badgeText.implicitWidth + 6)
|
||
height: 14
|
||
radius: 7
|
||
color: root.palette.color1
|
||
Text {
|
||
id: badgeText
|
||
anchors.centerIn: parent
|
||
text: bar.notifList.length > 99 ? "99+" : bar.notifList.length
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 9
|
||
font.bold: true
|
||
color: "#0f111a"
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
id: bellArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onClicked: {
|
||
bar.notifOpen = !bar.notifOpen
|
||
if (bar.notifOpen) notifProc.running = true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// ---- notification panel (mako history minus what was marked read) ----
|
||
Process {
|
||
id: notifProc
|
||
command: ["python3", "/home/nico/.config/quickshell/default/scripts/notifs.py"]
|
||
stdout: StdioCollector { id: notifCollector }
|
||
onExited: {
|
||
try { bar.notifList = JSON.parse(notifCollector.text) } catch (e) {}
|
||
}
|
||
}
|
||
|
||
Process {
|
||
id: notifReadProc
|
||
onExited: notifProc.running = true
|
||
}
|
||
|
||
function markRead(keys) {
|
||
var gone = {}
|
||
keys.forEach(function (k) { gone[k] = true })
|
||
notifList = notifList.filter(function (n) { return !gone[n.key] })
|
||
notifReadProc.command = ["python3", "/home/nico/.config/quickshell/default/scripts/notifs.py", "read"].concat(keys)
|
||
notifReadProc.running = true
|
||
}
|
||
|
||
Timer { interval: 400; running: true; repeat: false; onTriggered: notifProc.running = true }
|
||
Timer { interval: 4000; running: true; repeat: true; onTriggered: notifProc.running = true }
|
||
|
||
Process {
|
||
id: netProc
|
||
command: ["bash", "-c", "conn_line=$(nmcli -t -f TYPE,STATE,CONNECTION,DEVICE device status 2>/dev/null | awk -F: '$2==\"connected\"{print $1\"|\"$4; exit}'); conn=${conn_line%%|*}; dev=${conn_line##*|}; if [ \"$conn\" = \"wifi\" ]; then name=$(nmcli -t -f active,ssid dev wifi 2>/dev/null | awk -F: '$1==\"yes\"{print $2; exit}'); else name=\"LAN\"; fi; ip=$(ip route get 1.1.1.1 2>/dev/null | awk '{for(i=1;i<=NF;i++) if ($i==\"src\") print $(i+1)}'); echo \"${conn}|${name}|${ip}|${dev}\""]
|
||
stdout: StdioCollector { id: netCollector }
|
||
onExited: {
|
||
var parts = netCollector.text.trim().split("|")
|
||
bar.connType = parts[0] || ""
|
||
bar.connName = parts[1] || ""
|
||
bar.localIp = parts[2] || ""
|
||
var dev = parts[3] || ""
|
||
if (dev !== bar.netDevice) bar.netPrevT = 0 // switched interface: drop the stale baseline
|
||
bar.netDevice = dev
|
||
}
|
||
}
|
||
|
||
Timer { interval: 300; running: true; repeat: false; onTriggered: netProc.running = true }
|
||
Timer { interval: 8000; running: true; repeat: true; onTriggered: netProc.running = true }
|
||
|
||
// Throughput for whatever netProc found as the active device, sampled every second
|
||
// independently of the (slower) connection/SSID lookup above so up/down feels live.
|
||
Process {
|
||
id: netIoProc
|
||
command: ["bash", "-c", "d=\"$0\"; if [ -n \"$d\" ] && [ -d \"/sys/class/net/$d/statistics\" ]; then cat \"/sys/class/net/$d/statistics/rx_bytes\" \"/sys/class/net/$d/statistics/tx_bytes\"; else echo 0; echo 0; fi", bar.netDevice]
|
||
stdout: StdioCollector { id: netIoCollector }
|
||
onExited: {
|
||
var lines = netIoCollector.text.trim().split("\n")
|
||
var rx = parseFloat(lines[0]) || 0
|
||
var tx = parseFloat(lines[1]) || 0
|
||
var now = Date.now()
|
||
if (bar.netPrevT > 0) {
|
||
var dt = (now - bar.netPrevT) / 1000
|
||
if (dt > 0) {
|
||
bar.netRxKBps = Math.max(0, rx - bar.netPrevRx) / 1024 / dt
|
||
bar.netTxKBps = Math.max(0, tx - bar.netPrevTx) / 1024 / dt
|
||
}
|
||
}
|
||
bar.netPrevT = now
|
||
bar.netPrevRx = rx
|
||
bar.netPrevTx = tx
|
||
}
|
||
}
|
||
|
||
Timer { interval: 1000; running: true; repeat: true; onTriggered: netIoProc.running = true }
|
||
|
||
Process {
|
||
id: publicIpProc
|
||
command: ["bash", "-c", "curl -s -m 3 https://api.ipify.org"]
|
||
stdout: StdioCollector { id: publicIpCollector }
|
||
onExited: {
|
||
var text = publicIpCollector.text.trim()
|
||
bar.publicIp = text !== "" ? text : (root.isGerman ? "nicht verfügbar" : "unavailable")
|
||
bar.publicIpLoading = false
|
||
}
|
||
}
|
||
|
||
Process {
|
||
id: volumeProc
|
||
command: ["bash", "/home/nico/.config/quickshell/default/scripts/volume.sh"]
|
||
stdout: StdioCollector { id: volumeCollector }
|
||
onExited: {
|
||
var parts = volumeCollector.text.trim().split("|")
|
||
bar.volumePct = parseInt(parts[0]) || 0
|
||
bar.volumeMuted = parts[1] === "1"
|
||
}
|
||
}
|
||
|
||
Timer { interval: 500; running: true; repeat: false; onTriggered: volumeProc.running = true }
|
||
Timer { interval: 5000; running: true; repeat: true; onTriggered: volumeProc.running = true }
|
||
|
||
Process {
|
||
id: volumeWatchProc
|
||
command: ["pactl", "subscribe"]
|
||
running: true
|
||
stdout: SplitParser {
|
||
onRead: data => {
|
||
if (data.indexOf("sink") !== -1) volumeProc.running = true
|
||
}
|
||
}
|
||
}
|
||
|
||
Process { id: pavucontrolProc; command: ["pavucontrol"] }
|
||
Process { id: volUpProc; command: ["wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+"] }
|
||
Process { id: volDownProc; command: ["wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-"] }
|
||
Process { id: volMuteProc; command: ["wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle"] }
|
||
|
||
Process { id: logoutProc; command: ["hyprctl", "dispatch", "hl.dsp.exit()"] }
|
||
Process { id: rebootProc; command: ["systemctl", "reboot"] }
|
||
Process { id: shutdownProc; command: ["systemctl", "poweroff"] }
|
||
|
||
FontMetrics {
|
||
id: valueFont
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
}
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
color: root.argb(root.palette.bar_color, root.barOpacity)
|
||
}
|
||
|
||
Rectangle {
|
||
anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
|
||
height: 1
|
||
color: root.argb(root.palette.accent, 0.45)
|
||
}
|
||
|
||
// ================= LEFT =================
|
||
RowLayout {
|
||
id: leftRow
|
||
anchors { left: parent.left; leftMargin: 8; verticalCenter: parent.verticalCenter }
|
||
spacing: 6
|
||
|
||
Rectangle {
|
||
Layout.preferredWidth: logoText.implicitWidth + 28
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: root.argb(root.palette.accent, 0.12)
|
||
|
||
Text {
|
||
id: logoText
|
||
anchors.centerIn: parent
|
||
text: ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 18
|
||
color: root.palette.accent
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
onClicked: bar.taskbarMode = !bar.taskbarMode
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
visible: !bar.taskbarMode
|
||
Layout.preferredWidth: visible ? wsRow.implicitWidth + 8 : 0
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
RowLayout {
|
||
id: wsRow
|
||
anchors.centerIn: parent
|
||
spacing: 2
|
||
|
||
Repeater {
|
||
model: bar.workspaceIds
|
||
|
||
Rectangle {
|
||
id: wsBtn
|
||
required property int modelData
|
||
readonly property var hyprWs: {
|
||
for (let i = 0; i < Hyprland.workspaces.values.length; i++) {
|
||
if (Hyprland.workspaces.values[i].id === modelData) return Hyprland.workspaces.values[i]
|
||
}
|
||
return null
|
||
}
|
||
readonly property bool active: hyprWs !== null && hyprWs.active && Hyprland.focusedMonitor !== null && Hyprland.focusedMonitor.name === bar.modelData.name
|
||
|
||
Layout.preferredWidth: 22
|
||
Layout.preferredHeight: 20
|
||
radius: 8
|
||
color: active ? root.palette.accent : (wsArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.22) : "transparent")
|
||
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: {
|
||
if (wsBtn.active) return ""
|
||
if (wsBtn.modelData === 5) return ""
|
||
if (wsBtn.modelData === 6) return ""
|
||
if (wsBtn.modelData === 7) return ""
|
||
if (wsBtn.modelData === 8) return ""
|
||
return wsBtn.modelData.toString()
|
||
}
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: wsBtn.active ? "#0f111a" : root.palette.color8
|
||
}
|
||
|
||
MouseArea {
|
||
id: wsArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onClicked: Hyprland.dispatch("hl.dsp.focus({workspace = " + wsBtn.modelData + "})")
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
Loader {
|
||
id: bellBtn
|
||
visible: !bar.taskbarMode
|
||
Layout.preferredWidth: visible ? 32 : 0
|
||
Layout.preferredHeight: 26
|
||
sourceComponent: bellComp
|
||
}
|
||
}
|
||
|
||
// ================= CENTER =================
|
||
// The focused monitor shows the active window's title; other
|
||
// monitors have nothing better to show there, so use that space
|
||
// for the currently playing track instead.
|
||
Item {
|
||
id: centerContainer
|
||
visible: !bar.taskbarMode
|
||
// Center in the whole bar by default; only shift off that if it
|
||
// would actually overlap the left or right pill group (their
|
||
// widths aren't equal, so bar-centering isn't always safe).
|
||
readonly property real barCenteredX: (bar.width - width) / 2
|
||
x: Math.min(Math.max(centerContainer.barCenteredX, leftRow.x + leftRow.width), rightRow.x - width)
|
||
anchors.verticalCenter: parent.verticalCenter
|
||
width: Math.min(centerRow.implicitWidth, 500)
|
||
height: centerRow.implicitHeight
|
||
clip: true
|
||
|
||
readonly property bool isFocusedMonitor: Hyprland.focusedMonitor !== null && Hyprland.focusedMonitor.name === bar.modelData.name
|
||
readonly property bool showingMedia: !centerContainer.isFocusedMonitor && bar.activePlayer !== null && bar.activePlayer.trackTitle !== ""
|
||
readonly property string mainText: centerContainer.isFocusedMonitor ? bar.titleText : (centerContainer.showingMedia ? bar.activePlayer.trackTitle : "")
|
||
readonly property string artistText: centerContainer.showingMedia ? (bar.activePlayer.trackArtist || "") : ""
|
||
|
||
Row {
|
||
id: centerRow
|
||
spacing: 6
|
||
|
||
Text {
|
||
text: centerContainer.mainText
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
font.bold: centerContainer.showingMedia
|
||
color: root.palette.foreground
|
||
}
|
||
Text {
|
||
visible: centerContainer.artistText !== ""
|
||
text: "—"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: root.palette.accent
|
||
}
|
||
Text {
|
||
visible: centerContainer.artistText !== ""
|
||
text: centerContainer.artistText
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: root.palette.color12
|
||
}
|
||
}
|
||
|
||
NumberAnimation {
|
||
target: centerRow
|
||
property: "x"
|
||
running: centerRow.implicitWidth > centerContainer.width
|
||
loops: Animation.Infinite
|
||
from: centerContainer.width
|
||
to: -centerRow.implicitWidth
|
||
duration: Math.max(4000, centerRow.implicitWidth * 20)
|
||
onRunningChanged: if (!running) centerRow.x = 0
|
||
}
|
||
}
|
||
|
||
// ================= TASKBAR (toggled via Arch logo) =================
|
||
RowLayout {
|
||
id: taskbarRow
|
||
visible: bar.taskbarMode
|
||
|
||
// Hyprland.toplevels can silently reorder (e.g. on focus changes),
|
||
// which makes taskbar buttons jump around. Sort by address so each
|
||
// window keeps a stable slot like a real taskbar.
|
||
//
|
||
// It also includes things hyprctl clients doesn't (e.g. fcitx's
|
||
// "Input" / "Default IME" popup toplevels) - those never get a
|
||
// real workspace assigned, unlike genuine application windows, so
|
||
// filter on that.
|
||
readonly property var sortedToplevels: {
|
||
var arr = Hyprland.toplevels.values.filter(function (tl) {
|
||
return tl.workspace !== null
|
||
})
|
||
arr.sort(function (a, b) {
|
||
return a.address < b.address ? -1 : (a.address > b.address ? 1 : 0)
|
||
})
|
||
return arr
|
||
}
|
||
|
||
// Prefer the Wayland toplevel handle's appId - it's set by the
|
||
// compositor immediately on window creation. lastIpcObject
|
||
// (Hyprland's IPC JSON snapshot) can lag or stay stale for
|
||
// windows opened after Quickshell started, which was leaving
|
||
// icons unresolved for anything not already open at launch.
|
||
function classOf(tl) {
|
||
if (tl.wayland && tl.wayland.appId) return tl.wayland.appId
|
||
return tl.lastIpcObject ? (tl.lastIpcObject.class || "") : ""
|
||
}
|
||
|
||
// One entry per app class, each carrying all its windows, so
|
||
// multiple windows of the same app collapse into a single button.
|
||
readonly property var groupedTasks: {
|
||
var groups = {}
|
||
var order = []
|
||
for (var i = 0; i < taskbarRow.sortedToplevels.length; i++) {
|
||
var tl = taskbarRow.sortedToplevels[i]
|
||
var cls = taskbarRow.classOf(tl)
|
||
var key = cls || tl.address
|
||
if (!groups[key]) {
|
||
groups[key] = { wmClass: cls, windows: [] }
|
||
order.push(key)
|
||
}
|
||
groups[key].windows.push(tl)
|
||
}
|
||
var result = []
|
||
for (var j = 0; j < order.length; j++) result.push(groups[order[j]])
|
||
return result
|
||
}
|
||
|
||
anchors {
|
||
left: leftRow.right
|
||
leftMargin: 8
|
||
verticalCenter: parent.verticalCenter
|
||
}
|
||
spacing: 8
|
||
|
||
Text {
|
||
visible: taskbarRow.groupedTasks.length === 0
|
||
text: root.isGerman ? "Keine Fenster geöffnet" : "No open windows"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color8
|
||
}
|
||
|
||
Repeater {
|
||
model: taskbarRow.groupedTasks
|
||
|
||
Rectangle {
|
||
id: taskBtn
|
||
required property var modelData
|
||
readonly property var windows: taskBtn.modelData.windows
|
||
readonly property bool isActive: bar.activeToplevel !== null && taskBtn.windows.some(function (w) { return w.address === bar.activeToplevel.address })
|
||
// Popup stays open across the gap between the button and the
|
||
// popup itself (they're separate surfaces) via a short close
|
||
// delay, so the pointer has time to reach the window list.
|
||
property bool showPopup: false
|
||
|
||
Timer {
|
||
id: hidePopupTimer
|
||
interval: 250
|
||
onTriggered: taskBtn.showPopup = false
|
||
}
|
||
|
||
readonly property var desktopEntry: {
|
||
// heuristicLookup() is a plain call, not a reactive property read;
|
||
// depend on applications explicitly so this re-evaluates once the
|
||
// desktop entry list has finished loading (it's empty for a moment
|
||
// at Quickshell startup).
|
||
var _appList = DesktopEntries.applications
|
||
return taskBtn.modelData.wmClass ? DesktopEntries.heuristicLookup(taskBtn.modelData.wmClass) : null
|
||
}
|
||
readonly property string iconSource: taskBtn.desktopEntry && taskBtn.desktopEntry.icon ? Quickshell.iconPath(taskBtn.desktopEntry.icon, "") : ""
|
||
readonly property string fallbackLetter: {
|
||
if (taskBtn.modelData.wmClass && taskBtn.modelData.wmClass.length > 0) return taskBtn.modelData.wmClass.charAt(0).toUpperCase()
|
||
if (taskBtn.windows.length > 0 && taskBtn.windows[0].title) return taskBtn.windows[0].title.charAt(0).toUpperCase()
|
||
return "?"
|
||
}
|
||
Layout.preferredWidth: 32
|
||
Layout.preferredHeight: 26
|
||
radius: 8
|
||
color: taskBtn.isActive ? root.palette.accent : (taskArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.22) : root.argb(root.palette.pill_color, root.pillOpacity))
|
||
|
||
Image {
|
||
visible: taskBtn.iconSource !== ""
|
||
anchors.centerIn: parent
|
||
width: 16
|
||
height: 16
|
||
source: taskBtn.iconSource
|
||
sourceSize: Qt.size(16, 16)
|
||
}
|
||
|
||
Text {
|
||
visible: taskBtn.iconSource === ""
|
||
anchors.centerIn: parent
|
||
text: taskBtn.fallbackLetter
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
font.bold: true
|
||
color: taskBtn.isActive ? "#0f111a" : root.palette.foreground
|
||
}
|
||
|
||
// Multi-window indicator
|
||
Rectangle {
|
||
visible: taskBtn.windows.length > 1
|
||
anchors.right: parent.right
|
||
anchors.bottom: parent.bottom
|
||
anchors.rightMargin: -3
|
||
anchors.bottomMargin: -3
|
||
width: 14
|
||
height: 14
|
||
radius: 7
|
||
color: root.palette.color12
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.102, 0.106, 0.149, 1)
|
||
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: taskBtn.windows.length
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 9
|
||
font.bold: true
|
||
color: "#0f111a"
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
id: taskArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: {
|
||
hidePopupTimer.stop()
|
||
taskBtn.showPopup = true
|
||
}
|
||
onExited: hidePopupTimer.restart()
|
||
onClicked: {
|
||
var addr = taskBtn.windows[0].address
|
||
if (!addr.startsWith("0x")) addr = "0x" + addr
|
||
Hyprland.dispatch("hl.dsp.focus({window = \"address:" + addr + "\"})")
|
||
}
|
||
}
|
||
|
||
// Window list, shown only on hover. The bar is a fixed-size
|
||
// Wayland layer surface, so content can't just overflow its
|
||
// bounds - this needs its own popup surface, same pattern as
|
||
// the clock tooltip below. One row per window in the group,
|
||
// each individually clickable to focus that specific window.
|
||
LazyLoader {
|
||
active: taskBtn.showPopup
|
||
|
||
PanelWindow {
|
||
screen: bar.modelData
|
||
anchors { top: true; left: true }
|
||
margins { top: 34; left: taskbarRow.x + taskBtn.x }
|
||
implicitWidth: 220
|
||
implicitHeight: taskGroupCol.implicitHeight + 16
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "taskbar-tooltip"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 8
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
// Tracks hover without stealing clicks from the
|
||
// row MouseAreas below, so moving the pointer
|
||
// into the popup cancels the close timer.
|
||
HoverHandler {
|
||
onHoveredChanged: {
|
||
if (hovered) hidePopupTimer.stop()
|
||
else hidePopupTimer.restart()
|
||
}
|
||
}
|
||
|
||
ColumnLayout {
|
||
id: taskGroupCol
|
||
anchors.fill: parent
|
||
anchors.margins: 8
|
||
spacing: 2
|
||
|
||
Repeater {
|
||
model: taskBtn.windows
|
||
|
||
Rectangle {
|
||
id: taskGroupRow
|
||
required property var modelData
|
||
Layout.fillWidth: true
|
||
implicitHeight: 24
|
||
radius: 6
|
||
color: groupRowArea.containsMouse ? root.palette.accent : "transparent"
|
||
|
||
Text {
|
||
anchors.fill: parent
|
||
anchors.leftMargin: 8
|
||
anchors.rightMargin: 8
|
||
verticalAlignment: Text.AlignVCenter
|
||
elide: Text.ElideRight
|
||
text: taskGroupRow.modelData.title
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: groupRowArea.containsMouse ? "#0f111a" : root.palette.foreground
|
||
}
|
||
|
||
MouseArea {
|
||
id: groupRowArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onClicked: {
|
||
var addr = taskGroupRow.modelData.address
|
||
if (!addr.startsWith("0x")) addr = "0x" + addr
|
||
Hyprland.dispatch("hl.dsp.focus({window = \"address:" + addr + "\"})")
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// ================= RIGHT =================
|
||
RowLayout {
|
||
id: rightRow
|
||
anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
|
||
spacing: 10
|
||
|
||
Rectangle {
|
||
id: trayPill
|
||
readonly property int count: SystemTray.items.values.length
|
||
visible: count > 0 && !bar.taskbarMode
|
||
Layout.preferredWidth: visible ? trayRow.implicitWidth + 16 : 0
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
RowLayout {
|
||
id: trayRow
|
||
anchors.centerIn: parent
|
||
spacing: 8
|
||
|
||
Repeater {
|
||
model: SystemTray.items
|
||
|
||
Item {
|
||
required property var modelData
|
||
Layout.preferredWidth: 18
|
||
Layout.preferredHeight: 18
|
||
|
||
Image {
|
||
anchors.fill: parent
|
||
source: modelData.icon
|
||
sourceSize: Qt.size(18, 18)
|
||
smooth: true
|
||
}
|
||
|
||
MouseArea {
|
||
id: trayItemArea
|
||
anchors.fill: parent
|
||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||
onClicked: mouse => {
|
||
if (mouse.button === Qt.RightButton && modelData.hasMenu) {
|
||
var pos = trayItemArea.mapToItem(bar.contentItem, mouse.x, mouse.y)
|
||
modelData.display(bar, pos.x, pos.y)
|
||
} else {
|
||
modelData.activate()
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: cpuPill
|
||
visible: !bar.taskbarMode
|
||
Layout.preferredWidth: cpuRow.implicitWidth + 14
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: bar.hovered === "cpu" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Row {
|
||
id: cpuRow
|
||
anchors.centerIn: parent
|
||
spacing: 4
|
||
Text {
|
||
text: ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
// Deliberately hardcoded, not theme-bound: sharing color12 with the
|
||
// help icon/detail text meant recoloring one recolored the other.
|
||
color: bar.hovered === "cpu" ? "#0f111a" : (bar.showCpuTemp ? (bar.tempCritical ? "#f7768e" : "#f9e2af") : "#7aa2f7")
|
||
}
|
||
Text {
|
||
text: bar.showCpuTemp ? (bar.tempC + "°C") : (bar.cpuPct + "%")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
width: valueFont.advanceWidth("100%")
|
||
horizontalAlignment: Text.AlignRight
|
||
color: bar.hovered === "cpu" ? "#0f111a" : root.palette.foreground
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: bar.hovered = "cpu"
|
||
onExited: bar.hovered = ""
|
||
onClicked: if (bar.tempAvailable) bar.showCpuTemp = !bar.showCpuTemp
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: memPill
|
||
visible: !bar.taskbarMode
|
||
Layout.preferredWidth: memRow.implicitWidth + 20
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: bar.hovered === "mem" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Row {
|
||
id: memRow
|
||
anchors.centerIn: parent
|
||
spacing: 5
|
||
Text {
|
||
text: ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: bar.hovered === "mem" ? "#0f111a" : root.palette.color6
|
||
}
|
||
Text {
|
||
text: bar.memPct + "%"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
width: valueFont.advanceWidth("100%")
|
||
horizontalAlignment: Text.AlignRight
|
||
color: bar.hovered === "mem" ? "#0f111a" : root.palette.foreground
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: bar.hovered = "mem"
|
||
onExited: bar.hovered = ""
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: diskPill
|
||
visible: !bar.taskbarMode
|
||
Layout.preferredWidth: diskRow.implicitWidth + 20
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: bar.hovered === "disk" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Row {
|
||
id: diskRow
|
||
anchors.centerIn: parent
|
||
spacing: 5
|
||
Text {
|
||
text: ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: bar.hovered === "disk" ? "#0f111a" : root.palette.foreground
|
||
}
|
||
Text {
|
||
text: bar.currentDisk.pct + "%"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
width: valueFont.advanceWidth("100%")
|
||
horizontalAlignment: Text.AlignRight
|
||
color: bar.hovered === "disk" ? "#0f111a" : root.palette.foreground
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: bar.hovered = "disk"
|
||
onExited: bar.hovered = ""
|
||
onClicked: if (bar.diskMounts.length > 0) bar.diskIndex = (bar.diskIndex + 1) % bar.diskMounts.length
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: gpuPill
|
||
visible: bar.gpuAvailable && !bar.taskbarMode
|
||
Layout.preferredWidth: visible ? gpuRow.implicitWidth + 14 : 0
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: bar.hovered === "gpu" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Row {
|
||
id: gpuRow
|
||
anchors.centerIn: parent
|
||
spacing: 4
|
||
Text {
|
||
text: ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: bar.hovered === "gpu" ? "#0f111a" : (bar.showGpuTemp ? root.palette.color3 : root.palette.color2)
|
||
}
|
||
Text {
|
||
text: bar.showGpuTemp ? (bar.gpuTemp + "°C") : (bar.gpuUtil + "%")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
width: valueFont.advanceWidth("100%")
|
||
horizontalAlignment: Text.AlignRight
|
||
color: bar.hovered === "gpu" ? "#0f111a" : root.palette.foreground
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: bar.hovered = "gpu"
|
||
onExited: bar.hovered = ""
|
||
onClicked: bar.showGpuTemp = !bar.showGpuTemp
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: volumePill
|
||
visible: !bar.taskbarMode
|
||
Layout.preferredWidth: volRow.implicitWidth + 20
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: bar.hovered === "vol" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Row {
|
||
id: volRow
|
||
anchors.centerIn: parent
|
||
spacing: 5
|
||
Text {
|
||
text: bar.volumeMuted ? "" : ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: bar.hovered === "vol" ? "#0f111a" : (bar.volumeMuted ? root.palette.color8 : root.palette.color5)
|
||
}
|
||
Text {
|
||
text: (bar.volumeMuted ? (root.isGerman ? "muted" : "muted") : bar.volumePct + "%")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: bar.hovered === "vol" ? "#0f111a" : root.palette.foreground
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||
onEntered: bar.hovered = "vol"
|
||
onExited: bar.hovered = ""
|
||
onClicked: mouse => {
|
||
if (mouse.button === Qt.RightButton) {
|
||
volMuteProc.running = true
|
||
} else {
|
||
pavucontrolProc.startDetached()
|
||
}
|
||
}
|
||
onWheel: wheel => {
|
||
if (wheel.angleDelta.y > 0) volUpProc.running = true
|
||
else volDownProc.running = true
|
||
}
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: networkPill
|
||
visible: !bar.taskbarMode
|
||
Layout.preferredWidth: netRow.implicitWidth + 20
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: bar.hovered === "net" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
readonly property string icon: bar.connType === "wifi" ? "" : bar.connType === "ethernet" ? "" : ""
|
||
readonly property string statusText: bar.connType === "wifi" ? (bar.connName || "WLAN") : bar.connType === "ethernet" ? "LAN" : "offline"
|
||
readonly property color statusColor: bar.connType === "" ? root.palette.color8 : root.palette.color2
|
||
|
||
Row {
|
||
id: netRow
|
||
anchors.centerIn: parent
|
||
spacing: 6
|
||
Text {
|
||
text: networkPill.icon
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 14
|
||
color: bar.hovered === "net" ? "#0f111a" : networkPill.statusColor
|
||
}
|
||
Text {
|
||
text: networkPill.statusText
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
elide: Text.ElideRight
|
||
width: Math.min(implicitWidth, 90)
|
||
color: bar.hovered === "net" ? "#0f111a" : root.palette.foreground
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: bar.hovered = "net"
|
||
onExited: bar.hovered = ""
|
||
onClicked: {
|
||
bar.showPublicIp = !bar.showPublicIp
|
||
if (bar.showPublicIp) {
|
||
bar.publicIpLoading = true
|
||
publicIpProc.running = true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
Loader {
|
||
visible: bar.taskbarMode
|
||
Layout.preferredWidth: visible ? 32 : 0
|
||
Layout.preferredHeight: 26
|
||
sourceComponent: bellComp
|
||
}
|
||
|
||
Rectangle {
|
||
id: helpBtn
|
||
visible: bar.taskbarMode
|
||
Layout.preferredWidth: visible ? 32 : 0
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: (helpArea.containsMouse || root.helpOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 14
|
||
color: (helpArea.containsMouse || root.helpOpen) ? "#0f111a" : root.palette.color12
|
||
}
|
||
|
||
MouseArea {
|
||
id: helpArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: bar.hovered = "help"
|
||
onExited: bar.hovered = ""
|
||
onClicked: root.helpOpen = !root.helpOpen
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: clockPill
|
||
Layout.preferredWidth: 100
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: (clockArea.containsMouse || bar.calendarOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: Qt.formatDateTime(bar.now, "dd.MM. hh:mm")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: (clockArea.containsMouse || bar.calendarOpen) ? "#0f111a" : root.palette.foreground
|
||
}
|
||
|
||
MouseArea {
|
||
id: clockArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onEntered: bar.clockHovering = true
|
||
onExited: bar.clockHovering = false
|
||
onClicked: bar.calendarOpen = !bar.calendarOpen
|
||
}
|
||
}
|
||
|
||
Rectangle {
|
||
id: powerBtn
|
||
Layout.preferredWidth: 32
|
||
Layout.preferredHeight: 26
|
||
radius: 10
|
||
color: (powerArea.containsMouse || bar.menuOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
|
||
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 15
|
||
color: (powerArea.containsMouse || bar.menuOpen) ? "#0f111a" : root.palette.accent
|
||
}
|
||
|
||
MouseArea {
|
||
id: powerArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onClicked: bar.menuOpen = !bar.menuOpen
|
||
}
|
||
}
|
||
}
|
||
|
||
// ================= POPUPS =================
|
||
|
||
LazyLoader {
|
||
active: bar.hovered !== "" && bar.hovered !== "net"
|
||
|
||
PanelWindow {
|
||
screen: bar.modelData
|
||
anchors { top: true; right: true }
|
||
margins { top: 34; right: bar.width - (rightRow.x + statsPopupAnchor.x + statsPopupAnchor.width) }
|
||
implicitWidth: (bar.hovered === "cpu" && bar.perCore.length > 0) ? 320 : (bar.hovered === "vol" ? 300 : (bar.hovered === "disk" ? 300 : 220))
|
||
implicitHeight: tooltipCol.implicitHeight + 20
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "stats-tooltip"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
readonly property var statsPopupAnchor: bar.hovered === "cpu" ? cpuPill : bar.hovered === "mem" ? memPill : bar.hovered === "disk" ? diskPill : bar.hovered === "gpu" ? gpuPill : bar.hovered === "vol" ? volumePill : cpuPill
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
id: tooltipCol
|
||
anchors.fill: parent
|
||
anchors.margins: 10
|
||
spacing: 4
|
||
|
||
Text {
|
||
text: ({
|
||
cpu: "CPU",
|
||
mem: root.isGerman ? "Arbeitsspeicher" : "Memory",
|
||
disk: root.isGerman ? "Speicher" : "Storage",
|
||
gpu: "GPU",
|
||
vol: root.isGerman ? "Lautstärke" : "Volume",
|
||
})[bar.hovered] || ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
font.bold: true
|
||
color: root.palette.accent
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "cpu"
|
||
text: (root.isGerman ? "Last (1/5/15 Min): " : "Load (1/5/15 min): ") + bar.load1 + " / " + bar.load5 + " / " + bar.load15
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.foreground
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "cpu" && bar.tempAvailable
|
||
text: (root.isGerman ? "Temperatur (Tctl): " : "Temperature (Tctl): ") + bar.tempC + "°C"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color12
|
||
}
|
||
GridLayout {
|
||
visible: bar.hovered === "cpu" && bar.perCore.length > 0
|
||
columns: 4
|
||
columnSpacing: 10
|
||
rowSpacing: 2
|
||
|
||
Repeater {
|
||
model: bar.perCore
|
||
Text {
|
||
required property int index
|
||
required property var modelData
|
||
text: "C" + index + ": " + modelData + "%"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
}
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "cpu"
|
||
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "mem"
|
||
text: (root.isGerman ? "Belegt: " : "Used: ") + bar.memUsed.toFixed(1) + " / " + bar.memTotal.toFixed(1) + " GiB"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.foreground
|
||
}
|
||
ColumnLayout {
|
||
visible: bar.hovered === "disk"
|
||
Layout.fillWidth: true
|
||
spacing: 6
|
||
|
||
Repeater {
|
||
model: bar.diskMounts
|
||
|
||
ColumnLayout {
|
||
required property int index
|
||
required property var modelData
|
||
Layout.fillWidth: true
|
||
spacing: 1
|
||
|
||
Text {
|
||
text: (index === bar.diskIndex ? "▸ " : "") + modelData.path + (modelData.device !== "" ? " (" + modelData.device + ")" : "")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
font.bold: index === bar.diskIndex
|
||
elide: Text.ElideMiddle
|
||
Layout.fillWidth: true
|
||
color: index === bar.diskIndex ? root.palette.foreground : "#9aa5ce"
|
||
}
|
||
Text {
|
||
text: modelData.pct + "%" + " · " + (root.isGerman ? "Belegt " : "Used ") + modelData.used.toFixed(0) + " / " + modelData.total.toFixed(0) + " GiB" + " · " + (root.isGerman ? "Frei " : "Free ") + modelData.avail.toFixed(0) + " GiB"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
Text {
|
||
text: "R: " + root.fmtRate(modelData.readKBps) + " W: " + root.fmtRate(modelData.writeKBps)
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
}
|
||
}
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "disk"
|
||
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "gpu"
|
||
text: (root.isGerman ? "Temperatur: " : "Temperature: ") + bar.gpuTemp + "°C"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color12
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "gpu"
|
||
text: "VRAM: " + bar.gpuMemUsed + " / " + bar.gpuMemTotal + " MiB"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color8
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "gpu"
|
||
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
Text {
|
||
visible: bar.hovered === "vol"
|
||
Layout.preferredWidth: 280
|
||
wrapMode: Text.WordWrap
|
||
text: root.isGerman ? "Klick: Mixer · Rechtsklick: Stumm · Scroll: Lautstärke" : "Click: Mixer · Right-click: Mute · Scroll: Volume"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: bar.hovered === "net"
|
||
|
||
PanelWindow {
|
||
screen: bar.modelData
|
||
anchors { top: true; right: true }
|
||
margins { top: 34; right: bar.width - (rightRow.x + networkPill.x + networkPill.width) }
|
||
implicitWidth: 220
|
||
implicitHeight: netTooltipCol.implicitHeight + 20
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "net-tooltip"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
id: netTooltipCol
|
||
anchors.fill: parent
|
||
anchors.margins: 10
|
||
spacing: 4
|
||
|
||
Text {
|
||
text: root.isGerman ? "Netzwerk" : "Network"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
font.bold: true
|
||
color: root.palette.accent
|
||
}
|
||
Text {
|
||
text: bar.connType === "" ? (root.isGerman ? "Nicht verbunden" : "Not connected") : (bar.connType === "wifi" ? (root.isGerman ? "WLAN" : "Wi-Fi") : (root.isGerman ? "Kabelgebunden" : "Wired"))
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.foreground
|
||
}
|
||
Text {
|
||
visible: bar.connType === "wifi"
|
||
Layout.fillWidth: true
|
||
text: "SSID: " + (bar.connName || "n/a")
|
||
wrapMode: Text.WrapAnywhere
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color2
|
||
}
|
||
Text {
|
||
text: (bar.showPublicIp ? (root.isGerman ? "Öffentliche IP: " : "Public IP: ") + (bar.publicIpLoading ? "…" : (bar.publicIp || "n/a")) : (root.isGerman ? "Lokale IP: " : "Local IP: ") + (bar.localIp || "n/a"))
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color12
|
||
}
|
||
Text {
|
||
visible: bar.netDevice !== ""
|
||
text: (root.isGerman ? "Gerät: " : "Device: ") + bar.netDevice
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color8
|
||
}
|
||
Text {
|
||
visible: bar.connType !== ""
|
||
text: " " + root.fmtBitrate(bar.netRxKBps) + " " + root.fmtBitrate(bar.netTxKBps)
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.foreground
|
||
}
|
||
Text {
|
||
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: bar.clockHovering && !bar.calendarOpen
|
||
|
||
PanelWindow {
|
||
screen: bar.modelData
|
||
anchors { top: true; right: true }
|
||
margins { top: 34; right: bar.width - (rightRow.x + clockPill.x + clockPill.width) }
|
||
implicitWidth: Math.max(230, clockTooltipCol.implicitWidth + 20)
|
||
implicitHeight: clockTooltipCol.implicitHeight + 20
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "clock-tooltip"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
id: clockTooltipCol
|
||
anchors.fill: parent
|
||
anchors.margins: 10
|
||
spacing: 4
|
||
|
||
Text {
|
||
text: Qt.formatDateTime(bar.now, "dddd, dd. MMMM yyyy")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
font.bold: true
|
||
color: root.palette.foreground
|
||
}
|
||
Text {
|
||
text: (root.isGerman ? "KW " : "Week ") + root.isoWeek(bar.now)
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color12
|
||
}
|
||
Text {
|
||
text: Qt.formatDateTime(bar.now, "hh:mm:ss")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color8
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: bar.hovered === "help" && !root.helpOpen
|
||
|
||
PanelWindow {
|
||
screen: bar.modelData
|
||
anchors { top: true; right: true }
|
||
margins { top: 34; right: bar.width - (rightRow.x + helpBtn.x + helpBtn.width) }
|
||
implicitWidth: helpHintText.implicitWidth + 24
|
||
implicitHeight: helpHintText.implicitHeight + 20
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "help-hint"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
Text {
|
||
id: helpHintText
|
||
anchors.centerIn: parent
|
||
text: root.isGerman ? "Zeigt alle Tastenkombinationen" : "Shows all keybinds"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.foreground
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: root.helpOpen && Hyprland.focusedMonitor !== null && bar.modelData.name === Hyprland.focusedMonitor.name
|
||
|
||
PanelWindow {
|
||
id: helpWindow
|
||
screen: bar.modelData
|
||
// No anchors: wlr-layer-shell centers a surface on the output when none of its
|
||
// edges are anchored, which is what we want for a cheatsheet-style overlay.
|
||
implicitWidth: 540
|
||
implicitHeight: Math.min(helpCol.implicitHeight + 100, bar.modelData.height - 80)
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "help-panel"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
HyprlandFocusGrab {
|
||
windows: [ helpWindow ]
|
||
active: true
|
||
onCleared: root.helpOpen = false
|
||
}
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 12
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
anchors.fill: parent
|
||
anchors.margins: 12
|
||
spacing: 8
|
||
|
||
Text {
|
||
Layout.fillWidth: true
|
||
text: root.isGerman ? "Tastenkombinationen" : "Keybinds"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 18
|
||
font.bold: true
|
||
color: root.palette.foreground
|
||
}
|
||
|
||
Flickable {
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
clip: true
|
||
contentWidth: width
|
||
contentHeight: helpCol.implicitHeight
|
||
boundsBehavior: Flickable.StopAtBounds
|
||
|
||
ColumnLayout {
|
||
id: helpCol
|
||
width: parent.width
|
||
spacing: 10
|
||
|
||
Repeater {
|
||
model: root.keybindGroups
|
||
|
||
ColumnLayout {
|
||
required property var modelData
|
||
Layout.fillWidth: true
|
||
spacing: 3
|
||
|
||
Text {
|
||
text: modelData.cat
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 15
|
||
font.bold: true
|
||
color: root.palette.accent
|
||
}
|
||
|
||
Repeater {
|
||
model: modelData.items
|
||
|
||
RowLayout {
|
||
required property var modelData
|
||
Layout.fillWidth: true
|
||
spacing: 10
|
||
|
||
Text {
|
||
text: modelData.keys
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 14
|
||
color: root.palette.color12
|
||
Layout.preferredWidth: 225
|
||
wrapMode: Text.WrapAnywhere
|
||
}
|
||
Text {
|
||
Layout.fillWidth: true
|
||
text: root.isGerman ? modelData.de : modelData.en
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 14
|
||
color: root.palette.foreground
|
||
wrapMode: Text.WordWrap
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: bar.notifOpen
|
||
|
||
PanelWindow {
|
||
id: notifWindow
|
||
screen: bar.modelData
|
||
anchors { top: true; right: true; bottom: true }
|
||
margins { top: 34; right: 8; bottom: 8 }
|
||
implicitWidth: 380
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "notif-panel"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
HyprlandFocusGrab {
|
||
windows: [ notifWindow ]
|
||
active: true
|
||
onCleared: bar.notifOpen = false
|
||
}
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 12
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
anchors.fill: parent
|
||
anchors.margins: 12
|
||
spacing: 8
|
||
|
||
RowLayout {
|
||
Layout.fillWidth: true
|
||
|
||
Text {
|
||
Layout.fillWidth: true
|
||
text: root.isGerman ? "Benachrichtigungen" : "Notifications"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 14
|
||
font.bold: true
|
||
color: root.palette.foreground
|
||
}
|
||
|
||
Rectangle {
|
||
visible: bar.notifList.length > 0
|
||
Layout.preferredWidth: readAllText.implicitWidth + 16
|
||
Layout.preferredHeight: 24
|
||
radius: 8
|
||
color: readAllArea.containsMouse ? root.palette.accent : Qt.rgba(0.478, 0.635, 0.969, 0.15)
|
||
|
||
Text {
|
||
id: readAllText
|
||
anchors.centerIn: parent
|
||
text: "\uf00c " + (root.isGerman ? "Alle gelesen" : "Mark all read")
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: readAllArea.containsMouse ? "#0f111a" : root.palette.foreground
|
||
}
|
||
|
||
MouseArea {
|
||
id: readAllArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onClicked: bar.markRead(bar.notifList.map(function (n) { return n.key }))
|
||
}
|
||
}
|
||
}
|
||
|
||
Text {
|
||
visible: bar.notifList.length === 0
|
||
Layout.fillWidth: true
|
||
Layout.topMargin: 20
|
||
horizontalAlignment: Text.AlignHCenter
|
||
text: root.isGerman ? "Alles gelesen" : "All caught up"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color8
|
||
}
|
||
|
||
ListView {
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
clip: true
|
||
spacing: 6
|
||
model: bar.notifList
|
||
boundsBehavior: Flickable.StopAtBounds
|
||
|
||
delegate: Rectangle {
|
||
required property var modelData
|
||
width: ListView.view.width
|
||
height: cardCol.implicitHeight + 16
|
||
radius: 10
|
||
color: cardArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.18) : Qt.rgba(0.478, 0.635, 0.969, 0.08)
|
||
border.width: modelData.urgency === "critical" ? 1 : 0
|
||
border.color: root.palette.color1
|
||
|
||
ColumnLayout {
|
||
id: cardCol
|
||
anchors { left: parent.left; right: parent.right; top: parent.top; margins: 8 }
|
||
spacing: 2
|
||
|
||
RowLayout {
|
||
Layout.fillWidth: true
|
||
Text {
|
||
Layout.fillWidth: true
|
||
text: modelData.app
|
||
elide: Text.ElideRight
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 10
|
||
color: root.palette.accent
|
||
}
|
||
Text {
|
||
text: "\uf00c"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: cardArea.containsMouse ? root.palette.color2 : root.palette.color8
|
||
}
|
||
}
|
||
Text {
|
||
Layout.fillWidth: true
|
||
text: modelData.summary
|
||
wrapMode: Text.Wrap
|
||
maximumLineCount: 2
|
||
elide: Text.ElideRight
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
font.bold: true
|
||
color: root.palette.foreground
|
||
}
|
||
Text {
|
||
visible: modelData.body !== ""
|
||
Layout.fillWidth: true
|
||
text: modelData.body
|
||
wrapMode: Text.Wrap
|
||
maximumLineCount: 4
|
||
elide: Text.ElideRight
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: "#9aa5ce"
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
id: cardArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onClicked: bar.markRead([modelData.key])
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: bar.calendarOpen
|
||
|
||
PanelWindow {
|
||
id: calendarWindow
|
||
screen: bar.modelData
|
||
anchors { top: true; right: true }
|
||
margins { top: 34; right: bar.width - (rightRow.x + clockPill.x + clockPill.width) }
|
||
implicitWidth: 250
|
||
implicitHeight: calCol.implicitHeight + 20
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "clock-calendar"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
HyprlandFocusGrab {
|
||
windows: [ calendarWindow ]
|
||
active: true
|
||
onCleared: bar.calendarOpen = false
|
||
}
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
id: calCol
|
||
anchors.fill: parent
|
||
anchors.margins: 10
|
||
spacing: 6
|
||
|
||
RowLayout {
|
||
Layout.fillWidth: true
|
||
|
||
Text {
|
||
text: "‹"
|
||
font.pixelSize: 16
|
||
color: root.palette.color12
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
anchors.margins: -6
|
||
onClicked: {
|
||
if (bar.viewMonth === 0) {
|
||
bar.viewMonth = 11
|
||
bar.viewYear -= 1
|
||
} else {
|
||
bar.viewMonth -= 1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
Text {
|
||
Layout.fillWidth: true
|
||
horizontalAlignment: Text.AlignHCenter
|
||
text: Qt.formatDateTime(new Date(bar.viewYear, bar.viewMonth, 1), "MMMM yyyy")
|
||
font.bold: true
|
||
font.pixelSize: 13
|
||
color: root.palette.foreground
|
||
}
|
||
|
||
Text {
|
||
text: "›"
|
||
font.pixelSize: 16
|
||
color: root.palette.color12
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
anchors.margins: -6
|
||
onClicked: {
|
||
if (bar.viewMonth === 11) {
|
||
bar.viewMonth = 0
|
||
bar.viewYear += 1
|
||
} else {
|
||
bar.viewMonth += 1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
RowLayout {
|
||
Layout.fillWidth: true
|
||
spacing: 2
|
||
|
||
Text { Layout.preferredWidth: 22; text: "" }
|
||
|
||
Repeater {
|
||
model: 7
|
||
Text {
|
||
Layout.preferredWidth: 24
|
||
horizontalAlignment: Text.AlignHCenter
|
||
text: Qt.locale().dayName(index + 1, Locale.ShortFormat)
|
||
font.pixelSize: 11
|
||
color: root.palette.color8
|
||
}
|
||
}
|
||
}
|
||
|
||
Repeater {
|
||
model: root.buildCalendar(bar.viewYear, bar.viewMonth, bar.now)
|
||
|
||
RowLayout {
|
||
required property var modelData
|
||
Layout.fillWidth: true
|
||
spacing: 2
|
||
|
||
Text {
|
||
Layout.preferredWidth: 22
|
||
horizontalAlignment: Text.AlignHCenter
|
||
text: modelData.weekNum
|
||
font.pixelSize: 10
|
||
color: root.palette.color8
|
||
}
|
||
|
||
Repeater {
|
||
model: modelData.days
|
||
|
||
Rectangle {
|
||
required property var modelData
|
||
Layout.preferredWidth: 24
|
||
Layout.preferredHeight: 22
|
||
radius: 6
|
||
color: modelData.isToday ? root.palette.accent : "transparent"
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: modelData.day ?? ""
|
||
font.pixelSize: 11
|
||
color: modelData.isToday ? "#0f111a" : (modelData.day ? root.palette.foreground : "transparent")
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: bar.menuOpen
|
||
|
||
PanelWindow {
|
||
id: menu
|
||
screen: bar.modelData
|
||
anchors { top: true; right: true }
|
||
margins { top: 34; right: bar.width - (rightRow.x + powerBtn.x + powerBtn.width) }
|
||
implicitWidth: 170
|
||
implicitHeight: col.implicitHeight + 16
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "power-menu"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
HyprlandFocusGrab {
|
||
windows: [ menu ]
|
||
active: true
|
||
onCleared: bar.menuOpen = false
|
||
}
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
id: col
|
||
anchors.fill: parent
|
||
anchors.margins: 8
|
||
spacing: 4
|
||
|
||
MenuEntry {
|
||
label: root.logoutLabel
|
||
icon: ""
|
||
onTriggered: {
|
||
bar.menuOpen = false
|
||
logoutProc.startDetached()
|
||
}
|
||
}
|
||
|
||
MenuEntry {
|
||
label: root.restartLabel
|
||
icon: ""
|
||
onTriggered: {
|
||
bar.menuOpen = false
|
||
rebootProc.startDetached()
|
||
}
|
||
}
|
||
|
||
MenuEntry {
|
||
label: root.shutdownLabel
|
||
icon: ""
|
||
onTriggered: {
|
||
bar.menuOpen = false
|
||
shutdownProc.startDetached()
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
LazyLoader {
|
||
active: root.windowSwitcherOpen && Hyprland.focusedMonitor !== null && bar.modelData.name === Hyprland.focusedMonitor.name
|
||
|
||
PanelWindow {
|
||
id: winSwitchPopup
|
||
screen: bar.modelData
|
||
anchors { top: true; left: true }
|
||
margins { top: 34; left: leftRow.x + bellBtn.x + bellBtn.width + 6 }
|
||
implicitWidth: 320
|
||
implicitHeight: winSwitchCol.implicitHeight + 16
|
||
color: "transparent"
|
||
WlrLayershell.namespace: "window-switcher"
|
||
WlrLayershell.layer: WlrLayer.Top
|
||
|
||
// Hyprland.toplevels includes things hyprctl clients doesn't
|
||
// (e.g. fcitx's "Input" / "Default IME" popups) - those never
|
||
// get a real workspace assigned, unlike genuine windows.
|
||
readonly property var filteredToplevels: Hyprland.toplevels.values.filter(function (tl) {
|
||
return tl.workspace !== null
|
||
})
|
||
|
||
HyprlandFocusGrab {
|
||
windows: [ winSwitchPopup ]
|
||
active: true
|
||
onCleared: root.windowSwitcherOpen = false
|
||
}
|
||
|
||
Rectangle {
|
||
anchors.fill: parent
|
||
radius: 10
|
||
color: root.argb(root.palette.popup_color, root.popupOpacity)
|
||
border.width: 1
|
||
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
|
||
|
||
ColumnLayout {
|
||
id: winSwitchCol
|
||
anchors.fill: parent
|
||
anchors.margins: 8
|
||
spacing: 2
|
||
|
||
Text {
|
||
visible: winSwitchPopup.filteredToplevels.length === 0
|
||
text: root.isGerman ? "Keine Fenster ge\u00f6ffnet" : "No open windows"
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 12
|
||
color: root.palette.color8
|
||
}
|
||
|
||
Repeater {
|
||
model: winSwitchPopup.filteredToplevels
|
||
|
||
Rectangle {
|
||
id: winRow
|
||
required property var modelData
|
||
Layout.fillWidth: true
|
||
implicitHeight: 30
|
||
radius: 8
|
||
color: winRowArea.containsMouse ? root.palette.accent : "transparent"
|
||
|
||
RowLayout {
|
||
anchors.fill: parent
|
||
anchors.leftMargin: 8
|
||
anchors.rightMargin: 8
|
||
spacing: 8
|
||
|
||
Text {
|
||
Layout.preferredWidth: 22
|
||
text: winRow.modelData.workspace ? winRow.modelData.workspace.name : ""
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 11
|
||
color: winRowArea.containsMouse ? "#0f111a" : root.palette.color8
|
||
}
|
||
|
||
Text {
|
||
Layout.fillWidth: true
|
||
elide: Text.ElideRight
|
||
text: winRow.modelData.title
|
||
font.family: "JetBrainsMono Nerd Font"
|
||
font.pixelSize: 13
|
||
color: winRowArea.containsMouse ? "#0f111a" : root.palette.foreground
|
||
}
|
||
}
|
||
|
||
MouseArea {
|
||
id: winRowArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
onClicked: {
|
||
var addr = winRow.modelData.address
|
||
if (!addr.startsWith("0x")) addr = "0x" + addr
|
||
Hyprland.dispatch("hl.dsp.focus({window = \"address:" + addr + "\"})")
|
||
root.windowSwitcherOpen = false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|