hefty: bar: workspace widget

This commit is contained in:
end-4
2026-02-05 12:49:36 +01:00
parent 24392e3791
commit 6f633122ed
14 changed files with 581 additions and 73 deletions
@@ -109,7 +109,8 @@ Singleton {
*/
function transparentize(color, percentage = 1) {
var c = Qt.color(color);
return Qt.rgba(c.r, c.g, c.b, c.a * (1 - percentage));
var a = c.a * (1 - clamp01(percentage));
return Qt.rgba(c.r, c.g, c.b, a);
}
/**
@@ -121,7 +122,7 @@ Singleton {
*/
function applyAlpha(color, alpha) {
var c = Qt.color(color);
var a = Math.max(0, Math.min(1, alpha));
var a = clamp01(alpha);
return Qt.rgba(c.r, c.g, c.b, a);
}
@@ -0,0 +1,16 @@
pragma Singleton
import Quickshell
Singleton {
id: root
/**
* Rounds the given number to the nearest even integer.
*
* @param {number} num - The number to round.
* @returns {number} The nearest even integer.
*/
function roundToEven(num) {
return Math.round(num / 2) * 2;
}
}