[Haskell-cafe] How to make a dock window for xmonad using gtk2hs?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Thu Mar 5 01:45:51 EST 2009


I am confused. Code like this works in other WM, except xmonad.
#include <gtk/gtk.h>

int main(int argc, char **argv) {
        GtkWidget *panel;
        gtk_init(&argc, &argv);
        panel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_type_hint(GTK_WINDOW(panel),
                GDK_WINDOW_TYPE_HINT_DOCK);
        gtk_widget_show(panel);
        gtk_main();
        return 0;
}
And here is my xmonad.hs, which you can see, no "special dock
configuration" for xmobar....
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import qualified System.IO.UTF8

main = do
  xmproc <- spawnPipe "xmobar ~/.xmonad/xmobar.config"
  xmonad $ defaultConfig { terminal = "~/bin/mTerm",
                           borderWidth = 3,
	                   normalBorderColor = "#0000ff",
	                   focusedBorderColor = "#00ff00",
                           layoutHook = avoidStruts $ layoutHook defaultConfig,
                           logHook = dynamicLogWithPP $ xmobarPP {
ppOutput = System.IO.UTF8.hPutStrLn xmproc,

ppTitle = xmobarColor "green" ""
                                                                 },
                           modMask = mod4Mask
                         } `additionalKeys` [ ((mod4Mask, xK_z), spawn "slock")
                                            , ((0, xK_Print), spawn "scrot") ]


On Thu, Mar 5, 2009 at 2:06 PM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> Since I am using gtk, I set Gdk::Window::TYPE_HINT_DOCK as its
> document says. But it does not work.
> And as I looked into xmobar's source, there seems no special code for
> xmonad. And my xmonad.hs is very simple, too.
> So I wonder how to make it work....
>
> On Thu, Mar 5, 2009 at 11:59 AM, Brandon S. Allbery KF8NH
> <allbery at ece.cmu.edu> wrote:
>> On 2009 Mar 4, at 21:40, Magicloud Magiclouds wrote:
>>>
>>>  I am using gtk2hs to make some sidebar thing for xmonad. Well, after
>>> I tried a few ways, I still cannot make it dock like xmobar. It just
>>> covered other windows at the edge of the screen.
>>>  Could someone give me a sample or something I could learn from? Thanks.
>>
>>
>> You need to go to freedesktop.org and read up on the Extended Window Manager
>> Hints.  In this particular case the extension you need is the _NET_WM_STRUT
>> property.
>>
>> (xmobar is open source, you could look through its source)
>>
>> --
>> brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
>> system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
>> electrical and computer engineering, carnegie mellon university    KF8NH
>>
>>
>>
>
>
>
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>



-- 
竹密岂妨流水过
山高哪阻野云飞


More information about the Haskell-Cafe mailing list