lunedì 15 settembre 2014

What's coming to Green Island: part 1


I want to share with you some of the progress I recently made.
This is not all, more will come in another post.

Multi output support: part 1

Green Island now supports multiple outputs.

QtCompositor only support one output so in order to do this I did a little abstraction to enumarate outputs and played with QML to show them in the compositor window.

How does it work?

It's pretty simple: it has a ScreenModel that provides data such as name, primary boolean flag and geometry. The main QML file has a repeater using this model to create an OutputView for each output.

Every OutputView has layers to stack different kind of windows (panels, lock screen, workspaces), one of the layers is HotCorners which contains 8 hot corners.

During test and development one often need to fake outputs to test several different configurations without having real monitors, but this requires a dedicated backend and a configuration format.

So ScreenModel has its own backend code, one of the backends is based on QScreen and the other is for fake outputs.

Studying the problem and doing some prototype made me realize that QScreen has a very limited API (for example it doesn't detect when the primary output changes) and that this matter was already implemented with libkscreen.

It happens to be a framework that doesn't pull in undesired dependencies, so now Green Island is using it and I have to say it saved me a lot of work.

In the video below you can see a Green Island window with two 1024x768 outputs side by side, at some point the first one (which is also primary) is removed and all the windows are migrated to the other output that is now the new primary output.


Multi output support: part 2

A single big fat window for all the outputs is not such a great idea, it was good enough to continue the development keeping multiple outputs in mind but it's not the solution in the long run.

Such a solution may hit hardware limits pretty, plus outputs can have a different refresh rate so they really should not be done this way.

QtCompositor handles only one window so I patched it to be aware of multiple outputs with one window for each of them.
The patch targets the dev branch and at the time of this writing is in the review queue.

All the QML code was reused except for the Repeater and the logic to move windows when an output goes away was moved to C++.
This means that almost none of the code previously wrote was removed.

The hard part came when I needed to figure out how to show the same surface on multiple output windows.

Considering that QQuickItems cannot be shared between multiple windows I had to create a view for each output.

When a shell surface is created for a surface, the compositor creates a view that inherits from QQuickItem, the output is assigned based on the mouse pointer coordinates. No other view is created at this time because the position is calculated to be within output bounds considering the surface size.

More views are created on demand when the surface is mapped.

As windows are moved all views are moved accordingly, global coordinates are mapped to the output coordinates so that windows are shown only where they are meant to be.

Unresponsive applications

Wayland offers a ping/pong API that compositors use to know whether a surface is responsive or not, even with CSD (in the past there was some concern about this).

When a window is clicked, Green Island ping the surface and if it doesn't reply with a pong within 200ms it marks it as unresponsive and apply a colorize effect, draw some explanatory text, and intercepts mouse input. It also adds a couple of push buttons, one to wait for the application to become available again and the other to brutally murder the application.



domenica 6 luglio 2014

Maui using Mer

Back in Sep 2012 I sent an email to the Qt Interest mailing list showing off Hawaii and what I was doing.

After that I've been contacted by a couple of people from the Mer Project that explained to me what Mer is and what advantages it offers.

After I recovered from the overwhelming quantity of information to process I found a very warm and enjouable community.

Mer didn't come at that time with x86_64 support which was and still is pretty important to me because the main focus is desktop and todays machines are likely to have 64-bit capable CPUs.

Another issue was packages that were not up to date. Hawaii requires the latest version of many packages (mainly systemd, wayland and Qt) and so I decided to keep using Yocto as a base system building components on top of it with mauibuild and postpone my decision.

Here we are now, I've been using and updating Mer for the past months, packaged a lot of stuff and worked on a few adaptations besides x86 and x86_64, mainly Raspberry Pi.

OBS is a very nice tool that does a lot for you like rebuilding dependencies when you update a package and with kickstart it's been quite easy to make images.

There's a new mauibuild work in progress version that builds images from kickstart files with mic.

mic, the image creator, has been extended with a few plugins for Maui that bring improved syslinux configuration, dracut support, plymouth and plymouth-lite detection, and UEFI support although this cannot be used until I packaged grub2 and all the signing stuff.

Now that OSTree is getting RPM support this migtht work out very well with my original idea of atomic upgrades.

Even if Mer now has x86_64 support there's a nasty bug preventing me from creating x86_64 images but I found a way to work around the issue, I will likely be able to build both 32-bit and 64-bit images soon.

sabato 26 aprile 2014

2048 with QML

So apparently everyone's crazy about the 2048 game.
I'm probably the last guy on Earth that discovered it but I really enjoy it.

Since my phone doesn't have a data plan I decided to port the game to QML, so I can play it with my Jolla while commuting to work.

To kill two birds with one stone, I started writing a desktop friendly version for Hawaii but it can be used in any desktop environment and once touch support is added it will work on mobile too.

You can find the source code here.

The logic code has been ported straight from this version, which BTW seems the original implementation. It was the easiest part but I must admit that the graphical part didn't take more time thanks to QML.

Colors are from this version but I plan on letting the user change it.

The UI is fully scalable so here's how it is at startup:



but the grid and the text inside tiles is scaled (although calculation is a bit lame) with the window keeping its aspect ratio:



I did this a month ago and never had the time to polish it.

Off the top of my head there are a few important things left to do:

  • Animations
  • Palette loading

domenica 16 febbraio 2014

Updates and plans for the next Hawaii version

QtDay and FOSDEM are over and I finally took some time to update the plans for the next Hawaii version.

First things first. Next Hawaii iteration will be the 0.3.0 release.
At first I thought to do minor improvements in a 0.2.1 version and release shortly after 0.2.0 but then I decided to do more work.

Most of the stuff is already implemented at this point, but it needs further improvements.

So what should you expect for Hawaii 0.3.0?

Weston 1.4 is here now so the plugin was ported to the new version, some code refactoring is needed though to make the code more manageable.
The plugin will also support drop-down windows and a whitelist for trusted clients that need to access some Wayland interfaces (a possible usage is a screenshot application).

Shell is going to be improved with better multiple screen management, multiple panels (you can have one panel for each edge), configuration directly accessible from the panel, elements in panels can be reordered.

There was also a major refactoring, components such as dialogs, popups and overlays were moved to a plugin that can be used by external QML applications.

This was necessary in order to separate the PolicyKit agent and notifications daemon from the shell.
Other desktops (I'm thinking about LXQt here) can use these components more easily now if they wish.
Both are not launched by the shell automatically and currently there's no switch to turn them on and off but there are units for the systemd user session so you can manage them from the command line or with a graphical frontend. I can't exclude a service manager integrated in Hawaii in the future but there are no plans yet.

Compositor and deamons now notify systemd upon startup and as I mentioned above there is support for systemd user session however I'm having some problems running weston.

Screensavers. Yes it's a bit anachronistic but some people might enjoy it.
It's disabled by default and currently there is no switch to turn it on and off, later a preferences applet will be available.

As I showed during FOSDEM, now Hawaii can switch between different layouts on the fly.
This is one of the main goals of this project and goes by the name of convergence these days.
I will talk more about it in another post but the idea is to have a dedicated user interface for different devices and even react to things like input devices or screen resolution changing.

This work also make it easier to implement animated wallpapers because the shell is now much modular and can load different components.
Currently the background is implemented by a QML component that according to the settings draws a picture, a solid color or a gradient.
Animated wallpapers are just loadable QML components that does nice stuff such as animations, react to mouse click and tap to change the background and so on.
At this point it becomes clear that Hawaii needs a generic way to deal with this things, hence the standard background is going to be split in a wallpaper plugin, a solid color plugin and a gradient plugin and will be no more different than animated wallpapers.

Here you can see the task list.

martedì 4 febbraio 2014

Hawaii responsive user interface

This was written after FOSDEM but never had the time to finish it and do the video so with too many months of delay I've got some time in my hands to post about the Hawaii desktop environment responsive user interface.

Hawaii is currently focused on desktops and laptops but it's always been a goal to get ready for other devices as well supporting screens with different DPIs.

Why bother, can't we just do the same user interface and let the controls scale according to DPIs and expand contents to fit the screen size? No, we can't because there are differences between devices.

Desktops and laptops have a keyboard and most of the time a mouse and to complicate things even further they can also have a touchpad, for example I own an Apple Magic Trackpad.  Mobile devices, on the other hand, have touch input, no keyboard and higher DPIs.

The same user interface cannot be used for different devices, the user expects it to suit the device.

On a tablet the user expects to see an application at a time and use several gestures, there is also less screen space so you have to design interfaces with fewer things on screen.
The opposite is true on desktop where you can show multiple windows and some tiling feature is more than welcome and since the mouse is more precise you can put more controls on the screen.

Today there are some devices like the Yoga that can alternatively be turned into either a tablet or a laptop. The only problem is that it's not cheap, I will have to save money before buying one :)

That's why I prefer calling this responsive user interface rather than convergence.

Hawaii should react on events such as screen resolution change, mouse plugged in or touch input device plugged in and load the user interface that is willing to step in and show a user interface for the current setup.

To make development easier the switch happens reading settings with the QtConfiguration library that supports changes notifications. That's enough to simulate an event. In the future I plan to use Solid to determine what's the current setup like, but maybe QScreen and QTouchDevice will be sufficient.

Most things that a desktop environment need can be shared between shells, for example lock screen management, idle state management, notifications, power management and sounds are all features that need to be done once.

With Green Island, the QML compositor, one can also plug in different ways to manage windows and panels all with their Wayland protocol interface.

This is not all. Applications need to switch the user interface too, so I've been experimenting with QFileSelector and QQmlUrlInterceptor.

In the application demo I have used QQmlUrlInterceptor.
The application has a content directory with the QML code for the desktop with the following subdirectories that override files for specific profiles: +phone, +tablet, +touch

The +touch subdirectory contains code for all touch user interface, one example is the list view delegate, +phone and +tablet override the main view (the tablet version has a menu that can be pulled from the left with a gesture while the phone version has it always visible).

For demo purpose, the user has to pass all the relevant profiles to the application so for example if I want the tablet version both touch and tablet are passed as arguments.

Here's a little video showing the switch from a tablet UI to a desktop UI and different layouts for the same application.


As you can see the tablet user interface has two panels (launcher at the bottom edge and a smaller panel with indicators on top), it also have a desktop view with a search bar and application icons. Stacked below there's the background view.  The desktop user interface is the classic Hawaii shell that has a bottom panel with more elements.