forked from Shinonome/dots-hyprland
hefty: bar: make battery vertical-compatible
This commit is contained in:
@@ -3,5 +3,5 @@ import QtQuick
|
|||||||
|
|
||||||
FadeLoader {
|
FadeLoader {
|
||||||
id: root
|
id: root
|
||||||
onActiveChanged: item.shown = true
|
onActiveChanged: if (active) item.shown = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,20 +27,11 @@ HBarWidgetWithPopout {
|
|||||||
contentImplicitWidth: activeItem.implicitWidth
|
contentImplicitWidth: activeItem.implicitWidth
|
||||||
contentImplicitHeight: activeItem.implicitHeight
|
contentImplicitHeight: activeItem.implicitHeight
|
||||||
onClicked: root.showPopup = !root.showPopup
|
onClicked: root.showPopup = !root.showPopup
|
||||||
property var activeItem: vertical ? verticalContent : horizontalContent
|
property var activeItem: sysInfoContent
|
||||||
|
|
||||||
Loader {
|
SysInfoContent {
|
||||||
id: horizontalContent
|
id: sysInfoContent
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: !contentRoot.vertical
|
|
||||||
sourceComponent: HorizontalSysInfo {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: verticalContent
|
|
||||||
anchors.fill: parent
|
|
||||||
active: contentRoot.vertical
|
|
||||||
sourceComponent: HorizontalSysInfo {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SysInfoPopupContent {
|
SysInfoPopupContent {
|
||||||
@@ -56,23 +47,40 @@ HBarWidgetWithPopout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component HorizontalSysInfo: Item {
|
component SysInfoContent: Item {
|
||||||
implicitWidth: row.implicitWidth + row.anchors.leftMargin + row.anchors.rightMargin
|
implicitWidth: contentGrid.implicitWidth + contentGrid.anchors.leftMargin + contentGrid.anchors.rightMargin
|
||||||
implicitHeight: row.implicitHeight + row.anchors.topMargin + row.anchors.bottomMargin
|
implicitHeight: contentGrid.implicitHeight + contentGrid.anchors.topMargin + contentGrid.anchors.bottomMargin
|
||||||
|
|
||||||
RowLayout {
|
GridLayout {
|
||||||
id: row
|
id: contentGrid
|
||||||
|
columns: root.vertical ? 1 : -1
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: root.startSide ? 8 : 6
|
|
||||||
anchors.rightMargin: root.endSide ? 0 : -3
|
|
||||||
|
|
||||||
Battery {}
|
Battery {
|
||||||
|
Layout.leftMargin: !root.vertical ? (root.startSide ? 8 : 6) : 0
|
||||||
|
Layout.rightMargin: !root.vertical ? (root.endSide ? 0 : -3) : 0
|
||||||
|
Layout.bottomMargin: root.vertical ? (root.endSide ? 4 : 2) : 0
|
||||||
|
Layout.topMargin: root.vertical ? 2 : 0
|
||||||
|
Layout.fillWidth: root.vertical
|
||||||
|
Layout.fillHeight: !root.vertical
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component Battery: Row {
|
component Battery: Item {
|
||||||
spacing: 1.5
|
implicitWidth: !root.vertical ? battShape.implicitWidth : battShape.implicitHeight
|
||||||
|
implicitHeight: !root.vertical ? battShape.implicitHeight : battShape.implicitWidth
|
||||||
|
|
||||||
|
BatteryShape {
|
||||||
|
id: battShape
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component BatteryShape: Row {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
spacing: 1.5
|
||||||
|
rotation: -90 * root.vertical
|
||||||
|
|
||||||
W.ClippedProgressBar {
|
W.ClippedProgressBar {
|
||||||
id: batteryProgress
|
id: batteryProgress
|
||||||
@@ -89,6 +97,7 @@ HBarWidgetWithPopout {
|
|||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
width: batteryProgress.valueBarWidth
|
width: batteryProgress.valueBarWidth
|
||||||
height: batteryProgress.valueBarHeight
|
height: batteryProgress.valueBarHeight
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
@@ -102,6 +111,7 @@ HBarWidgetWithPopout {
|
|||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.leftMargin: -2
|
Layout.leftMargin: -2
|
||||||
Layout.rightMargin: -2
|
Layout.rightMargin: -2
|
||||||
|
rotation: 90 * root.vertical
|
||||||
fill: 1 * (text == "bolt")
|
fill: 1 * (text == "bolt")
|
||||||
fillAnimation: null
|
fillAnimation: null
|
||||||
text: {
|
text: {
|
||||||
@@ -116,7 +126,9 @@ HBarWidgetWithPopout {
|
|||||||
visible: root.chargingAndNotFull || root.powerSaving
|
visible: root.chargingAndNotFull || root.powerSaving
|
||||||
}
|
}
|
||||||
W.VisuallyCenteredStyledText {
|
W.VisuallyCenteredStyledText {
|
||||||
|
visible: batteryProgress.value < 1
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
rotation: 90 * root.vertical
|
||||||
font: batteryProgress.font
|
font: batteryProgress.font
|
||||||
text: batteryProgress.text
|
text: batteryProgress.text
|
||||||
}
|
}
|
||||||
@@ -152,7 +164,7 @@ HBarWidgetWithPopout {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
W.CircularProgress {
|
W.CircularProgress {
|
||||||
implicitSize: notSoImportantBatteryStats.implicitHeight
|
implicitSize: Math.max(notSoImportantBatteryStats.implicitHeight, 44)
|
||||||
lineWidth: 3
|
lineWidth: 3
|
||||||
value: S.Battery.percentage
|
value: S.Battery.percentage
|
||||||
W.MaterialSymbol {
|
W.MaterialSymbol {
|
||||||
|
|||||||
@@ -604,5 +604,186 @@
|
|||||||
"Recognize music": "Recognize music",
|
"Recognize music": "Recognize music",
|
||||||
"Stroke width": "Stroke width",
|
"Stroke width": "Stroke width",
|
||||||
"Use varying shapes for password characters": "Use varying shapes for password characters",
|
"Use varying shapes for password characters": "Use varying shapes for password characters",
|
||||||
"Battery full": "Battery full"
|
"Battery full": "Battery full",
|
||||||
|
"Fonts": "Fonts",
|
||||||
|
"Desktop %1": "Desktop %1",
|
||||||
|
"Balance brightness based on content": "Balance brightness based on content",
|
||||||
|
"Polkit": "Polkit",
|
||||||
|
"Online | Google's model\nPro-level intelligence at the speed and pricing of Flash.": "Online | Google's model\nPro-level intelligence at the speed and pricing of Flash.",
|
||||||
|
"Widget: Weather": "Widget: Weather",
|
||||||
|
"Used for headings and titles": "Used for headings and titles",
|
||||||
|
"Shut down": "Shut down",
|
||||||
|
"Wi-Fi": "Wi-Fi",
|
||||||
|
"Used for reading large blocks of text": "Used for reading large blocks of text",
|
||||||
|
"Off": "Off",
|
||||||
|
"Enable update checks": "Enable update checks",
|
||||||
|
"Font weight": "Font weight",
|
||||||
|
"Show only when locked": "Show only when locked",
|
||||||
|
"Command": "Command",
|
||||||
|
"Numbers font": "Numbers font",
|
||||||
|
"Use adaptive alignment": "Use adaptive alignment",
|
||||||
|
"Task View": "Task View",
|
||||||
|
"%1 mins": "%1 mins",
|
||||||
|
"Copy region (LMB) or annotate (RMB)": "Copy region (LMB) or annotate (RMB)",
|
||||||
|
"Media": "Media",
|
||||||
|
"No new notifications": "No new notifications",
|
||||||
|
"Enable opening zoom animation": "Enable opening zoom animation",
|
||||||
|
"Font family": "Font family",
|
||||||
|
"Window": "Window",
|
||||||
|
"Move to front": "Move to front",
|
||||||
|
"Health:": "Health:",
|
||||||
|
"Manage accounts": "Manage accounts",
|
||||||
|
"Sound effects": "Sound effects",
|
||||||
|
"Video Recording Path": "Video Recording Path",
|
||||||
|
"Last refresh: %1": "Last refresh: %1",
|
||||||
|
"Move left": "Move left",
|
||||||
|
"Check interval (mins)": "Check interval (mins)",
|
||||||
|
"Apps": "Apps",
|
||||||
|
"Open": "Open",
|
||||||
|
"Main font": "Main font",
|
||||||
|
"Show hidden icons": "Show hidden icons",
|
||||||
|
"Pin to Start": "Pin to Start",
|
||||||
|
"Snip": "Snip",
|
||||||
|
"Digital": "Digital",
|
||||||
|
"Monospace font": "Monospace font",
|
||||||
|
"Aligns the date and quote to left, center or right depending on its position on the screen.": "Aligns the date and quote to left, center or right depending on its position on the screen.",
|
||||||
|
"Adjust the color temperature": "Adjust the color temperature",
|
||||||
|
"Quick markup (Ctrl+E)": "Quick markup (Ctrl+E)",
|
||||||
|
"Least busy": "Least busy",
|
||||||
|
"Right to left": "Right to left",
|
||||||
|
"More Internet settings": "More Internet settings",
|
||||||
|
"Reading font": "Reading font",
|
||||||
|
"Text extractor": "Text extractor",
|
||||||
|
"Used for code and terminal": "Used for code and terminal",
|
||||||
|
"Restart": "Restart",
|
||||||
|
"Font family name (e.g., Google Sans Flex)": "Font family name (e.g., Google Sans Flex)",
|
||||||
|
"Recognize text": "Recognize text",
|
||||||
|
"Not secured": "Not secured",
|
||||||
|
"Get the latest features and security improvements with\nthe newest feature update.\n\n%1 packages": "Get the latest features and security improvements with\nthe newest feature update.\n\n%1 packages",
|
||||||
|
"Image source": "Image source",
|
||||||
|
"Close (Esc)": "Close (Esc)",
|
||||||
|
"Cookie": "Cookie",
|
||||||
|
"Do you want to allow this app to make changes to your device?": "Do you want to allow this app to make changes to your device?",
|
||||||
|
"Discharging": "Discharging",
|
||||||
|
"+%1 notifications": "+%1 notifications",
|
||||||
|
"Command-line-invoked Action": "Command-line-invoked Action",
|
||||||
|
"Saving...": "Saving...",
|
||||||
|
"Font family name (e.g., Readex Pro)": "Font family name (e.g., Readex Pro)",
|
||||||
|
"Productivity": "Productivity",
|
||||||
|
"Font width and roundness settings are only available for some fonts like Google Sans Flex": "Font width and roundness settings are only available for some fonts like Google Sans Flex",
|
||||||
|
"Anti-flashbang": "Anti-flashbang",
|
||||||
|
"Overlay: General": "Overlay: General",
|
||||||
|
"%1\nInternet access": "%1\nInternet access",
|
||||||
|
"Font family name": "Font family name",
|
||||||
|
"Font roundness": "Font roundness",
|
||||||
|
"On": "On",
|
||||||
|
"Clear all": "Clear all",
|
||||||
|
"More Bluetooth settings": "More Bluetooth settings",
|
||||||
|
"Widgets": "Widgets",
|
||||||
|
"New desktop": "New desktop",
|
||||||
|
"Clock style (locked)": "Clock style (locked)",
|
||||||
|
"Swap": "Swap",
|
||||||
|
"Focusing": "Focusing",
|
||||||
|
"There might be a download in progress. Check your Downloads folder.": "There might be a download in progress. Check your Downloads folder.",
|
||||||
|
"Speakers (%1): %2": "Speakers (%1): %2",
|
||||||
|
"Creativity": "Creativity",
|
||||||
|
"remaining": "remaining",
|
||||||
|
"Show this window on all desktops": "Show this window on all desktops",
|
||||||
|
"Actions": "Actions",
|
||||||
|
"Enjoy your empty sidebar...": "Enjoy your empty sidebar...",
|
||||||
|
"Utilities & Tools": "Utilities & Tools",
|
||||||
|
"Super key symbol": "Super key symbol",
|
||||||
|
"Snipping area": "Snipping area",
|
||||||
|
"Battery: %1%2": "Battery: %1%2",
|
||||||
|
"All": "All",
|
||||||
|
"Expressive font": "Expressive font",
|
||||||
|
"System updates (Arch only)": "System updates (Arch only)",
|
||||||
|
"Darken screen": "Darken screen",
|
||||||
|
"Font family name (e.g., JetBrains Mono NF)": "Font family name (e.g., JetBrains Mono NF)",
|
||||||
|
"Description font size": "Description font size",
|
||||||
|
"Web": "Web",
|
||||||
|
"Show date": "Show date",
|
||||||
|
"Search for apps": "Search for apps",
|
||||||
|
"e.g. for F1, for F12": "e.g. for F1, for F12",
|
||||||
|
"Save paths": "Save paths",
|
||||||
|
"Used for general UI text": "Used for general UI text",
|
||||||
|
"Notes": "Notes",
|
||||||
|
"CPU": "CPU",
|
||||||
|
"Not connected": "Not connected",
|
||||||
|
"Write something here...\nUse '-' to create copyable bullet points, like this:\n\nSheep fricker\n- 4x Slab\n- 1x Boat\n- 4x Redstone Dust\n- 1x Sticky Piston\n- 1x End Rod\n- 4x Redstone Repeater\n- 1x Redstone Torch\n- 1x Sheep": "Write something here...\nUse '-' to create copyable bullet points, like this:\n\nSheep fricker\n- 4x Slab\n- 1x Boat\n- 4x Redstone Dust\n- 1x Sticky Piston\n- 1x End Rod\n- 4x Redstone Repeater\n- 1x Redstone Torch\n- 1x Sheep",
|
||||||
|
"Close all windows": "Close all windows",
|
||||||
|
"Search with Google Lens": "Search with Google Lens",
|
||||||
|
"Draggable": "Draggable",
|
||||||
|
"Screenshot Path (leave empty to just copy)": "Screenshot Path (leave empty to just copy)",
|
||||||
|
"Move right": "Move right",
|
||||||
|
"Local account": "Local account",
|
||||||
|
"Record region": "Record region",
|
||||||
|
"Display modifiers and keys in multiple keycap (e.g., \"Ctrl + A\" instead of \"Ctrl A\" or \" + A\" instead of \" A\")": "Display modifiers and keys in multiple keycap (e.g., \"Ctrl + A\" instead of \"Ctrl A\" or \" + A\" instead of \" A\")",
|
||||||
|
"Use symbols for mouse": "Use symbols for mouse",
|
||||||
|
"See fewer": "See fewer",
|
||||||
|
"More comfortable viewing at night": "More comfortable viewing at night",
|
||||||
|
"Best match": "Best match",
|
||||||
|
"Parallax": "Parallax",
|
||||||
|
"Enter a valid number": "Enter a valid number",
|
||||||
|
"Other": "Other",
|
||||||
|
"No applications": "No applications",
|
||||||
|
"Overlay: Crosshair": "Overlay: Crosshair",
|
||||||
|
"Center icons": "Center icons",
|
||||||
|
"Pinned": "Pinned",
|
||||||
|
"Use symbols for function keys": "Use symbols for function keys",
|
||||||
|
"Pin to taskbar": "Pin to taskbar",
|
||||||
|
"Click to show": "Click to show",
|
||||||
|
"Widget: Clock": "Widget: Clock",
|
||||||
|
"File Explorer": "File Explorer",
|
||||||
|
"Sound output": "Sound output",
|
||||||
|
"to full": "to full",
|
||||||
|
"Font width": "Font width",
|
||||||
|
"Commands": "Commands",
|
||||||
|
"Emoji": "Emoji",
|
||||||
|
"Use macOS-like symbols for mods keys": "Use macOS-like symbols for mods keys",
|
||||||
|
"Nerd font icons": "Nerd font icons",
|
||||||
|
"Charging": "Charging",
|
||||||
|
"Tooltips": "Tooltips",
|
||||||
|
"Most busy": "Most busy",
|
||||||
|
"Manage my account": "Manage my account",
|
||||||
|
"Sign out": "Sign out",
|
||||||
|
"Change password": "Change password",
|
||||||
|
"Image search": "Image search",
|
||||||
|
"Replace for \"Scroll ↓\", \"Scroll ↑\", L \"LMB\", R \"RMB\", \"Scroll ↑/↓\" and ⇞/⇟ for \"Page_↑/↓\"": "Replace for \"Scroll ↓\", \"Scroll ↑\", L \"LMB\", R \"RMB\", \"Scroll ↑/↓\" and ⇞/⇟ for \"Page_↑/↓\"",
|
||||||
|
"Sound input": "Sound input",
|
||||||
|
"Open recordings folder": "Open recordings folder",
|
||||||
|
"Secured": "Secured",
|
||||||
|
"Bottom-up": "Bottom-up",
|
||||||
|
"Top-down": "Top-down",
|
||||||
|
"Type /key to get started with online models\nCtrl+O to expand sidebar\nCtrl+P to pin sidebar\nCtrl+D to detach sidebar": "Type /key to get started with online models\nCtrl+O to expand sidebar\nCtrl+P to pin sidebar\nCtrl+D to detach sidebar",
|
||||||
|
"Left to right": "Left to right",
|
||||||
|
"Title font": "Title font",
|
||||||
|
"Font used for Nerd Font icons": "Font used for Nerd Font icons",
|
||||||
|
"e.g. for Ctrl, for Alt, for Shift, etc": "e.g. for Ctrl, for Alt, for Shift, etc",
|
||||||
|
"Font family name (e.g., Space Grotesk)": "Font family name (e.g., Space Grotesk)",
|
||||||
|
"Press Super+G to open the overlay and pin the crosshair": "Press Super+G to open the overlay and pin the crosshair",
|
||||||
|
"Rectangle": "Rectangle",
|
||||||
|
"RAM": "RAM",
|
||||||
|
"Font size": "Font size",
|
||||||
|
"Split buttons": "Split buttons",
|
||||||
|
"Unknown Application": "Unknown Application",
|
||||||
|
"Unpin from taskbar": "Unpin from taskbar",
|
||||||
|
"Close window": "Close window",
|
||||||
|
"Set FPS limit": "Set FPS limit",
|
||||||
|
"Keybind font size": "Keybind font size",
|
||||||
|
"Han chars": "Han chars",
|
||||||
|
"You can also manually edit cheatsheet.superKey": "You can also manually edit cheatsheet.superKey",
|
||||||
|
"Unpin from Start": "Unpin from Start",
|
||||||
|
"Overlay: Floating Image": "Overlay: Floating Image",
|
||||||
|
"Turn on from sunset to sunrise": "Turn on from sunset to sunrise",
|
||||||
|
"Input device": "Input device",
|
||||||
|
"End session": "End session",
|
||||||
|
"Used for displaying numbers": "Used for displaying numbers",
|
||||||
|
"Saved": "Saved",
|
||||||
|
"More volume settings": "More volume settings",
|
||||||
|
"Network": "Network",
|
||||||
|
"(Plugged in)": "(Plugged in)",
|
||||||
|
"Output device": "Output device",
|
||||||
|
"of %1": "of %1",
|
||||||
|
"Used for decorative/expressive text": "Used for decorative/expressive text"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user