The KWin Button Applet

March 24, 2010

I like to save screen estate, and in the latest iteration of my workspace layout, I have eliminated another 20px vertical space. I noticed that I’m mostly working in maximized windows. Their titlebar is nearly empty due to my wide notebook screen. What a waste!

Solution: Move the panel to the top and make it cover the titlebar of the maximized window.

Problem: The panel is bigger than the titlebar, and therefore covering the toolbar.

Solution: Make the titlebar bigger (Oxygen windeco allows to make the buttons bigger), then make the panel size match the titlebar size.

Next problem: There are buttons in the titlebar which I might need.

Immediate solution: Resize the panel to not cover these buttons. But that does not work because I’m regularly changing my screen resolution when wiring up my notebook to a projector.

Slightly harder solution: Implement the titlebar buttons as a Plasma applet. (Sounds harder than it is, thanks to libtaskmanager from kdebase-workspace.) Because this is something others might find useful, I’ve shared these 200 lines of code.

Updates:

  • Aaron Seigo points out that plasma-netbook comes with a quite similar applet called “Current Application Control”, which combines all buttons into one, together with the title of the current application.
  • Christian adds that KWin has built-in support for removing the decoration from maximized windows automatically, although this option is not presented in the GUI. To activate this option, set “BorderlessMaximizedWindows=true” in the “[Windows]” section of your kwinrc (usually found at .kde/share/config/kwinrc or .kde4/share/config/kwinrc in your home directory). Then fire up KRunner and run “kwin –replace” to restart KWin.
  • Luboš Luňák announces the immediate availability of an openSUSE build service package for the kwinbuttonapplet. I have added this information to the kde-look page.

Thanks to all commenters!

KWin button applet in action

KWin button applet in action

Advertisements

