Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround unreliable GDK geometry scaling for matching monitors #768

Conversation

wistfulbrick
Copy link
Contributor

@wistfulbrick wistfulbrick commented Feb 10, 2025

Building on top of the testing and discussion in #713

@Sawy7, sorry for the hijack! Happy for these changes to go into your PR instead, I just want to quickly test this.

Should fix #636 but needs to be tested by the folks in #713 who had fractionally scaled GDK geometry.

This should be linted correctly, please let me know if the comments are incorrect or if you have any other changes you want to make.

@wistfulbrick
Copy link
Contributor Author

@uwidev @tixwho @ppenguin Could you test my workaround here?

@uwidev
Copy link

uwidev commented Feb 10, 2025

Did not work on my end.

I think I installed it correctly on Arch. I edited the source to point to your repo and branch and then installed it as a system package. This is the PKGBUILD.

Arch Linux PKGBUILD
# Maintainer: cat_nm
# Maintainer: jaskir
pkgname=ags-hyprpanel-git
pkgver=gdk.geo.monitor.matching.workaround
pkgrel=1
pkgdesc="A Bar/Panel for Hyprland with extensive customizability"
arch=('x86_64')
url="https://hyprpanel.com/"
license=('MIT')
depends=(
    # official repository:
    'wireplumber'
    'libgtop'
    'bluez'
    'bluez-utils'
    'networkmanager'
    'dart-sass'
    'wl-clipboard'
    'upower'
    'gvfs'
    'ttf-jetbrains-mono-nerd'
    # aur:
    'aylurs-gtk-shell-git'
)
makedepends=(
    'meson'
    'unzip'
    'git'
)
optdepends=(
    'python: GPU usage tracking (NVidia only)'
    'python-gpustat: GPU usage tracking (NVidia only)'
    'python-pywal: Pywal hook for wallpapers'
    'pacman-contrib: Checking for pacman updates'
    'power-profiles-daemon: Switch power profiles'
    'swww: Setting wallpapers'
    'grimblast-git: For the snapshot shortcut'
    'brightnessctl: To control keyboard and screen brightness'
    'btop: To view system resource usage'
    'gpu-screen-recorder: To use the built in screen recorder'
    'hyprpicker: To use the preset color picker shortcut'
    'hypridle: To use hyprlands idle inhibitor'
    'hyprsunset: To enable the hyprland blue light filter'
    'matugen-bin: To use wallpaper based color schemes'
)
source=('git+https://github.com/wistfulbrick/HyprPanel.git#branch=gdk-geo-monitor-matching-workaround')
sha256sums=('SKIP')

pkgver() {
    cd "$srcdir/HyprPanel"
    printf $pkgver
}

build() {
    cd "$srcdir/HyprPanel"
    arch-meson --reconfigure build
    meson compile -C build
}

package() {
    cd "$srcdir/HyprPanel"

    meson install -C build --destdir "$pkgdir"

    # License
    install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}

I also double checked the ./src tree and made sure your commit existed in the cloned repo.

Again, my configs for reference.

Hyprpanel monitor configs

# Scale up and down to meet in the middle, middle DPI
monitor=DP-3,2560x1440@144,0x0,1.25,bitdepth,10
monitor=HDMI-A-1,1920x1080,-1152x-896,0.9375,transform,1,bitdepth,10
monitor=HDMI-A-1,addreserved,896,0,0,0

Monitor Readings

> xrandr --listmonitors
Monitors: 2
 0: +*DP-3 2048/530x1152/300+1080+0  DP-3
 1: +HDMI-A-1 1152/530x2048/300+0+0  HDMI-A-1
> hyprctl monitors
Monitor HDMI-A-1 (ID 0):
	[email protected] at -1152x-896
	description: Ancor Communications Inc VS248 D9LMQS081513
	make: Ancor Communications Inc
	model: VS248
	serial: D9LMQS081513
	active workspace: 1 (1)
	special workspace: 0 ()
	reserved: 0 950 0 0
	scale: 0.94
	transform: 1
	focused: no
	dpmsStatus: 1
	vrr: false
	solitary: 5565c9061630
	activelyTearing: false
	directScanoutTo: 0
	disabled: false
	currentFormat: XBGR2101010
	mirrorOf: none
	availableModes: [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] 

Monitor DP-3 (ID 1):
	[email protected] at 0x0
	description: Dell Inc. Dell S2417DG #ASOS21QQ6RLd
	make: Dell Inc.
	model: Dell S2417DG
	serial: #ASOS21QQ6RLd
	active workspace: 2 (2)
	special workspace: 0 ()
	reserved: 0 52 0 0
	scale: 1.25
	transform: 0
	focused: yes
	dpmsStatus: 1
	vrr: false
	solitary: 0
	activelyTearing: false
	directScanoutTo: 0
	disabled: false
	currentFormat: XBGR2101010
	mirrorOf: none
	availableModes: [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] 

GTK Inspector
image

@wistfulbrick
Copy link
Contributor Author

@uwidev I think your issue is coming from your transform=1 setting in hyprland.

You might have to bear with me here (incoming infodump). I think whats happening is that the xdg_output received by GDK/GTK IS correctly fractionally scaled (even in GDK3). However this means that xdg_output is the same as wl_output, GDK receives the intended scale and rounds it up to an integer. Well if that integer scale factor is 2, GDK sees that xdg_output hasn’t been scaled because it equals wl_output so it “corrects” the GDK geometry by scaling it by the scale factor.. 2.

This is what @Sawy7 ‘s PR was to fix. However what happens when you have a 90 degree rotation? Well that swaps the height and width, so now xdg_output is not equal to wl_output and GDK seeing this knows NOT to scale it with the scaleFactor. So the geometry will be the correct fractionally scaled inverted height width.

I think.. haha 😁Tomorrow morning Ill doing some testing and hopefully we’ll have a true fix

@wistfulbrick
Copy link
Contributor Author

This behavior is driving me nuts. I thought maybe it was a transform thing but I couldn't reproduce it on my end.

I have a Mac eDP monitor with resolution 3456x2160 here's my testing for GDK3:

HyprScale Transform gdk-width gdk-height gdk-scale
0.8 3456 2160 1
0.8 90° 3456 2160 1
1.0 3456 2160 1
1.0 90° 3456 2160 1
1.2 1728 1080 2
1.2 90° 1728 1080 2
2.0 1728 1080 2
2.0 90° 1728 1080 2

Then for GDK4:

HyprScale Transform gdk-width gdk-height gdk-scale
0.8 4320 2700 0.8
0.8 90° 2700 4320 1.28
1.0 3456 2160 1
1.0 90° 2160 3456 1.6
1.2 2880 1800 1.2
1.2 90° 1800 2880 1.92
2.0 1728 1080 2
2.0 90° 1080 1728 3.2

I also tried a bunch of other hyprland render variables and was not able to get similar fractional gdk geometry values like @uwidev. Could be related to the nvidia driver maybe?

One interesting thing is that when the gdk scaleFactor is used to scale the gdk geometry (as in my case), rotating the screen 90 degrees does not swap the gdk width/height. So for me at least the rotation logic is incorrect.

In @uwidev 's case where the gdk geometry is scaled by the fractional scale, the width/height IS swapped when rotated 90 degrees (similar to GDK4).

Current theory is that in my case, both xdg_output and wl_output geometry always matches the original monitor resolution (regardless of rotation, strange). This results in GDK3 scaling the geometry with the scaling factor when it's 2.

In @uwidev 's case, I think the xdg_output is prescaled with the fractional scale and transformed correctly, and because xdg_output is different to wl_output..? GDK3 doesn't apply any additional scaling.

@uwidev /@tixwho if you wanted to do me and everyone else here a massive solid, you could generate similar tables to above for one of your monitors (remember you need to restart hyprland session after each change).

@wistfulbrick
Copy link
Contributor Author

wistfulbrick commented Feb 11, 2025

The gdk key for uwidev's Ankor monitor should be:
Ankormodel_1152x2048_1

The hyprland key should be:
Ankormodel_{hypr monitor height/0.9735}_{hypr monitor width/0.9735}_1 or
Ankormodel_{1080/0.9375}_{1920/0.9375}_1 or
Ankormodel_1152_2048_1

I'm wondering if maybe the hyprland monitor width/height that Astal gets is already scaled by the fractional scale, so this code is scaling it twice. I'm going to push a change and we'll see if it fixes it..

@wistfulbrick
Copy link
Contributor Author

Okay this most recent change fixes monitor matching when screens have a transform applied for my (scalefactor) case so that's nice!

