Icons: Brightness and battery
This commit is contained in:
parent
404a1d3e8b
commit
ea6b8e0c02
18 changed files with 36 additions and 66 deletions
|
|
@ -39,7 +39,7 @@ Item {
|
||||||
// Test mode
|
// Test mode
|
||||||
readonly property bool testMode: false
|
readonly property bool testMode: false
|
||||||
readonly property int testPercent: 50
|
readonly property int testPercent: 50
|
||||||
readonly property bool testCharging: true
|
readonly property bool testCharging: false
|
||||||
|
|
||||||
// Main properties
|
// Main properties
|
||||||
readonly property var battery: UPower.displayDevice
|
readonly property var battery: UPower.displayDevice
|
||||||
|
|
@ -87,8 +87,7 @@ Item {
|
||||||
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
||||||
icon: testMode ? BatteryService.getIcon(testPercent, testCharging, true) : BatteryService.getIcon(percent,
|
icon: testMode ? BatteryService.getIcon(testPercent, testCharging, true) : BatteryService.getIcon(percent,
|
||||||
charging, isReady)
|
charging, isReady)
|
||||||
iconRotation: -90
|
text: (isReady || testMode) ? Math.round(percent) + "%" : "-"
|
||||||
text: ((isReady && battery.isLaptopBattery) || testMode) ? Math.round(percent) + "%" : "-"
|
|
||||||
textColor: charging ? Color.mPrimary : Color.mOnSurface
|
textColor: charging ? Color.mPrimary : Color.mOnSurface
|
||||||
iconCircleColor: Color.mPrimary
|
iconCircleColor: Color.mPrimary
|
||||||
collapsedIconColor: Color.mOnSurface
|
collapsedIconColor: Color.mOnSurface
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ Item {
|
||||||
function getIcon() {
|
function getIcon() {
|
||||||
var monitor = getMonitor()
|
var monitor = getMonitor()
|
||||||
var brightness = monitor ? monitor.brightness : 0
|
var brightness = monitor ? monitor.brightness : 0
|
||||||
return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness
|
return brightness <= 0.5 ? FontService.icons["brightness_low"] : FontService.icons["brightness_high"]
|
||||||
< 0.66 ? "brightness_medium" : "brightness_high"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connection used to open the pill when brightness changes
|
// Connection used to open the pill when brightness changes
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,7 @@ Loader {
|
||||||
width: 100 * scaling
|
width: 100 * scaling
|
||||||
height: 100 * scaling
|
height: 100 * scaling
|
||||||
imagePath: Settings.data.general.avatarImage
|
imagePath: Settings.data.general.avatarImage
|
||||||
fallbackIcon: "person"
|
fallbackIcon: FontService.icons["person"]
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ NBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "add"
|
icon: FontService.icons["add"]
|
||||||
|
|
||||||
colorBg: Color.mPrimary
|
colorBg: Color.mPrimary
|
||||||
colorFg: Color.mOnPrimary
|
colorFg: Color.mOnPrimary
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ Popup {
|
||||||
|
|
||||||
NButton {
|
NButton {
|
||||||
text: "Apply"
|
text: "Apply"
|
||||||
icon: "check"
|
icon: FontService.icons["check"]
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (settingsLoader.item && settingsLoader.item.saveSettings) {
|
if (settingsLoader.item && settingsLoader.item.saveSettings) {
|
||||||
var newSettings = settingsLoader.item.saveSettings()
|
var newSettings = settingsLoader.item.saveSettings()
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ ColumnLayout {
|
||||||
NToggle {
|
NToggle {
|
||||||
id: showMemoryAsPercent
|
id: showMemoryAsPercent
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
label: "Show memory as percentage"
|
label: "Memory as percentage"
|
||||||
checked: valueShowMemoryAsPercent
|
checked: valueShowMemoryAsPercent
|
||||||
onToggled: checked => valueShowMemoryAsPercent = checked
|
onToggled: checked => valueShowMemoryAsPercent = checked
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ NPanel {
|
||||||
}, {
|
}, {
|
||||||
"id": SettingsPanel.Tab.ColorScheme,
|
"id": SettingsPanel.Tab.ColorScheme,
|
||||||
"label": "Color Scheme",
|
"label": "Color Scheme",
|
||||||
"icon": "paint_bucket",
|
"icon": "paint_drop",
|
||||||
"source": colorSchemeTab
|
"source": colorSchemeTab
|
||||||
}, {
|
}, {
|
||||||
"id": SettingsPanel.Tab.Wallpaper,
|
"id": SettingsPanel.Tab.Wallpaper,
|
||||||
|
|
@ -190,7 +190,7 @@ NPanel {
|
||||||
}, {
|
}, {
|
||||||
"id": SettingsPanel.Tab.Hooks,
|
"id": SettingsPanel.Tab.Hooks,
|
||||||
"label": "Hooks",
|
"label": "Hooks",
|
||||||
"icon": "cable",
|
"icon": "link",
|
||||||
"source": hooksTab
|
"source": hooksTab
|
||||||
}, {
|
}, {
|
||||||
"id": SettingsPanel.Tab.About,
|
"id": SettingsPanel.Tab.About,
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ ColumnLayout {
|
||||||
imagePath: modelData.avatar_url || ""
|
imagePath: modelData.avatar_url || ""
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginXS * scaling
|
anchors.margins: Style.marginXS * scaling
|
||||||
fallbackIcon: "person"
|
fallbackIcon: FontService.icons["person"]
|
||||||
borderColor: contributorArea.containsMouse ? Color.mOnTertiary : Color.mPrimary
|
borderColor: contributorArea.containsMouse ? Color.mOnTertiary : Color.mPrimary
|
||||||
borderWidth: Math.max(1, Style.borderM * scaling)
|
borderWidth: Math.max(1, Style.borderM * scaling)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ ColumnLayout {
|
||||||
|
|
||||||
// Button aligned to the center of the actual input field
|
// Button aligned to the center of the actual input field
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "add"
|
icon: FontService.icons["add"]
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
Layout.bottomMargin: blacklistInput.description ? Style.marginS * scaling : 0
|
Layout.bottomMargin: blacklistInput.description ? Style.marginS * scaling : 0
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ ColumnLayout {
|
||||||
width: 108 * scaling
|
width: 108 * scaling
|
||||||
height: 108 * scaling
|
height: 108 * scaling
|
||||||
imagePath: Settings.data.general.avatarImage
|
imagePath: Settings.data.general.avatarImage
|
||||||
fallbackIcon: "person"
|
fallbackIcon: FontService.icons["person"]
|
||||||
borderColor: Color.mPrimary
|
borderColor: Color.mPrimary
|
||||||
borderWidth: Math.max(1, Style.borderM * scaling)
|
borderWidth: Math.max(1, Style.borderM * scaling)
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginXS * scaling
|
anchors.margins: Style.marginXS * scaling
|
||||||
imagePath: currentWallpaper
|
imagePath: currentWallpaper
|
||||||
fallbackIcon: "image"
|
fallbackIcon: FontService.icons["image"]
|
||||||
imageRadius: Style.radiusM * scaling
|
imageRadius: Style.radiusM * scaling
|
||||||
borderColor: Color.mSecondary
|
borderColor: Color.mSecondary
|
||||||
borderWidth: Style.borderL * 2 * scaling
|
borderWidth: Style.borderL * 2 * scaling
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ NBox {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginXS * scaling
|
anchors.margins: Style.marginXS * scaling
|
||||||
imagePath: MediaService.trackArtUrl
|
imagePath: MediaService.trackArtUrl
|
||||||
fallbackIcon: "music_note"
|
fallbackIcon: FontService.icons["vinyl"]
|
||||||
borderColor: Color.mOutline
|
borderColor: Color.mOutline
|
||||||
borderWidth: Math.max(1, Style.borderS * scaling)
|
borderWidth: Math.max(1, Style.borderS * scaling)
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +307,7 @@ NBox {
|
||||||
|
|
||||||
// Previous button
|
// Previous button
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "skip_previous"
|
icon: FontService.icons["previous"]
|
||||||
tooltipText: "Previous Media"
|
tooltipText: "Previous Media"
|
||||||
visible: MediaService.canGoPrevious
|
visible: MediaService.canGoPrevious
|
||||||
onClicked: MediaService.canGoPrevious ? MediaService.previous() : {}
|
onClicked: MediaService.canGoPrevious ? MediaService.previous() : {}
|
||||||
|
|
@ -323,7 +323,7 @@ NBox {
|
||||||
|
|
||||||
// Next button
|
// Next button
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "skip_next"
|
icon: FontService.icons["next"]
|
||||||
tooltipText: "Next media"
|
tooltipText: "Next media"
|
||||||
visible: MediaService.canGoNext
|
visible: MediaService.canGoNext
|
||||||
onClicked: MediaService.canGoNext ? MediaService.next() : {}
|
onClicked: MediaService.canGoNext ? MediaService.next() : {}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ NBox {
|
||||||
width: Style.baseWidgetSize * 1.25 * scaling
|
width: Style.baseWidgetSize * 1.25 * scaling
|
||||||
height: Style.baseWidgetSize * 1.25 * scaling
|
height: Style.baseWidgetSize * 1.25 * scaling
|
||||||
imagePath: Settings.data.general.avatarImage
|
imagePath: Settings.data.general.avatarImage
|
||||||
fallbackIcon: "person"
|
fallbackIcon: FontService.icons["person"]
|
||||||
borderColor: Color.mPrimary
|
borderColor: Color.mPrimary
|
||||||
borderWidth: Math.max(1, Style.borderM * scaling)
|
borderWidth: Math.max(1, Style.borderM * scaling)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ pragma Singleton
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.UPower
|
import Quickshell.Services.UPower
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -9,41 +10,18 @@ Singleton {
|
||||||
// Choose icon based on charge and charging state
|
// Choose icon based on charge and charging state
|
||||||
function getIcon(percent, charging, isReady) {
|
function getIcon(percent, charging, isReady) {
|
||||||
if (!isReady) {
|
if (!isReady) {
|
||||||
return "battery_error"
|
return FontService.icons["battery_empty"] // FIXME: find battery error ?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (charging) {
|
if (charging) {
|
||||||
if (percent >= 95)
|
return FontService.icons["battery_charging"]
|
||||||
return "battery_full"
|
|
||||||
if (percent >= 85)
|
|
||||||
return "battery_charging_90"
|
|
||||||
if (percent >= 65)
|
|
||||||
return "battery_charging_80"
|
|
||||||
if (percent >= 55)
|
|
||||||
return "battery_charging_60"
|
|
||||||
if (percent >= 45)
|
|
||||||
return "battery_charging_50"
|
|
||||||
if (percent >= 25)
|
|
||||||
return "battery_charging_30"
|
|
||||||
if (percent >= 0)
|
|
||||||
return "battery_charging_20"
|
|
||||||
} else {
|
} else {
|
||||||
if (percent >= 95)
|
|
||||||
return "battery_full"
|
|
||||||
if (percent >= 85)
|
if (percent >= 85)
|
||||||
return "battery_6_bar"
|
return FontService.icons["battery_full"]
|
||||||
if (percent >= 70)
|
|
||||||
return "battery_5_bar"
|
|
||||||
if (percent >= 55)
|
|
||||||
return "battery_4_bar"
|
|
||||||
if (percent >= 40)
|
|
||||||
return "battery_3_bar"
|
|
||||||
if (percent >= 25)
|
if (percent >= 25)
|
||||||
return "battery_2_bar"
|
return FontService.icons["battery_low"]
|
||||||
if (percent >= 10)
|
|
||||||
return "battery_1_bar"
|
|
||||||
if (percent >= 0)
|
if (percent >= 0)
|
||||||
return "battery_0_bar"
|
return FontService.icons["battery_empty"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,14 @@ Singleton {
|
||||||
"volume_off": "\uF026",
|
"volume_off": "\uF026",
|
||||||
"volume_half": "\uF027",
|
"volume_half": "\uF027",
|
||||||
"volume_full": "\uF028",
|
"volume_full": "\uF028",
|
||||||
|
"brightness_low": "\uF1CF",
|
||||||
|
"brightness_high": "\uF1CD",
|
||||||
"power": "\uf011",
|
"power": "\uf011",
|
||||||
"gear": "\ue615",
|
"gear": "\ue615",
|
||||||
"close": "\uf00D",
|
"close": "\uf00D",
|
||||||
"check": "\uf00C",
|
"check": "\uf00C",
|
||||||
"panel": "\uF28C",
|
"panel": "\uF28C",
|
||||||
"memory": "\uF2D6",
|
"memory": "\uF2D6",
|
||||||
|
|
||||||
"trash": "\uF014",
|
"trash": "\uF014",
|
||||||
"image": "\uF03E",
|
"image": "\uF03E",
|
||||||
"refresh": "\uF021",
|
"refresh": "\uF021",
|
||||||
|
|
@ -57,17 +58,22 @@ Singleton {
|
||||||
"stop": "\uEFFB",
|
"stop": "\uEFFB",
|
||||||
"next": "\uF051",
|
"next": "\uF051",
|
||||||
"prev": "\uF048",
|
"prev": "\uF048",
|
||||||
"paint_drop": "\uF043",
|
"paint_drop": "\uF30C",
|
||||||
"lightning": "\uF0E7",
|
"lightning": "\uF0E7",
|
||||||
"brightness": "\uF0A3",
|
"brightness": "\uF0A3",
|
||||||
"arrow_drop_down": "\uF0D7",
|
"arrow_drop_down": "\uF0D7",
|
||||||
|
"warning": "\uF334",
|
||||||
|
"info": "\uF26A",
|
||||||
|
"upload": "\uF01B",
|
||||||
|
"download": "\uF01A",
|
||||||
"vinyl": "\uEFBD",
|
"vinyl": "\uEFBD",
|
||||||
|
"link": "\uF0C1",
|
||||||
|
"add": "\uF055", // FIXME UGLY
|
||||||
"bell": "\uF189",
|
"bell": "\uF189",
|
||||||
"bell_striked": "\uEE15", // FIXME
|
"bell_striked": "\uEE15", // FIXME
|
||||||
"drive": "\uEE15", // FIXME
|
"drive": "\uEE15", // FIXME
|
||||||
"upload": "\uEE15", // FIXME
|
"person": "\uEE15", // FIXME
|
||||||
"download": "\uEE15", // FIXME
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -502,7 +502,7 @@ Popup {
|
||||||
|
|
||||||
NButton {
|
NButton {
|
||||||
text: "Apply"
|
text: "Apply"
|
||||||
icon: "check"
|
icon: FontService.icons["check"]
|
||||||
customHeight: 36 * scaling
|
customHeight: 36 * scaling
|
||||||
customWidth: 100 * scaling
|
customWidth: 100 * scaling
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ Item {
|
||||||
property color iconTextColor: Color.mSurface
|
property color iconTextColor: Color.mSurface
|
||||||
property color collapsedIconColor: Color.mOnSurface
|
property color collapsedIconColor: Color.mOnSurface
|
||||||
|
|
||||||
property real iconRotation: 0
|
|
||||||
property real sizeRatio: 0.8
|
property real sizeRatio: 0.8
|
||||||
property bool autoHide: false
|
property bool autoHide: false
|
||||||
property bool forceOpen: false
|
property bool forceOpen: false
|
||||||
|
|
@ -119,7 +118,6 @@ Item {
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
text: root.icon
|
text: root.icon
|
||||||
rotation: root.iconRotation
|
|
||||||
font.pointSize: Style.fontSizeM * scaling
|
font.pointSize: Style.fontSizeM * scaling
|
||||||
// When forced shown, use pill text color; otherwise accent color when hovered
|
// When forced shown, use pill text color; otherwise accent color when hovered
|
||||||
color: forceOpen ? textColor : (showPill ? iconTextColor : Color.mOnSurface)
|
color: forceOpen ? textColor : (showPill ? iconTextColor : Color.mOnSurface)
|
||||||
|
|
|
||||||
|
|
@ -118,17 +118,7 @@ Item {
|
||||||
// Icon
|
// Icon
|
||||||
NIcon {
|
NIcon {
|
||||||
id: icon
|
id: icon
|
||||||
text: {
|
text: (root.type == "warning") ? FontService.icons["warning"] : FontService.icons["info"]
|
||||||
switch (root.type) {
|
|
||||||
case "warning":
|
|
||||||
return "warning"
|
|
||||||
case "notice":
|
|
||||||
return "info"
|
|
||||||
default:
|
|
||||||
return "info"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
color: {
|
color: {
|
||||||
switch (root.type) {
|
switch (root.type) {
|
||||||
case "warning":
|
case "warning":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue