X Tutup
Skip to content

Fix multi-monitor common issues#949

Merged
PapyElGringo merged 10 commits intomainfrom
fix-#945
Mar 6, 2023
Merged

Fix multi-monitor common issues#949
PapyElGringo merged 10 commits intomainfrom
fix-#945

Conversation

@PapyElGringo
Copy link
Collaborator

Effort in making multi-monitor work better:

First ensure to have a first class support of the following configuration:

Gnome settings

org.gnome.mutter dynamic-workspaces true

Material Shell settings

Maximize layout

Using those settings and the code changes from this branch let's list all unexpected behavior and we will expand from there.

@PapyElGringo PapyElGringo mentioned this pull request Feb 21, 2023
2 tasks
@rizajur
Copy link

rizajur commented Feb 22, 2023

How to contribute

Installation

Important to know :

If you have installed material shell please remove it first, since the make install just makes it installed for the next login session (wayland). So you log out login and after log out it will default back to the previous installed version which could lead to confusions / false issues so please acknowledge this

git clone https://github.com/material-shell/material-shell.git -b  fix-\#945 
cd material-shell

# debian / ubuntu / pop os / linux mint
# apt install npm -y

# arch linux, manjaro, garuda etc
# pacman -S npm

# requires package groups base-devel / build-essentials 
make install
#org.gnome.mutter dynamic-workspaces true
#  gsettings set org.gnome.mutter dynamic-workspaces true

# on wayland for enabling fractional scaling (different between monitors)
# gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

If you stumble upon a bug please create an issue and we will link it here.

List of existing Issues

  1. fake second window spawn and generate empty half gap after intended window jumped to wrong monitor
    half - still sometimes does this (way less)

6 . (wayland) when sub window spawns it sometimes moves the parent window also to the other monitor, resulting in wrong click translation and leaving a gab on the monitor it previously was on, but the title bar of that monitor still contains that item but the window is now on the wrong monitor and is most of the times either half visible, half clickable or complete garbage. (ms believes it is still on that screen, so using up the screen space and showing the window as item in the window list but without the window being still present on the monitor

usually the bug is less heavy and just result in a broken window and workspace on where the gap.

dream

  1. monitor selection - random selection + mouse cursor position where to spawn window instead of current focused

  2. low prio - minor visual bug - border scaling - Setting request border thickness #865

  3. xorg - no scaling still wrong display click to window translation, operating with a off set (saw it to the top as well as to right)

Solved issues so far:

  1. panel + app launcher size scaling when using scaling on wayland
  2. still we get shortcut generated bugs regarding the closing of windows via shortcuts leaving gaps - xorg only - never saw this again
  3. spawn new window on wrong monitor which has no focus and quickly move new window, creating a unpleasant flashing effect
    solved by @PapyElGringo by dirty fix with check of lifetime from new windows (200ms) - best option for now
  4. click through windows so wrong click translation
  5. Password prompt loses focus while user is typing due to material shell background activity
  6. Focus App Launcher - leaves focus on wrong monitor - Focus App Launcher on multi-monitor setup puts focus on wrong display #896

@PapyElGringo
Copy link
Collaborator Author

You need to install the git version of the extension and then switch to the PR branch and make install

@PapyElGringo
Copy link
Collaborator Author

PapyElGringo commented Feb 23, 2023

For the monitor scaling issue:
After discussing with devs from Gnome it's seem that multi-dpi on Xorg is impossible and on Wayland it required to enable Fractional scaling
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"
I also had to changes some Material Shell code to be compatible with the Fractionnal scaling but now it should work
without this experimental features the Shell interface does scale on every monitor depending of the scale of the primary monitor

@PapyElGringo
Copy link
Collaborator Author

Did you applied the code changes by pulling and reinstall?

@PapyElGringo
Copy link
Collaborator Author

In order to apply lastest changes from the checkout branch you have to:

git pull
make install

For the flashing window does it happen when you open app from Material Shell launcher or from external sources like keyboard shortcut?

@PapyElGringo
Copy link
Collaborator Author

I pushed some changes that should help regarding the flickering issue and the hidden apps

@rizajur
Copy link

rizajur commented Mar 1, 2023

Screencast.from.2023-03-01.09-12-25.webm

the decision where to spawn the new window , on which monitor
but i also saw it when launching apps from the ms launcher

i didnt moved the window..

@PapyElGringo PapyElGringo requested a review from HalfVoxel March 3, 2023 10:37
global.display.get_monitor_scale(monitorIndex)
);
getPanelSize() {
return this.getScaledSize(this.themeSettings.get_int('panel-size'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this no longer depend on the monitor index? You can have different dpi scaling on different monitors, can you not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On X11 you cannot and on Wayland it does work properly only if you have fractionnal scaling enabled by gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']" and with this setting enabled the UI scaling factor is set to 1 and the scaling is automatically managed by Clutter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Add a comment :)

msWindow.lifecycleState.type === 'app-placeholder' &&
msWindow.lifecycleState.waitingForAppSince !== undefined
) {
// If there is an authentication dialog postpone the window cleaning process
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to do this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you try to open an app that require sudo there is an system authentication dialog that ask for the sudo password.
Our routine detect this has app didn't opened properly and close the MsWindow before the app could be opened which lead to actualizing the focus on another tileable stealing the focus from the authentication dialog

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Add a comment :)

* On creation window can jump from monitor to monitor quickly for obscure reason until they stabilize on the correct one
* In order to get ride of the visual glitch of this behavior we guard rapid changes
*/
setWindowToMsWorkspaceWithCreationChaosProtection(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, this is ugly, bug I suppose

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some gnome apps like the gnome terminal does jump around monitor on their creation causing tiling flickering I didn't found a better way to handle this

@HalfVoxel
Copy link
Contributor

When opening a new app on a workspace with multiple tabs already, the whole workspace animates quickly by sliding to the left. This is kinda jarring and not an improvement imo.

@PapyElGringo
Copy link
Collaborator Author

When opening a new app on a workspace with multiple tabs already, the whole workspace animates quickly by sliding to the left. This is kinda jarring and not an improvement imo.

This is a new behavior caused by this PR?

@HalfVoxel
Copy link
Contributor

This is a new behavior caused by this PR?

Ah, nvm. It's not caused by this PR.

@HalfVoxel
Copy link
Contributor

I tested it locally, and I cannot spot any obvious bugs.

@Xqua
Copy link

Xqua commented Mar 3, 2023

Hellllo :)

As this work is happening I'd like to add that I have another bug here. I can't get Workspaces to work on the second monitor. When I activate the option in gnome shell options, it reverts to workspaces on primary.

Thank you for working on this ! It'll make everything so much nicer <3

@HalfVoxel
Copy link
Contributor

HalfVoxel commented Mar 4, 2023

Under wayland, display scaling is kinda wonky. Ubuntu 22.04.1, Gnome 42.5.

I note that I can set my primary display to 200% scaling and a secondary display to 100% scaling. Gnome will display its settings app on that monitor using 100% scaling, but material shell will use 200% scaling on all monitors:
image
Gnome settings doesn't even allow me to use 200% scaling on my third monitor (probably because it is too small: it's old). And material-shell using 200% scaling on that display doesn't work well: The application launcher becomes so cramped that it doesn't display any applications at all:
image

Though, it is not great at automatically adjusting the dpi. When I drag the settings app from a 200% screen to a 100% screen. It stays at 200%, and I cannot interact with it until I switch the window layout back and forth.

Changing the display scale also seems to move windows between displays for some reason.

The window tabs do not immediately update after having changed the display scaling. They do update when I hover over them:
image

@PapyElGringo
Copy link
Collaborator Author

Under wayland, display scaling is kinda wonky. Ubuntu 22.04.1, Gnome 42.5.

I note that I can set my primary display to 200% scaling and a secondary display to 100% scaling. Gnome will display its settings app on that monitor using 100% scaling, but material shell will use 200% scaling on all monitors:
image
Gnome settings doesn't even allow me to use 200% scaling on my third monitor (probably because it is too small: it's old). And material-shell using 200% scaling on that display doesn't work well: The application launcher becomes so cramped that it doesn't display any applications at all:
image

Though, it is not great at automatically adjusting the dpi. When I drag the settings app from a 200% screen to a 100% screen. It stays at 200%, and I cannot interact with it until I switch the window layout back and forth.

Changing the display scale also seems to move windows between displays for some reason.

The window tabs do not immediately update after having changed the display scaling. They do update when I hover over them:
image

This is the behavior to on Wayland without gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']" are you sure you enabled this settings properly?

@HalfVoxel
Copy link
Contributor

This is the behavior to on Wayland without gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']" are you sure you enabled this settings properly?

We can't assume users will enable this. It should not break by default.

@rizajur
Copy link

rizajur commented Mar 4, 2023

It should not break by default.

// npm install gi      - within the project dir
import * as gi from 'gi';

const { Gio, GLib } = gi;

const SCHEMA = "org.gnome.mutter";
const KEY = "experimental-features";

// Create a GSettings object for the mutter schema
const settings = new Gio.Settings({ schema_id: SCHEMA });

// Get the value of the experimental-features key
const value = settings.get_strv(KEY);

// Check if the value includes "scale-monitor-framebuffer"
const isEnabled = value.includes("scale-monitor-framebuffer");

if (isEnabled) {
  console.log("is enabled")
  // Do something if the experimental feature is enabled
} else {
  console.log("is disabled")
  // Enable the experimental feature if it's not currently enabled
  value.push("scale-monitor-framebuffer");
  settings.set_strv(KEY, value);
  // Do something else now that the experimental feature is enabled
}

would something like this work? i currently cant debug

@PapyElGringo
Copy link
Collaborator Author

We can't force enable as Gnome can't enable this option by default because it come with severe downside too (XWayland window become blurry). The best thing we can do is to invite them to do it but we don't have a proper place to do that.

We should have a specific page to warn users about stuff like incompatible extensions, warning about settings override and stuff but we currently don't.

I'll still merge this as it's full of improvements with no down-side

@PapyElGringo
Copy link
Collaborator Author

@Xqua Sorry for the answer delay ! You are right we are currently incompatible with span workspaces but it's not a trivial work to be done

@PapyElGringo PapyElGringo merged commit 292984b into main Mar 6, 2023
@PapyElGringo PapyElGringo deleted the fix-#945 branch March 6, 2023 10:18
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.

4 participants

X Tutup