@uwidev I've made a change to how the fractional scaled key is generated, I'm not 100% sure whether it will work. However I've also just added some debug console logging. Could you update to this latest commit and apply the resolutions you were having issues with, then in a terminal pkill hyprpanel then run hyprpanel and copy the key matching debug logs here?

Thank you so much for your support/testing this issue btw!

@uwidev
Copy link

uwidev commented Feb 11, 2025

hyprpanel-Message: 08:31:31.529: Attempting 1st gdk key match
hyprpanel-Message: 08:31:31.529: GDK key: VS248_1152x2048_1
hyprpanel-Message: 08:31:31.529: HypMon.width: 2560
hyprpanel-Message: 08:31:31.529: HypMon.height: 1440
hyprpanel-Message: 08:31:31.529: HypMon.scale: 1.25
hyprpanel-Message: 08:31:31.529: scaleFactor: 2
hyprpanel-Message: 08:31:31.529: scaleFactorKey: Dell S2417DG_1280x720_2
hyprpanel-Message: 08:31:31.529: scaleKey: Dell S2417DG_2560x1440_2
hyprpanel-Message: 08:31:31.529: match?: false
hyprpanel-Message: 08:31:31.529: Attempting 1st gdk key match
hyprpanel-Message: 08:31:31.529: GDK key: VS248_1152x2048_1
hyprpanel-Message: 08:31:31.529: HypMon.width: 1920
hyprpanel-Message: 08:31:31.529: HypMon.height: 1080
hyprpanel-Message: 08:31:31.529: HypMon.scale: 0.94
hyprpanel-Message: 08:31:31.529: scaleFactor: 1
hyprpanel-Message: 08:31:31.530: scaleFactorKey: VS248_1920x1080_1
hyprpanel-Message: 08:31:31.530: scaleKey: VS248_1080x1920_1
hyprpanel-Message: 08:31:31.530: match?: false
hyprpanel-Message: 08:31:31.530: Attempting 2nd gdk key match
hyprpanel-Message: 08:31:31.530: GDK key: VS248_1152x2048_1
hyprpanel-Message: 08:31:31.530: HypMon.width: 2560
hyprpanel-Message: 08:31:31.530: HypMon.height: 1440
hyprpanel-Message: 08:31:31.530: HypMon.scale: 1.25
hyprpanel-Message: 08:31:31.530: scaleFactor: 2
hyprpanel-Message: 08:31:31.530: scaleFactorKey: Dell S2417DG_1280x720_2
hyprpanel-Message: 08:31:31.530: scaleKey: Dell S2417DG_2560x1440_2
hyprpanel-Message: 08:31:31.530: match?: false
hyprpanel-Message: 08:31:31.530: Attempting 2nd gdk key match
hyprpanel-Message: 08:31:31.530: GDK key: VS248_1152x2048_1
hyprpanel-Message: 08:31:31.530: HypMon.width: 1920
hyprpanel-Message: 08:31:31.530: HypMon.height: 1080
hyprpanel-Message: 08:31:31.530: HypMon.scale: 0.94
hyprpanel-Message: 08:31:31.530: scaleFactor: 1
hyprpanel-Message: 08:31:31.530: scaleFactorKey: VS248_1920x1080_1
hyprpanel-Message: 08:31:31.530: scaleKey: VS248_1080x1920_1
hyprpanel-Message: 08:31:31.531: match?: false
hyprpanel-Message: 08:31:31.563: Attempting 1st gdk key match
hyprpanel-Message: 08:31:31.563: GDK key: Dell S2417DG_2048x1152_2
hyprpanel-Message: 08:31:31.563: HypMon.width: 2560
hyprpanel-Message: 08:31:31.563: HypMon.height: 1440
hyprpanel-Message: 08:31:31.563: HypMon.scale: 1.25
hyprpanel-Message: 08:31:31.563: scaleFactor: 2
hyprpanel-Message: 08:31:31.563: scaleFactorKey: Dell S2417DG_1280x720_2
hyprpanel-Message: 08:31:31.563: scaleKey: Dell S2417DG_2560x1440_2
hyprpanel-Message: 08:31:31.563: match?: false
hyprpanel-Message: 08:31:31.563: Attempting 1st gdk key match
hyprpanel-Message: 08:31:31.563: GDK key: Dell S2417DG_2048x1152_2
hyprpanel-Message: 08:31:31.563: HypMon.width: 1920
hyprpanel-Message: 08:31:31.563: HypMon.height: 1080
hyprpanel-Message: 08:31:31.563: HypMon.scale: 0.94
hyprpanel-Message: 08:31:31.563: scaleFactor: 1
hyprpanel-Message: 08:31:31.563: scaleFactorKey: VS248_1920x1080_1
hyprpanel-Message: 08:31:31.563: scaleKey: VS248_1080x1920_1
hyprpanel-Message: 08:31:31.563: match?: false
hyprpanel-Message: 08:31:31.563: Attempting 2nd gdk key match
hyprpanel-Message: 08:31:31.563: GDK key: Dell S2417DG_2048x1152_2
hyprpanel-Message: 08:31:31.564: HypMon.width: 2560
hyprpanel-Message: 08:31:31.564: HypMon.height: 1440
hyprpanel-Message: 08:31:31.564: HypMon.scale: 1.25
hyprpanel-Message: 08:31:31.564: scaleFactor: 2
hyprpanel-Message: 08:31:31.564: scaleFactorKey: Dell S2417DG_1280x720_2
hyprpanel-Message: 08:31:31.564: scaleKey: Dell S2417DG_2560x1440_2
hyprpanel-Message: 08:31:31.564: match?: false
hyprpanel-Message: 08:31:31.564: Attempting 2nd gdk key match
hyprpanel-Message: 08:31:31.564: GDK key: Dell S2417DG_2048x1152_2
hyprpanel-Message: 08:31:31.564: HypMon.width: 1920
hyprpanel-Message: 08:31:31.564: HypMon.height: 1080
hyprpanel-Message: 08:31:31.564: HypMon.scale: 0.94
hyprpanel-Message: 08:31:31.564: scaleFactor: 1
hyprpanel-Message: 08:31:31.564: scaleFactorKey: VS248_1920x1080_1
hyprpanel-Message: 08:31:31.564: scaleKey: VS248_1080x1920_1
hyprpanel-Message: 08:31:31.564: match?: false

