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];

View File

@@ -49,12 +49,12 @@ const devices = (bluetooth, self) => {
hpack: "center",
children: [
Widget.Label({
class_name: "dim",
class_name: "no-bluetooth-devices dim",
hexpand: true,
label: "No devices currently found",
}),
Widget.Label({
class_name: "dim",
class_name: "search-bluetooth-label dim",
hexpand: true,
label: "Press '󰑐' to search",
}),