Clock and quotes: The clock shrinks and position changes with two monitors

Bug #1096035 reported by Crimbo
48
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Variety
Confirmed
Low
Unassigned

Bug Description

I love the clock feature - it looks so good!

When I set it up on a computer I have with two monitors, the clock shrinks and position changes. On my second monitor, it actually clips off screen. When I unplug the additional monitor, the clock displays as it should. I reckon this is happening because total desktop area is much wider than just having on monitor.

It would be nice if you could select it to only show on the primary monitor.

Version: 0.4.12
Unity
Ubuntu 12.10

Revision history for this message
Crimbo (ckhatton) wrote :
Revision history for this message
Peter Levi (peterlevi) wrote :

Clock is drawn on the wallpaper image so it is not possible to have it on one monitor only, as Ubuntu uses the same wallpaper image for both monitors. Position is calculated according to the primary monitor's display resolution (actually whatever GTK calls "default display") and the size of the image itself, and the calculations assume that the user is using the "Zoom" setting for showing the wallpaper (this is the default and most reasonable setting and probably 99% of users use it), which means that images wider than the screen ratio will be clipped at the sides, while images higher than the screen ratio will be clipped at top/bottom. Clock is then drawn on the image so as to compensate for these clipped regions.

So, in theory, assuming that you are using the "Zoom" wallpaper setting, clock should display always OK on your primary monitor and, yes, on your second monitor the clock won't display correctly if it has different proportions than the primary. Does this describe correctly your situation?

Now, the problem is, with the above-described approach of drawing the clock on the image itself, I can't really do anything to fix this problem - Ubuntu does not allow having different wallpapers per screen. The only solution is to adopt a completely different way of drawing the clock (e.g. drawing to root screen, separate transparent window, etc.), but every other approach has its own set of problems and limitations.

So, I see there is a problem, but can't think of anything at the moment that will resolve it and am open to suggestions.

Changed in variety:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Peter Levi (peterlevi) wrote :

Actually, as a workaround - you can configure the clock to display farther from the edge, or even center it, so that it falls within the visible space of both screens. Please read here on how to configure it: http://peterlevi.com/variety/2012/11/configuring-the-clock/

Revision history for this message
Crimbo (ckhatton) wrote :

Thanks for the fast response - the information was helpful.

Revision history for this message
Peter Levi (peterlevi) wrote :

Actually, the clock does shrink more than normal even on the primary monitor. This is because the GDK call to return the screen resolution returns the total size of all monitors, so Variety thinks the display is larger than it is and scales the image to fit this larger resolution, and afterwards Gnome scales it down further to fit it on each monitor, thus reducing the clock and quotes sizes.

This can be fixed only if Variety analyzes the whole monitor setup, as well as the wallpaper setting (Zoom, Span, etc.). Looks like too much work and code complexity for what it is worth.

Revision history for this message
Crimbo (ckhatton) wrote :

Thought as much. Just needs an algorithm sussed - I'm picturing loads of IF statements :) It would only really work, as well, if each monitor had its own individual wallpaper.

Revision history for this message
Crimbo (ckhatton) wrote :

I've suddenly had a spark...

How about adding a drop-down box for users to select the resolution of the primary monitor?
Selecting 'Default' will keep it calculating the desktop size of all monitors.

...Because the wallpaper stretches to fill, right?

Revision history for this message
Peter Levi (peterlevi) wrote :

Not needed - the resolution can be found in the program. This is not the issue. The wallpaper does not necessarily stretch - the mode can be one of several different (Zoom repeats the wallpaper on every monitor, Span "spans" the image on all monitors), and besides this setting is DE-dependent and hard to obtain. Taking these two factors (resolution of primary and display mode) into account makes the calculation too complex without resulting in a "perfect" result anyway. For now users have the ability to fix things by editing the clock filter, which actually gives them more freedom to achieve what they like.

Revision history for this message
John Drouhard (jmdrouhard) wrote :

Unfortunately, changing the clock filter doesn't allow the position of the quotes to be fixed. Quotes have the same issue as the Clock. I realize the preferences menuhas these options, but the size is still distorted because Variety thinks the resolution of the *wallpaper* is different than it should be. Requiring users to change the sliders to reposition quotes and to modify an ImageMagick filter just to get those to display in the correct locations seems to be against the philosphy of Variety being easy to use. This also doesn't apply to the advanced filter effects or the "require minimum resolution" preferences since Variety is basing its calculations off of a size that doesn't directly correlate to the way it'll be displayed on the actual system.