@ppenguin
Copy link

@uwidev @tixwho @ppenguin Could you test my workaround here?

For my use case this PR also works, it behaves the same as #713 for me. (Only tested on 2 identical monitors scaled 1.5, which didn't work from master)

@tixwho
Copy link

tixwho commented Feb 11, 2025

IDK why pkill hyprpanel can't kill the process... But that doesn't matter I guess?

Does't work for me either, but here is the debug output:

hyprpanel-Message: 12:06:58.016: Attempting 1st gdk key match
hyprpanel-Message: 12:06:58.016: GDK key: DELL U2723QE_1440x2560_2
hyprpanel-Message: 12:06:58.016: HypMon.width: 3840
hyprpanel-Message: 12:06:58.016: HypMon.height: 2160
hyprpanel-Message: 12:06:58.016: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.016: scaleFactor: 2
hyprpanel-Message: 12:06:58.016: scaleFactorKey: LG ULTRAGEAR+_1920x1080_2
hyprpanel-Message: 12:06:58.016: scaleKey: LG ULTRAGEAR+_3840x2160_2
hyprpanel-Message: 12:06:58.016: match?: false
hyprpanel-Message: 12:06:58.016: Attempting 1st gdk key match
hyprpanel-Message: 12:06:58.016: GDK key: DELL U2723QE_1440x2560_2
hyprpanel-Message: 12:06:58.016: HypMon.width: 3840
hyprpanel-Message: 12:06:58.016: HypMon.height: 2160
hyprpanel-Message: 12:06:58.016: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.016: scaleFactor: 2
hyprpanel-Message: 12:06:58.016: scaleFactorKey: DELL U2723QE_1920x1080_2
hyprpanel-Message: 12:06:58.016: scaleKey: DELL U2723QE_2160x3840_2
hyprpanel-Message: 12:06:58.016: match?: false
hyprpanel-Message: 12:06:58.017: Attempting 2nd gdk key match
hyprpanel-Message: 12:06:58.017: GDK key: DELL U2723QE_1440x2560_2
hyprpanel-Message: 12:06:58.017: HypMon.width: 3840
hyprpanel-Message: 12:06:58.017: HypMon.height: 2160
hyprpanel-Message: 12:06:58.017: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.017: scaleFactor: 2
hyprpanel-Message: 12:06:58.017: scaleFactorKey: LG ULTRAGEAR+_1920x1080_2
hyprpanel-Message: 12:06:58.017: scaleKey: LG ULTRAGEAR+_3840x2160_2
hyprpanel-Message: 12:06:58.017: match?: false
hyprpanel-Message: 12:06:58.017: Attempting 2nd gdk key match
hyprpanel-Message: 12:06:58.017: GDK key: DELL U2723QE_1440x2560_2
hyprpanel-Message: 12:06:58.017: HypMon.width: 3840
hyprpanel-Message: 12:06:58.017: HypMon.height: 2160
hyprpanel-Message: 12:06:58.017: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.017: scaleFactor: 2
hyprpanel-Message: 12:06:58.017: scaleFactorKey: DELL U2723QE_1920x1080_2
hyprpanel-Message: 12:06:58.017: scaleKey: DELL U2723QE_2160x3840_2
hyprpanel-Message: 12:06:58.017: match?: false
hyprpanel-Message: 12:06:58.037: Attempting 1st gdk key match
hyprpanel-Message: 12:06:58.037: GDK key: LG ULTRAGEAR+_2560x1440_2
hyprpanel-Message: 12:06:58.037: HypMon.width: 3840
hyprpanel-Message: 12:06:58.037: HypMon.height: 2160
hyprpanel-Message: 12:06:58.037: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.037: scaleFactor: 2
hyprpanel-Message: 12:06:58.037: scaleFactorKey: LG ULTRAGEAR+_1920x1080_2
hyprpanel-Message: 12:06:58.038: scaleKey: LG ULTRAGEAR+_3840x2160_2
hyprpanel-Message: 12:06:58.038: match?: false
hyprpanel-Message: 12:06:58.038: Attempting 1st gdk key match
hyprpanel-Message: 12:06:58.038: GDK key: LG ULTRAGEAR+_2560x1440_2
hyprpanel-Message: 12:06:58.038: HypMon.width: 3840
hyprpanel-Message: 12:06:58.038: HypMon.height: 2160
hyprpanel-Message: 12:06:58.038: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.038: scaleFactor: 2
hyprpanel-Message: 12:06:58.038: scaleFactorKey: DELL U2723QE_1920x1080_2
hyprpanel-Message: 12:06:58.038: scaleKey: DELL U2723QE_2160x3840_2
hyprpanel-Message: 12:06:58.038: match?: false
hyprpanel-Message: 12:06:58.038: Attempting 2nd gdk key match
hyprpanel-Message: 12:06:58.038: GDK key: LG ULTRAGEAR+_2560x1440_2
hyprpanel-Message: 12:06:58.038: HypMon.width: 3840
hyprpanel-Message: 12:06:58.038: HypMon.height: 2160
hyprpanel-Message: 12:06:58.038: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.038: scaleFactor: 2
hyprpanel-Message: 12:06:58.038: scaleFactorKey: LG ULTRAGEAR+_1920x1080_2
hyprpanel-Message: 12:06:58.038: scaleKey: LG ULTRAGEAR+_3840x2160_2
hyprpanel-Message: 12:06:58.038: match?: false
hyprpanel-Message: 12:06:58.038: Attempting 2nd gdk key match
hyprpanel-Message: 12:06:58.038: GDK key: LG ULTRAGEAR+_2560x1440_2
hyprpanel-Message: 12:06:58.038: HypMon.width: 3840
hyprpanel-Message: 12:06:58.038: HypMon.height: 2160
hyprpanel-Message: 12:06:58.038: HypMon.scale: 1.5
hyprpanel-Message: 12:06:58.038: scaleFactor: 2
hyprpanel-Message: 12:06:58.038: scaleFactorKey: DELL U2723QE_1920x1080_2
hyprpanel-Message: 12:06:58.038: scaleKey: DELL U2723QE_2160x3840_2
hyprpanel-Message: 12:06:58.038: match?: false

@wistfulbrick
Copy link
Contributor Author

@uwidev Aha! My first commits code was actually correct. The reason that it's not working for you is that hyprland is rounding up your Ankor monitors scale to two decimal places when reporting information.

The scale you set in your config is 0.9375 and hyprland will use that exact value for scaling, i.e. your gdk geometry for that monitor is 1152x2048 where 1920 / 0.9375 = 2048 and 1080 / 0.9375 = 1152.

HOWEVER for some reason when hyprland reports monitor scale, it rounds it up to two decimal places giving 0.94 both in hyprctl monitor and in communication with the hyprland socket itself (how HyprPanel gets it).

So this code takes the hyprland monitor scale 0.94 and uses it to scale the hyprland width/height to match the GDK version, except it will get the wrong value. 1920 / 0.94 = 2042.55 ~> 2042 and 1080 / 0.94 = 1148.93 ~> 1148. This fails the match.

Unfortunately scale rounding is a hyprland thing, it's not something that could ever be addressed with HyprPanel code (we can't get from 0.94 back to 0.9375). It would be ideal if hyprland rounded the scale to two decimal points when it scales the surface, that way the gdk geometry would be scaled by 0.94 but it's a super minor issue imo.

You can just set the scale in your hyprland config to 0.94 and this will work just fine (scaling-wise it will probably be a few pixels difference, completely unnoticeable). I just need to revert the fraction key code to its previous logic.

