Monitor identification update. (#107)
* Add proper gtk to hyprland monitor mapping * Updated the monitor identification logic to sync GDK monitor IDs properly with hyprland monitor IDs. * Remove console statement. * Revert this to how it was before since its exactly the same thing.
This commit is contained in:
@@ -17,11 +17,16 @@ const moveBoxToCursor = (self: any, fixed: boolean) => {
|
||||
}
|
||||
|
||||
globalMousePos.connect("changed", ({ value }) => {
|
||||
const hyprScaling = hyprland.monitors[hyprland.active.monitor.id].scale;
|
||||
const currentWidth = self.child.get_allocation().width;
|
||||
const curHyprlandMonitor = hyprland.monitors.find(m => m.id === hyprland.active.monitor.id);
|
||||
const dropdownWidth = self.child.get_allocation().width;
|
||||
|
||||
let monWidth = hyprland.monitors[hyprland.active.monitor.id].width;
|
||||
let monHeight = hyprland.monitors[hyprland.active.monitor.id].height;
|
||||
const hyprScaling = curHyprlandMonitor?.scale;
|
||||
let monWidth = curHyprlandMonitor?.width;
|
||||
let monHeight = curHyprlandMonitor?.height;
|
||||
|
||||
if (monWidth === undefined || monHeight === undefined || hyprScaling === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If GDK Scaling is applied, then get divide width by scaling
|
||||
// to get the proper coordinates.
|
||||
@@ -39,24 +44,28 @@ const moveBoxToCursor = (self: any, fixed: boolean) => {
|
||||
}
|
||||
|
||||
// If monitor is vertical (transform = 1 || 3) swap height and width
|
||||
if (hyprland.monitors[hyprland.active.monitor.id].transform % 2 !== 0) {
|
||||
const isVertical = curHyprlandMonitor?.transform !== undefined
|
||||
? curHyprlandMonitor.transform % 2 !== 0
|
||||
: false;
|
||||
|
||||
if (isVertical) {
|
||||
[monWidth, monHeight] = [monHeight, monWidth];
|
||||
}
|
||||
|
||||
let marginRight = monWidth - currentWidth / 2;
|
||||
let marginRight = monWidth - dropdownWidth / 2;
|
||||
marginRight = fixed ? marginRight - monWidth / 2 : marginRight - value[0];
|
||||
let marginLeft = monWidth - currentWidth - marginRight;
|
||||
let marginLeft = monWidth - dropdownWidth - marginRight;
|
||||
|
||||
const minimumMargin = 0;
|
||||
|
||||
if (marginRight < minimumMargin) {
|
||||
marginRight = minimumMargin;
|
||||
marginLeft = monWidth - currentWidth - minimumMargin;
|
||||
marginLeft = monWidth - dropdownWidth - minimumMargin;
|
||||
}
|
||||
|
||||
if (marginLeft < minimumMargin) {
|
||||
marginLeft = minimumMargin;
|
||||
marginRight = monWidth - currentWidth - minimumMargin;
|
||||
marginRight = monWidth - dropdownWidth - minimumMargin;
|
||||
}
|
||||
|
||||
const marginTop = 45;
|
||||
|
||||
Reference in New Issue
Block a user