The Window Manager Construction Toolkit Kwin Goes Scripting

The Window Manager Construction Toolkit Kwin Goes Scripting

The Window Manager Construction Toolkit KWin goes Scripting Martin Gr¨aßlin [email protected] Akademy 2012 01.07.2012 Agenda 1 History of KWin Scripting 2 Scriptable Types of KWin 3 Influence on Codebase 4 Example of 3rd Party Usage 5 Development of Scripts 6 What's Next? Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 2/43 Agenda 1 History of KWin Scripting 2 Scriptable Types of KWin 3 Influence on Codebase 4 Example of 3rd Party Usage 5 Development of Scripts 6 What's Next? Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 3/43 Tokamak IV Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 4/43 Akademy 2010 Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 5/43 GSoC as Prototype Google Summer of Code 2010 Implemented Scripting Support API hand-crafted API Documentation hand-written Strong interweaving of core and scripting Scripts invoked at wrong places Scripting module undocumented Prototype This prototype should never have been merged! Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 6/43 GSoC as Prototype Google Summer of Code 2010 Implemented Scripting Support API hand-crafted API Documentation hand-written Strong interweaving of core and scripting Scripts invoked at wrong places Scripting module undocumented Prototype This prototype should never have been merged! Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 6/43 Going Generic: Animation Effect Issues with Effects Many Effects to animate window state changes Code got copied over and adjusted Changes to Effect System difficult to implement Same errors present in many Effects AnimationEffect Base implementation handling animation Effects only react on state changes Better suited for 3rd Party usage Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 7/43 Going Generic: Animation Effect Issues with Effects Many Effects to animate window state changes Code got copied over and adjusted Changes to Effect System difficult to implement Same errors present in many Effects AnimationEffect Base implementation handling animation Effects only react on state changes Better suited for 3rd Party usage Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 7/43 Plasma Active Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 8/43 Agenda 1 History of KWin Scripting 2 Scriptable Types of KWin 3 Influence on Codebase 4 Example of 3rd Party Usage 5 Development of Scripts 6 What's Next? Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 9/43 Window Switcher Window Switcher Problematic Not one size fits all possible Caption length very different Thumbnails only useful if large Icons partially useful Effects do not use a toolkit Solution since 4.8 Windows are provided in a Model QML for GUI DeclarativeItem to render a thumbnail Documentation on Techbase http://ur1.ca/9jzyw Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 10/43 Window Switcher Window Switcher Problematic Not one size fits all possible Caption length very different Thumbnails only useful if large Icons partially useful Effects do not use a toolkit Solution since 4.8 Windows are provided in a Model QML for GUI DeclarativeItem to render a thumbnail Documentation on Techbase http://ur1.ca/9jzyw Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 10/43 Desktop Switcher Window Switcher's Little Brother Shares Framework with Window Switcher QML Support since 4.9 Only one available layout DeclarativeItem for Desktop Preview missing Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 11/43 QtScript Primary Scripting Functionality function synchronizeSwitcher(c) { Clients exported to Script c.skipSwitcher= c.skipTaskbar; Wrapper around Workspace } Full access to KWin's function setup(c) { synchronizeSwitcher(c); Options c.skipTaskbarChanged.connect(c, Everything QProperty based synchronizeSwitcher); } Script (un)loading at workspace.clientAdded.connect(setup); Runtime through D-Bus // connect all existing clients Global Shortcut Support var clients= workspace.clientList(); for(vari=0; i<clients.length; i++){ Screen Edge Support setup(clients[i]); } Configuration Support Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 12/43 Declarative Scripts GUI for QtScript Same API exported as for import QtQuick 1.0 import org.kde.kwin 0.1 as KWin QtScripts ListView { objectName: "listView" Support Plasma model: clientModel Components delegate: KWin.ThumbnailItem { wId: windowId Support Window Switcher's width: 200 Thumbnail Item height: 200 } Limited Usage: no \real" } windows Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 13/43 Effect Scripts Generic++ var fadeInTime, fadeOutTime, fade; function loadConfig() { Based on AnimationEffect fadeInTime= animationTime( effect.readConfig("FadeInTime", 150)); QtScript based fadeOutTime= animationTime( No Script execution in effect.readConfig("FadeOutTime", 150)); fade= effect.readConfig( rendering phase "FadeWindows", true); } API close to KWin Scripts loadConfig(); No access to Workspace effect.configChanged.connect( function() {loadConfig();}); Access to Windows instead effects.windowAdded.connect(function(w) { if (fade&& isFadeWindow(w)) { of Clients effect.animate(w, Not as elaborated as KWin Effect.Opacity, fadeInTime, 1.0, 0.0); } Scripts }); Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 14/43 Window Decorations Aurorae 3 Rewritten in QML Decoration Bindings a side-product Theme Preview is interactive More To Come QML theme support under development Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 15/43 Agenda 1 History of KWin Scripting 2 Scriptable Types of KWin 3 Influence on Codebase 4 Example of 3rd Party Usage 5 Development of Scripts 6 What's Next? Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 16/43 Dogfoding License: CC BY 3.0, by Wikimedia Commons Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 17/43 Options Historic Artifacts Fixed with Scripts Options a singleton to all Member variables are private Config values Access only through Implemented access to Getters&Setters public member variables Dependency between Dependencies between options ensured through options not ensured setters Design present in first QProperties added commit Documentation added setAutoRaise(config.readEntry("AutoRaise", Options::defaultAutoRaise())); setAutoRaiseInterval(config.readEntry("AutoRaiseInterval", Options::defaultAutoRaiseInterval())); setDelayFocusInterval(config.readEntry("DelayFocusInterval", Options::defaultDelayFocusInterval())); setShadeHover(config.readEntry("ShadeHover", Options::defaultShadeHover())); setShadeHoverInterval(config.readEntry("ShadeHoverInterval", Options::defaultShadeHoverInterval())); Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 18/43 Desktop Change OSD Improvements through Script Dropped a Build Option Workspace had code to create OSD Fixed several bugs Removed 700 lines C++ code Just 280 lines of QML Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 19/43 Simple Effect Ported Effects Fade Fade Desktop Prototype for Sheet More? Waiting for you! Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 20/43 Simple Effect Ported Effects Fade Fade Desktop Prototype for Sheet More? Waiting for you! Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 20/43 Window Switcher Grid Present Windows Mode Window Switching in Present Windows was a Hack Did not work well with Multiple Screens Best overview for many windows Requires Desktop Effects Grid Window Switcher Layout Does not require Desktop Effects Proper Multi-Screen support Dropped special handling in effect (180 SLOC) Martin Gr¨aßlin| The Window Manager Construction Toolkit | Akademy | Tallinn | www.kde.org | 21/43 Introduction of QProperties Preparing for Wayland class Client : public Toplevel Describes Client's interface { Q_OBJECT /** Adds documentation * Whether this Client is active or not. Use Workspace::activateClient() to activate a Client. * @see Workspace::activateClient Used by Effect System **/ Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) 40 properties on Toplevel /** * The Caption of the Client. Read from WM_NAME property together with a suffix for hostname and shortcut. * To read only the caption as provided by WM_NAME, use the getter with an additional @c false value. 37 properties on Client **/ Q_PROPERTY(QString caption READ caption NOTIFY captionChanged) 65 properties on Options /** * Whether the window can be closed by the user. The value is evaluated each time the getter is called. 14 properties on Workspace * Because of that no changed signal is provided. **/ Wrapper Q_PROPERTY(bool closeable READ isCloseable) /** * The desktop this Client is on. If the Client is on all desktops the property has value -1. Most of Extended Window **/ Manager Hints exported Q_PROPERTY(int

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    49 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us