Skip to content

Commit

Permalink
fix: Consider scale when matching monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
simonkampe committed Jan 14, 2025
1 parent 1812193 commit 9330dcd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/bar/utils/monitors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export const gdkMonitorIdToHyprlandId = (monitor: number, usedHyprlandMonitors:
const directMatch = hyprlandService.get_monitors().find((hypMon) => {
const isVertical = hypMon?.transform !== undefined ? hypMon.transform % 2 !== 0 : false;

const width = isVertical ? hypMon.height : hypMon.width;
const height = isVertical ? hypMon.width : hypMon.height;
const width = (isVertical ? hypMon.height : hypMon.width) / hypMon.scale;
const height = (isVertical ? hypMon.width : hypMon.height) / hypMon.scale;

const hyprlandKey = `${hypMon.model}_${width}x${height}_${hypMon.scale}`;
return gdkMonitor.key.startsWith(hyprlandKey) && !usedHyprlandMonitors.has(hypMon.id) && hypMon.id === monitor;
Expand All @@ -135,8 +135,8 @@ export const gdkMonitorIdToHyprlandId = (monitor: number, usedHyprlandMonitors:
const hyprlandMonitor = hyprlandService.get_monitors().find((hypMon) => {
const isVertical = hypMon?.transform !== undefined ? hypMon.transform % 2 !== 0 : false;

const width = isVertical ? hypMon.height : hypMon.width;
const height = isVertical ? hypMon.width : hypMon.height;
const width = (isVertical ? hypMon.height : hypMon.width) / hypMon.scale;
const height = (isVertical ? hypMon.width : hypMon.height) / hypMon.scale;

const hyprlandKey = `${hypMon.model}_${width}x${height}_${hypMon.scale}`;
return gdkMonitor.key.startsWith(hyprlandKey) && !usedHyprlandMonitors.has(hypMon.id);
Expand Down

0 comments on commit 9330dcd

Please sign in to comment.