Page 1 of 3 123 LastLast
Results 1 to 10 of 42

Thread: What is the tiniest Window Manager in existence for Linux?

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Kent, UK
    Beans
    214

    What is the tiniest Window Manager in existence for Linux?

    I was wondering about this because I wanted one that I could play games on under Cedega, and my first thoughts were awesome, Fluxbox, TWM etc etc, just to give my pc the easiest time possible and offset the (possibly small) performance hit of playing games emulated.

    But that got me thinking. What is the smallest window manager out there? Is there ANYTHING smaller than TWM? o.O

    Hoppi
    Registered Ubuntu user #28880

  2. #2
    Join Date
    Jun 2005
    Beans
    6,115

    Re: What is the tiniest Window Manager in existence for Linux?

    CLI?



    Maybe ratpoison
    HOME BUILT SYSTEM! http://brainstorm.ubuntu.com/idea/22804/ Please vote up!
    remember kiddies: sudo rm -rf= BAD!, if someone tells you to do this, please ignore them unless YOU WANT YOUR SYSTEM WIPED

  3. #3
    Join Date
    Apr 2008
    Location
    RiceMonsterland, Canada
    Beans
    Hidden!

    Re: What is the tiniest Window Manager in existence for Linux?

    TinyWM. It's only 50 lines of code or something like that.

    Edit: Here's the code:

    Code:
    /* TinyWM is written by Nick Welch <mack@incise.org>, 2005.
     *
     * This software is in the public domain
     * and is provided AS IS, with NO WARRANTY. */
    
    #include <X11/Xlib.h>
    
    #define MAX(a, b) ((a) > (b) ? (a) : (b))
    
    int main()
    {
        Display * dpy;
        Window root;
        XWindowAttributes attr;
        XButtonEvent start;
        XEvent ev;
    
        if(!(dpy = XOpenDisplay(0x0))) return 1;
    
        root = DefaultRootWindow(dpy);
    
        XGrabKey(dpy, XKeysymToKeycode(dpy, XStringToKeysym("F1")), Mod1Mask, root,
                True, GrabModeAsync, GrabModeAsync);
        XGrabButton(dpy, 1, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
                GrabModeAsync, None, None);
        XGrabButton(dpy, 3, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
                GrabModeAsync, None, None);
    
        for(;;)
        {
            XNextEvent(dpy, &ev);
            if(ev.type == KeyPress && ev.xkey.subwindow != None)
                XRaiseWindow(dpy, ev.xkey.subwindow);
            else if(ev.type == ButtonPress && ev.xbutton.subwindow != None)
            {
                XGrabPointer(dpy, ev.xbutton.subwindow, True,
                        PointerMotionMask|ButtonReleaseMask, GrabModeAsync,
                        GrabModeAsync, None, None, CurrentTime);
                XGetWindowAttributes(dpy, ev.xbutton.subwindow, &attr);
                start = ev.xbutton;
            }
            else if(ev.type == MotionNotify)
            {
                int xdiff, ydiff;
                while(XCheckTypedEvent(dpy, MotionNotify, &ev));
                xdiff = ev.xbutton.x_root - start.x_root;
                ydiff = ev.xbutton.y_root - start.y_root;
                XMoveResizeWindow(dpy, ev.xmotion.window,
                    attr.x + (start.button==1 ? xdiff : 0),
                    attr.y + (start.button==1 ? ydiff : 0),
                    MAX(1, attr.width + (start.button==3 ? xdiff : 0)),
                    MAX(1, attr.height + (start.button==3 ? ydiff : 0)));
            }
            else if(ev.type == ButtonRelease)
                XUngrabPointer(dpy, CurrentTime);
        }
    }
    Code:
    while true; do echo -n "RiceMonster "; done
    Best thread ever

  4. #4
    Join Date
    Jun 2007
    Location
    Kent, UK
    Beans
    214

    Re: What is the tiniest Window Manager in existence for Linux?

    Wow, that really is tiny!

    Im not sure if its possible to beat 50 lines of code! lol
    Registered Ubuntu user #28880

  5. #5
    Join Date
    May 2008
    Beans
    60

    Re: What is the tiniest Window Manager in existence for Linux?

    tinywm wins, but I think dwm takes it for one that is actively maintained and has a decent user base.

  6. #6
    Join Date
    Jun 2009
    Location
    0000:0400
    Beans
    Hidden!

    Re: What is the tiniest Window Manager in existence for Linux?

    The smallest is none at all. Run your app on a separate X server. I've got a script called newX that looks like this:
    Code:
    #!/bin/bash
    DISPLAY=:1
    X :1 -ac -terminate &
    sleep 2
    $*
    so running `newX <application>` would launch a new X server with only your application running on it. It'll use the next available virtual console, so if you use ctrl-alt-f7 to get back to your desktop from a TTY, the new X server will be ctrl-alt-f8.

  7. #7
    Join Date
    Aug 2009
    Location
    Ireland / The Czech Repub
    Beans
    283
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: What is the tiniest Window Manager in existence for Linux?

    Quote Originally Posted by RiceMonster View Post
    TinyWM. It's only 50 lines of code or something like that.

    Edit: Here's the code:

    Code:
    /* TinyWM is written by Nick Welch <mack@incise.org>, 2005.
     *
     * This software is in the public domain
     * and is provided AS IS, with NO WARRANTY. */
    
    #include <X11/Xlib.h>
    
    #define MAX(a, b) ((a) > (b) ? (a) : (b))
    
    int main()
    {
        Display * dpy;
        Window root;
        XWindowAttributes attr;
        XButtonEvent start;
        XEvent ev;
    
        if(!(dpy = XOpenDisplay(0x0))) return 1;
    
        root = DefaultRootWindow(dpy);
    
        XGrabKey(dpy, XKeysymToKeycode(dpy, XStringToKeysym("F1")), Mod1Mask, root,
                True, GrabModeAsync, GrabModeAsync);
        XGrabButton(dpy, 1, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
                GrabModeAsync, None, None);
        XGrabButton(dpy, 3, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
                GrabModeAsync, None, None);
    
        for(;;)
        {
            XNextEvent(dpy, &ev);
            if(ev.type == KeyPress && ev.xkey.subwindow != None)
                XRaiseWindow(dpy, ev.xkey.subwindow);
            else if(ev.type == ButtonPress && ev.xbutton.subwindow != None)
            {
                XGrabPointer(dpy, ev.xbutton.subwindow, True,
                        PointerMotionMask|ButtonReleaseMask, GrabModeAsync,
                        GrabModeAsync, None, None, CurrentTime);
                XGetWindowAttributes(dpy, ev.xbutton.subwindow, &attr);
                start = ev.xbutton;
            }
            else if(ev.type == MotionNotify)
            {
                int xdiff, ydiff;
                while(XCheckTypedEvent(dpy, MotionNotify, &ev));
                xdiff = ev.xbutton.x_root - start.x_root;
                ydiff = ev.xbutton.y_root - start.y_root;
                XMoveResizeWindow(dpy, ev.xmotion.window,
                    attr.x + (start.button==1 ? xdiff : 0),
                    attr.y + (start.button==1 ? ydiff : 0),
                    MAX(1, attr.width + (start.button==3 ? xdiff : 0)),
                    MAX(1, attr.height + (start.button==3 ? ydiff : 0)));
            }
            else if(ev.type == ButtonRelease)
                XUngrabPointer(dpy, CurrentTime);
        }
    }


    That's so adorable! Awwwwwwwwwwwwwwwwwwwwww

  8. #8
    Join Date
    Nov 2008
    Location
    Here, There, Everywhere
    Beans
    1,163
    Distro
    Xubuntu

    Re: What is the tiniest Window Manager in existence for Linux?

    open a xterm session from GDM/KDM and start your apps from there without WM.

    you need to run a network daemon (wicd-client or nm-applet) before launching an app that uses the internet.

  9. #9
    Join Date
    Jun 2007
    Location
    Kent, UK
    Beans
    214

    Re: What is the tiniest Window Manager in existence for Linux?

    Quote Originally Posted by RabbitWho View Post
    That's so adorable! Awwwwwwwwwwwwwwwwwwwwww
    hahaha

    Quote Originally Posted by danielrmt View Post
    open a xterm session from GDM/KDM and start your apps from there without WM.

    you need to run a network daemon (wicd-client or nm-applet) before launching an app that uses the internet.
    oo that's VERY smart I never thought of this kinda because I didn't know it was possible! Nice one I'll try this too
    Registered Ubuntu user #28880

  10. #10
    Join Date
    Apr 2008
    Location
    RiceMonsterland, Canada
    Beans
    Hidden!

    Re: What is the tiniest Window Manager in existence for Linux?

    The thing about running with no WM though, is that you can't move or resize windows. Still fun to try, none the less.
    Code:
    while true; do echo -n "RiceMonster "; done
    Best thread ever

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •