Multiple screens / xrandr #131

Open
x2b opened this Issue Mar 26, 2015 · 17 comments

Comments

Projects
None yet
4 participants
Contributor

x2b commented Mar 26, 2015

Let me start by saying that tilda is awesome and I much appreciate your work on it :)

My problem is the following: I have a convertible tablet (x230t) and I frequently rotate the screen to take notes / attach an additional screen via HDMI. As a result the screen dimensions and available screens change rather often. Unfortunately many applications don't seem to be dealing with this problem correctly and tilda seems to be among them.

For one thing the "Monitor" setting does not seem to be persistent: The monitor numbers don't seem to be suitable to identify monitors when cables are (un)plugged or across restarts so you have to set everything up all over again each time. Unfortunately it is also impossible to drag the tilda window like a normal window.

In addition the config does not save the percentage of the screen which is supposed to be used but rather the amount of pixels. This is generally not what I want and I would appreciate it if you could give people the choice between whether to use percentage or absolute values.

On Thu, Mar 26, 2015 at 07:16:25AM -0700, x2b wrote:

Unfortunately it is also impossible to drag the tilda window like a normal window.

Not sure if you consider this "normal", but I
can alt+left click to drag the tilda window around. I use openbox, but
I believe I've done this in MATE as well.

Owner

lanoxx commented Mar 26, 2015

Holding down ALT is probably a feature of Openbox. It also works in metacity and many other window managers, but thats not something provided by Tilda. Never the less the design of Tilda is not targeted towards moving the window often so this is not possible and will also not be implemented any time soon.

But I agree that tilda should recognize if the screen orientation changes. There is a signal called "monitors-changed" in GdkScreen that I could probably use for that. I am going to a look at this.

Contributor

x2b commented Mar 27, 2015

I am working on gdm, ALT + left click does not work on my system. But just to illustrate the persistency problem, I have written a small piece of code (https://gist.github.com/x2b/fadc219ecb2bf9bef17d) to test the assignment of screen numbers to physical monitors. If I plug a monitor using an HDMI cable, the result is:

$ ./screen_test 
Monitor number 0, name: HDMI1
Monitor origin: (0, 0), width = 1920, height = 1200
Monitor number 1, name: LVDS1
Monitor origin: (1920, 0), width = 1366, height = 768
Primary monitor: 1

Now if I unplug the monitor again I get the following:

$ ./screen_test 
Monitor number 0, name: LVDS1
Monitor origin: (0, 0), width = 1366, height = 768
Primary monitor: 0

As you see, the monitor numbers do not persistently correspond to physical monitors. Instead they seem to be assigned in an arbitrary, unforeseeable fashion. Therefore I suggest that we use the monitor plug names instead of the monitor numbers to store the monitor configuration. If you're ok with that idea I would start working on it.

Owner

lanoxx commented Mar 27, 2015

I was thinking about this problem too. In general I have no objections, but I have a question, what would happen if I have two monitors of same type: DVI-0 and DVI-1, and I plugout DVI-0? will DVI-1 be renamed to DVI-0 or will it keep DVI-1 as its name? Do we need special logic to handle this case?

Owner

lanoxx commented Mar 27, 2015

Btw. gdm provides x-display-manager not x-window-manager the ALT-feature is something that would be provided by your window manager not your display manager.

Contributor

x2b commented Mar 27, 2015

Well, regarding monitors of the same type I am actually not sure what would happen. Unfortunately I have no setup to test that... Still I think working with the device name would be a step forward and it would most certainly solve my problem.

Owner

lanoxx commented Mar 28, 2015

Ok. If you have time to write a patch that would be great.

x2b added a commit to x2b/tilda that referenced this issue Mar 28, 2015

A first try to fix lanoxx/tilda#131
The config file now stores the monitor plug name
Contributor

x2b commented Mar 29, 2015

Let me know where you come down on this...

lanoxx added a commit that referenced this issue Mar 30, 2015

Multi-Monitor support: Use monitor names
 * The config file now stores the monitor plug name instead of
   the monitor number. For example instead of saving 0 for the first
   monitor we now save "DVI-0" or "VGA-3". Note that monitor 0 must
   not necessarily be "DVI-0" but can also be "DVI-3".
 * See Issue #131
Owner

lanoxx commented Mar 30, 2015

Hi,

I have reviewed you commit and I think it looks good. I have rebased it onto master and pushed it to a new branch wip/monitornames with only some minor changes. I tested it on my notebook and it works, but I have one suggestion.

We should also handle the monitor-changed signal. Currently on my notebook, when I have tilda on VGA1 and remove that screen my window manager automatically moves it to LVDS1 but it ends up with an x-position of max_width which does not make much sense. Also if I do not open the wizard and plug the VGA1 back in, then tilda jumps back to VGA1 if that was its original position. But if I open the wizard before I plugin VGA1 then the combo box is reinitialized and VGA1 is removed so when I plugin VGA1 after that, then tilda will not move back to VGA1. I think its because you clear the list store in initialize_combo_choose_monitor. So an idea would be to save the last monitor name in the tilda_window struct and when the monitor-changed signal arrives and that monitor becomes available, we automatically move tilda to that monitor again.

What do you think about this?

Contributor

x2b commented Mar 30, 2015

I absolutely agree, the monitor-changed signal was going to be my next suggestion :) I am going to try to reproduce the issue with plugging / unplugging the monitors. However, I also noticed the following: tilda does not store whether the user wants the width / height relative to the screen dimensions or as absolute values. I generally want the former. However, if I plug in a monitor with a lower res than my built-in, move the tilda window to that monitor and unplug it, the tilda window is too small for my built-in monitor again. However the wizard seems always consider the relative placement when moving the window.