The other thing I'm seeing is that the hyprland width/height is:

  • Not fractionally scaled (phew, finally something makes sense!)
  • Not rotated/transformed, it's just as reported from hyprctl monitors

We still don't have an explanation as to why you and tixwho have fractionally scaled gdk geometry in the first place but I can definitely make this PR work for you both!

@tixwho
Copy link

tixwho commented Feb 11, 2025

@wistfulbrick Wonderful news, thank you so much for the debugging and follow up!! Do you still need the table for comparison? And if so, since it looks like a decimal rounding issue, are there specific scaling factors you want me to try?

@wistfulbrick
Copy link
Contributor Author

@tixwho Nope! No need for you two to do anything until I've got this new commit out :) Taking a little longer because I'm cleaning up

@uwidev
Copy link

uwidev commented Feb 11, 2025

I have confirmed that rounding the decimal to 2 decimal places has solved the issue. Hyprland operates a bit funky now and doesn't align my monitors or something, but the bars are at least at the right place.

@wistfulbrick
Copy link
Contributor Author

@uwidev @tixwho This latest commit should now match monitors correctly for you both, let me know how it runs. If there's any issues, run hyprpanel in a terminal and give me the debug logs.

@ppenguin it works sensibly on my machine but if you could test it again I would appreciate it (particularly monitor rotation/transforms).

@wistfulbrick
Copy link
Contributor Author

I have confirmed that rounding the decimal to 2 decimal places has solved the issue. Hyprland operates a bit funky now and doesn't align my monitors or something, but the bars are at least at the right place.

I'm guessing you have probably kept the monitor positions the same, you probably previously figured out the maths for positioning with the 0.9375 scale, you need to redo that math for 0.94 and it should behave more normally.

@tixwho
Copy link

tixwho commented Feb 11, 2025

Finally, work as expected! Posting log here just for reference:

hyprpanel-Message: 17:32:49.103: Attempting gdk key match
hyprpanel-Message: 17:32:49.104: GDK key: DELL U2723QE_1440x2560_2
hyprpanel-Message: 17:32:49.104: HypMon.width: 3840
hyprpanel-Message: 17:32:49.104: HypMon.height: 2160
hyprpanel-Message: 17:32:49.104: HypMon.scale: 1.5
hyprpanel-Message: 17:32:49.104: HypMon.transform: 0
hyprpanel-Message: 17:32:49.104: isRotated90: false
hyprpanel-Message: 17:32:49.104: scaleFactor: 2
hyprpanel-Message: 17:32:49.104: scaleFactorKey: LG ULTRAGEAR+_1920x1080_2
hyprpanel-Message: 17:32:49.104: scaleKey: LG ULTRAGEAR+_2560x1440_2
hyprpanel-Message: 17:32:49.104: match?: false
hyprpanel-Message: 17:32:49.104: Attempting gdk key match
hyprpanel-Message: 17:32:49.104: GDK key: DELL U2723QE_1440x2560_2
hyprpanel-Message: 17:32:49.104: HypMon.width: 3840
hyprpanel-Message: 17:32:49.104: HypMon.height: 2160
hyprpanel-Message: 17:32:49.104: HypMon.scale: 1.5
hyprpanel-Message: 17:32:49.104: HypMon.transform: 3
hyprpanel-Message: 17:32:49.104: isRotated90: true
hyprpanel-Message: 17:32:49.104: scaleFactor: 2
hyprpanel-Message: 17:32:49.104: scaleFactorKey: DELL U2723QE_1920x1080_2
hyprpanel-Message: 17:32:49.104: scaleKey: DELL U2723QE_1440x2560_2
hyprpanel-Message: 17:32:49.104: match?: true
hyprpanel-Message: 17:32:49.150: Attempting gdk key match
hyprpanel-Message: 17:32:49.150: GDK key: LG ULTRAGEAR+_2560x1440_2
hyprpanel-Message: 17:32:49.150: HypMon.width: 3840
hyprpanel-Message: 17:32:49.150: HypMon.height: 2160
hyprpanel-Message: 17:32:49.150: HypMon.scale: 1.5
hyprpanel-Message: 17:32:49.150: HypMon.transform: 0
hyprpanel-Message: 17:32:49.150: isRotated90: false
hyprpanel-Message: 17:32:49.150: scaleFactor: 2
hyprpanel-Message: 17:32:49.151: scaleFactorKey: LG ULTRAGEAR+_1920x1080_2
hyprpanel-Message: 17:32:49.151: scaleKey: LG ULTRAGEAR+_2560x1440_2
hyprpanel-Message: 17:32:49.151: match?: true