33 Responses to “The KWin Button Applet”

  1. nuno Says:

    you can heven save more space a n making the aplications more usable but making tose buttons on a small auto hide pannel on top and puting the traditional pannel in the bottom,
    this will give you infinite hit area for the appplication menus 😉

  2. cjc15153 Says:

    Thank you. I work in a similar way and have wanted something like this.

    I’ve never been able to figure out how to make Max Window == borderless in a sane, obviously reversible way, but the button plasmoids are a good chunk of what I want.

  3. Aaron Seigo Says:

    > Implement the titlebar buttons as a Plasma applet

    plasma-netbook ships with a plasmoid called currentappcontrol (sexy, i know 😉 that provides window controls. it is not a 100% replica of what you’ve done, but it’s quite close. it’s in kdebase/workspace/plasma/netbook/applets/currentappcontrol/

    in combination with some kwin settings, plasma-netbook manages to give you exactly the layout you have there, swapping out the tasks widget for an activities switcher (you switch tasks by clicking on the name of the current window, which triggers expose)

  4. nip Says:

    I got as far as the last step, and was left wondering if it would be possible to have window buttons on the panel. you solved that.

    this should be perfect for netbook screens as well. kde netbook remix default maybe?

  5. Francesco R. Says:

    ¡ like it !

    • Francesco R. Says:

      Linking CXX shared module lib/plasma_applet_kwinbutton.so
      /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lKDE4Workspace__taskmanager
      collect2: ld returned 1 exit status

      != like

  6. Christian Says:

    Hi Stefan!

    Thank you very much for sharing your applet. It is really useful to me. I was looking for such applet already because I remove the window title bar from maximized windows to save screen space.

    You say you accomplish it by making the panel cover the window title bar. Well, KDE has a better way for this, it’s sometimes called netbook mode. Just add the line “BorderlessMaximizedWindows=true” into the [Windows] section of your .kde/share/config/kwinrc – and from now on KDE will show maximized windows borderless.

    Greetings,
    Chris

  7. mike wyatt Says:

    wouldn’t it still be nice of plasma could remember the width of its panels as “screenwidth – x px” or at least in percentages

  8. Freddie Says:

    Hrm, one step closer to the panel becoming a tab-bar. 🙂 Similar to the way ChromeOS works. I can see a setup like that being very useful.

  9. Luboš Luňák Says:

    Rings a bell, I think there’s a wish for this somewhere at bugs.kde.org .

    BTW, you could have also shared binaries of code, with kde-obs-generator it was a minute of “work”. You can modify the kde-apps.org profile to include OBS repository home:llunak:kde, package kwinbuttonapplet (see http://en.opensuse.org/KDE/Build_Service/Cross-distro).

  10. Martin Says:

    My current idea to this use case is to make the window decoration auto-hiding if the window is maximized. Don’t know if it will work, but it is worth a try.

  11. eothred Says:

    Nice work! I love all the cool creativity that’s coming from the KDE project! 😀

  12. Danakil Says:

    I have done a similar applet nearly one year ago I think, it’s called active window control and resides in playground but I never took the time to clean it and update it

    • DanaKil Says:

      from your screenshot, it seems that the applet don’t reflect the disabled/enabled states of the kwin’s button (ie: the “maximize” button should be disabled because the windows is already maximized). But I may be wrong ?

      For those interested : http://kde-look.org/content/show.php/ActiveWindow+Control?content=91258
      (I think the version in playground is a bit more up-to-date)

      One of my idea (not yet really implemented) was to navigate through open windows (next/prev, similar to alt-tab) by using the scrollwheel on the applet) so that you can move your mouse on the plasmoid’s close button and quickly choose with the scrollwheel which windows to close (or hide, minimize, etc.)

      Anyway, it’s a bit old but maybe someone will be interested 🙂

  13. abcd Says:

    It would be better, if you have helped to complete http://kde-look.org/content/show.php/ActiveWindow+Control?content=91258

  14. Cyril Says:

    Hm, i just set my panels to “window can cover” resp. “autohide” in order to save space on my 13″ screen. I don’t really see what this new solution makes better, unless you get rid of the title bar at all, but then the panel will cover the menu again.

    • Stefan Majewsky Says:

      It’s a matter of personal taste. I do not like hiding the panel because it contains information that is important to me.

  15. Carsten Says:

    I have not tested this “BorderlessMaximizedWindows=true”, it seems interesting, but how are such windows easily closed? how about a screen-corner-action that shows the min/max/close buttons?

  16. kriko Says:

    Is it possible to compile “Current Application Control” on kde 4.4?
    I’m getting:
    ” Unknown CMake command “kde4_add_plugin”.”

    or is this for future 4.5 versions….

    • Stefan Majewsky Says:

      KDE SC 4.4 should come with “Current Application Control” preinstalled. It’s included with the Plasma Netbook shell, so if that one is in a separate package in your distribution, you might want to install this package.


  17. Who would’ve thought…


  18. […] this time goes to Christian who wrote about this feature in a comment in this blog post. The post also links to a neat widget […]


  19. […] this time go to Christian who wrote about this feature in a comment in this blog post. The post also links to a neat widget […]

  20. John Says:

    Instead of hiding the panel, what about making another panel that is narrower with the information you need? I’ve done that from time to time, though I ultimately enjoy a completely hidden panel.

  21. lalaland Says:

    hi
    would u update this so it can be installed in kubuntu kde 4.5.3 ppa ?
    the other plasmoid you mentioned does not cut it for me, i want just plain the 3 close maximze and minize buttons.
    thank you


  22. […] Fuente GA_googleAddAttr("AdOpt", "1"); GA_googleAddAttr("Origin", "other"); GA_googleAddAttr("LangId", "19"); GA_googleAddAttr("Tag", "archlinux"); GA_googleAddAttr("Tag", "kde"); GA_googleFillSlot("wpcom_sharethrough"); Share this:TwitterMe gusta:LikeSé el primero en decir que te gusta esta post. Esta entrada fue publicada en archlinux, KDE por Dario. Guarda el enlace permanente. […]

  23. Carrozza Says:

    Thanks for this article, I’m pretty sure that the tips from Aaron and Christian will cut it right for my need of vertical screen space.
    Hope all this stuff will work the same way in upcoming Kubuntu 12.04, too.
    Cheers!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s