feat: quickshell rewrite wip
This commit is contained in:
1 parent
962ae7c1c7
commit
452d7080f9
36 files changed
+677
-1685
No files matched your search
@@ -1,32 +0,0 @@
|
|||||||
# Quickshell panel – agent guide
|
|
||||||
|
|
||||||
This repo is a **Quickshell** config: a Qt/QML Wayland panel (bar + widgets). It uses Quickshell APIs and a shared theme.
|
|
||||||
|
|
||||||
## Layout
|
|
||||||
|
|
||||||
- **`shell.qml`** – Entry. Uses `Bar` and enables `Quickshell.watchFiles` for reload on change.
|
|
||||||
- **`Bar/`** – Panel window and bar UI:
|
|
||||||
- `Bar.qml` – `PanelWindow` with a `RowLayout`; left/center/right sections use `BarPill`.
|
|
||||||
- `BarPill.qml` – Rounded container for a group of widgets (default property `content`).
|
|
||||||
- **`Theme/`** – Singleton `Theme` (Catppuccin Mocha): colors, `barHeight`, `padding`, `spacing`, `fontPixelSize`, `fontFamily`, `sectionRadius`, etc. All widgets and bar UI should use `Theme` only (no hardcoded colors/sizes).
|
|
||||||
- **`Widgets/`** – Bar widgets. Each has a `qmldir` entry; Bar imports `qs.Widgets` and instantiates them inside `BarPill`s.
|
|
||||||
|
|
||||||
## Conventions
|
|
||||||
|
|
||||||
1. **Theme** – Use `import qs.Theme` and reference `Theme.*` for colors, fonts, and layout constants.
|
|
||||||
2. **Widget root** – Widgets are typically `Item` with `implicitWidth`/`implicitHeight` from a main child (e.g. a `Text`).
|
|
||||||
3. **Icons** – Nerd Font codepoints in `Text` (e.g. `"\uF017 "` for clock). Font: `Theme.fontFamily` ("Fira Code Nerd Font").
|
|
||||||
4. **Popup/panel** – Widgets that open a popup (e.g. Clock, Tray) take `property var panelWindow: null` and receive the Bar’s `PanelWindow` from `Bar.qml`.
|
|
||||||
5. **CLI data** – Use Quickshell’s `Process` plus `StdioCollector` on stdout; use a `Timer` to refresh (e.g. every 30s). See `MemoryWidget.qml`.
|
|
||||||
6. **Bar placement** – To add/move widgets, edit `Bar/Bar.qml`: left section, center (e.g. clock), or right section; each group lives in one `BarPill`.
|
|
||||||
|
|
||||||
## Adding a widget
|
|
||||||
|
|
||||||
1. Add `YourWidget 1.0 YourWidget.qml` to `Widgets/qmldir`.
|
|
||||||
2. Implement the widget in `Widgets/YourWidget.qml` (Item root, Theme, implicit size).
|
|
||||||
3. In `Bar/Bar.qml`, add `YourWidget {}` inside the desired `BarPill` (and set `panelWindow: panel` if it needs a popup).
|
|
||||||
|
|
||||||
## Tech
|
|
||||||
|
|
||||||
- **Runtime**: Quickshell (Qt 6, QML, Wayland). Entry is `shell.qml`; pragmas at top (e.g. `UseQApplication`, `Env QT_QPA_PLATFORM=wayland`).
|
|
||||||
- **Modules**: `qs.Bar`, `qs.Theme`, `qs.Widgets` – each has a `qmldir` in its folder.
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import qs.Theme
|
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
id: panel
|
|
||||||
anchors.top: true
|
|
||||||
anchors.left: true
|
|
||||||
anchors.right: true
|
|
||||||
implicitHeight: Theme.barHeight + Theme.barMargin * 2
|
|
||||||
exclusionMode: ExclusionMode.Normal
|
|
||||||
exclusiveZone: implicitHeight
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: Theme.barMargin
|
|
||||||
anchors.rightMargin: Theme.barMargin
|
|
||||||
anchors.topMargin: Theme.barMargin
|
|
||||||
anchors.bottomMargin: Theme.barMargin
|
|
||||||
spacing: Theme.spacing
|
|
||||||
|
|
||||||
BarPill {
|
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
|
||||||
HyprlandWorkspaceWidget {}
|
|
||||||
NetTrafficWidget {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
|
|
||||||
BarPill {
|
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
|
||||||
Clock { panelWindow: panel }
|
|
||||||
}
|
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
|
|
||||||
BarPill {
|
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
||||||
StorageWidget {}
|
|
||||||
MemoryWidget {}
|
|
||||||
CpuWidget {}
|
|
||||||
TemperatureWidget {}
|
|
||||||
AudioWidget {}
|
|
||||||
TrayWidget { panelWindow: panel }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
default property alias content: sectionContent.data
|
|
||||||
property real pillRadius: Theme.sectionRadius
|
|
||||||
property real pillPadding: Theme.sectionPadding
|
|
||||||
|
|
||||||
implicitWidth: sectionContent.implicitWidth + pillPadding * 2
|
|
||||||
implicitHeight: Theme.barHeight - 2
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: pillRadius
|
|
||||||
color: Theme.base
|
|
||||||
opacity: 0.6
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: sectionContent
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.widgetSpacing
|
|
||||||
height: parent.height - 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
spacing: 6
|
|
||||||
Layout.fillHeight: true
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
module Bar
|
|
||||||
Bar 1.0 Bar.qml
|
|
||||||
BarSection 1.0 BarSection.qml
|
|
||||||
BarPill 1.0 BarPill.qml
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
// Catppuccin Mocha
|
|
||||||
property color base: "#1e1e2e"
|
|
||||||
property color mantle: "#181825"
|
|
||||||
property color crust: "#11111b"
|
|
||||||
property color surface0: "#313244"
|
|
||||||
property color surface1: "#45475a"
|
|
||||||
property color surface2: "#585b70"
|
|
||||||
property color overlay0: "#6c7086"
|
|
||||||
property color overlay1: "#7f849c"
|
|
||||||
property color overlay2: "#9399b2"
|
|
||||||
property color text: "#cdd6f4"
|
|
||||||
property color subtext0: "#a6adc8"
|
|
||||||
property color subtext1: "#bac2de"
|
|
||||||
property color mauve: "#cba6f7"
|
|
||||||
property color flamingo: "#f2cdcd"
|
|
||||||
property color peach: "#fab387"
|
|
||||||
property color sky: "#89dceb"
|
|
||||||
property color green: "#a6e3a1"
|
|
||||||
property color yellow: "#f9e2af"
|
|
||||||
property color red: "#f38ba8"
|
|
||||||
property color rosewater: "#f5e0dc"
|
|
||||||
|
|
||||||
property real barHeight: 36
|
|
||||||
property real padding: 10
|
|
||||||
property real spacing: 10
|
|
||||||
property real fontPixelSize: 14
|
|
||||||
property string fontFamily: "Fira Code Nerd Font"
|
|
||||||
property real sectionRadius: 14
|
|
||||||
property real sectionPadding: 12
|
|
||||||
property real barMargin: 16
|
|
||||||
property real widgetSpacing: 8
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
singleton Theme 1.0 Theme.qml
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
implicitWidth: label.implicitWidth
|
|
||||||
implicitHeight: label.implicitHeight
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: label
|
|
||||||
text: "\uF028 —%"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.peach
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: process
|
|
||||||
command: ["sh", "-c", "wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: function() {
|
|
||||||
var s = text.trim()
|
|
||||||
var muted = s.indexOf("MUTED") >= 0
|
|
||||||
var m = s.match(/[\d.]+/)
|
|
||||||
var vol = m ? parseFloat(m[0]) : 0
|
|
||||||
var pct = Math.round(vol * 100)
|
|
||||||
label.text = (muted ? "\uF6A9 " : "\uF028 ") + pct + "%"
|
|
||||||
label.color = muted ? Theme.overlay0 : Theme.peach
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: restartTimer.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: restartTimer
|
|
||||||
interval: 2000
|
|
||||||
repeat: false
|
|
||||||
onTriggered: process.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
if (mouse.button === Qt.RightButton)
|
|
||||||
Quickshell.execDetached(["wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle"])
|
|
||||||
else
|
|
||||||
Quickshell.execDetached(["pavucontrol"])
|
|
||||||
process.running = false
|
|
||||||
process.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: process.running = true
|
|
||||||
}
|
|
||||||
@@ -1,231 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: clockRoot
|
|
||||||
property bool popupOpen: false
|
|
||||||
property var panelWindow: null
|
|
||||||
implicitWidth: label.implicitWidth
|
|
||||||
implicitHeight: label.implicitHeight
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: label
|
|
||||||
text: "\uF017 " + Qt.formatDateTime(new Date(), "HH:mm d MMM")
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.mauve
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 1000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
onTriggered: label.text = "\uF017 " + Qt.formatDateTime(new Date(), "HH:mm d MMM")
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
onClicked: clockRoot.popupOpen = !clockRoot.popupOpen
|
|
||||||
}
|
|
||||||
|
|
||||||
PopupWindow {
|
|
||||||
id: popup
|
|
||||||
visible: clockRoot.popupOpen
|
|
||||||
implicitWidth: 280
|
|
||||||
implicitHeight: 320
|
|
||||||
anchor.item: clockRoot
|
|
||||||
anchor.rect: Qt.rect(0, clockRoot.height, clockRoot.width, 1)
|
|
||||||
anchor.edges: Qt.AlignTop | Qt.AlignLeft
|
|
||||||
anchor.gravity: Qt.AlignBottom | Qt.AlignRight
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.85)
|
|
||||||
border.color: Theme.surface1
|
|
||||||
radius: 8
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 12
|
|
||||||
spacing: 6
|
|
||||||
|
|
||||||
// Header: close only
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
Text {
|
|
||||||
text: "×"
|
|
||||||
font.pixelSize: Theme.fontPixelSize + 4
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.subtext0
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: -4
|
|
||||||
onClicked: clockRoot.popupOpen = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Month navigation
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 4
|
|
||||||
spacing: 4
|
|
||||||
Text {
|
|
||||||
text: "‹"
|
|
||||||
font.pixelSize: Theme.fontPixelSize + 2
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.subtext0
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: -6
|
|
||||||
onClicked: calendar.prevMonth()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: Qt.formatDate(calendar.viewDate, "MMMM yyyy")
|
|
||||||
font.pixelSize: Theme.fontPixelSize + 1
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.text
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
text: "›"
|
|
||||||
font.pixelSize: Theme.fontPixelSize + 2
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.subtext0
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: -6
|
|
||||||
onClicked: calendar.nextMonth()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
Text {
|
|
||||||
text: "Today"
|
|
||||||
font.pixelSize: Theme.fontPixelSize - 2
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.sky
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: -4
|
|
||||||
onClicked: {
|
|
||||||
calendar.viewDate = new Date()
|
|
||||||
calendar.refresh()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
}
|
|
||||||
// Day names (Mon–Sun)
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Repeater {
|
|
||||||
model: ["M", "T", "W", "T", "F", "S", "S"]
|
|
||||||
Text {
|
|
||||||
Layout.preferredWidth: 32
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: modelData
|
|
||||||
font.pixelSize: Theme.fontPixelSize - 2
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.overlay0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calendar grid
|
|
||||||
GridLayout {
|
|
||||||
id: calGrid
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
columns: 7
|
|
||||||
rowSpacing: 2
|
|
||||||
columnSpacing: 2
|
|
||||||
Repeater {
|
|
||||||
model: calendar.daysModel
|
|
||||||
Rectangle {
|
|
||||||
Layout.preferredWidth: 32
|
|
||||||
Layout.preferredHeight: 24
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
color: modelData.isToday ? Theme.surface1 : "transparent"
|
|
||||||
radius: 4
|
|
||||||
border.color: modelData.isToday ? Theme.mauve : "transparent"
|
|
||||||
border.width: 1
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: modelData.day > 0 ? modelData.day : ""
|
|
||||||
font.pixelSize: Theme.fontPixelSize - 1
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: modelData.isCurrentMonth ? Theme.text : Theme.overlay0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: calendar
|
|
||||||
property date viewDate: new Date()
|
|
||||||
property var daysModel: []
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
var d = new Date(viewDate.getFullYear(), viewDate.getMonth(), 1)
|
|
||||||
var year = d.getFullYear(), month = d.getMonth()
|
|
||||||
var firstWeekday = (d.getDay() + 6) % 7 // Mon=0
|
|
||||||
var daysInMonth = new Date(year, month + 1, 0).getDate()
|
|
||||||
var today = new Date()
|
|
||||||
var todayDate = today.getDate()
|
|
||||||
var todayMonth = today.getMonth()
|
|
||||||
var todayYear = today.getFullYear()
|
|
||||||
var list = []
|
|
||||||
var i
|
|
||||||
for (i = 0; i < firstWeekday; i++)
|
|
||||||
list.push({ day: 0, isToday: false, isCurrentMonth: false })
|
|
||||||
for (i = 1; i <= daysInMonth; i++)
|
|
||||||
list.push({
|
|
||||||
day: i,
|
|
||||||
isToday: i === todayDate && month === todayMonth && year === todayYear,
|
|
||||||
isCurrentMonth: true
|
|
||||||
})
|
|
||||||
var total = list.length
|
|
||||||
var remainder = total % 7
|
|
||||||
if (remainder) {
|
|
||||||
for (i = 0; i < 7 - remainder; i++)
|
|
||||||
list.push({ day: 0, isToday: false, isCurrentMonth: false })
|
|
||||||
}
|
|
||||||
daysModel = list
|
|
||||||
}
|
|
||||||
|
|
||||||
function prevMonth() {
|
|
||||||
viewDate = new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 1)
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
function nextMonth() {
|
|
||||||
viewDate = new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1)
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: refresh()
|
|
||||||
onViewDateChanged: refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: clockRoot
|
|
||||||
function onPopupOpenChanged() {
|
|
||||||
if (clockRoot.popupOpen)
|
|
||||||
calendar.viewDate = new Date()
|
|
||||||
calendar.refresh()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
implicitWidth: label.implicitWidth
|
|
||||||
implicitHeight: label.implicitHeight
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: label
|
|
||||||
text: "\uE266 —%"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.rosewater
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: process
|
|
||||||
command: ["sh", "-c", "read cpu user nice sys idle iowait irq softirq steal guest guest_nice < /proc/stat; idle1=$((idle+iowait)); nonidle1=$((user+nice+sys+irq+softirq+steal)); total1=$((idle1+nonidle1)); sleep 1; read cpu user nice sys idle iowait irq softirq steal guest guest_nice < /proc/stat; idle2=$((idle+iowait)); nonidle2=$((user+nice+sys+irq+softirq+steal)); total2=$((idle2+nonidle2)); totald=$((total2-total1)); idled=$((idle2-idle1)); [ \"$totald\" -gt 0 ] && printf '%s\\n' $(((1000*(totald-idled)/totald + 5)/10)) || printf '0\\n'"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: function() {
|
|
||||||
var v = text.trim()
|
|
||||||
label.text = "\uE266 " + (v || "—") + "%"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: restartTimer.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: restartTimer
|
|
||||||
interval: 2000
|
|
||||||
repeat: false
|
|
||||||
onTriggered: process.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: process.running = true
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: root
|
|
||||||
spacing: Theme.spacing
|
|
||||||
|
|
||||||
property ListModel workspaces: ListModel {}
|
|
||||||
|
|
||||||
property bool isHyprland: (Quickshell.env("XDG_CURRENT_DESKTOP") || "").toLowerCase().indexOf("hyprland") >= 0
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: process
|
|
||||||
command: ["sh", "-c", "hyprctl activeworkspace -j | jq .id; hyprctl workspaces -j | jq -c ."]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: function() {
|
|
||||||
var lines = text.trim().split('\n');
|
|
||||||
if (lines.length < 2) return;
|
|
||||||
var activeId = parseInt(lines[0], 10);
|
|
||||||
var workspacesData = JSON.parse(lines[1]);
|
|
||||||
|
|
||||||
workspaces.clear();
|
|
||||||
workspacesData.forEach(workspace => {
|
|
||||||
workspaces.append({
|
|
||||||
"tagId": workspace.id,
|
|
||||||
"output": workspace.monitor,
|
|
||||||
"isOccupied": workspace.windows > 0,
|
|
||||||
"isActive": workspace.id === activeId,
|
|
||||||
"isUrgent": false
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: if (root.isHyprland) restartTimer.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: restartTimer
|
|
||||||
interval: 500
|
|
||||||
repeat: false
|
|
||||||
onTriggered: if (root.isHyprland) process.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: if (root.isHyprland) process.running = true
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: workspaces
|
|
||||||
delegate: Rectangle {
|
|
||||||
height: Theme.barHeight - 16
|
|
||||||
width: height
|
|
||||||
radius: width / 2
|
|
||||||
color: model.isActive ? Theme.mauve : (model.isOccupied ? Theme.surface1 : Theme.surface0)
|
|
||||||
border.color: model.isUrgent ? Theme.red : "transparent"
|
|
||||||
border.width: 2
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: model.tagId
|
|
||||||
color: Theme.text
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
Quickshell.execDetached(["hyprctl", "dispatch", "workspace", model.tagId]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
implicitWidth: label.implicitWidth
|
|
||||||
implicitHeight: label.implicitHeight
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: label
|
|
||||||
text: "\uF2DB —/—GB"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.rosewater
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: process
|
|
||||||
command: ["sh", "-c", "free -g | awk '/^Mem:/ {print $3 \" \" $2}'"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: function() {
|
|
||||||
var parts = text.trim().split(/\s+/)
|
|
||||||
var used = parts[0] || "—", total = parts[1] || "—"
|
|
||||||
label.text = "\uF2DB " + used + "/" + total + "GB"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: restartTimer.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: restartTimer
|
|
||||||
interval: 30000
|
|
||||||
repeat: false
|
|
||||||
onTriggered: process.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: process.running = true
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
implicitWidth: row.implicitWidth
|
|
||||||
implicitHeight: row.implicitHeight
|
|
||||||
|
|
||||||
property string downText: "—"
|
|
||||||
property string upText: "—"
|
|
||||||
|
|
||||||
// Internal state for delta calculation
|
|
||||||
property real prevRx: 0
|
|
||||||
property real prevTx: 0
|
|
||||||
property var lastUpdate: 0
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: row
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 8
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "\uF437"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.peach
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "\uF0AB"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.peach
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
Layout.preferredWidth: 44
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
text: downText
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.peach
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "\uF0AA"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.peach
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
Layout.preferredWidth: 44
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
text: upText
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.peach
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: process
|
|
||||||
command: ["sh", "-c", "awk 'NR>2 && $1!~/^lo:/ {rx+=$2; tx+=$10} END{print rx+0, tx+0}' /proc/net/dev"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: function() {
|
|
||||||
var now = Date.now();
|
|
||||||
var parts = text.trim().split(/\s+/);
|
|
||||||
|
|
||||||
if (parts.length >= 2) {
|
|
||||||
var rx = parseInt(parts[0], 10) || 0;
|
|
||||||
var tx = parseInt(parts[1], 10) || 0;
|
|
||||||
|
|
||||||
// Only calculate speed if we have a previous data point
|
|
||||||
if (root.prevRx > 0) {
|
|
||||||
var elapsed = (now - root.lastUpdate) / 1000;
|
|
||||||
if (elapsed <= 0) elapsed = 1; // Prevent division by zero
|
|
||||||
|
|
||||||
var down = (rx - root.prevRx) / elapsed;
|
|
||||||
var up = (tx - root.prevTx) / elapsed;
|
|
||||||
|
|
||||||
function fmt(bytesPerSec) {
|
|
||||||
var bps = bytesPerSec * 8; // Convert to bits per second
|
|
||||||
if (bps >= 1e6) return (bps / 1e6).toFixed(1) + "Mb";
|
|
||||||
if (bps >= 1e3) return (bps / 1e3).toFixed(0) + "Kb";
|
|
||||||
return bps.toFixed(0) + "b";
|
|
||||||
}
|
|
||||||
|
|
||||||
root.downText = fmt(down);
|
|
||||||
root.upText = fmt(up);
|
|
||||||
}
|
|
||||||
|
|
||||||
root.prevRx = rx;
|
|
||||||
root.prevTx = tx;
|
|
||||||
root.lastUpdate = now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: restartTimer.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: restartTimer
|
|
||||||
interval: 2000
|
|
||||||
repeat: false
|
|
||||||
onTriggered: process.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: process.running = true
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
implicitWidth: label.implicitWidth
|
|
||||||
implicitHeight: label.implicitHeight
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: label
|
|
||||||
text: "\uF0A0 —"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.text
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: process
|
|
||||||
command: ["sh", "-c", "df -h -P -l / | awk 'NR==2 {gsub(/%/,\"\",$5); print $5 \" \" $4}'"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: function() {
|
|
||||||
var parts = text.trim().split(/\s+/)
|
|
||||||
var pct = parts[0] || "—"
|
|
||||||
var avail = parts[1] || ""
|
|
||||||
label.text = "\uF0A0 " + (avail ? avail : pct + "%")
|
|
||||||
var n = parseInt(pct, 10)
|
|
||||||
if (!isNaN(n)) {
|
|
||||||
if (n >= 90) label.color = Theme.red
|
|
||||||
else if (n >= 80) label.color = Theme.yellow
|
|
||||||
else label.color = Theme.text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: restartTimer.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: restartTimer
|
|
||||||
interval: 60000
|
|
||||||
repeat: false
|
|
||||||
onTriggered: process.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: process.running = true
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
property string hwmonPath: "" // e.g. /sys/class/hwmon/hwmon2/temp1_input
|
|
||||||
implicitWidth: label.implicitWidth
|
|
||||||
implicitHeight: label.implicitHeight
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: label
|
|
||||||
text: "\uF2C8 —°C"
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
color: Theme.rosewater
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: process
|
|
||||||
command: root.hwmonPath ? ["bash", "/home/johannes/.config/quickshell/scripts/cpu-temp.sh", root.hwmonPath] : ["bash", "/home/johannes/.config/quickshell/scripts/cpu-temp.sh"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: function() {
|
|
||||||
var v = text.trim()
|
|
||||||
label.text = "\uF2C8 " + (v ? v + "°C" : "—°C")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: restartTimer.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: restartTimer
|
|
||||||
interval: 4000
|
|
||||||
repeat: false
|
|
||||||
onTriggered: process.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: process.running = true
|
|
||||||
}
|
|
||||||
@@ -1,383 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
FloatingWindow {
|
|
||||||
id: win
|
|
||||||
title: "Theme Switcher"
|
|
||||||
visible: false
|
|
||||||
implicitWidth: 920
|
|
||||||
implicitHeight: 460
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
property string scriptsDir: Quickshell.env("HOME") + "/.config/nushell/scripts"
|
|
||||||
property string currentTheme: "—"
|
|
||||||
property int selectedIndex: currentTheme === "latte" ? 2 : currentTheme === "mocha" ? 1 : 0
|
|
||||||
property bool mouseWasInside: false
|
|
||||||
readonly property var modes: ["auto", "mocha", "latte"]
|
|
||||||
readonly property var names: ["Auto", "Mocha", "Latte"]
|
|
||||||
readonly property var subtitles: ["Follow darkman / system", "Catppuccin dark", "Catppuccin light"]
|
|
||||||
|
|
||||||
function clampIndex(index) {
|
|
||||||
return ((index % modes.length) + modes.length) % modes.length
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectIndex(index) {
|
|
||||||
selectedIndex = clampIndex(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectedMode() {
|
|
||||||
return modes[selectedIndex]
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectedName() {
|
|
||||||
return names[selectedIndex]
|
|
||||||
}
|
|
||||||
|
|
||||||
function modeForOffset(offset) {
|
|
||||||
return modes[clampIndex(selectedIndex + offset)]
|
|
||||||
}
|
|
||||||
|
|
||||||
function nameForMode(mode) {
|
|
||||||
const idx = modes.indexOf(mode)
|
|
||||||
return idx >= 0 ? names[idx] : mode
|
|
||||||
}
|
|
||||||
|
|
||||||
function subtitleForMode(mode) {
|
|
||||||
const idx = modes.indexOf(mode)
|
|
||||||
return idx >= 0 ? subtitles[idx] : ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function open() {
|
|
||||||
mouseWasInside = false
|
|
||||||
visible = true
|
|
||||||
refresh()
|
|
||||||
keyScope.forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggle() {
|
|
||||||
visible = !visible
|
|
||||||
if (visible) {
|
|
||||||
mouseWasInside = false
|
|
||||||
refresh()
|
|
||||||
keyScope.forceActiveFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() { themeState.running = true }
|
|
||||||
|
|
||||||
function runTheme(mode) {
|
|
||||||
themeApply.command = [scriptsDir + "/theme-switch.nu", "--" + mode]
|
|
||||||
themeApply.running = true
|
|
||||||
visible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
function applySelected() {
|
|
||||||
runTheme(selectedMode())
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "themeSwitcher"
|
|
||||||
function open() { win.open() }
|
|
||||||
function toggle() { win.toggle() }
|
|
||||||
function autoTheme() { win.runTheme("auto") }
|
|
||||||
function mocha() { win.runTheme("mocha") }
|
|
||||||
function latte() { win.runTheme("latte") }
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: keyScope
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: win.visible
|
|
||||||
|
|
||||||
Keys.onPressed: function(event) {
|
|
||||||
if (event.key === Qt.Key_Left || event.key === Qt.Key_H) {
|
|
||||||
win.selectIndex(win.selectedIndex - 1)
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Right || event.key === Qt.Key_L) {
|
|
||||||
win.selectIndex(win.selectedIndex + 1)
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space) {
|
|
||||||
win.applySelected()
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Escape) {
|
|
||||||
win.visible = false
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
onEntered: win.mouseWasInside = true
|
|
||||||
onExited: if (win.mouseWasInside) win.visible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: 34
|
|
||||||
color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38)
|
|
||||||
border.width: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: carousel
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: 8
|
|
||||||
anchors.rightMargin: 8
|
|
||||||
anchors.topMargin: 24
|
|
||||||
anchors.bottomMargin: 76
|
|
||||||
clip: false
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: [-1, 0, 1]
|
|
||||||
|
|
||||||
ThemeCard {
|
|
||||||
id: card
|
|
||||||
property int offset: modelData
|
|
||||||
property string mode: win.modeForOffset(offset)
|
|
||||||
property bool centered: offset === 0
|
|
||||||
|
|
||||||
width: centered ? 430 : 330
|
|
||||||
height: centered ? 300 : 230
|
|
||||||
x: carousel.width / 2 - width / 2 + offset * 260
|
|
||||||
y: carousel.height / 2 - height / 2
|
|
||||||
z: centered ? 20 : 10
|
|
||||||
|
|
||||||
modeName: win.nameForMode(mode)
|
|
||||||
subtitle: win.subtitleForMode(mode)
|
|
||||||
themeMode: mode
|
|
||||||
active: mode === win.currentTheme
|
|
||||||
selected: centered
|
|
||||||
|
|
||||||
Behavior on x { NumberAnimation { duration: 140; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on y { NumberAnimation { duration: 140; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on width { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on height { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
if (centered) win.applySelected()
|
|
||||||
else win.selectIndex(win.selectedIndex + offset)
|
|
||||||
keyScope.forceActiveFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.leftMargin: 42
|
|
||||||
anchors.rightMargin: 42
|
|
||||||
anchors.bottomMargin: 22
|
|
||||||
height: 48
|
|
||||||
radius: 20
|
|
||||||
color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: 14
|
|
||||||
anchors.rightMargin: 14
|
|
||||||
spacing: 12
|
|
||||||
|
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: win.selectedName() + " · Current: " + win.currentTheme
|
|
||||||
elide: Text.ElideMiddle
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
color: Theme.text
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: (win.selectedIndex + 1) + " / 3 · ←/→ select · Enter apply · Esc"
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize - 2
|
|
||||||
color: Theme.overlay2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component ThemeCard: Rectangle {
|
|
||||||
id: card
|
|
||||||
property string modeName: ""
|
|
||||||
property string subtitle: ""
|
|
||||||
property string themeMode: "mocha"
|
|
||||||
property bool active: false
|
|
||||||
property bool selected: false
|
|
||||||
signal clicked()
|
|
||||||
|
|
||||||
radius: selected ? 30 : 26
|
|
||||||
color: card.themeMode === "latte" ? "#eff1f5" : card.themeMode === "mocha" ? "#1e1e2e" : Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.88)
|
|
||||||
border.color: selected ? Theme.mauve : active ? Theme.green : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.65)
|
|
||||||
border.width: selected ? 3 : 1
|
|
||||||
opacity: selected ? 1.0 : 0.86
|
|
||||||
antialiasing: true
|
|
||||||
|
|
||||||
property color fg: themeMode === "latte" ? "#4c4f69" : "#cdd6f4"
|
|
||||||
property color sub: themeMode === "latte" ? "#6c6f85" : "#bac2de"
|
|
||||||
property color base: themeMode === "latte" ? "#eff1f5" : "#1e1e2e"
|
|
||||||
property color crust: themeMode === "latte" ? "#dce0e8" : "#11111b"
|
|
||||||
property color surface: themeMode === "latte" ? "#ccd0da" : "#313244"
|
|
||||||
property color accent: themeMode === "latte" ? "#8839ef" : "#cba6f7"
|
|
||||||
property color blue: themeMode === "latte" ? "#1e66f5" : "#89b4fa"
|
|
||||||
property color green: themeMode === "latte" ? "#40a02b" : "#a6e3a1"
|
|
||||||
property color peach: themeMode === "latte" ? "#fe640b" : "#fab387"
|
|
||||||
property int dotSize: selected ? 28 : 18
|
|
||||||
property int dotGap: selected ? 8 : 5
|
|
||||||
|
|
||||||
Behavior on opacity { NumberAnimation { duration: 120; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on border.color { ColorAnimation { duration: 100 } }
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 12
|
|
||||||
radius: card.radius - 8
|
|
||||||
color: Qt.rgba(card.crust.r, card.crust.g, card.crust.b, 0.72)
|
|
||||||
border.color: Qt.rgba(card.surface.r, card.surface.g, card.surface.b, 0.88)
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: card.selected ? 18 : 14
|
|
||||||
spacing: card.selected ? 12 : 9
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: 10
|
|
||||||
|
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: card.modeName
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize + (card.selected ? 8 : 3)
|
|
||||||
font.bold: true
|
|
||||||
color: card.fg
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
visible: card.active
|
|
||||||
width: 34
|
|
||||||
height: 34
|
|
||||||
radius: 17
|
|
||||||
color: Qt.rgba(card.green.r, card.green.g, card.green.b, 0.92)
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "✓"
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize + 2
|
|
||||||
color: card.base
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: card.subtitle
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize - 1
|
|
||||||
color: card.sub
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: 18
|
|
||||||
color: card.base
|
|
||||||
border.color: card.surface
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.margins: 12
|
|
||||||
width: parent.width * 0.24
|
|
||||||
radius: 13
|
|
||||||
color: card.crust
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.margins: 12
|
|
||||||
height: 26
|
|
||||||
radius: 13
|
|
||||||
color: card.surface
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.leftMargin: parent.width * 0.32
|
|
||||||
anchors.rightMargin: 16
|
|
||||||
anchors.topMargin: 52
|
|
||||||
anchors.bottomMargin: 16
|
|
||||||
spacing: 10
|
|
||||||
|
|
||||||
Rectangle { width: parent.width * 0.78; height: 18; radius: 9; color: card.accent }
|
|
||||||
Rectangle { width: parent.width; height: 16; radius: 8; color: card.surface }
|
|
||||||
Rectangle { width: parent.width * 0.64; height: 16; radius: 8; color: card.surface }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.rightMargin: 16
|
|
||||||
anchors.bottomMargin: card.selected ? 16 : 30
|
|
||||||
spacing: card.dotGap
|
|
||||||
Rectangle { width: card.dotSize; height: card.dotSize; radius: card.dotSize / 2; color: card.accent }
|
|
||||||
Rectangle { width: card.dotSize; height: card.dotSize; radius: card.dotSize / 2; color: card.blue }
|
|
||||||
Rectangle { width: card.dotSize; height: card.dotSize; radius: card.dotSize / 2; color: card.green }
|
|
||||||
Rectangle { width: card.dotSize; height: card.dotSize; radius: card.dotSize / 2; color: card.peach }
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
visible: card.themeMode === "auto"
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: 18
|
|
||||||
gradient: Gradient {
|
|
||||||
orientation: Gradient.Horizontal
|
|
||||||
GradientStop { position: 0.0; color: "#eff1f5" }
|
|
||||||
GradientStop { position: 0.48; color: "#eff1f5" }
|
|
||||||
GradientStop { position: 0.52; color: "#1e1e2e" }
|
|
||||||
GradientStop { position: 1.0; color: "#1e1e2e" }
|
|
||||||
}
|
|
||||||
opacity: 0.28
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
onClicked: card.clicked()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process { id: themeApply; running: false; onExited: win.refresh() }
|
|
||||||
Process {
|
|
||||||
id: themeState
|
|
||||||
command: ["sh", "-c", "cat ~/.config/current-theme 2>/dev/null || echo unknown"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
win.currentTheme = text.trim()
|
|
||||||
win.selectedIndex = win.currentTheme === "latte" ? 2 : win.currentTheme === "mocha" ? 1 : win.selectedIndex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Services.SystemTray
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
property var panelWindow: null
|
|
||||||
implicitWidth: trayRow.implicitWidth
|
|
||||||
implicitHeight: trayRow.implicitHeight
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: trayRow
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: SystemTray.items
|
|
||||||
|
|
||||||
delegate: Item {
|
|
||||||
Layout.preferredWidth: 24
|
|
||||||
Layout.preferredHeight: 24
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: icon
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 20
|
|
||||||
height: 20
|
|
||||||
source: modelData.icon || ""
|
|
||||||
sourceSize: Qt.size(width, height)
|
|
||||||
smooth: true
|
|
||||||
mipmap: true
|
|
||||||
visible: !!modelData.icon
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: ma
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
|
||||||
onClicked: function(mouse) {
|
|
||||||
if (mouse.button === Qt.LeftButton)
|
|
||||||
modelData.activate()
|
|
||||||
else if (mouse.button === Qt.RightButton && root.panelWindow) {
|
|
||||||
var p = ma.mapToItem(root.panelWindow.contentItem, mouse.x, mouse.y)
|
|
||||||
modelData.display(root.panelWindow, p.x, p.y)
|
|
||||||
} else if (mouse.button === Qt.MiddleButton)
|
|
||||||
modelData.secondaryActivate()
|
|
||||||
}
|
|
||||||
onWheel: function(wheel) {
|
|
||||||
modelData.scroll(wheel.angleDelta.y, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,285 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Widgets as QSW
|
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Theme
|
|
||||||
|
|
||||||
FloatingWindow {
|
|
||||||
id: win
|
|
||||||
title: "Wallpaper Switcher"
|
|
||||||
visible: false
|
|
||||||
implicitWidth: 1120
|
|
||||||
implicitHeight: 520
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
property string scriptsDir: Quickshell.env("HOME") + "/.config/nushell/scripts"
|
|
||||||
property var wallpapers: []
|
|
||||||
property string currentWallpaper: "—"
|
|
||||||
property int selectedIndex: 0
|
|
||||||
property string selectedWallpaper: wallpapers.length > 0 ? wallpapers[selectedIndex] : ""
|
|
||||||
readonly property int cellWidth: 520
|
|
||||||
property bool mouseWasInside: false
|
|
||||||
|
|
||||||
function fileUrl(path) {
|
|
||||||
if (!path || path === "—") return ""
|
|
||||||
return "file://" + path
|
|
||||||
}
|
|
||||||
|
|
||||||
function clampIndex(index) {
|
|
||||||
if (wallpapers.length === 0) return 0
|
|
||||||
return ((index % wallpapers.length) + wallpapers.length) % wallpapers.length
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectIndex(index) {
|
|
||||||
if (wallpapers.length === 0) return
|
|
||||||
selectedIndex = clampIndex(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectPath(path) {
|
|
||||||
const idx = wallpapers.indexOf(path)
|
|
||||||
if (idx >= 0) selectIndex(idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
function open() {
|
|
||||||
mouseWasInside = false
|
|
||||||
visible = true
|
|
||||||
refresh()
|
|
||||||
keyScope.forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggle() {
|
|
||||||
visible = !visible
|
|
||||||
if (visible) {
|
|
||||||
mouseWasInside = false
|
|
||||||
refresh()
|
|
||||||
keyScope.forceActiveFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
wallpaperState.running = true
|
|
||||||
wallpaperList.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function applySelected() {
|
|
||||||
if (selectedWallpaper) runWallpaper(["--set", selectedWallpaper])
|
|
||||||
}
|
|
||||||
|
|
||||||
function runWallpaper(args) {
|
|
||||||
wallpaperApply.command = [scriptsDir + "/wallpaper-switch.nu"].concat(args)
|
|
||||||
wallpaperApply.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "wallpaperSwitcher"
|
|
||||||
function open() { win.open() }
|
|
||||||
function toggle() { win.toggle() }
|
|
||||||
function random() { win.runWallpaper(["--random"]) }
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: keyScope
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: win.visible
|
|
||||||
|
|
||||||
Keys.onPressed: function(event) {
|
|
||||||
if (event.key === Qt.Key_Left || event.key === Qt.Key_H) {
|
|
||||||
win.selectIndex(win.selectedIndex - 1)
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Right || event.key === Qt.Key_L) {
|
|
||||||
win.selectIndex(win.selectedIndex + 1)
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space) {
|
|
||||||
win.applySelected()
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Escape) {
|
|
||||||
win.visible = false
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_R) {
|
|
||||||
win.runWallpaper(["--random"])
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
onEntered: win.mouseWasInside = true
|
|
||||||
onExited: if (win.mouseWasInside) win.visible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transparent glass layer: Hyprland blur handles the background behind this window.
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: 34
|
|
||||||
color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38)
|
|
||||||
border.width: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: carousel
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: 8
|
|
||||||
anchors.rightMargin: 8
|
|
||||||
anchors.topMargin: 24
|
|
||||||
anchors.bottomMargin: 70
|
|
||||||
clip: false
|
|
||||||
|
|
||||||
function pathForOffset(offset) {
|
|
||||||
if (win.wallpapers.length === 0) return ""
|
|
||||||
return win.wallpapers[win.clampIndex(win.selectedIndex + offset)]
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: [-1, 0, 1]
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: cell
|
|
||||||
property int offset: modelData
|
|
||||||
property bool centered: offset === 0
|
|
||||||
property string wallpaperPath: carousel.pathForOffset(offset)
|
|
||||||
property bool current: wallpaperPath === win.currentWallpaper
|
|
||||||
width: centered ? 610 : 500
|
|
||||||
height: centered ? 390 : 320
|
|
||||||
x: carousel.width / 2 - width / 2 + offset * 300
|
|
||||||
y: carousel.height / 2 - height / 2
|
|
||||||
z: centered ? 20 : 10
|
|
||||||
|
|
||||||
Behavior on x { NumberAnimation { duration: 140; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on y { NumberAnimation { duration: 140; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on width { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on height { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
||||||
|
|
||||||
QSW.ClippingRectangle {
|
|
||||||
id: card
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: centered ? 30 : 26
|
|
||||||
color: Theme.crust
|
|
||||||
border.color: centered ? Theme.mauve : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.55)
|
|
||||||
border.width: centered ? 3 : 1
|
|
||||||
antialiasing: true
|
|
||||||
contentUnderBorder: true
|
|
||||||
contentInsideBorder: false
|
|
||||||
|
|
||||||
Behavior on border.color { ColorAnimation { duration: 100 } }
|
|
||||||
|
|
||||||
Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: win.fileUrl(cell.wallpaperPath)
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
asynchronous: true
|
|
||||||
cache: true
|
|
||||||
retainWhileLoading: true
|
|
||||||
smooth: true
|
|
||||||
mipmap: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
visible: cell.current
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.margins: 16
|
|
||||||
width: 36
|
|
||||||
height: 36
|
|
||||||
radius: 18
|
|
||||||
color: Qt.rgba(Theme.green.r, Theme.green.g, Theme.green.b, 0.92)
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "✓"
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize + 3
|
|
||||||
color: Theme.base
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
if (cell.centered) win.applySelected()
|
|
||||||
else win.selectIndex(win.selectedIndex + cell.offset)
|
|
||||||
keyScope.forceActiveFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.leftMargin: 42
|
|
||||||
anchors.rightMargin: 42
|
|
||||||
anchors.bottomMargin: 22
|
|
||||||
height: 48
|
|
||||||
radius: 20
|
|
||||||
color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: 14
|
|
||||||
anchors.rightMargin: 14
|
|
||||||
spacing: 12
|
|
||||||
|
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: win.selectedWallpaper ? win.selectedWallpaper.split('/').pop() : "No wallpapers found"
|
|
||||||
elide: Text.ElideMiddle
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize
|
|
||||||
color: Theme.text
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: (win.wallpapers.length > 0 ? (win.selectedIndex + 1) + " / " + win.wallpapers.length + " · " : "") + "←/→ · Enter apply · R random · Esc"
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: Theme.fontPixelSize - 2
|
|
||||||
color: Theme.overlay2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: wallpaperApply
|
|
||||||
running: false
|
|
||||||
onExited: win.refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: wallpaperState
|
|
||||||
command: [scriptsDir + "/wallpaper-switch.nu", "--current"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
win.currentWallpaper = text.trim() || "—"
|
|
||||||
if (win.wallpapers.length > 0) win.selectPath(win.currentWallpaper)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: wallpaperList
|
|
||||||
command: [scriptsDir + "/wallpaper-switch.nu", "--list"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
try {
|
|
||||||
const oldSelection = win.selectedWallpaper
|
|
||||||
win.wallpapers = JSON.parse(text.trim())
|
|
||||||
win.selectedIndex = win.clampIndex(win.selectedIndex)
|
|
||||||
if (oldSelection && win.wallpapers.indexOf(oldSelection) >= 0) win.selectPath(oldSelection)
|
|
||||||
else win.selectPath(win.currentWallpaper)
|
|
||||||
} catch (e) {
|
|
||||||
win.wallpapers = []
|
|
||||||
win.selectedIndex = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
module Widgets
|
|
||||||
Clock 1.0 Clock.qml
|
|
||||||
CpuWidget 1.0 CpuWidget.qml
|
|
||||||
MemoryWidget 1.0 MemoryWidget.qml
|
|
||||||
NetTrafficWidget 1.0 NetTrafficWidget.qml
|
|
||||||
StorageWidget 1.0 StorageWidget.qml
|
|
||||||
TemperatureWidget 1.0 TemperatureWidget.qml
|
|
||||||
AudioWidget 1.0 AudioWidget.qml
|
|
||||||
TrayWidget 1.0 TrayWidget.qml
|
|
||||||
HyprlandWorkspaceWidget 1.0 HyprlandWorkspaceWidget.qml
|
|
||||||
ThemeSwitcherWindow 1.0 ThemeSwitcherWindow.qml
|
|
||||||
WallpaperSwitcherWindow 1.0 WallpaperSwitcherWindow.qml
|
|
||||||
PowerMenuWindow 1.0 PowerMenuWindow.qml
|
|
||||||
ClipboardPickerWindow 1.0 ClipboardPickerWindow.qml
|
|
||||||
AppLauncherWindow 1.0 AppLauncherWindow.qml
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -u
|
|
||||||
|
|
||||||
read_temp() {
|
|
||||||
local sensor=$1
|
|
||||||
[ -n "$sensor" ] || return 1
|
|
||||||
[ -f "$sensor" ] || return 1
|
|
||||||
awk '{print int(($1 + 500) / 1000)}' "$sensor" 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
pick_sensor() {
|
|
||||||
local d name f label_file label
|
|
||||||
local sensor=""
|
|
||||||
local cpu_like=""
|
|
||||||
local k10=""
|
|
||||||
local any=""
|
|
||||||
|
|
||||||
for d in /sys/class/hwmon/hwmon* /sys/devices/platform/coretemp.0/hwmon/hwmon*; do
|
|
||||||
[ -f "$d/name" ] || continue
|
|
||||||
name=$(<"$d/name")
|
|
||||||
|
|
||||||
for f in "$d"/temp*_input; do
|
|
||||||
[ -f "$f" ] || continue
|
|
||||||
[ -n "$any" ] || any="$f"
|
|
||||||
|
|
||||||
label_file=${f%_input}_label
|
|
||||||
label=""
|
|
||||||
[ -f "$label_file" ] && label=$(<"$label_file")
|
|
||||||
|
|
||||||
case "$label" in
|
|
||||||
Package\ id*|Tdie*|SoC\ Temperature*)
|
|
||||||
printf '%s\n' "$f"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$label" in
|
|
||||||
*[Cc][Pp][Uu]*)
|
|
||||||
[ -n "$cpu_like" ] || cpu_like="$f"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$name" in
|
|
||||||
*cpu*|*CPU*)
|
|
||||||
[ -n "$cpu_like" ] || cpu_like="$f"
|
|
||||||
;;
|
|
||||||
k10temp)
|
|
||||||
[ -n "$k10" ] || k10="$f"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
sensor=${cpu_like:-${k10:-$any}}
|
|
||||||
if [ -n "$sensor" ]; then
|
|
||||||
printf '%s\n' "$sensor"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
for d in /sys/class/thermal/thermal_zone*; do
|
|
||||||
[ -f "$d/temp" ] || continue
|
|
||||||
printf '%s\n' "$d/temp"
|
|
||||||
return 0
|
|
||||||
done
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local sensor=${1:-}
|
|
||||||
|
|
||||||
if [ -n "$sensor" ]; then
|
|
||||||
read_temp "$sensor"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
sensor=$(pick_sensor) || exit 0
|
|
||||||
read_temp "$sensor"
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
//@ pragma UseQApplication
|
|
||||||
//@ pragma Env QT_QPA_PLATFORM=wayland
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import qs.Bar
|
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
ShellRoot {
|
|
||||||
id: root
|
|
||||||
property var barInstances: []
|
|
||||||
Component {
|
|
||||||
id: barComponent
|
|
||||||
Bar {}
|
|
||||||
}
|
|
||||||
function updateBars() {
|
|
||||||
for (var i = 0; i < barInstances.length; i++)
|
|
||||||
barInstances[i].destroy()
|
|
||||||
barInstances = []
|
|
||||||
var screens = Quickshell.screens
|
|
||||||
if (screens.length === 0) {
|
|
||||||
var bar = barComponent.createObject(root, {})
|
|
||||||
if (bar) barInstances.push(bar)
|
|
||||||
} else {
|
|
||||||
for (var i = 0; i < screens.length; i++) {
|
|
||||||
var bar = barComponent.createObject(root, { screen: screens[i] })
|
|
||||||
if (bar) barInstances.push(bar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ThemeSwitcherWindow {}
|
|
||||||
WallpaperSwitcherWindow {}
|
|
||||||
PowerMenuWindow {}
|
|
||||||
ClipboardPickerWindow {}
|
|
||||||
AppLauncherWindow {}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
Quickshell.watchFiles = true
|
|
||||||
Qt.callLater(updateBars)
|
|
||||||
}
|
|
||||||
Connections {
|
|
||||||
target: Quickshell
|
|
||||||
function onScreensChanged() { updateBars() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Generated
+49
-1
@@ -280,6 +280,19 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_4": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1787360063,
|
||||||
|
"narHash": "sha256-95aJfHyQTLWslCXFVNB0odgmVkpdmDezQwTg9mhqV1E=",
|
||||||
|
"rev": "2c423e03bbafcff28bfadc6781a4a8257f205cb5",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1059570.2c423e03bbaf/nixexprs.tar.xz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
@@ -287,7 +300,27 @@
|
|||||||
"home-manager": "home-manager_3",
|
"home-manager": "home-manager_3",
|
||||||
"hyprmod": "hyprmod",
|
"hyprmod": "hyprmod",
|
||||||
"nixcord": "nixcord",
|
"nixcord": "nixcord",
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": "nixpkgs_3",
|
||||||
|
"spicetify": "spicetify"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spicetify": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_4",
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1787460061,
|
||||||
|
"narHash": "sha256-r2FJY01jRVhrZIKPdhQ3QFYsAz3wjilWTMSSH7VMOeo=",
|
||||||
|
"owner": "Gerg-L",
|
||||||
|
"repo": "spicetify-nix",
|
||||||
|
"rev": "a8adfd6f9f341dd586d5c06dda3bbfa21c6014e7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Gerg-L",
|
||||||
|
"repo": "spicetify-nix",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
@@ -305,6 +338,21 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"treefmt-nix": {
|
"treefmt-nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|||||||
@@ -17,18 +17,20 @@
|
|||||||
url = "github:BlueManCZ/hyprmod";
|
url = "github:BlueManCZ/hyprmod";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
spicetify.url = "github:Gerg-L/spicetify-nix";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, home-manager, agenix, chaotic, nixcord, hyprmod, ... }:
|
outputs = { self, nixpkgs, home-manager, agenix, chaotic, nixcord, hyprmod, spicetify, ... }:
|
||||||
let
|
let
|
||||||
mkHome = system: home-manager.lib.homeManagerConfiguration {
|
mkHome = system: home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
extraSpecialArgs = { inherit hyprmod; };
|
extraSpecialArgs = { inherit hyprmod spicetify; };
|
||||||
modules = [
|
modules = [
|
||||||
agenix.homeManagerModules.age
|
agenix.homeManagerModules.age
|
||||||
nixcord.homeModules.nixcord
|
nixcord.homeModules.nixcord
|
||||||
./home.nix
|
./home.nix
|
||||||
chaotic.homeModules.default
|
chaotic.homeModules.default
|
||||||
|
spicetify.homeManagerModules.default
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, lib, hyprmod, ... }:
|
{ config, pkgs, lib, hyprmod, spicetify, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
nix.package = pkgs.nix;
|
nix.package = pkgs.nix;
|
||||||
@@ -75,6 +75,7 @@
|
|||||||
".config/btop".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/mutable_config/btop";
|
".config/btop".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/mutable_config/btop";
|
||||||
".config/lazygit".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/mutable_config/lazygit";
|
".config/lazygit".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/mutable_config/lazygit";
|
||||||
".config/hypr".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/mutable_config/hypr";
|
".config/hypr".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/mutable_config/hypr";
|
||||||
|
".config/quickshell".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/mutable_config/quickshell";
|
||||||
".local/share" = {
|
".local/share" = {
|
||||||
source = ./local_share;
|
source = ./local_share;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
@@ -161,5 +162,30 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.spicetify =
|
||||||
|
let
|
||||||
|
spicePkgs = spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
enabledExtensions = with spicePkgs.extensions; [
|
||||||
|
adblock
|
||||||
|
hidePodcasts
|
||||||
|
shuffle # shuffle+ (special characters are sanitized out of extension names)
|
||||||
|
];
|
||||||
|
enabledCustomApps = with spicePkgs.apps; [
|
||||||
|
newReleases
|
||||||
|
ncsVisualizer
|
||||||
|
];
|
||||||
|
enabledSnippets = with spicePkgs.snippets; [
|
||||||
|
rotatingCoverart
|
||||||
|
pointer
|
||||||
|
];
|
||||||
|
|
||||||
|
theme = spicePkgs.themes.catppuccin;
|
||||||
|
colorScheme = "mocha";
|
||||||
|
};
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
}
|
}
|
||||||
+1
-1
@@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Widgets as QSW
|
import Quickshell.Widgets as QSW
|
||||||
import qs.Theme
|
import "../core"
|
||||||
|
|
||||||
FloatingWindow {
|
FloatingWindow {
|
||||||
id: win
|
id: win
|
||||||
+1
-1
@@ -2,7 +2,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Theme
|
import "../core"
|
||||||
|
|
||||||
FloatingWindow {
|
FloatingWindow {
|
||||||
id: win
|
id: win
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import "../core"
|
||||||
|
|
||||||
|
ModuleContainer {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
// Initial state
|
||||||
|
text: "00:00"
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 1000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: {
|
||||||
|
var d = new Date();
|
||||||
|
var h = d.getHours().toString().padStart(2, '0');
|
||||||
|
var m = d.getMinutes().toString().padStart(2, '0');
|
||||||
|
root.text = h + ":" + m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Embed the MPRIS Popup natively into the pill's slot
|
||||||
|
popupItem: PopupWindow {
|
||||||
|
id: mprisPopup
|
||||||
|
implicitWidth: 260
|
||||||
|
implicitHeight: 80
|
||||||
|
|
||||||
|
anchor.item: root
|
||||||
|
anchor.edges: Edges.Bottom
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.bg
|
||||||
|
radius: Theme.radius
|
||||||
|
border.color: Theme.bgAlt
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.padding
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Now Playing"
|
||||||
|
color: Theme.fgAlt
|
||||||
|
font: Theme.font
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: mprisText
|
||||||
|
text: "Nothing playing"
|
||||||
|
color: Theme.fg
|
||||||
|
font: Theme.fontBold
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: mprisProcess
|
||||||
|
command: ["sh", "-c", "playerctl metadata --format '{{title}} - {{artist}}' || echo 'Nothing playing'"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
mprisText.text = text.trim() || "Nothing playing";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 2000
|
||||||
|
running: mprisPopup.visible
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: mprisProcess.running = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Effects
|
||||||
|
import Quickshell
|
||||||
|
import "../core"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property bool active: true
|
||||||
|
property bool clickable: false
|
||||||
|
|
||||||
|
// Inner content configuration
|
||||||
|
property string icon: ""
|
||||||
|
property string text: ""
|
||||||
|
property Component customContent: null
|
||||||
|
|
||||||
|
// Popup configuration
|
||||||
|
property var popupItem: null
|
||||||
|
|
||||||
|
// Styling
|
||||||
|
property color pillColor: Theme.bgAlt
|
||||||
|
|
||||||
|
// Standard pill dimensions
|
||||||
|
implicitHeight: 28
|
||||||
|
|
||||||
|
// Monitor tracking for exclusive visibility
|
||||||
|
property var monitor: null
|
||||||
|
property bool exclusiveToScreen: false
|
||||||
|
property bool isFocusedMonitor: monitor ? monitor.focused : true
|
||||||
|
property bool effectivelyActive: active && (!exclusiveToScreen || isFocusedMonitor)
|
||||||
|
|
||||||
|
// Fluid auto-hide transitions
|
||||||
|
visible: opacity > 0
|
||||||
|
opacity: effectivelyActive ? 1 : 0
|
||||||
|
implicitWidth: effectivelyActive ? contentRow.implicitWidth + (Theme.padding * 2) : 0
|
||||||
|
clip: false // Turn off clip so shadow isn't cut off
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation { duration: 250; easing.type: Easing.InOutQuad }
|
||||||
|
}
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation { duration: 250; easing.type: Easing.OutBack }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shadow Effect
|
||||||
|
MultiEffect {
|
||||||
|
anchors.fill: bgRect
|
||||||
|
source: bgRect
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: "#000000"
|
||||||
|
shadowOpacity: 0.4
|
||||||
|
shadowBlur: 0.8
|
||||||
|
shadowVerticalOffset: 2
|
||||||
|
shadowHorizontalOffset: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: bgRect
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: Theme.radius / 2
|
||||||
|
color: (clickable || popupItem !== null) && mouseArea.containsMouse ? Qt.darker(root.pillColor, 1.2) : root.pillColor
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: contentRow
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: root.customContent !== null
|
||||||
|
sourceComponent: root.customContent
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
visible: root.icon !== "" && root.customContent === null
|
||||||
|
text: root.icon
|
||||||
|
color: Theme.fg
|
||||||
|
font: Theme.font
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
visible: root.text !== "" && root.customContent === null
|
||||||
|
text: root.text
|
||||||
|
color: Theme.fg
|
||||||
|
font: Theme.fontBold
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: root.clickable || root.popupItem !== null
|
||||||
|
cursorShape: (root.clickable || root.popupItem !== null) ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
onClicked: {
|
||||||
|
if (root.popupItem !== null) {
|
||||||
|
root.popupItem.visible = !root.popupItem.visible;
|
||||||
|
}
|
||||||
|
root.clicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signal clicked()
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
import Quickshell
|
||||||
|
import Quickshell.Services.Notifications
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import "../core"
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: notifWindow
|
||||||
|
|
||||||
|
// Anchor to top right, just below the bar
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset slightly from the screen edges
|
||||||
|
margins {
|
||||||
|
top: 40 // height of top bar (32) + 8 padding
|
||||||
|
right: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dynamic height based on notifications
|
||||||
|
implicitWidth: 320
|
||||||
|
implicitHeight: notifList.contentHeight
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
// Make invisible if no notifications
|
||||||
|
visible: notificationServer.trackedNotifications.values.length > 0
|
||||||
|
|
||||||
|
NotificationServer {
|
||||||
|
id: notificationServer
|
||||||
|
bodySupported: true
|
||||||
|
actionsSupported: false
|
||||||
|
inlineReplySupported: false
|
||||||
|
imageSupported: true
|
||||||
|
actionIconsSupported: false
|
||||||
|
persistenceSupported: false
|
||||||
|
|
||||||
|
onNotification: function(notification) {
|
||||||
|
notification.tracked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: notifList
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 8
|
||||||
|
model: notificationServer.trackedNotifications.values
|
||||||
|
clip: false // Allow shadows or animations outside
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
id: delegateRect
|
||||||
|
width: notifWindow.width
|
||||||
|
height: layout.height + Theme.padding * 2
|
||||||
|
color: Theme.bg
|
||||||
|
radius: Theme.radius
|
||||||
|
border.color: Theme.bgAlt
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
property var notif: modelData
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: layout
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: Theme.padding
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: notif.appName || "Notification"
|
||||||
|
color: Theme.primary
|
||||||
|
font: Theme.fontBold
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "✕"
|
||||||
|
color: Theme.fgAlt
|
||||||
|
font: Theme.fontBold
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: notif.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: notif.summary || ""
|
||||||
|
color: Theme.fg
|
||||||
|
font: Theme.fontBold
|
||||||
|
Layout.fillWidth: true
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: notif.body || ""
|
||||||
|
color: Theme.fgAlt
|
||||||
|
font: Theme.font
|
||||||
|
Layout.fillWidth: true
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
maximumLineCount: 4
|
||||||
|
elide: Text.ElideRight
|
||||||
|
visible: text.length > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: expireTimer
|
||||||
|
interval: notif.expireTimeout > 0 ? (notif.expireTimeout) : 5000
|
||||||
|
running: true
|
||||||
|
onTriggered: notif.expire()
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
// Don't swallow clicks for the close button
|
||||||
|
z: -1
|
||||||
|
onClicked: notif.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -2,7 +2,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Theme
|
import "../core"
|
||||||
|
|
||||||
FloatingWindow {
|
FloatingWindow {
|
||||||
id: win
|
id: win
|
||||||
@@ -17,7 +17,7 @@ FloatingWindow {
|
|||||||
property bool mouseWasInside: false
|
property bool mouseWasInside: false
|
||||||
readonly property var actions: [
|
readonly property var actions: [
|
||||||
{ name: "Lock", icon: "", hint: "hyprlock", cmd: "hyprlock", danger: false },
|
{ name: "Lock", icon: "", hint: "hyprlock", cmd: "hyprlock", danger: false },
|
||||||
{ name: "Logout", icon: "", hint: "loginctl terminate-user", cmd: "loginctl terminate-user $USER", danger: true },
|
{ name: "Logout", icon: "", hint: "hyprctl dispatch exit", cmd: "hyprctl dispatch exit", danger: true },
|
||||||
{ name: "Suspend", icon: "", hint: "systemctl suspend", cmd: "systemctl suspend", danger: false },
|
{ name: "Suspend", icon: "", hint: "systemctl suspend", cmd: "systemctl suspend", danger: false },
|
||||||
{ name: "Reboot", icon: "", hint: "systemctl reboot", cmd: "systemctl reboot", danger: true },
|
{ name: "Reboot", icon: "", hint: "systemctl reboot", cmd: "systemctl reboot", danger: true },
|
||||||
{ name: "Shutdown", icon: "", hint: "systemctl poweroff", cmd: "systemctl poweroff", danger: true }
|
{ name: "Shutdown", icon: "", hint: "systemctl poweroff", cmd: "systemctl poweroff", danger: true }
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import "../core"
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
// State properties
|
||||||
|
property string wifiSsid: ""
|
||||||
|
property bool btConnected: false
|
||||||
|
property string batteryPct: ""
|
||||||
|
property bool isCharging: false
|
||||||
|
|
||||||
|
// Visibility
|
||||||
|
property var monitor: null
|
||||||
|
property bool exclusiveToScreen: false
|
||||||
|
|
||||||
|
// Poller
|
||||||
|
Timer {
|
||||||
|
interval: 3000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: {
|
||||||
|
wifiProcess.running = true
|
||||||
|
btProcess.running = true
|
||||||
|
batProcess.running = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wifi
|
||||||
|
Process {
|
||||||
|
id: wifiProcess
|
||||||
|
command: ["sh", "-c", "nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
wifiSsid = text.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onExited: function(code, status) {
|
||||||
|
if (code !== 0) wifiSsid = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bluetooth
|
||||||
|
Process {
|
||||||
|
id: btProcess
|
||||||
|
command: ["sh", "-c", "bluetoothctl info | grep 'Connected: yes'"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
btConnected = text.trim().length > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onExited: function(code, status) {
|
||||||
|
if (code !== 0) btConnected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Battery
|
||||||
|
Process {
|
||||||
|
id: batProcess
|
||||||
|
command: ["sh", "-c", "if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then cat /sys/class/power_supply/BAT*/capacity | head -n1; cat /sys/class/power_supply/BAT*/status | head -n1; fi"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
var lines = text.trim().split("\n");
|
||||||
|
if (lines.length >= 2) {
|
||||||
|
batteryPct = lines[0];
|
||||||
|
isCharging = (lines[1] === "Charging");
|
||||||
|
} else {
|
||||||
|
batteryPct = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UI Elements
|
||||||
|
ModuleContainer {
|
||||||
|
monitor: parent.monitor
|
||||||
|
exclusiveToScreen: parent.exclusiveToScreen
|
||||||
|
active: wifiSsid !== ""
|
||||||
|
pillColor: Theme.primary
|
||||||
|
icon: ""
|
||||||
|
text: wifiSsid
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleContainer {
|
||||||
|
monitor: parent.monitor
|
||||||
|
exclusiveToScreen: parent.exclusiveToScreen
|
||||||
|
active: btConnected
|
||||||
|
pillColor: Theme.primary
|
||||||
|
icon: ""
|
||||||
|
text: "Connected"
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleContainer {
|
||||||
|
monitor: parent.monitor
|
||||||
|
exclusiveToScreen: parent.exclusiveToScreen
|
||||||
|
active: batteryPct !== ""
|
||||||
|
pillColor: Theme.accent
|
||||||
|
icon: isCharging ? "" : ""
|
||||||
|
text: batteryPct + "%"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import "../core"
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: root
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
property var monitor: null
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: Hyprland.workspaces
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
property var ws: modelData
|
||||||
|
|
||||||
|
// Only show workspaces belonging to the specific monitor
|
||||||
|
visible: root.monitor === null || (ws.monitor && ws.monitor.name === root.monitor.name)
|
||||||
|
|
||||||
|
width: visible ? 28 : 0
|
||||||
|
height: visible ? 28 : 0
|
||||||
|
radius: Theme.radius / 2
|
||||||
|
|
||||||
|
// Highlight if active
|
||||||
|
color: ws.isActive ? Theme.primary : Theme.bgAlt
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: ws.id
|
||||||
|
color: ws.isActive ? Theme.bg : Theme.fg
|
||||||
|
font: Theme.fontBold
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: Hyprland.dispatch("workspace", ws.id)
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Workspaces Workspaces.qml
|
||||||
|
Clock Clock.qml
|
||||||
|
StatusIndicators StatusIndicators.qml
|
||||||
|
NotificationDaemon NotificationDaemon.qml
|
||||||
|
ModuleContainer ModuleContainer.qml
|
||||||
|
AppLauncherWindow AppLauncherWindow.qml
|
||||||
|
ClipboardPickerWindow ClipboardPickerWindow.qml
|
||||||
|
PowerMenuWindow PowerMenuWindow.qml
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
pragma Singleton
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
// Mocha-like palette
|
||||||
|
property color bg: "#1e1e2e"
|
||||||
|
property color bgAlt: "#313244"
|
||||||
|
property color fg: "#cdd6f4"
|
||||||
|
property color fgAlt: "#a6adc8"
|
||||||
|
property color primary: "#89b4fa"
|
||||||
|
property color accent: "#f38ba8"
|
||||||
|
property color transparent: "transparent"
|
||||||
|
|
||||||
|
property int radius: 8
|
||||||
|
property int padding: 8
|
||||||
|
|
||||||
|
// Legacy / Catppuccin Aliases for imported Widgets
|
||||||
|
property string fontFamily: "sans-serif"
|
||||||
|
property int fontPixelSize: 14
|
||||||
|
|
||||||
|
property color base: "#1e1e2e"
|
||||||
|
property color crust: "#11111b"
|
||||||
|
property color text: "#cdd6f4"
|
||||||
|
property color subtext0: "#a6adc8"
|
||||||
|
property color surface0: "#313244"
|
||||||
|
property color surface1: "#45475a"
|
||||||
|
property color overlay1: "#7f849c"
|
||||||
|
property color overlay2: "#9399b2"
|
||||||
|
property color green: "#a6e3a1"
|
||||||
|
property color mauve: "#cba6f7"
|
||||||
|
property color lavender: "#b4befe"
|
||||||
|
property color red: "#f38ba8"
|
||||||
|
|
||||||
|
property font font: Qt.font({ family: fontFamily, pixelSize: fontPixelSize })
|
||||||
|
property font fontBold: Qt.font({ family: fontFamily, pixelSize: fontPixelSize, bold: true })
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
singleton Theme Theme.qml
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import "components"
|
||||||
|
import "core"
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
delegate: Component {
|
||||||
|
PanelWindow {
|
||||||
|
id: topBar
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
property var hyprMonitor: Hyprland.monitorFor(modelData)
|
||||||
|
|
||||||
|
screen: modelData
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
implicitHeight: 32 + 8 // Changed to implicitHeight per warnings
|
||||||
|
color: "transparent"
|
||||||
|
exclusiveZone: implicitHeight
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: 8
|
||||||
|
anchors.leftMargin: Theme.padding
|
||||||
|
anchors.rightMargin: Theme.padding
|
||||||
|
|
||||||
|
// Left: Workspaces
|
||||||
|
RowLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
// Wrap workspaces in a solid pill
|
||||||
|
ModuleContainer {
|
||||||
|
pillColor: Theme.bgAlt
|
||||||
|
customContent: Component {
|
||||||
|
Workspaces {
|
||||||
|
monitor: hyprMonitor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Center: Clock
|
||||||
|
RowLayout {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
Clock {
|
||||||
|
pillColor: Theme.primary
|
||||||
|
monitor: hyprMonitor
|
||||||
|
exclusiveToScreen: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Right: Status Indicators
|
||||||
|
RowLayout {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
StatusIndicators {
|
||||||
|
monitor: hyprMonitor
|
||||||
|
exclusiveToScreen: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notification Daemon (Global, usually tied to primary monitor or floating)
|
||||||
|
NotificationDaemon {}
|
||||||
|
|
||||||
|
// Global floating widget windows
|
||||||
|
AppLauncherWindow {}
|
||||||
|
ClipboardPickerWindow {}
|
||||||
|
PowerMenuWindow {}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user