summaryrefslogtreecommitdiff
path: root/.config/quickshell/Services
diff options
context:
space:
mode:
Diffstat (limited to '.config/quickshell/Services')
-rw-r--r--.config/quickshell/Services/Battery.qml33
-rw-r--r--.config/quickshell/Services/Brightness.qml18
-rw-r--r--.config/quickshell/Services/Cava.qml21
-rw-r--r--.config/quickshell/Services/Flexoki.qml32
-rw-r--r--.config/quickshell/Services/HyprlandService.qml11
-rw-r--r--.config/quickshell/Services/Song.qml45
-rw-r--r--.config/quickshell/Services/Tags.qml18
-rw-r--r--.config/quickshell/Services/Time.qml15
-rw-r--r--.config/quickshell/Services/Uptime.qml63
-rw-r--r--.config/quickshell/Services/Volume.qml22
-rw-r--r--.config/quickshell/Services/Wifi.qml30
11 files changed, 308 insertions, 0 deletions
diff --git a/.config/quickshell/Services/Battery.qml b/.config/quickshell/Services/Battery.qml
new file mode 100644
index 0000000..0d6213c
--- /dev/null
+++ b/.config/quickshell/Services/Battery.qml
@@ -0,0 +1,33 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property string status: "Discharging"
+ property int capacity: 0
+
+ FileView {
+ id: statusFile
+ path: "/sys/class/power_supply/BAT0/status"
+ onLoaded: root.status = this.text().trim()
+ }
+
+ FileView {
+ id: capacityFile
+ path: "/sys/class/power_supply/BAT0/capacity"
+ onLoaded: root.capacity = parseInt(this.text().trim())
+ }
+
+ Timer {
+ interval: 10000
+ running: true
+ repeat: true
+ onTriggered: {
+ statusFile.reload()
+ capacityFile.reload()
+ }
+ }
+}
diff --git a/.config/quickshell/Services/Brightness.qml b/.config/quickshell/Services/Brightness.qml
new file mode 100644
index 0000000..80a8d1f
--- /dev/null
+++ b/.config/quickshell/Services/Brightness.qml
@@ -0,0 +1,18 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property int brightness
+
+ Process {
+ command: ["brightctl", "-l"]
+ running: true
+ stdout: SplitParser {
+ onRead: line => root.brightness = parseInt(line)
+ }
+ }
+}
diff --git a/.config/quickshell/Services/Cava.qml b/.config/quickshell/Services/Cava.qml
new file mode 100644
index 0000000..96cb918
--- /dev/null
+++ b/.config/quickshell/Services/Cava.qml
@@ -0,0 +1,21 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property list<int> heights
+
+ Process {
+ command: ["cava", "-p", "/home/samn/.config/quickshell/cava.ini"]
+ running: true
+ stdout: SplitParser {
+ onRead: line => {
+ var heights = line.substring(0, line.length - 1).split(';').map(x => parseInt(x))
+ if (heights !== root.heights) root.heights = heights
+ }
+ }
+ }
+}
diff --git a/.config/quickshell/Services/Flexoki.qml b/.config/quickshell/Services/Flexoki.qml
new file mode 100644
index 0000000..1c467b5
--- /dev/null
+++ b/.config/quickshell/Services/Flexoki.qml
@@ -0,0 +1,32 @@
+pragma Singleton
+
+import Quickshell
+
+Singleton {
+ readonly property string bg: "#100F0F"
+ readonly property string bg2: "#1C1B1A"
+ readonly property string ui: "#282726"
+ readonly property string ui2: "#343331"
+ readonly property string ui3: "#403E3C"
+ readonly property string tx3: "#575653"
+ readonly property string tx2: "#878580"
+ readonly property string tx: "#CECDC3"
+
+ readonly property string re: "#D14D41"
+ readonly property string or: "#DA702C"
+ readonly property string ye: "#D0A215"
+ readonly property string gr: "#879A39"
+ readonly property string cy: "#3AA99F"
+ readonly property string bl: "#4385BE"
+ readonly property string pu: "#8B7EC8"
+ readonly property string ma: "#CE5D97"
+
+ readonly property string re2: "#AF3029"
+ readonly property string or2: "#BC5215"
+ readonly property string ye2: "#AD8301"
+ readonly property string gr2: "#66800B"
+ readonly property string cy2: "#24837B"
+ readonly property string bl2: "#205EA6"
+ readonly property string pu2: "#5E409D"
+ readonly property string ma2: "#A02F6F"
+}
diff --git a/.config/quickshell/Services/HyprlandService.qml b/.config/quickshell/Services/HyprlandService.qml
new file mode 100644
index 0000000..9d35866
--- /dev/null
+++ b/.config/quickshell/Services/HyprlandService.qml
@@ -0,0 +1,11 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Hyprland
+import QtQuick
+
+Singleton {
+ id: root
+ property int activeWorkspace
+
+}
diff --git a/.config/quickshell/Services/Song.qml b/.config/quickshell/Services/Song.qml
new file mode 100644
index 0000000..a4dc969
--- /dev/null
+++ b/.config/quickshell/Services/Song.qml
@@ -0,0 +1,45 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property string file
+ property string artist
+ property string title
+ property string coverPath: "/home/samn/Music/cover.jpg"
+
+ Process {
+ id: songProc
+ command: ["rmpc", "song"]
+ running: true
+ stdout: StdioCollector {
+ onStreamFinished: {
+ var oldFile = root.file
+ var obj = JSON.parse(this.text);
+
+ root.file = obj.file
+ root.artist = obj.metadata.artist
+ root.title = obj.metadata.title
+
+ if (obj.file !== oldFile) {
+ coverProc.exec(["ffmpeg", "-y", "-i", "/home/samn/Music/" + obj.file, "-an", "-c:v", "copy", "/home/samn/Music/cover.jpg"])
+ }
+ }
+ }
+ }
+
+ Process {
+ id: coverProc
+ running: false
+ }
+
+ Timer {
+ interval: 5000
+ running: true
+ repeat: true
+ onTriggered: songProc.running = true
+ }
+}
diff --git a/.config/quickshell/Services/Tags.qml b/.config/quickshell/Services/Tags.qml
new file mode 100644
index 0000000..66aadaa
--- /dev/null
+++ b/.config/quickshell/Services/Tags.qml
@@ -0,0 +1,18 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property var tags: []
+
+ Process {
+ command: ["river-bedload", "-minified", "-watch", "tags"]
+ running: true
+ stdout: SplitParser {
+ onRead: line => root.tags = JSON.parse(line).filter(tag => tag.id < 10)
+ }
+ }
+}
diff --git a/.config/quickshell/Services/Time.qml b/.config/quickshell/Services/Time.qml
new file mode 100644
index 0000000..7af1b1f
--- /dev/null
+++ b/.config/quickshell/Services/Time.qml
@@ -0,0 +1,15 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ readonly property var time: clock.date
+
+ SystemClock {
+ id: clock
+ precision: SystemClock.Seconds
+ }
+}
diff --git a/.config/quickshell/Services/Uptime.qml b/.config/quickshell/Services/Uptime.qml
new file mode 100644
index 0000000..155be44
--- /dev/null
+++ b/.config/quickshell/Services/Uptime.qml
@@ -0,0 +1,63 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property string uptime
+
+ Process {
+ id: uptimeProc
+ command: ["uptime"]
+ running: true
+ stdout: StdioCollector {
+ onStreamFinished: {
+ var t = this.text.trim().split(" up ")[1]
+
+ var days = 0
+ if (t.includes("day")) {
+ var [d, t] = t.split(" day")
+ days = parseInt(d.trim())
+ t = t.split(", ")[1]
+ }
+ t = t.split(", ")[0]
+
+ var hours = 0
+ var minutes = 0
+
+ if (t.includes("min")) {
+ minutes = parseInt(t.split(' min')[0])
+ } else {
+ var [h, m] = t.split(":")
+ hours = parseInt(h.trim())
+ minutes = parseInt(m.trim())
+ }
+
+ var uptime = "Up ";
+ if (days > 0) {
+ uptime += days + " day"
+ if (days != 1) uptime += "s"
+ uptime += ", "
+ }
+ if (hours > 0) {
+ uptime += hours + " hour"
+ if (hours != 1) uptime += "s"
+ uptime += ", "
+ }
+ uptime += minutes + " minute"
+ if (minutes != 1) uptime += "s"
+
+ root.uptime = uptime
+ }
+ }
+ }
+
+ Timer {
+ interval: 60000
+ running: true
+ repeat: true
+ onTriggered: uptimeProc.running = true
+ }
+}
diff --git a/.config/quickshell/Services/Volume.qml b/.config/quickshell/Services/Volume.qml
new file mode 100644
index 0000000..875f1c9
--- /dev/null
+++ b/.config/quickshell/Services/Volume.qml
@@ -0,0 +1,22 @@
+pragma Singleton
+
+import QtQuick
+import Quickshell
+import Quickshell.Services.Pipewire
+
+Singleton {
+ id: root
+ property int volume
+
+ PwObjectTracker {
+ objects: [ Pipewire.defaultAudioSink ]
+ }
+
+ Connections {
+ target: Pipewire.defaultAudioSink?.audio
+
+ function onVolumeChanged() {
+ root.volume = Math.round(Pipewire.defaultAudioSink?.audio.volume * 100)
+ }
+ }
+}
diff --git a/.config/quickshell/Services/Wifi.qml b/.config/quickshell/Services/Wifi.qml
new file mode 100644
index 0000000..a438471
--- /dev/null
+++ b/.config/quickshell/Services/Wifi.qml
@@ -0,0 +1,30 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Hyprland
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property string ssid
+
+ Process {
+ id: netProc
+ command: ["sh", "-c", "iwctl station wlan0 get-networks | awk -F' ' '/>/ {print $3}'"]
+ running: true
+ stdout: StdioCollector {
+ onStreamFinished: {
+ root.ssid = this.text.trim()
+ // Hyprland.refreshWorkspaces()
+ }
+ }
+ }
+
+ Timer {
+ interval: 5000
+ running: true
+ repeat: true
+ onTriggered: netProc.running = true
+ }
+}