[Development] extending the cocoa native style via a plugin: feasible?
René J.V. Bertin
rjvbertin at gmail.com
Tue Dec 1 10:52:46 CET 2015
I'd hoped to make this a shorter message, so please bear with me...
I'm currently working to facilitate deployment of the KF5 Frameworks (and dependent applications) on OS X, and looking to provide the best possible experience by supporting as much as possible of the KDE feature set.
To me, that clearly includes supporting the different font roles used throughout KDE. Even if we ignore the question whether applications should allow the user to configure a different typeface than what the system would use, an interface will evidently look (and possible work) better if it is displayed with the relative sizes and weights for which it was designed.
It would thus be interesting to have an extended native theme that supports the use of different font sizes and/or weights, but also (why not) font families, icon sets and even colour palettes.
How feasible would it be to write a plugin that extends the current native theme, i.e. that calls the existing code where possible rather than duplicating that code completely and modifying it where required?
If we forget about the native aspect for now: Simply using `-style kde` or `QT_STYLE_OVERRIDE=kde` switches to the graphical look/design of the active KDE theme, but does not changes the fonts (or colour palette or anything else).
Therefore, my initial approach in this matter has been to enable the use of KDE's platform theme plugin (through a few small patches to Qt 5.5) and to patch it so it initialises the native theme and uses it where KDE's platform theme plugin does not provide a feature (menus...) or should not be used (e.g. keyboard shortcuts). This works perfectly and allows users to run KDE applications with the KDE theme of their choice, after installing the platform theme plugin and setting an env. variable.
This works perfectly ... but it isn't the native theme and thus doesn't provide an improved native look. Experience with KDE4/Qt4 and initial testing with KF5/Qt5 suggests that it won't suffice to set the KDE theme to"Macintosh (aqua)". Hence the question above.
Subsidiary question: suppose such an extended theme is developed, how (un)likely is it that the necessary changes to Qt itself (hopefully only QCocoaTheme::themeNames()) would be accepted for incorporation so that automatic selection of the KDE platform theme becomes possible on OS X under similar conditions as those on other Unix versions (for instance, KDE_SESSION_VERSION set in the environment)?
If we look at the big picture: more and more applications nowadays provide a user experience (including look and feel) that is identical across platforms, either because they're web-based or because they don't use the full host widget set (or theme it). There's evidently a lot to say for making applications blend in with native applications, but there's also a lot to say for cross-platform applications to hide platform differences by looking as identical as possible wherever they're run. With the technology of the last couple of years any performance advantage of using native GUI APIs has become either insignificant or even a disadvantage (running the latest OS on not-so-recent hardware).
More information about the Development