summaryrefslogtreecommitdiff
path: root/.config/quickshell
diff options
context:
space:
mode:
Diffstat (limited to '.config/quickshell')
-rw-r--r--.config/quickshell/Modules/Bar.qml16
-rw-r--r--.config/quickshell/Modules/Music.qml86
-rw-r--r--.config/quickshell/Services/Song.qml19
-rw-r--r--.config/quickshell/Services/Wifi.qml9
-rw-r--r--.config/quickshell/Services/Workspaces.qml (renamed from .config/quickshell/Services/HyprlandService.qml)0
-rw-r--r--.config/quickshell/shell.qml9
6 files changed, 99 insertions, 40 deletions
diff --git a/.config/quickshell/Modules/Bar.qml b/.config/quickshell/Modules/Bar.qml
index 3120574..8ddd144 100644
--- a/.config/quickshell/Modules/Bar.qml
+++ b/.config/quickshell/Modules/Bar.qml
@@ -52,14 +52,18 @@ Variants {
spacing: 6
Repeater {
- model: ScriptModel {
- values: Hyprland.workspaces.values.filter(ws => ws.id >= 0).sort((a, b) => a.id - b.id)
- }
+ model: 10
delegate: Rectangle {
- required property HyprlandWorkspace modelData
- property bool focused: modelData.focused
- property bool occupied: modelData.toplevels.values.length > 0
+ property HyprlandWorkspace ws: {
+ Hyprland.workspaces.values.find(ws => ws.id === index + 1) || null
+ }
+ property bool focused: {
+ ws && ws.monitor.name === root.screen.name && ws.focused
+ }
+ property bool occupied: {
+ ws && ws.monitor.name === root.screen.name && ws.toplevels.values.length > 0
+ }
width: 20
height: 20
diff --git a/.config/quickshell/Modules/Music.qml b/.config/quickshell/Modules/Music.qml
index efb717e..8c79092 100644
--- a/.config/quickshell/Modules/Music.qml
+++ b/.config/quickshell/Modules/Music.qml
@@ -1,5 +1,6 @@
import Quickshell
import QtQuick
+import QtQuick.Layouts
import qs.Services
MouseArea {
@@ -7,10 +8,10 @@ MouseArea {
anchors.centerIn: parent
height: parent.implicitHeight
width: musicRow.implicitWidth
- state: "POPUP_CLOSED"
+ state: "popup-closed"
hoverEnabled: true
- onEntered: state = "POPUP_OPEN"
+ onEntered: state = "popup-open"
property string fontFamily: "FiraCode Nerd Font"
property int fontSize: 14
@@ -19,7 +20,7 @@ MouseArea {
states: [
State {
- name: "POPUP_CLOSED"
+ name: "popup-closed"
PropertyChanges { target: popup; visible: false }
PropertyChanges { target: musicRow; visible: true; spacing: 4 }
PropertyChanges { target: songContainer; bottomRightRadius: 4; topRightRadius: 4 }
@@ -30,11 +31,12 @@ MouseArea {
target: popupRect
width: musicRow.width
height: 36
+ opacity: 0
border.color: Flexoki.bg
}
},
State {
- name: "POPUP_OPEN"
+ name: "popup-open"
PropertyChanges { target: popup; visible: true }
PropertyChanges { target: musicRow; visible: false; spacing: -1 }
PropertyChanges { target: songContainer; bottomRightRadius: 0; topRightRadius: 0 }
@@ -45,6 +47,7 @@ MouseArea {
target: popupRect
width: 700
height: 500
+ opacity: 1
border.color: Flexoki.ui2
}
}
@@ -52,10 +55,13 @@ MouseArea {
transitions: [
Transition {
- from: "POPUP_CLOSED"
- to: "POPUP_OPEN"
+ from: "popup-closed"
+ to: "popup-open"
SequentialAnimation {
+ // show immediately so mouseleave works
+ PropertyAction { target: popup; property: "visible" }
+
ParallelAnimation {
NumberAnimation {
target: songContainer
@@ -86,7 +92,7 @@ MouseArea {
}
}
- PropertyAction { target: popup; property: "visible" }
+ PropertyAction { target: popupRect; property: "opacity" }
PropertyAction { target: musicRow; property: "visible" }
ParallelAnimation {
@@ -116,8 +122,9 @@ MouseArea {
}
},
Transition {
- from: "POPUP_OPEN"
- to: "POPUP_CLOSED"
+ // TODO: this transition flickers sometimes
+ from: "popup-open"
+ to: "popup-closed"
SequentialAnimation {
ParallelAnimation {
@@ -144,7 +151,8 @@ MouseArea {
}
PropertyAction { target: musicRow; property: "visible" }
- PropertyAction { target: popup; property: "visible" }
+ PropertyAction { target: popup; properties: "visible" }
+ PropertyAction { target: popupRect; property: "opacity" }
ParallelAnimation {
NumberAnimation {
@@ -194,24 +202,64 @@ MouseArea {
id: popupRect
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
- width: 700
- height: 36
color: Flexoki.bg
- border.color: Flexoki.ui
border.width: 2
radius: 18
MouseArea {
anchors.fill: parent
hoverEnabled: true
- onExited: root.state = "POPUP_CLOSED"
+ onExited: root.state = "popup-closed"
}
- Text {
- visible: false
- anchors.centerIn: parent
- color: Flexoki.tx
- text: "Hello world!"
+ RowLayout {
+ id: popupContent
+
+ anchors.fill: parent
+ anchors.topMargin: 32
+ anchors.bottomMargin: 32
+ anchors.leftMargin: 100
+ anchors.rightMargin: 100
+ spacing: 60
+
+ Image {
+ id: cover
+ asynchronous: true
+ source: "file://" + Song.coverPath
+ sourceSize.width: 300
+ sourceSize.height: 300
+ width: 300
+ height: 300
+
+ Connections {
+ target: Song
+
+ function onCoverLoaded() {
+ cover.source = "file://" + Song.coverPath
+ }
+ }
+ }
+
+ ColumnLayout {
+ Text {
+ Layout.alignment: Qt.AlignHCenter
+ color: Flexoki.re
+ text: Song.artist
+ font.pixelSize: root.fontSize
+ }
+ Text {
+ Layout.alignment: Qt.AlignHCenter
+ color: Flexoki.tx
+ text: Song.album
+ font.pixelSize: root.fontSize
+ }
+ Text {
+ Layout.alignment: Qt.AlignHCenter
+ color: Flexoki.tx
+ text: Song.title
+ font.pixelSize: root.fontSize
+ }
+ }
}
}
}
diff --git a/.config/quickshell/Services/Song.qml b/.config/quickshell/Services/Song.qml
index a4dc969..7c632be 100644
--- a/.config/quickshell/Services/Song.qml
+++ b/.config/quickshell/Services/Song.qml
@@ -8,8 +8,12 @@ Singleton {
id: root
property string file
property string artist
+ property string album
property string title
- property string coverPath: "/home/samn/Music/cover.jpg"
+ readonly property string coverPath: "/home/samn/Music/cover.jpg"
+
+ signal songChanged()
+ signal coverLoaded()
Process {
id: songProc
@@ -17,15 +21,25 @@ Singleton {
running: true
stdout: StdioCollector {
onStreamFinished: {
+ if (!this.text) {
+ root.file = ""
+ root.artist = ""
+ root.album = ""
+ root.title = ""
+ return
+ }
+
var oldFile = root.file
var obj = JSON.parse(this.text);
root.file = obj.file
root.artist = obj.metadata.artist
+ root.album = obj.metadata.album
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"])
+ root.songChanged()
+ coverProc.exec(["ffmpeg", "-y", "-i", "/home/samn/Music/" + obj.file, "-an", "-c:v", "copy", root.coverPath])
}
}
}
@@ -34,6 +48,7 @@ Singleton {
Process {
id: coverProc
running: false
+ onExited: root.coverLoaded()
}
Timer {
diff --git a/.config/quickshell/Services/Wifi.qml b/.config/quickshell/Services/Wifi.qml
index a438471..c8fd54b 100644
--- a/.config/quickshell/Services/Wifi.qml
+++ b/.config/quickshell/Services/Wifi.qml
@@ -1,7 +1,6 @@
pragma Singleton
import Quickshell
-import Quickshell.Hyprland
import Quickshell.Io
import QtQuick
@@ -11,12 +10,14 @@ Singleton {
Process {
id: netProc
- command: ["sh", "-c", "iwctl station wlan0 get-networks | awk -F' ' '/>/ {print $3}'"]
+ command: ["iwctl", "station", "wlan0", "get-networks"]
running: true
stdout: StdioCollector {
onStreamFinished: {
- root.ssid = this.text.trim()
- // Hyprland.refreshWorkspaces()
+ var line = this.text.split("\n").find(line => line.includes(">"))
+ // remove ANSI escape sequences
+ line = line.replace(/\x1b\[.*?[@A-Z\[\\\]^_`a-z\{\|\}~]/g, '')
+ root.ssid = line.split(" ").filter(x => x != "")[1]
}
}
}
diff --git a/.config/quickshell/Services/HyprlandService.qml b/.config/quickshell/Services/Workspaces.qml
index 9d35866..9d35866 100644
--- a/.config/quickshell/Services/HyprlandService.qml
+++ b/.config/quickshell/Services/Workspaces.qml
diff --git a/.config/quickshell/shell.qml b/.config/quickshell/shell.qml
index 4285ded..b6c76f8 100644
--- a/.config/quickshell/shell.qml
+++ b/.config/quickshell/shell.qml
@@ -1,17 +1,8 @@
import Quickshell
-import Quickshell.Hyprland
import QtQuick
import qs.Modules
Scope {
Bar {}
Wall {}
-
- Connections {
- target: Hyprland
- function onRawEvent(event) {
- throw new Exception('hyprland event')
- Hyprland.refreshWorkspaces()
- }
- }
}