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

Improve multiple monitor detection on Linux with i3wm #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

belden
Copy link

@belden belden commented Jul 11, 2024

My laptop is connected via HDMI to an external monitor. My window
manager is i3wm.

ffscreencast incorrectly detects my built-in and external displays
as a single very large screen. This is because xdpyinfo does not
report on physical hardware:

$ xdpyinfo | grep '^screen #' -A 1
screen #0:
  dimensions:    6096x2160 pixels (1612x571 millimeters)

xrandr correctly detects that I have two displays attached:

$ xrandr | grep ' connected'
eDP-1 connected primary 2256x1504+0+0 (normal left inverted right x axis y axis) 285mm x 190mm
DP-4 connected 3840x2160+2256+0 (normal left inverted right x axis y axis) 697mm x 392mm

This commit ensures the external displays are correctly detected.


Before:

$ ./ffscreencast --dry
/usr/bin/ffmpeg \
  -hide_banner \
  -loglevel info \
  -thread_queue_size 512 \
  -f x11grab \
  -video_size 6096x2160 \  💥 too big
  -i ":0.0" \              💥 no offset
  -c:v libx264 \
  -crf 0 \
  -preset ultrafast \
  -threads 0 "/home/blyman/Desktop/Screencast 2024-07-11 at 10.48.17.mkv"

After:

$ ./ffscreencast --dry
Available devices:
[1] eDP-1 connected primary 2256x1504+0+0 (normal left inverted right x axis y axis) 285mm x 190mm
[2] DP-4 connected 3840x2160+2256+0 (normal left inverted right x axis y axis) 697mm x 392mm
Enter device number: 2
/usr/bin/ffmpeg \
  -hide_banner \
  -loglevel info \
  -thread_queue_size 512 \
  -f x11grab \
  -video_size 3840x2160 \  💥 correct size of DP-4
  -i ":0.0+2256,0" \       💥 correct offset of DP-4
  -c:v libx264 \
  -crf 0 \
  -preset ultrafast \
  -threads 0 "/home/blyman/Desktop/Screencast 2024\-07-11 at 10.48.57.mkv"

My laptop is connected via HDMI to an external monitor. My window
manager is **i3wm**.

`ffscreencast` incorrectly detects my built-in and external displays
as a single very large screen. This is because `xdpyinfo` does not
report on physical hardware:

```
$ xdpyinfo | grep '^screen #' -A 1
screen #0:
  dimensions:    6096x2160 pixels (1612x571 millimeters)
```

`xrandr` correctly detects that I have two displays attached:

```
$ xrandr | grep ' connected'
eDP-1 connected primary 2256x1504+0+0 (normal left inverted right x axis y axis) 285mm x 190mm
DP-4 connected 3840x2160+2256+0 (normal left inverted right x axis y axis) 697mm x 392mm
```

This commit ensures the external displays are correctly detected.

----

Before:

    $ ./ffscreencast --dry
    /usr/bin/ffmpeg \
      -hide_banner \
      -loglevel info \
      -thread_queue_size 512 \
      -f x11grab \
      -video_size 6096x2160 \  💥 too big
      -i ":0.0" \              💥 no offset
      -c:v libx264 \
      -crf 0 \
      -preset ultrafast \
      -threads 0 "/home/blyman/Desktop/Screencast 2024-07-11 at 10.48.17.mkv"

After:

    $ ./ffscreencast --dry
    Available devices:
    [1] eDP-1 connected primary 2256x1504+0+0 (normal left inverted right x axis y axis) 285mm x 190mm
    [2] DP-4 connected 3840x2160+2256+0 (normal left inverted right x axis y axis) 697mm x 392mm
    Enter device number: 2
    /usr/bin/ffmpeg \
      -hide_banner \
      -loglevel info \
      -thread_queue_size 512 \
      -f x11grab \
      -video_size 3840x2160 \  💥 correct size of DP-4
      -i ":0.0+2256,0" \       💥 correct offset of DP-4
      -c:v libx264 \
      -crf 0 \
      -preset ultrafast \
      -threads 0 "/home/blyman/Desktop/Screencast 2024\-07-11 at 10.48.57.mkv"
I think I got the package names correct for Arch and CentOS.
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.

1 participant