switch back to svg icons
This commit is contained in:
parent
0a80d099bc
commit
be45e63c77
@ -4,6 +4,8 @@ import QtQuick
|
||||
import "../../"
|
||||
import "../settings/"
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@ -11,35 +13,6 @@ Item {
|
||||
implicitWidth: masterLayout.implicitWidth
|
||||
height: 34
|
||||
property bool isCharging: UPower.displayDevice.state === UPowerDeviceState.Charging
|
||||
function getBatteryIcon() {
|
||||
if (isCharging) {
|
||||
return "battery_android_frame_bolt";
|
||||
}
|
||||
if (UPower.displayDevice.percentage < 0.12) {
|
||||
return "battery_android_frame_0";
|
||||
}
|
||||
if (UPower.displayDevice.percentage < 0.24) {
|
||||
return "battery_android_frame_1";
|
||||
}
|
||||
if (UPower.displayDevice.percentage < 0.36) {
|
||||
return "battery_android_frame_2";
|
||||
}
|
||||
if (UPower.displayDevice.percentage < 0.48) {
|
||||
return "battery_android_frame_3";
|
||||
}
|
||||
if (UPower.displayDevice.percentage < 0.60) {
|
||||
return "battery_android_frame_4";
|
||||
}
|
||||
if (UPower.displayDevice.percentage < 0.72) {
|
||||
return "battery_android_frame_5";
|
||||
}
|
||||
if (UPower.displayDevice.percentage < 0.84) {
|
||||
return "battery_android_frame_6";
|
||||
}
|
||||
if (UPower.displayDevice.percentage > 0.84) {
|
||||
return "battery_android_full";
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
id: masterLayout
|
||||
implicitWidth: botText.width
|
||||
@ -54,8 +27,10 @@ Item {
|
||||
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
|
||||
color: Colors.foreground
|
||||
}
|
||||
Icons {
|
||||
text: root.getBatteryIcon()
|
||||
IconImage {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
implicitSize: 12
|
||||
source: Quickshell.iconPath(UPower.displayDevice.iconName)
|
||||
}
|
||||
}
|
||||
Text {
|
||||
|
||||
@ -2,6 +2,7 @@ import QtQuick
|
||||
import Quickshell.Services.Pipewire
|
||||
import Quickshell.Widgets
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import "../../"
|
||||
import "../settings/"
|
||||
@ -25,28 +26,29 @@ Item {
|
||||
command: ["pavucontrol"] // The command and args list
|
||||
|
||||
}
|
||||
|
||||
// Logic to pick the correct icon name
|
||||
function getVolumeIcon() {
|
||||
// Safety check: if Pipewire is dead or sink is missing
|
||||
if (!sink)
|
||||
return "volume_off";
|
||||
return "audio-volume-muted-symbolic";
|
||||
|
||||
// If muted, show the hush icon
|
||||
if (sink.audio.muted)
|
||||
return "volume_off";
|
||||
return "audio-volume-muted-symbolic";
|
||||
|
||||
// Volume is usually 0.0 to 1.0 (0% to 100%)
|
||||
const vol = sink.audio.volume;
|
||||
|
||||
if (vol <= 0.25)
|
||||
return "volume_mute";
|
||||
return "audio-volume-low-symbolic";
|
||||
if (vol < 0.75)
|
||||
return "volume_down";
|
||||
if (vol < 1.00)
|
||||
return "volume_up";
|
||||
return "audio-volume-medium-symbolic";
|
||||
if (vol <= 1.00)
|
||||
return "audio-volume-high-symbolic";
|
||||
|
||||
// If it's loud, prepare the ears!
|
||||
return "volume_up";
|
||||
return "audio-volume-high-danger-symbolic";
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
@ -55,10 +57,13 @@ Item {
|
||||
spacing: 0
|
||||
implicitWidth: botText.width
|
||||
Row {
|
||||
spacing: 2
|
||||
|
||||
spacing: 5
|
||||
Text {
|
||||
id: topText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
PwObjectTracker {
|
||||
|
||||
objects: Pipewire.ready ? root.sink : []
|
||||
}
|
||||
font.weight: 900
|
||||
@ -66,10 +71,13 @@ Item {
|
||||
font.family: Settings.font
|
||||
font.pixelSize: Settings.fontSize
|
||||
text: Pipewire.ready ? root.sink.audio.volume.toFixed(2) + "%" : "0%"
|
||||
onTextChanged: console.log(Quickshell.iconPath)
|
||||
}
|
||||
Icons {
|
||||
IconImage {
|
||||
id: icon
|
||||
text: root.getVolumeIcon()
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
implicitSize: 12
|
||||
source: Quickshell.iconPath(root.getVolumeIcon())
|
||||
}
|
||||
}
|
||||
Text {
|
||||
|
||||
@ -9,6 +9,14 @@ Singleton {
|
||||
property alias font: jsonAdapter.font
|
||||
property alias fontSize: jsonAdapter.fontSize
|
||||
property alias wallDir: jsonAdapter.wallDir
|
||||
onCurrentWallChanged: settingsView.writeAdapter()
|
||||
onWallDirChanged: settingsView.writeAdapter()
|
||||
onFontChanged: {
|
||||
Quickshell.reload();
|
||||
settingsView.writeAdapter();
|
||||
}
|
||||
onFontSizeChanged: settingsView.writeAdapter()
|
||||
|
||||
FileView {
|
||||
id: settingsView
|
||||
path: "/home/lucy/.config/quickshell/modules/settings/config.json"
|
||||
@ -21,12 +29,8 @@ Singleton {
|
||||
id: jsonAdapter
|
||||
property string currentWall: ""
|
||||
property string wallDir: "/home/lucy/.walls/"
|
||||
property string font: "MonaSpiceXe Nerd Font Propo"
|
||||
property real fontSize: 13
|
||||
property string font: "Google Sans"
|
||||
property real fontSize: 14
|
||||
}
|
||||
}
|
||||
onCurrentWallChanged: settingsView.writeAdapter()
|
||||
onWallDirChanged: settingsView.writeAdapter()
|
||||
onFontChanged: settingsView.writeAdapter()
|
||||
onFontSizeChanged: settingsView.writeAdapter()
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"currentWall": "file:///home/lucy/.walls/gentoo-abducted-1680x1050.png",
|
||||
"font": "MonaSpiceXe Nerd Font Propo",
|
||||
"currentWall": "file:///home/lucy/.walls/ayanami.png",
|
||||
"font": "SFMono Nerd Font Propo",
|
||||
"fontSize": 13,
|
||||
"wallDir": "/home/lucy/.walls/"
|
||||
}
|
||||
|
||||
@ -8,9 +8,9 @@ import "."
|
||||
WlrLayershell {
|
||||
id: overlayRoot
|
||||
required property var modelData
|
||||
property var padding: 2
|
||||
property var rounding: 15
|
||||
property var hyprgaps: 15
|
||||
property var padding: 0
|
||||
property var rounding: 25
|
||||
property var hyprgaps: 20
|
||||
onPaddingChanged: {
|
||||
hyprGaps.exec(hyprGaps.command);
|
||||
console.log(hyprGaps.command);
|
||||
@ -20,15 +20,15 @@ WlrLayershell {
|
||||
id: hyprGaps
|
||||
running: true
|
||||
property bool isZero: overlayRoot.padding === 0
|
||||
property var top: isZero ? 10 : overlayRoot.padding * 2 + overlayRoot.hyprgaps
|
||||
property var sides: overlayRoot.padding + overlayRoot.hyprgaps
|
||||
property var top: overlayRoot.hyprgaps
|
||||
property var sides: isZero ? overlayRoot.hyprgaps : overlayRoot.padding + overlayRoot.hyprgaps
|
||||
property var gaps: top + "," + sides + "," + sides + "," + sides
|
||||
command: ["hyprctl", "keyword", "general:gaps_out", gaps]
|
||||
onStarted: console.log("set gaps to ", gaps)
|
||||
}
|
||||
Process {
|
||||
id: hyprRounding
|
||||
property var rounding: overlayRoot.rounding - 5
|
||||
property var rounding: overlayRoot.rounding
|
||||
running: true
|
||||
command: ["hyprctl", "keyword", "decoration:rounding", rounding]
|
||||
onStarted: console.log("set rounding to ", overlayRoot.rounding)
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
//@ pragma UseQApplication
|
||||
pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import "./modules/bar/"
|
||||
import "./modules/wallpaper/"
|
||||
import "./modules/notifications/"
|
||||
|
||||
ShellRoot {
|
||||
id: shellRoot
|
||||
|
||||
Variants {
|
||||
id: barVariants
|
||||
model: Quickshell.screens
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user