remove battery module from local pc
This commit is contained in:
commit
c1267d5d8e
@ -32,14 +32,13 @@ Variants {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(Colors.surface.r, Colors.surface.g, Colors.surface.b, Settings.config.translucency)
|
||||
radius: Settings.config.floating ? Settings.config.barHeight / 2 : 0
|
||||
|
||||
RowLayout {
|
||||
id: leftStuff
|
||||
anchors.margins: Settings.config.barHeight / 4
|
||||
spacing: 10
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Workspaces {
|
||||
Layout.leftMargin: Settings.config.floating ? 5 : 20
|
||||
property var screen: root.modelData
|
||||
}
|
||||
Title {}
|
||||
@ -54,16 +53,16 @@ Variants {
|
||||
|
||||
RowLayout {
|
||||
id: rightStuff
|
||||
anchors.margins: Settings.config.barHeight / 4
|
||||
spacing: 10
|
||||
clip: true
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Network {}
|
||||
Volume {}
|
||||
Battery {}
|
||||
SysTray {}
|
||||
SettingsIcon {}
|
||||
StatusIcons {
|
||||
margin: Layout.rightMargin
|
||||
barWindow: root
|
||||
barContainer: container
|
||||
Layout.rightMargin: Settings.config.floating ? 5 : 20
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,83 +0,0 @@
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick.Layouts
|
||||
import QtQuick
|
||||
import Quickshell.Widgets
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import Quickshell
|
||||
import qs
|
||||
import qs.reusables
|
||||
import qs.settings
|
||||
|
||||
Rectangle {
|
||||
id: container
|
||||
visible: UPower.displayDevice.isLaptopBattery
|
||||
radius: implicitHeight / 2
|
||||
color: Colors.surfaceContainer
|
||||
implicitWidth: UPower.displayDevice.isLaptopBattery ? root.implicitWidth + 20 : 0
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
Item {
|
||||
id: root
|
||||
anchors.centerIn: parent
|
||||
|
||||
property bool frame1: UPower.displayDevice.percentage <= 0.16
|
||||
property bool frame2: UPower.displayDevice.percentage < 0.32
|
||||
property bool frame3: UPower.displayDevice.percentage < 0.48
|
||||
property bool frame4: UPower.displayDevice.percentage < 0.74
|
||||
property bool frame5: UPower.displayDevice.percentage < 0.90
|
||||
property bool frame6: UPower.displayDevice.percentage <= 1
|
||||
|
||||
function getBatteryIcon() {
|
||||
if (UPower.displayDevice.state == UPowerDeviceState.Charging) {
|
||||
return "battery_android_frame_bolt";
|
||||
}
|
||||
if (frame1) {
|
||||
return "battery_android_frame_1";
|
||||
}
|
||||
if (frame2) {
|
||||
return "battery_android_frame_2";
|
||||
}
|
||||
if (frame3) {
|
||||
return "battery_android_frame_3";
|
||||
}
|
||||
if (frame4) {
|
||||
return "battery_android_frame_4";
|
||||
}
|
||||
if (frame5) {
|
||||
return "battery_android_frame_5";
|
||||
}
|
||||
if (frame6) {
|
||||
return "battery_android_frame_full";
|
||||
}
|
||||
}
|
||||
function getProfileIcon() {
|
||||
if (PowerProfiles.profile.toString() == "2") {
|
||||
return "power-profile-performance-symbolic";
|
||||
}
|
||||
if (PowerProfiles.profile.toString() == "1") {
|
||||
return "power-profile-balanced-symbolic";
|
||||
}
|
||||
if (PowerProfiles.profile.toString() == "0") {
|
||||
return "power-profile-power-saver-symbolic";
|
||||
}
|
||||
}
|
||||
|
||||
implicitWidth: batRow.width
|
||||
implicitHeight: Settings.config.barHeight
|
||||
|
||||
RowLayout {
|
||||
id: batRow
|
||||
anchors.centerIn: parent
|
||||
height: parent.height
|
||||
spacing: 5
|
||||
CustomText {
|
||||
id: batText
|
||||
|
||||
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
|
||||
}
|
||||
CustomIcon {
|
||||
id: batIcon
|
||||
text: root.getBatteryIcon()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@ Rectangle {
|
||||
id: clockText
|
||||
property bool showFull
|
||||
anchors.centerIn: parent
|
||||
text: showFull ? Qt.formatDateTime(clock.date, "hh:mm / dd.mm.yy") : Qt.formatDateTime(clock.date, "hh:mm")
|
||||
text: showFull ? Qt.formatDateTime(clock.date, "hh:mm / dd.MM.yy") : Qt.formatDateTime(clock.date, "hh:mm")
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
|
||||
@ -6,15 +6,13 @@ import qs.settings
|
||||
import qs.reusables
|
||||
|
||||
Rectangle {
|
||||
id: container
|
||||
id: root
|
||||
visible: root.spotify != null
|
||||
radius: implicitHeight / 2
|
||||
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
||||
implicitWidth: root.implicitWidth + 20
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
Item {
|
||||
id: root
|
||||
anchors.centerIn: parent
|
||||
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
||||
implicitWidth: statusRow.width + 20
|
||||
|
||||
property var spotify: root.getSpotify()
|
||||
function getSpotify() {
|
||||
for (let i = 0; i < Mpris.players.values.length; i++) {
|
||||
@ -24,19 +22,19 @@ Rectangle {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
implicitWidth: statusRow.implicitWidth
|
||||
implicitHeight: statusRow.implicitHeight
|
||||
|
||||
RowLayout {
|
||||
id: statusRow
|
||||
spacing: 5
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.centerIn: parent
|
||||
property var combinedText: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
||||
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
|
||||
CustomText {
|
||||
id: mprisText
|
||||
Layout.maximumWidth: 300
|
||||
Layout.topMargin: 2
|
||||
text: root.spotify != null ? parent.combinedText : ""
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
CustomIcon {
|
||||
id: mprisStatus
|
||||
@ -44,7 +42,6 @@ Rectangle {
|
||||
text: root.spotify != null ? parent.status : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
anchors.fill: parent
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import Quickshell.Networking
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.reusables
|
||||
import qs.settings
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
// This is the background of the entire bar/module
|
||||
// You might want to make this transparent if you only want the "pills" to show
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
implicitWidth: mainLayout.implicitWidth + 20
|
||||
color: Colors.surfaceContainer
|
||||
radius: implicitHeight / 2
|
||||
|
||||
// --- Logic Functions ---
|
||||
function getIcon(device) {
|
||||
if (device.type === DeviceType.Wifi) {
|
||||
for (var i = 0; i < device.networks.values.length; i++) {
|
||||
var net = device.networks.values[i];
|
||||
if (net.connected) {
|
||||
if (net.signalStrength <= 0.20)
|
||||
return "android_wifi_0_bar";
|
||||
if (net.signalStrength <= 0.40)
|
||||
return "android_wifi_1_bar";
|
||||
if (net.signalStrength <= 0.60)
|
||||
return "android_wifi_2_bar";
|
||||
if (net.signalStrength <= 0.80)
|
||||
return "android_wifi_3_bar";
|
||||
return "android_wifi_4_bar";
|
||||
}
|
||||
}
|
||||
return "wifi_off";
|
||||
} else if (device.connected) {
|
||||
return "settings_ethernet";
|
||||
}
|
||||
return "wifi_off";
|
||||
}
|
||||
|
||||
function getStatus(device) {
|
||||
if (device.type === DeviceType.Wifi) {
|
||||
for (var i = 0; i < device.networks.values.length; i++) {
|
||||
var net = device.networks.values[i];
|
||||
if (net.connected) {
|
||||
return net.name;
|
||||
}
|
||||
}
|
||||
return "Disconnected";
|
||||
}
|
||||
return device.connected ? "Connected" : "Disconnected";
|
||||
}
|
||||
|
||||
// --- Main Layout ---
|
||||
RowLayout {
|
||||
id: mainLayout
|
||||
anchors.centerIn: parent
|
||||
spacing: 10 // Space between multiple device pills (if you have ethernet + wifi)
|
||||
|
||||
Repeater {
|
||||
id: netRepeater
|
||||
model: Networking.devices
|
||||
|
||||
delegate: RowLayout {
|
||||
id: innerContent
|
||||
required property var modelData
|
||||
// THIS fixes the centering issue:
|
||||
spacing: 8
|
||||
|
||||
CustomIcon {
|
||||
id: netIcon
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: root.getIcon(innerContent.modelData)
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: netText
|
||||
Layout.topMargin: 1
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: root.getStatus(innerContent.modelData)
|
||||
// Ensures the text font aligns vertically within its own line-height
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
134
modules/bar/StatusIcons.qml
Normal file
134
modules/bar/StatusIcons.qml
Normal file
@ -0,0 +1,134 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Pipewire
|
||||
import Quickshell.Networking
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs
|
||||
import qs.reusables
|
||||
import qs.settings
|
||||
import "functions.js" as Fn
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
implicitWidth: statusLayout.implicitWidth + 20
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
color: Colors.surfaceContainer
|
||||
radius: implicitHeight / 2
|
||||
required property var barWindow
|
||||
required property var barContainer
|
||||
required property var margin
|
||||
property var sink: Pipewire.defaultAudioSink
|
||||
property var sinkReady: Pipewire.defaultAudioSink.ready
|
||||
property var bat: UPower.displayDevice
|
||||
property var perc: UPower.displayDevice.percentage
|
||||
property var vol: Math.floor(Pipewire.defaultAudioSink.audio.volume * 100)
|
||||
Process {
|
||||
id: lowBat
|
||||
running: false
|
||||
command: ["sh", "-c", "notify-send", "'Low battery!'", "'Plug in your device!'"]
|
||||
}
|
||||
PopupWindow {
|
||||
id: batPopup
|
||||
property string popupText
|
||||
implicitWidth: root.width + 5
|
||||
implicitHeight: 30
|
||||
anchor.window: root.barWindow
|
||||
anchor.rect.y: root.barContainer.height + 5
|
||||
anchor.rect.x: root.barContainer.width - root.width - root.margin
|
||||
color: "transparent"
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Colors.surfaceContainer
|
||||
border.width: 5
|
||||
border.color: Colors.surface
|
||||
radius: Settings.config.floating ? height / 2 : Settings.config.screenCornerRadius
|
||||
|
||||
CustomText {
|
||||
anchors.centerIn: parent
|
||||
text: batPopup.popupText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: statusLayout
|
||||
anchors.centerIn: parent
|
||||
spacing: 10
|
||||
CustomIcon {
|
||||
id: volumeIcon
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
PwObjectTracker {
|
||||
objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
|
||||
}
|
||||
text: Fn.getVolumeIcon()
|
||||
MouseArea {
|
||||
id: pavuArea
|
||||
Process {
|
||||
id: pavuLauncher
|
||||
command: ["sh", "-c", "pavucontrol"]
|
||||
}
|
||||
anchors.fill: parent
|
||||
onClicked: pavuLauncher.exec(pavuLauncher.command)
|
||||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
batPopup.visible = true;
|
||||
batPopup.popupText = "Volume: " + root.vol + "%";
|
||||
}
|
||||
onExited: {
|
||||
batPopup.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: netRepeater
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
model: Networking.devices
|
||||
|
||||
delegate: CustomIcon {
|
||||
id: netIcon
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
required property var modelData
|
||||
text: Fn.getIcon(modelData)
|
||||
}
|
||||
}
|
||||
CustomIcon {
|
||||
id: batIcon
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: UPower.displayDevice.isLaptopBattery
|
||||
text: Fn.getBatteryIcon(root.perc)
|
||||
MouseArea {
|
||||
id: batHover
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
batPopup.visible = true;
|
||||
batPopup.popupText = "Battery: " + Math.floor(UPower.displayDevice.percentage * 100) + "%";
|
||||
}
|
||||
onExited: {
|
||||
batPopup.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
CustomIcon {
|
||||
id: settingsIcon
|
||||
text: "settings"
|
||||
MouseArea {
|
||||
id: settingsArea
|
||||
anchors.fill: settingsIcon
|
||||
onClicked: {
|
||||
Settings.config.settingsShown = true;
|
||||
}
|
||||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@ import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
implicitWidth: trayRow.implicitWidth + 10
|
||||
implicitWidth: trayRow.implicitWidth + 8
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
radius: implicitHeight / 2
|
||||
color: Colors.surfaceContainer
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
import QtQuick
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
import Quickshell
|
||||
import qs
|
||||
import qs.settings
|
||||
import qs.reusables
|
||||
import QtQuick.Layouts
|
||||
|
||||
Rectangle {
|
||||
id: container
|
||||
@ -14,13 +17,32 @@ Rectangle {
|
||||
id: root
|
||||
anchors.centerIn: parent
|
||||
readonly property var activeWindow: ToplevelManager.activeToplevel
|
||||
implicitWidth: titleText.implicitWidth + 20
|
||||
implicitWidth: titleLayout.implicitWidth
|
||||
implicitHeight: titleText.implicitHeight
|
||||
RowLayout {
|
||||
id: titleLayout
|
||||
anchors.centerIn: parent
|
||||
|
||||
anchors.fill: parent
|
||||
spacing: 5
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
radius: 30
|
||||
Layout.leftMargin: 10
|
||||
IconImage {
|
||||
id: icon
|
||||
source: root.activeWindow ? root.activeWindow.activated ? Quickshell.iconPath(root.activeWindow.appId, "") : "" : ""
|
||||
implicitSize: root.activeWindow ? root.activeWindow.activated ? 16 : 0 : 0
|
||||
}
|
||||
}
|
||||
CustomText {
|
||||
id: titleText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: root.activeWindow ? root.activeWindow.activated ? root.activeWindow.appId : "Desktop" : "Desktop"
|
||||
Layout.rightMargin: 10
|
||||
Layout.maximumWidth: 300
|
||||
text: root.activeWindow ? root.activeWindow.activated ? root.activeWindow.title : "Desktop" : "Desktop"
|
||||
onTextChanged: {}
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
import Quickshell.Io
|
||||
import QtQuick.Layouts
|
||||
import QtQuick
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.settings
|
||||
import qs.reusables
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
radius: implicitHeight / 2
|
||||
color: pavuArea.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
||||
implicitWidth: textRow.implicitWidth + 20
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
property var sink: Pipewire.defaultAudioSink
|
||||
function getVolumeIcon() {
|
||||
// Safety check: if Pipewire is dead or sink is missing
|
||||
if (!sink)
|
||||
return "volume_off";
|
||||
|
||||
// If muted, show the hush icon
|
||||
if (sink.audio.muted)
|
||||
return "volume_off";
|
||||
|
||||
// Volume is usually 0.0 to 1.0 (0% to 100%)
|
||||
const vol = sink.audio.volume;
|
||||
|
||||
if (vol <= 0.25)
|
||||
return "volume_mute";
|
||||
if (vol < 0.75)
|
||||
return "volume_down";
|
||||
if (vol <= 1.00)
|
||||
return "volume_up";
|
||||
|
||||
// If it's loud, prepare the ears!
|
||||
return "volume_up";
|
||||
}
|
||||
RowLayout {
|
||||
id: textRow
|
||||
spacing: 2
|
||||
anchors.centerIn: parent
|
||||
height: parent.height
|
||||
CustomText {
|
||||
id: volumeText
|
||||
PwObjectTracker {
|
||||
objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
|
||||
}
|
||||
text: Pipewire.ready ? Math.round(root.sink.audio.volume * 100) + "%" : "failure"
|
||||
opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0
|
||||
}
|
||||
CustomIcon {
|
||||
id: volumeIcon
|
||||
opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0
|
||||
text: Pipewire.ready ? root.getVolumeIcon() : null
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: pavuArea
|
||||
Process {
|
||||
id: pavuLauncher
|
||||
command: ["sh", "-c", "pavucontrol"]
|
||||
}
|
||||
anchors.fill: parent
|
||||
onClicked: pavuLauncher.exec(pavuLauncher.command)
|
||||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
@ -10,14 +10,14 @@ Rectangle {
|
||||
id: root
|
||||
color: Colors.surfaceContainer
|
||||
|
||||
implicitWidth: workspaceRow.implicitWidth + 20
|
||||
implicitWidth: workspaceRow.implicitWidth + 10
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
radius: Settings.config.barHeight / 2
|
||||
property var screen: screen
|
||||
Row {
|
||||
id: workspaceRow
|
||||
anchors.centerIn: parent
|
||||
spacing: 5 // Slightly increase spacing between workspace buttons
|
||||
spacing: 0 // Slightly increase spacing between workspace buttons
|
||||
|
||||
Repeater {
|
||||
id: wsRepeater
|
||||
@ -38,14 +38,22 @@ Rectangle {
|
||||
}
|
||||
|
||||
required property var modelData
|
||||
width: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
|
||||
height: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
|
||||
width: 20
|
||||
height: Settings.config.barHeight - 10
|
||||
color: "transparent"
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
|
||||
duration: 200
|
||||
easing.type: Easing.Linear
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
anchors.centerIn: workspaceNumber
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: parent.modelData.id
|
||||
color: Colors.onSurfaceColor
|
||||
opacity: workspaceNumber.modelData.focused ? 1 : 0.5
|
||||
}
|
||||
MouseArea {
|
||||
|
||||
91
modules/bar/functions.js
Normal file
91
modules/bar/functions.js
Normal file
@ -0,0 +1,91 @@
|
||||
function getIcon(device) {
|
||||
if (device.type === DeviceType.Wifi) {
|
||||
for (var i = 0; i < device.networks.values.length; i++) {
|
||||
var net = device.networks.values[i];
|
||||
if (net.connected) {
|
||||
if (net.signalStrength <= 0.20)
|
||||
return "\uf0b0";
|
||||
//signa_wifi_0_bar
|
||||
if (net.signalStrength <= 0.40)
|
||||
return "\uebe4";
|
||||
//network_wifi_1_bar
|
||||
if (net.signalStrength <= 0.60)
|
||||
return "\uebd6";
|
||||
//network_wifi_2_bar
|
||||
if (net.signalStrength <= 0.80)
|
||||
return "\uebe1";
|
||||
//network_wifi_3_bar
|
||||
if (net.signalStrength >= 0.80)
|
||||
return "\ue1d8";
|
||||
// signal_wifi_4_bar
|
||||
}
|
||||
}
|
||||
return "\ue1da";
|
||||
} else if (device.connected) {
|
||||
return "settings_ethernet";
|
||||
}
|
||||
return "\ue1da";
|
||||
// signal_wifi_off
|
||||
}
|
||||
|
||||
function getBatteryIcon(perc) {
|
||||
if (UPower.displayDevice.state == UPowerDeviceState.Charging) {
|
||||
return "battery_android_frame_bolt";
|
||||
}
|
||||
if (perc <= 0.16) {
|
||||
lowBat.running = true;
|
||||
return "battery_android_alert";
|
||||
}
|
||||
if (perc < 0.32) {
|
||||
return "battery_android_frame_2";
|
||||
}
|
||||
if (perc < 0.48) {
|
||||
return "battery_android_frame_3";
|
||||
}
|
||||
if (perc < 0.74) {
|
||||
return "battery_android_frame_4";
|
||||
}
|
||||
if (perc < 0.9) {
|
||||
return "battery_android_frame_5";
|
||||
}
|
||||
if (perc > 0.9) {
|
||||
return "battery_android_frame_full";
|
||||
}
|
||||
}
|
||||
|
||||
function getStatus(device) {
|
||||
if (device.type === DeviceType.Wifi) {
|
||||
for (var i = 0; i < device.networks.values.length; i++) {
|
||||
var net = device.networks.values[i];
|
||||
if (net.connected) {
|
||||
return net.name;
|
||||
}
|
||||
}
|
||||
return "Disconnected";
|
||||
}
|
||||
return device.connected ? "Connected" : "Disconnected";
|
||||
}
|
||||
// pipewire function
|
||||
function getVolumeIcon() {
|
||||
// Safety check: if Pipewire is dead or sink is missing
|
||||
if (!sink)
|
||||
return "volume_off";
|
||||
|
||||
// If muted, show the hush icon
|
||||
if (sink.audio.muted)
|
||||
return "volume_off";
|
||||
|
||||
// Volume is usually 0.0 to 1.0 (0% to 100%)
|
||||
const vol = sink.audio.volume;
|
||||
|
||||
if (vol <= 0.25)
|
||||
return "volume_mute";
|
||||
if (vol < 0.75)
|
||||
return "volume_down";
|
||||
if (vol <= 1.00)
|
||||
return "volume_up";
|
||||
|
||||
// If it's loud, prepare the ears!
|
||||
return "volume_up";
|
||||
}
|
||||
|
||||
@ -11,8 +11,10 @@ Rectangle {
|
||||
required property var modelData
|
||||
implicitWidth: ListView.view ? ListView.view.width : 300
|
||||
implicitHeight: fullLayout.implicitHeight + 20
|
||||
color: dismissArea.containsMouse ? Colors.surfaceContainer : Colors.surfaceContainerLowest
|
||||
color: dismissArea.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
||||
radius: 22
|
||||
border.width: 1
|
||||
border.color: Colors.outline
|
||||
Timer {
|
||||
id: dismissTimer
|
||||
interval: 5000
|
||||
|
||||
@ -24,7 +24,7 @@ Variants {
|
||||
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
fillMode: Image.Stretch
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: Settings.config.currentWall
|
||||
}
|
||||
ScreenCorners {}
|
||||
|
||||
@ -1,98 +0,0 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import QtQuick.Dialogs
|
||||
import Quickshell.Widgets
|
||||
import qs
|
||||
import qs.settings
|
||||
import qs.reusables
|
||||
|
||||
FloatingWindow {
|
||||
id: root
|
||||
visible: Settings.config.settingsShown
|
||||
onClosed: {
|
||||
Settings.config.settingsShown = false;
|
||||
}
|
||||
color: Colors.surface
|
||||
title: "qs-settings"
|
||||
implicitWidth: 800
|
||||
implicitHeight: 600
|
||||
ListModel {
|
||||
id: pageModel
|
||||
ListElement {
|
||||
text: "welcomePage"
|
||||
source: "WelcomePage.qml"
|
||||
}
|
||||
ListElement {
|
||||
text: "Appearance"
|
||||
source: "Appearance.qml"
|
||||
}
|
||||
ListElement {
|
||||
text: "Matugen"
|
||||
source: "Matugen.qml"
|
||||
}
|
||||
ListElement {
|
||||
text: "test"
|
||||
source: "WelcomePage.qml"
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: windowLayout
|
||||
clip: true
|
||||
anchors.fill: parent
|
||||
spacing: 10
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
id: pageWrapper
|
||||
Layout.margins: 20
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 200
|
||||
Layout.rightMargin: 0
|
||||
margin: 20
|
||||
color: Colors.surfaceContainerLow
|
||||
radius: 12
|
||||
ListView {
|
||||
id: pageView
|
||||
clip: true
|
||||
model: pageModel
|
||||
delegate: pageDelegate
|
||||
Component {
|
||||
id: pageDelegate
|
||||
Rectangle {
|
||||
radius: 24
|
||||
color: ListView.isCurrentItem ? Colors.surfaceContainerHigh : "transparent"
|
||||
implicitHeight: 30
|
||||
implicitWidth: pageWrapper.width - 50
|
||||
required property var modelData
|
||||
required property int index
|
||||
CustomText {
|
||||
id: delegateText
|
||||
leftPadding: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: parent.modelData.text
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
contentLoader.source = parent.modelData.source;
|
||||
pageView.currentIndex = parent.index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
id: contentLoader
|
||||
Layout.leftMargin: 0
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: 20
|
||||
source: pageModel.get(pageView.currentIndex).source
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,9 @@ ClippingWrapperRectangle {
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
clip: true
|
||||
color: Colors.surfaceContainerLow
|
||||
color: Colors.surfaceContainerHigh
|
||||
border.color: Colors.primary
|
||||
border.width: 1
|
||||
radius: 12
|
||||
margin: 20
|
||||
|
||||
@ -45,7 +47,7 @@ ClippingWrapperRectangle {
|
||||
bottomRightRadius: 4
|
||||
bottomLeftRadius: 4
|
||||
|
||||
color: Colors.surfaceContainerHigh
|
||||
color: Colors.primaryContainer
|
||||
implicitHeight: 30
|
||||
child: RowLayout {
|
||||
id: fontLayout
|
||||
@ -73,7 +75,7 @@ ClippingWrapperRectangle {
|
||||
bottomRightRadius: 4
|
||||
topRightRadius: 4
|
||||
topLeftRadius: 4
|
||||
color: Colors.surfaceContainerHigh
|
||||
color: Colors.primaryContainer
|
||||
child: RowLayout {
|
||||
id: floatingToggleLayout
|
||||
spacing: 40
|
||||
@ -102,7 +104,7 @@ ClippingWrapperRectangle {
|
||||
bottomRightRadius: 4
|
||||
topRightRadius: 4
|
||||
topLeftRadius: 4
|
||||
color: Colors.surfaceContainerHigh
|
||||
color: Colors.primaryContainer
|
||||
child: RowLayout {
|
||||
id: screenCornerLayout
|
||||
spacing: 40
|
||||
@ -131,7 +133,7 @@ ClippingWrapperRectangle {
|
||||
bottomRightRadius: 4
|
||||
topRightRadius: 4
|
||||
topLeftRadius: 4
|
||||
color: Colors.surfaceContainerHigh
|
||||
color: Colors.primaryContainer
|
||||
child: RowLayout {
|
||||
id: screenCornerRadiusLayout
|
||||
spacing: 5
|
||||
@ -174,7 +176,7 @@ ClippingWrapperRectangle {
|
||||
bottomRightRadius: 4
|
||||
topRightRadius: 4
|
||||
topLeftRadius: 4
|
||||
color: Colors.surfaceContainerHigh
|
||||
color: Colors.primaryContainer
|
||||
child: RowLayout {
|
||||
id: barControlsLayout
|
||||
spacing: 5
|
||||
@ -217,7 +219,7 @@ ClippingWrapperRectangle {
|
||||
bottomRightRadius: 4
|
||||
topRightRadius: 4
|
||||
topLeftRadius: 4
|
||||
color: Colors.surfaceContainerHigh
|
||||
color: Colors.primaryContainer
|
||||
child: RowLayout {
|
||||
id: barMarginLayout
|
||||
spacing: 5
|
||||
@ -257,7 +259,7 @@ ClippingWrapperRectangle {
|
||||
bottomRightRadius: 12
|
||||
topRightRadius: 4
|
||||
topLeftRadius: 4
|
||||
color: Colors.surfaceContainerHigh
|
||||
color: Colors.primaryContainer
|
||||
Layout.fillWidth: true
|
||||
RowLayout {
|
||||
id: translucencyLayout
|
||||
|
||||
@ -14,7 +14,7 @@ FloatingWindow {
|
||||
onClosed: {
|
||||
Settings.config.settingsShown = false;
|
||||
}
|
||||
color: Colors.surface
|
||||
color: Colors.surfaceContainer
|
||||
title: "qs-settings"
|
||||
implicitWidth: 800
|
||||
implicitHeight: 600
|
||||
@ -50,7 +50,7 @@ FloatingWindow {
|
||||
Layout.preferredWidth: 200
|
||||
Layout.rightMargin: 0
|
||||
margin: 20
|
||||
color: Colors.surfaceContainerLow
|
||||
color: Colors.surfaceContainer
|
||||
radius: 12
|
||||
ListView {
|
||||
id: pageView
|
||||
@ -61,7 +61,7 @@ FloatingWindow {
|
||||
id: pageDelegate
|
||||
Rectangle {
|
||||
radius: 24
|
||||
color: ListView.isCurrentItem ? Colors.surfaceContainerHigh : "transparent"
|
||||
color: ListView.isCurrentItem ? Colors.primaryContainer : "transparent"
|
||||
implicitHeight: 30
|
||||
implicitWidth: pageWrapper.width - 50
|
||||
required property var modelData
|
||||
|
||||
@ -8,7 +8,9 @@ ClippingWrapperRectangle {
|
||||
id: root
|
||||
anchors.centerIn: parent
|
||||
clip: true
|
||||
color: Colors.surfaceContainerLow
|
||||
color: Colors.surfaceContainerHigh
|
||||
border.width: 1
|
||||
border.color: Colors.primary
|
||||
radius: 12
|
||||
margin: 20
|
||||
ColumnLayout {
|
||||
|
||||
@ -23,7 +23,7 @@ FloatingWindow {
|
||||
}
|
||||
Process {
|
||||
id: wallustRunner
|
||||
property string cmd: "matugen image " + Settings.config.currentWall
|
||||
property string cmd: "matugen image " + Settings.config.currentWall + " --source-color-index 0"
|
||||
command: ["sh", "-c", cmd]
|
||||
}
|
||||
GlobalShortcut {
|
||||
|
||||
@ -15,9 +15,7 @@ Button {
|
||||
}
|
||||
background: Rectangle {
|
||||
id: contentBackground
|
||||
border.color: control.down ? Colors.primaryFixed : Colors.primary
|
||||
border.width: 1
|
||||
radius: parent.implicitHeight / 2
|
||||
color: Colors.surfaceContainerLow
|
||||
color: Colors.surfaceContainerHigh
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,11 +3,19 @@ import qs
|
||||
import qs.settings
|
||||
|
||||
Text {
|
||||
id: root
|
||||
color: Colors.onSurfaceColor
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pixelSize: 14
|
||||
font.variableAxes: ({
|
||||
GRAD: 200,
|
||||
wght: 400
|
||||
})
|
||||
property real iconSize: 16
|
||||
property real fill: 1
|
||||
renderType: Text.NativeRendering
|
||||
font {
|
||||
hintingPreference: Font.PreferNoHinting
|
||||
family: "Material Symbols Outlined"
|
||||
pixelSize: iconSize
|
||||
weight: Font.Normal + (Font.DemiBold - Font.Normal) * fill
|
||||
variableAxes: {
|
||||
"FILL": fill,
|
||||
"opsz": iconSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,6 @@ Slider {
|
||||
height: parent.height
|
||||
color: Colors.primary
|
||||
radius: 2
|
||||
border.color: Colors.outline
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +30,5 @@ Slider {
|
||||
implicitHeight: control.implicitHeight - 2
|
||||
radius: 13
|
||||
color: control.pressed ? Colors.primary : Colors.surfaceContainerLowest
|
||||
border.color: control.pressed ? Colors.surfaceContainerLowest : Colors.primary
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ Switch {
|
||||
implicitHeight: parent.implicitHeight
|
||||
radius: 26
|
||||
color: Colors.surfaceContainerLow
|
||||
border.color: control.checked ? Colors.primary : Colors.onSurfaceColor
|
||||
|
||||
Rectangle {
|
||||
implicitHeight: parent.implicitHeight - 6
|
||||
|
||||
@ -3,12 +3,8 @@ import qs
|
||||
import qs.settings
|
||||
|
||||
Text {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Colors.onSurfaceColor
|
||||
font.family: Settings.config.font
|
||||
font.pixelSize: Settings.config.fontSize
|
||||
font.variableAxes: ({
|
||||
GRAD: 200,
|
||||
wght: 400
|
||||
})
|
||||
font.weight: Settings.config.fontWeight
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import Quickshell.Io
|
||||
Singleton {
|
||||
id: root
|
||||
property alias config: settingsAdapter
|
||||
property alias currentWall: settingsAdapter.currentWall
|
||||
onConfigChanged: settingsView.writeAdapter()
|
||||
FileView {
|
||||
id: settingsView
|
||||
@ -32,7 +33,6 @@ Singleton {
|
||||
property double translucency: 1
|
||||
property bool blackScreenCorners: true
|
||||
property bool settingsShown: true
|
||||
property string schemeGenerator: "matugen"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user