If the "default" configuration that you intend Variety to work best with out of the box is for a user to have "Zoom" and each monitor in their setup have its own wallpaper (the default for extended desktops on Ubuntu with multiple monitors), then I propose the calculations for screen size be determined based off the resolution of the primary monitor instead of the entire screen space.

I attached a patch that implements this proposed fix for multiple monitors.

Revision history for this message
Peter Levi (peterlevi) wrote :

Thanks for the patch, John. As far as I remember last time I was thinking about this problem, I also thought about this approach, but found some issue with it that made me drop the idea, but I can't recall now what it was. In fact, it may have actually applied to something else in Variety. When I have the time, I'll try to recall what my concern was and if nothing comes up, I'll apply the patch.
(The obvious (small) problem is that this would break it for users using "Span" mode, but my vague memory tells me there was something worse than this.)

To be fair, this needs a proper fix that would actually obtain the zoom/span/etc. setting and would use either primary or total size accordingly, but I'm just very reluctant to have even more DE-dependent code in there, as it makes support a bitch...

Revision history for this message
John Drouhard (jmdrouhard) wrote :

Understood! There was actually one mistake in my patch. In Util.py, the height needs to call get_default() on Screen before it can call get_monitor_geometry() (at least I think...). Not sure how I missed that...

However, because I think Variety is such an amazing utility, and because I use multiple monitors on my primary Linux desktop, I actually went ahead and implemented a mechanism that will let Variety determine whether it will use the primary monitor resolution or the full screen resolution, based on whether the current wallpaper is being spanned or not. I tested xfce4 and gsettings (Gnome3 and Ubuntu Unity), and it seems to do the job pretty well. I've attached this (larger) patch if you were interested. I understand it makes support a little tougher, but at least the way I did it, it will default to utilizing the primary monitor's resolution for calculations (which is what most users will want, I expect).

Revision history for this message
Crimbo (ckhatton) wrote :

This is great news.

I did suggest a drop-down box for selecting the resolution of the primary monitor (if the program couldn't detect it), 'Default' selection keeping it calculating the desktop size of all monitors together.

@peterlevi I think it was that the calculation would be too complex to take zooming and spanning into account.

Revision history for this message
Crimbo (ckhatton) wrote :

I hope that did not come across as a 'I told you so'... I'm just pointing out another angle.

Peter Levi (peterlevi)
summary: - Clock: The clock shrinks and position changes
+ Clock and quotes: The clock shrinks and position changes with two
+ monitors
Revision history for this message
Jonathan D'Orleans (jonathan.dorleans) wrote :

Hey everyone, Is that problem related to the Quotes font size too ?
Reported in this: https://bugs.launchpad.net/variety/+bug/1323425

I've read the comments and it seems it should only happen when we have 2 different resolutions. However, in my case, my other monitor has the same resolution of the default one. Both my laptop monitor and the external monitor are configured with Full HD resolution and everytime I'm only using my laptop the Quotes font size changes.

I've tested it with Ubuntu 14.04 and 15.10 using Variety v0.5.5. Is there any workaround to fix that ? thx.

Revision history for this message
Peter Levi (peterlevi) wrote :

Jonathan, you are probably correct - Variety's computation for this uses a method which returns the total screen resolution, so when you plug two monitors, Variety "sees" it as a bigger screen.

This should probably be fixed by using only the primary screen for calculations. We cannot get correct font-sizes on all monitors when resolutions differ with the current approach of drawing on the wallpaper image, but let's get at least one monitor right.

But I haven't had enough time and opportunities to work on Variety in a multi-monitor setup.
Patches for this are welcome.

Revision history for this message
Dasgrooves (dasgrooves) wrote :

Is this the correct code for a 12 hour set up?

clock_filter = "-density 100 -font `fc-match -f '%{file[0]}' '%CLOCK_FONT_NAME'` -pointsize %CLOCK_FONT_SIZE -gravity SouthEast -fill '#00000044' -annotate 0x0+[%HOFFSET+58]+[%VOFFSET+108] '%I:%M %p' -fill white -annotate 0x0+[%HOFFSET+60]+[%VOFFSET+110] '%I:%M %p' -font `fc-match -f '%{file[0]}' '%DATE_FONT_NAME'` -pointsize %DATE_FONT_SIZE -fill '#00000044' -annotate 0x0+[%HOFFSET+58]+[%VOFFSET+58] '%A, %B %d' -fill white -annotate 0x0+[%HOFFSET+60]+[%VOFFSET+60] '%A, %B %d'"

I ask because it is not changing the set up at all
Why can there not be a switch to change from 12 to 24 hour set up or vise versa?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.