quickshell work

This commit is contained in:
2025-11-09 18:02:29 -06:00
parent 160ae56e03
commit 103c8e803a
9 changed files with 256 additions and 85 deletions

View File

@@ -0,0 +1,81 @@
import Quickshell // for PanelWindow
import QtQuick // for Text
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Io
import Quickshell.Widgets
import Quickshell.Wayland
PanelWindow {
anchors {
top: true
//left: true
//right: true
//bottom: true
}
id: bar
exclusionMode: ExclusionMode.Ignore
WlrLayershell.layer: WlrLayer.Background
color: "#a0706050"
implicitHeight: 40
implicitWidth: 1900
Flow {
x: 0
padding: 5
spacing: 10
Launcher { id: l }
Workspaces { id: ws }
}
RowLayout {
x: (parent.width - cl.width) / 2 + parent.x - cl.x
y: parent.y + (parent.height - height) / 2
spacing: 10
Volume { id: v }
Battery { id: bat }
Hyprsunset { id: hs }
Clock { id: cl }
IdleInhibitor { id: ii }
Wifi { id: wifi }
Bluetooth { id: bt }
}
Flow {
x: parent.width + parent.x - width
padding: 5
spacing: 10
Layout.alignment: Qt.AlignRight
Media { id: media }
Tray { id: tray; window: bar }
Notifications { id: notif }
Power {
id: power
window: bar
}
}
}

View File

@@ -0,0 +1,30 @@
import Quickshell // for PanelWindow
import QtQuick // for Text
import QtQuick.Controls
import Quickshell.Io
import Quickshell.Widgets
ClippingWrapperRectangle {
radius: 5
implicitWidth: 30; height: 30
Button {
id: button
text: "󰛨 "
font.pointSize: 16
Process {
id: idlent
running: false
command: ["hyprsunset", "-t", "4000"]
onExited: {
running = button.text == "󰛨 " ? false : true
}
}
onClicked: {
idlent.running = button.text == "󰛨 " ? true : false
button.text = button.text == "󰛨 " ? "󱩌 " : "󰛨 "
}
implicitHeight: parent.height
}
}

View File

@@ -0,0 +1,34 @@
import Quickshell // for PanelWindow
import QtQuick // for Text
import QtQuick.Controls
import Quickshell.Io
import Quickshell.Widgets
ClippingWrapperRectangle {
property real interval: 100
id: root
radius: 5
implicitWidth: 30; height: 30
Button {
id: button
text: "󰒲 "
font.pointSize: 16
Process {
id: idlent
running: false
command: ["systemd-inhibit", "--what=idle", "sleep", root.interval.toString()]
onExited: {
running = button.text == "󰒲 " ? false : true
}
}
onClicked: {
idlent.running = button.text == "󰒲 " ? true : false
button.text = button.text == "󰒲 " ? "󰒳 " : "󰒲 "
}
implicitHeight: parent.height
}
}

View File

@@ -51,7 +51,13 @@ Item {
}
font.pointSize: 11
onClicked: {
timer.running = !timer.running
}
Timer {
id: timer
interval: 225
running: true

View File

@@ -1,28 +1,49 @@
import QtQuick // for Text
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Hyprland
import Quickshell.Services.Notifications
import Quickshell.Io
import Quickshell.Widgets
Item {
width: 30
width: 50
height: 30
ClippingWrapperRectangle {
radius: 5
width: 30; height: 30
anchors.fill: parent
Button {
id: button
text: "󰂚"
//icon.source: ''
font.pointSize: 16
Process {
id: launcher
running: false
command: ["rofi", "-show", "drun"]
onClicked: {
while(server.trackedNotifications.values.length > 0) {
server.trackedNotifications.values[0].dismiss()
}
text = "󰂚"
}
onClicked: launcher.running = true
implicitHeight: parent.height
}
}
NotificationServer {
id: server
persistenceSupported: true
imageSupported: true
actionsSupported: true
bodyImagesSupported: true
bodySupported: true
bodyHyperlinksSupported: true
inlineReplySupported: true
actionIconsSupported: true
onNotification: (n) => {
n.tracked = true
console.log(n?.body)
button.text = '󱅫 ' + (server.trackedNotifications.values.length + 1)
}
}
}

View File

@@ -1,3 +1,4 @@
import Quickshell
import QtQuick // for Text
import QtQuick.Controls
import QtQuick.Layouts
@@ -9,6 +10,10 @@ Item {
width: 30
height: 30
id: root
property var window: null
ClippingWrapperRectangle {
radius: 5
width: 30; height: 30
@@ -16,13 +21,59 @@ Item {
id: button
text: " "
font.pointSize: 16
Process {
id: launcher
running: false
command: ["rofi", "-show", "drun"]
}
onClicked: launcher.running = true
onClicked: menu.visible = !menu.visible
implicitHeight: parent.height
}
}
PopupWindow {
id: menu
anchor.window: window
anchor.rect.x: root.parent.x + root.parent.width - width
anchor.rect.y: 50
implicitWidth: 250
implicitHeight: 150
visible: true
color: "transparent"
ClippingWrapperRectangle {
radius: 5
implicitHeight: parent.height - 20
implicitWidth: parent.width
ColumnLayout {
spacing: 2
Button {
x: (parent.width - width) / 2
implicitWidth: parent.width - 10
implicitHeight: parent.height / 4 - parent.spacing
}
Button {
x: (parent.width - width) / 2
implicitWidth: parent.width - 10
implicitHeight: parent.height / 4 - parent.spacing
}
Button {
x: (parent.width - width) / 2
implicitWidth: parent.width - 10
implicitHeight: parent.height / 4 - parent.spacing
}
Button {
x: (parent.width - width) / 2
implicitWidth: parent.width - 10
implicitHeight: parent.height / 4 - parent.spacing
}
}
}
}
}

View File

@@ -8,6 +8,10 @@ Item {
width: 10 + rep.count * (2 * lay.spacing + 20)
height: 30
visible: SystemTray.items.values.length != 0
id: root
property var window: null
ClippingWrapperRectangle {
radius: 5
anchors.fill: parent
@@ -23,7 +27,7 @@ Item {
radius: 10
implicitWidth: 20
implicitHeight: 20
AbstractButton {
MouseArea {
anchors.fill: parent
Image {
@@ -38,7 +42,15 @@ Item {
}
}
onClicked: console.log('clicked!')
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (mouse) => {
if(mouse.button == Qt.LeftButton) {
SystemTray.items.values[index].activate()
} else if(mouse.button == Qt.RightButton) {
SystemTray.items.values[index].display(root.window, root.x + root.parent.x, 40)
}
}
}
}
}

View File

@@ -2,77 +2,13 @@
//@ pragma Env QSG_RENDER_LOOP=threaded
//@ pragma Env QT_QUICK_FLICKABLE_WHEEL_DECELERATION=10000
import Quickshell // for PanelWindow
import QtQuick // for Text
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Io
import Quickshell.Widgets
import Quickshell.Wayland
//@ pragma UseQApplication
import Quickshell // for ShellRoot
import qs.modules
ShellRoot {
PanelWindow {
anchors {
top: true
//left: true
//right: true
}
exclusionMode: ExclusionMode.Ignore
WlrLayershell.layer: WlrLayer.Background
color: "#a0706050"
implicitHeight: 40
implicitWidth: 1900
Flow {
x: 0
padding: 5
spacing: 10
Launcher { id: l }
Workspaces { id: ws }
}
RowLayout {
x: (parent.width - cl.width) / 2 + parent.x - cl.x
y: parent.y + (parent.height - height) / 2
spacing: 10
Volume { id: v }
Battery { id: bat }
Clock { id: cl }
Wifi { id: wifi }
Bluetooth { id: bt }
}
Flow {
x: parent.width + parent.x - width
padding: 5
spacing: 10
Layout.alignment: Qt.AlignRight
Media { id: media }
Tray { id: tray }
Notifications { id: notif }
Power { id: power }
}
Bar {
id: bar
}
}