fix wrong monitor size (#537)

This commit is contained in:
end-4
2024-05-25 19:50:13 +07:00
parent df9adb18da
commit 3f18c4bc9d
5 changed files with 11 additions and 6 deletions
@@ -0,0 +1,24 @@
const { Gdk } = imports.gi;
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
const { execAsync, exec } = Utils;
export let monitors;
// Mixes with Gdk monitor size cuz it reports monitor size scaled
async function updateStuff() {
monitors = JSON.parse(exec('hyprctl monitors -j'))
const display = Gdk.Display.get_default();
monitors.forEach((monitor, i) => {
const gdkMonitor = display.get_monitor(i);
monitor.realWidth = monitor.width;
monitor.realHeight = monitor.height;
// monitor.width = gdkMonitor.get_geometry().width;
// monitor.height = gdkMonitor.get_geometry().height;
monitor.width = Math.ceil(monitor.realWidth / monitor.scale);
monitor.height = Math.ceil(monitor.realHeight / monitor.scale);
});
console.log(monitors)
}
updateStuff().catch(print);