x2b added a commit to x2b/tilda that referenced this issue Mar 30, 2015

Contributor

x2b commented Mar 31, 2015

@lanoxx does the problem persist with the latest patch? I can't seem to reproduce it...

lanoxx added a commit that referenced this issue Mar 31, 2015

Multi-Monitor support: Use monitor names
 * The config file now stores the monitor plug name instead of
   the monitor number. For example instead of saving 0 for the first
   monitor we now save "DVI-0" or "VGA-3". Note that monitor 0 must
   not necessarily be "DVI-0" but can also be "DVI-3".
 * See Issue #131

lanoxx added a commit that referenced this issue Mar 31, 2015

Contributor

x2b commented Apr 7, 2015

As far as I am concerned the remaining problem is how to deal with different screen geometries. In my opinion we should ask the users (via the wizard) whether they want to the window to always have the same size in pixels (as far as geometry permits it), whether they want a fixed percentage of the screen to be covered or maybe how many lines / columns they want.

Owner

lanoxx commented Apr 8, 2015

I think there is another problem. This wizard should be aware of monitors that are configured but have been removed. If tilda is configure to be on DVI-1 and its removed then the wizard should know about this.

So when the wizard is opened there should be a label under the monitor combo box like this:

Tilda is configured to show on `VGA-1` but this monitor is currently unavailable. Tilda is currently on monitor `LVDS-1` and will be automatically moved back to `VGA-1` When this monitor is plugged in again. 

The combobox should still show VGA-1 but in red color.

What do you think about this?

I agree about the width in pixels vs. percentage issue. I would suggest to change the UI to use radio buttons, so the user can use either pixels or percentages but not both at the same time.

Unfortunately I dont have time to work on tilda this week.

lanoxx added a commit that referenced this issue Oct 11, 2015

Multi-Monitor support: Use monitor names
 * The config file now stores the monitor plug name instead of
   the monitor number. For example instead of saving 0 for the first
   monitor we now save "DVI-0" or "VGA-3". Note that monitor 0 must
   not necessarily be "DVI-0" but can also be "DVI-3".
 * See Issue #131
Owner

lanoxx commented Oct 11, 2015

I have pushed some of your commits today. In particular the part that switches Tilda to use monitor names. I should have done that a long time ago, sorry that it took so long. For the future, make sure you commit small and clean patches (e.g. without some of the more verbose changes done by glade that are caused by using different versions of glade to edit the ui file).

I am not yet happy with the patch tilda window reacts to changes in screen geometry, I will comment inline on it.

Note that I have added a few things to your original patch:

  1. You removed the old option show_on_monitor_number, I readded that and added migration code to remove it and emit a warning.
  2. I now print both the number and the name in the combo box, internally it now stores the monitor_number, monitor_plug_name and a display_name, the display name uses mark up which should make it easier to extend this in the future (e.g. to remember removed monitor names and mark them red as I suggested in an earlier comment).

I split up some of your code clean up changes into a separate commit, for future commits please always send me separate commits for this, then I will also be able to review and merge your commits faster.

Owner

lanoxx commented Oct 11, 2015

In addition the config does not save the percentage of the screen which is supposed to be used but
rather the amount of pixels. This is generally not what I want and I would appreciate it if you could
give people the choice between whether to use percentage or absolute values.

I thought about this and I think the solution is to split the whole sizing part into two groups which can be selected by radio buttons, one group for percentage based sizing and another one for pixel based sizing. Doing this would also allow us to get rid of the code that updates the pixel based spinners based on the percentage changed and vice versa and that would make the code much simpler.

Good day @lanoxx, I am very very interested in this last feature that you are talking about. Normally I work on my laptop and, in the lab, I connect a second monitor. Every time y have to manually resize the tilda windows in preferences, because it save the pixel number, not the percent (100% in my case), then when I change to the laptop the size is outside the screen. I think that you are right, the radio buttons will fix it. I want to know, are you working on it? Can I help you? This is the only thing I need to forget yakuake XD

Owner

lanoxx commented Feb 16, 2016

Hi @vialrogo,

I am not currently working on this, but I would like to do this for 1.4, of course it all depends on how much time I have.

If you would like to work on it, feel free to send me a pull request. If you have some questions regarding the implementation or design, please let me know.

lanoxx added a commit that referenced this issue Oct 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment