Compare commits
3 commits
1c034a3904
...
45646b6b5e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45646b6b5e | ||
|
|
c0125912b1 | ||
|
|
d7024f3d77 |
7 changed files with 196 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ Singleton {
|
||||||
property Clock clock: Clock {}
|
property Clock clock: Clock {}
|
||||||
property Pipewire pipewire: Pipewire {}
|
property Pipewire pipewire: Pipewire {}
|
||||||
property Network network: Network {}
|
property Network network: Network {}
|
||||||
|
property Bluetooth bluetooth: Bluetooth {}
|
||||||
property Storage storage: Storage {}
|
property Storage storage: Storage {}
|
||||||
property Memory memory: Memory {}
|
property Memory memory: Memory {}
|
||||||
property Cpu cpu: Cpu {}
|
property Cpu cpu: Cpu {}
|
||||||
|
|
@ -62,6 +63,13 @@ Singleton {
|
||||||
property int verticalPadding: 6
|
property int verticalPadding: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component Bluetooth: QtObject {
|
||||||
|
property int fontSize: 16
|
||||||
|
property int height: 30
|
||||||
|
property int horizontalPadding: 8
|
||||||
|
property int verticalPadding: 6
|
||||||
|
}
|
||||||
|
|
||||||
component Storage: QtObject {
|
component Storage: QtObject {
|
||||||
property int iconSize: 14
|
property int iconSize: 14
|
||||||
property int fontSize: 14
|
property int fontSize: 14
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import Quickshell
|
||||||
Singleton {
|
Singleton {
|
||||||
property string bell: "\u{E05d}"
|
property string bell: "\u{E05d}"
|
||||||
property string bellRing: "\u{E224}"
|
property string bellRing: "\u{E224}"
|
||||||
|
property string bluetooth: "\u{E060}"
|
||||||
|
property string bluetoothConnected: "\u{E1b8}"
|
||||||
property string brickWall: "\u{E586}"
|
property string brickWall: "\u{E586}"
|
||||||
property string coffee: "\u{E09a}"
|
property string coffee: "\u{E09a}"
|
||||||
property string cpu: "\u{E0ad}"
|
property string cpu: "\u{E0ad}"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
|
import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import "components"
|
import "components"
|
||||||
|
import "components/bluetooth"
|
||||||
import "components/hyprland"
|
import "components/hyprland"
|
||||||
import "components/mpris"
|
import "components/mpris"
|
||||||
import "components/tray"
|
import "components/tray"
|
||||||
import "../../config/"
|
|
||||||
|
|
||||||
Scope {
|
Scope {
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
|
|
@ -108,6 +109,10 @@ Scope {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bluetooth {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
Storage {
|
Storage {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
|
||||||
39
modules/bar/components/bluetooth/Bluetooth.qml
Normal file
39
modules/bar/components/bluetooth/Bluetooth.qml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
import qs.config
|
||||||
|
import qs.constants
|
||||||
|
import qs.styled
|
||||||
|
|
||||||
|
Clickable {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
implicitWidth: text.width
|
||||||
|
implicitHeight: Dimensions.bluetooth.height
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
popup.opened = !popup.opened;
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
font.family: Theme.lucide.font.family
|
||||||
|
font.pixelSize: Dimensions.bluetooth.fontSize
|
||||||
|
font.bold: true
|
||||||
|
text: Icons.bluetooth
|
||||||
|
|
||||||
|
color: root.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
topPadding: Dimensions.bluetooth.verticalPadding
|
||||||
|
bottomPadding: Dimensions.bluetooth.verticalPadding
|
||||||
|
leftPadding: Dimensions.bluetooth.horizontalPadding
|
||||||
|
rightPadding: Dimensions.bluetooth.horizontalPadding
|
||||||
|
}
|
||||||
|
|
||||||
|
BluetoothMenu {
|
||||||
|
id: popup
|
||||||
|
|
||||||
|
anchor.item: root
|
||||||
|
anchor.rect.x: root.width / 2 - width / 2
|
||||||
|
anchor.rect.y: root.height + 8
|
||||||
|
}
|
||||||
|
}
|
||||||
74
modules/bar/components/bluetooth/BluetoothMenu.qml
Normal file
74
modules/bar/components/bluetooth/BluetoothMenu.qml
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.config
|
||||||
|
import qs.constants
|
||||||
|
import qs.services
|
||||||
|
import qs.styled
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell.Widgets
|
||||||
|
|
||||||
|
StyledPopupWindow {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
backgroundColor: Theme.palette.base300
|
||||||
|
margins: 16
|
||||||
|
radius: 8
|
||||||
|
|
||||||
|
content: ColumnLayout {
|
||||||
|
spacing: 8
|
||||||
|
WrapperRectangle {
|
||||||
|
margin: 16
|
||||||
|
color: Theme.palette.base200
|
||||||
|
radius: 8
|
||||||
|
Layout.fillWidth: true
|
||||||
|
RowLayout {
|
||||||
|
StyledText {
|
||||||
|
text: "Bluetooth"
|
||||||
|
}
|
||||||
|
|
||||||
|
Switch {
|
||||||
|
checked: Bluetooth.defaultAdapter.enabled
|
||||||
|
onClicked: Bluetooth.defaultAdapter.enabled = checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WrapperRectangle {
|
||||||
|
margin: 16
|
||||||
|
color: Theme.palette.base200
|
||||||
|
radius: 8
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
font.bold: true
|
||||||
|
text: "Connected Devices"
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceList {
|
||||||
|
devices: Bluetooth.connectedDevices
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
font.bold: true
|
||||||
|
text: "Paired Devices"
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceList {
|
||||||
|
devices: Bluetooth.pairedDevices
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
font.bold: true
|
||||||
|
text: "Available Devices"
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceList {
|
||||||
|
devices: Bluetooth.availableDevices
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
46
modules/bar/components/bluetooth/DeviceList.qml
Normal file
46
modules/bar/components/bluetooth/DeviceList.qml
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
import qs.config
|
||||||
|
import qs.constants
|
||||||
|
import qs.services
|
||||||
|
import qs.styled
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: root
|
||||||
|
required property var devices
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: devices
|
||||||
|
delegate: Clickable {
|
||||||
|
id: device
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
implicitWidth: row.width
|
||||||
|
implicitHeight: row.height
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: row
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
topPadding: 8
|
||||||
|
bottomPadding: 8
|
||||||
|
leftPadding: 8
|
||||||
|
text: device.modelData.deviceName
|
||||||
|
}
|
||||||
|
StyledText {
|
||||||
|
font.family: Theme.lucide.font.family
|
||||||
|
font.pixelSize: 10
|
||||||
|
font.bold: true
|
||||||
|
text: device.modelData.connected ? Icons.bluetoothConnected : Icons.bluetooth
|
||||||
|
|
||||||
|
topPadding: 8
|
||||||
|
bottomPadding: 8
|
||||||
|
rightPadding: 8
|
||||||
|
|
||||||
|
color: device.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
services/Bluetooth.qml
Normal file
21
services/Bluetooth.qml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Bluetooth
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property BluetoothAdapter defaultAdapter: Bluetooth.defaultAdapter
|
||||||
|
property list<BluetoothDevice> connectedDevices: defaultAdapter.devices.values.filter(device => device.connected)
|
||||||
|
property list<BluetoothDevice> pairedDevices: defaultAdapter.devices.values.filter(device => device.paired)
|
||||||
|
property list<BluetoothDevice> availableDevices: defaultAdapter.devices.values.filter(device => !device.paired)
|
||||||
|
|
||||||
|
function isConnected(BluetoothDevice: device) {
|
||||||
|
return device.state == BluetoothDeviceState.Connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isConnecting(BluetoothDevice: device) {
|
||||||
|
return device.state == BluetoothDeviceState.Connecting;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue