Added customizable styling for network, bluetooth, battery and audio menu... and fixed window position based on scale.

This commit is contained in:
Jas Singh
2024-07-18 00:26:29 -07:00
parent 144746db0a
commit 1e3a23439d
8 changed files with 161 additions and 46 deletions

View File

@@ -20,6 +20,18 @@ const moveBoxToCursor = (self, fixed) => {
let monWidth = hyprland.monitors[hyprland.active.monitor.id].width;
let monHeight = hyprland.monitors[hyprland.active.monitor.id].height;
// If GDK Scaling is applied, then get divide width by scaling
// to get the proper coordinates.
// Ex: On a 2860px wide monitor... if scaling is set to 2, then the right
// end of the monitor is the 1430th pixel.
const gdkScale = Utils.exec('bash -c "echo $GDK_SCALE"');
if (/^\d+(.\d+)?$/.test(gdkScale)) {
const scale = parseFloat(gdkScale);
monWidth = monWidth / scale;
monHeight = monHeight / scale;
}
// If monitor is vertical (transform = 1 || 3) swap height and width
if (hyprland.monitors[hyprland.active.monitor.id].transform % 2 !== 0) {
[monWidth, monHeight] = [monHeight, monWidth];