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