emersion / kanshi

Dynamic display configuration (mirror)
https://wayland.emersion.fr/kanshi/
MIT License
652 stars 46 forks source link

Scale factor applied to output is different from the provided in the config file #94

Open Gochkin opened 3 years ago

Gochkin commented 3 years ago

I have encountered a strange problem. In my config file I set: output eDP-1 mode 1920x1200@59.95Hz scale 1.2 position 0,0

But the applied scale factor is different, here is the output from sway -t get-outputs command:

Output eDP-1 'Sharp Corporation 0x14F9 0x00000000' (focused)
  Current mode: 1920x1200 @ 59.950001 Hz
  Position: 0,0
  Scale factor: 1.199219
  Scale filter: linear
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2: general
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    1920x1200 @ 47.959999 Hz
    1920x1200 @ 59.950001 Hz

Firstly I thought that my laptop screen is somehow not supporting the resolution with 1.2 scale factor, but then I have tried apply the same command through swaymsg and it worked as supposed to:

$ swaymsg 'output eDP-1 mode 1920x1080@60Hz scale 1.2 position 0 0'
$ swaymsg -t get_outputs
Output eDP-1 'Sharp Corporation 0x14F9 0x00000000' (focused)
  Current mode: 1920x1200 @ 59.950001 Hz
  Position: 0,0
  Scale factor: 1.200000
  Scale filter: linear
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2: general
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    1920x1200 @ 47.959999 Hz
    1920x1200 @ 59.950001 Hz

It is not a huge problem, but it force me to recalculate and apply "ugly" pixel offset for external monitors (in my case 1920 / 1.199219 = 1601.042 instead of just 1600).

Gochkin commented 3 years ago

Is there any insight on what is happening here and if this is a bug on kanshi side? As I said before, applying the same configuration through swaymsg works as expected. For now I apply an additional exec swaymsg command to apply right scale factor.