@ppenguin
Copy link

@wistfulbrick

@ppenguin it works sensibly on my machine but if you could test it again I would appreciate it (particularly monitor rotation/transforms).

Still seems to work (on my desktop).
Haven't tested my other use case yet: 2in1 with touch/dynamic rotation (but mostly use built-in display)

@wistfulbrick
Copy link
Contributor Author

wistfulbrick commented Feb 12, 2025

@Jas-SinghFSU I think this is ready to review but I have two things to potentially clean up:

  1. Would you like me to squash the commits?
  2. I have left debug console logging in the monitor matching function. I think there's an argument to be made for enabling this logging as a config option, so that folks who run into monitor matching issues can enable it and send the logs on any issue they raise for it. I do think it's unnecessary in its current "always on" form, I'm also fine with just removing it.

Assuming you have nothing else you'd like to change, once I'm done addressing the above I'll run a final lint and this will be ready to merge :)

@Jas-SinghFSU
Copy link
Owner

@wistfulbrick Great work and investigation! Thank you for that

  1. Don't worry about squashing, I'll do that during merge.
  2. We can leave the debug logs in there

Looks good, I'll get this reviewed :)

@Jas-SinghFSU
Copy link
Owner

Everything looks good and ready to merge once we fix the type errors and linter issues.

Also one more thing, we can add those debug logs but only if keyMatch is true to reduce the noise.

@wistfulbrick
Copy link
Contributor Author

Excellent, I'll get those sorted out. For the debug logs, they will be most useful when keyMatch is false but I think instead of putting them behind a condition I was looking into GJS logging practices. We can convert this logging to console.debug("....") instead so it only appears when the correct environment variables for debug logging is set.

Unfortunately whilst GJS advises using the console.debug() in its recommended practices, it seems that none of the GJS environment variables control it. It's controlled instead by glib. So currently warn/error level messages appear in the shell but setting G_MESSAGES_DEBUG="GNOME Shell" will show debug messages. I'll put this info in a comment above this debug logging so folks looking into it can read the code to see how to enable it, that way it's disabled for everyone else by default. I'll test this all before pushing the final commit. Sound good?

@Jas-SinghFSU
Copy link
Owner

Yep, that sounds good.

@wistfulbrick
Copy link
Contributor Author

Okay, I think that covers everything! Let me know if you need anything else :)

@Jas-SinghFSU Jas-SinghFSU merged commit 4424a52 into Jas-SinghFSU:master Feb 14, 2025
1 check passed
@Jas-SinghFSU
Copy link
Owner

Thanks for the contribution ❤️.

@wistfulbrick
Copy link
Contributor Author

Thank you for making HyprPanel!

Extra thanks go to @uwidev @tixwho and @ppenguin You guys tested like 5 different versions before this was complete and gave really good info back, thank you! 🙌

@ppenguin
Copy link

@wistfulbrick @Jas-SinghFSU just discovered HP and really positive about it.

(Shameless plug: testing with versions was so easy because I'm on NixOS/home-manager, so I just change a repo/commit hash in my config and have a new version).

I have a few feature ideas for HP but no time at all to work on them, will issue them separately...

@wistfulbrick wistfulbrick deleted the gdk-geo-monitor-matching-workaround branch February 14, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bar is Displayed on wrong monitors (Dual Monitor)
5 participants