alex-courtis / way-displays

way-displays: Auto Manage Your Wayland Displays
MIT License
252 stars 13 forks source link

YAML output lacks current mode #108

Closed justinlovinger closed 1 year ago

justinlovinger commented 1 year ago

Output provided by way-displays -y -g lacks the current mode and has not way to get current resolution.

This is what "current" looks like for me:

CURRENT:
  SCALE: 2
  ENABLED: TRUE
  X: 0
  Y: 0
alex-courtis commented 1 year ago

The current mode is present, however it's not well presented and requires some ugly jq or yq to retrieve it.

I this case the current mode is the second:

STATE:
  HEADS:
    - NAME: DP-1
      DESCRIPTION: GIGA-BYTE TECHNOLOGY CO., LTD. M28U 21490B006081 (DP-1)
      MAKE: GIGA-BYTE TECHNOLOGY CO., LTD.
      MODEL: M28U
      SERIAL_NUMBER: 21490B006081
      WIDTH_MM: 630
      HEIGHT_MM: 360
      TRANSFORM: 0
      CURRENT:
        SCALE: 1.75
        ENABLED: TRUE
        X: 0
        Y: 0
      DESIRED:
        SCALE: 1.75
        ENABLED: TRUE
        X: 0
        Y: 0
      MODES:
        - WIDTH: 3840
          HEIGHT: 2160
          REFRESH_MHZ: 60000
          PREFERRED: TRUE
          CURRENT: FALSE
        - WIDTH: 3840
          HEIGHT: 2160
          REFRESH_MHZ: 144000
          PREFERRED: FALSE
          CURRENT: TRUE
        - WIDTH: 3840
          HEIGHT: 2160
          REFRESH_MHZ: 120000
          PREFERRED: FALSE
          CURRENT: FALSE
...

I'd be very grateful to suggestions on how this could be improved for better usability. I'd be most grateful if you could draft/sketch some YAML that would be more useful.

justinlovinger commented 1 year ago

I see. I had not noticed that. I was expecting mode to be provided as part of the CURRENT key, like,

STATE:
  HEADS:
    - NAME: DP-1
      DESCRIPTION: GIGA-BYTE TECHNOLOGY CO., LTD. M28U 21490B006081 (DP-1)
      MAKE: GIGA-BYTE TECHNOLOGY CO., LTD.
      MODEL: M28U
      SERIAL_NUMBER: 21490B006081
      WIDTH_MM: 630
      HEIGHT_MM: 360
      TRANSFORM: 0
      CURRENT:
        SCALE: 1.75
        ENABLED: TRUE
        X: 0
        Y: 0
        MODE:
          WIDTH: 3840
          HEIGHT: 2160
          REFRESH_MHZ: 144000
          PREFERRED: FALSE
      DESIRED:
        SCALE: 1.75
        ENABLED: TRUE
        X: 0
        Y: 0
      MODES:
        - WIDTH: 3840
          HEIGHT: 2160
          REFRESH_MHZ: 60000
          PREFERRED: TRUE
          CURRENT: FALSE
        - WIDTH: 3840
          HEIGHT: 2160
          REFRESH_MHZ: 144000
          PREFERRED: FALSE
          CURRENT: TRUE
        - WIDTH: 3840
          HEIGHT: 2160
          REFRESH_MHZ: 120000
          PREFERRED: FALSE
          CURRENT: FALSE
alex-courtis commented 1 year ago

This is great, thank you. Tracking at #109

alex-courtis commented 1 year ago

Fixed on master.

@JustinLovinger I would be grateful if you could test:

git clone git@github.com:alex-courtis/way-displays.git
cd way-displays
git submodule update --init
make
sudo make install

When you are done you can

sudo make uninstall
alex-courtis commented 1 year ago

Merged and released.