You are not logged in.

#1 2010-12-26 21:39:06

aleks223
Member
Registered: 2010-03-27
Posts: 178
Website

The WMFS Thread (Window Manager From Scratch)

As the wmfs user community is growing, jasonwryan and myself though about the creation of a special thread for that tiling manager. The aim of this thread is to share informations and config files of wmfs to help new user to start with it,

So just ask whatever and enjoy using wmfs !

Offline

#2 2010-12-26 21:41:25

aleks223
Member
Registered: 2010-03-27
Posts: 178
Website

Re: The WMFS Thread (Window Manager From Scratch)

Here you'll find one of my last wmfsrc : https://github.com/aleks223/dotfiles/blob/master/wmfsrc

Offline

#3 2010-12-26 22:12:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

Great idea! smile

I've only just started using wmfs, but am very impressed. One question I have is regarding keybinds for toggling layouts. I've tried binding Mod4+t to set tile_right, but it doesn't work:

[key] mod = {"Mod4"} key = "t" func = "toggle_tile_right" [/key]

And the behaviour for "max" and "free" seem slightly counter-intuitive after dwm - but I am coping smile

My wmfsrc and wmfs-status scripts are here: https://bitbucket.org/jasonwryan/eeepc/src/


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2010-12-26 22:31:20

aleks223
Member
Registered: 2010-03-27
Posts: 178
Website

Re: The WMFS Thread (Window Manager From Scratch)

wmfs -c layout_set tile_right

or

func = "layout_set" cmd = "tile_right"

Offline

#5 2010-12-26 22:59:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

Thanks aleks223, but no go:

[key] mod = {"Mod4"} key = "t"  func = "layout_set"  cmd = "tile_right" [/key]

doesn't work...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2010-12-26 23:03:36

aleks223
Member
Registered: 2010-03-27
Posts: 178
Website

Re: The WMFS Thread (Window Manager From Scratch)

and with set_layout ?

Offline

#7 2010-12-26 23:08:36

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

Ta Da!

Thanks - I might have got there (eventually). smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2010-12-29 15:19:24

bacardi55
Member
Registered: 2010-03-24
Posts: 25

Re: The WMFS Thread (Window Manager From Scratch)

Hey,

Great idea to create this thread smile

just a quick tip to learn all the function that you can use in your wmfsrc :
Just have a look at the const in config.c from line 37 to 97 smile
https://github.com/xorg62/wmfs/blob/mas … nfig.c#L37

You could have found the set_layout there :-)


Archlinux, wmfs and vim lover smile
dotfiles
wmfs contrib
Excuse my poor english, this ain't my mother tongue smile

Offline

#9 2010-12-29 21:11:40

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

Nice tip bacardi55 - I have added it to the wiki entry (along with doing a rewrite and adding some more detail around the .wmfsrc sections).

I have also refined my status script, based on some excellent suggestions in this thread: https://bbs.archlinux.org/viewtopic.php?id=110788


...and a screenie:

5304401121_304eb9b037_m.jpg


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2010-12-30 17:54:43

aleks223
Member
Registered: 2010-03-27
Posts: 178
Website

Re: The WMFS Thread (Window Manager From Scratch)

One wmfs fellow (Alm) wrote a nice python script for the status, here it is :

#!/usr/bin/python2
# -*- coding: UTF-8 -*-
import urllib
import imaplib
import os
import signal
import time
import re
import math
from datetime import datetime, timedelta
from mpd import MPDClient, ConnectionError
from subprocess import Popen, PIPE

### configuration
g_users = [ ['MAIL@gmail.com', 'PASSWD'] ]
g_weather = 'chvs0003'
g_cores = 2
g_iface = 'wlan0'
g_wm = 'wmfs'
### formatting for wmfs
g_fmt_weather = '\\#4A4A4A\\C\\#0081DE\\{0}'
g_fmt_gmail = '\\#4A4A4A\\@\\#AA4499\\{0}'
g_fmt_mpd = '\\#FFC400\\{0}'
g_fmt_mixer = '\\#0081DE\\{0}'
g_fmt_cpu = '\\#4A4A4A\\{0:d}\\#FFCC00\\{1:d}'
g_fmt_mem = '\\#AA2233\\{0:d}M'
g_fmt_eth = '\\#4A4A4A\\wlan\\#FFCC00\\{0:d}/{1:d}'


### classes ###
class Wi(object):
    def __init__(self, format = ''):
        self._val = ''
        self._fval = ''
        self._fmt = format

    def format(self):
        self._fval = self._fmt.format(self._val)
        return self._fval

class WiWeather(Wi):
    _url = 'http://www.meteomedia.com/weather/{0}'
    def __init__(self, area_code, format = ''):
        Wi.__init__(self, format)
        self._url = self._url.format(area_code)
        self._fmt = format

    def update(self):
        contents = urllib.urlopen(self._url).read()
        temp = re.search("<p>([-0-9]*)<\/p>", contents).group(1)
        felt = re.search("</strong>: ([-0-9]*).*</li>", contents).group(1)
        if felt == '-':
            out = temp
        else:
            out = temp + '/' + felt
        if len(out) >= 1:
            self._val = out
            self.format()
            return 0
        else:
            return 61 # if failed, wait ~1min before retrying


class WiGmail(Wi):
    _delimiter = '/'
    _mailbox = 'INBOX'
    _mailserver = 'imap.gmail.com'
    _port = 993
    def __init__(self, users, format = ''):
        Wi.__init__(self, format)
        self._users = users

    def fetch(self, username, password):
        # set up connection
        server = imaplib.IMAP4_SSL(self._mailserver, self._port)
        server.login(username, password)
        server.select(self._mailbox)
        # get + clean
        data = str(server.status(self._mailbox, '(MESSAGES UNSEEN)'))
        count = data.split()[5].replace(')\'])','')
        server.close()
        server.logout()
        return count

    def update(self):
        out = ''
        for u, p in self._users:
            s = self.fetch(u, p)
            if s == '':
                return 31 # if failed wait ~30 seconds before retrying
            if out == '':
                out += s
            else:
                out += self._delimiter + s
        self._val = out
        self.format()
        return 0


class WiMpd(Wi):
    def __init__(self, host = 'localhost', port = '6600', format = ''):
        Wi.__init__(self, format)
        self._host = host
        self._port = port
        self._con_id = {'host':host, 'port':port}
        self._client = MPDClient()
        self._connected = False
        self.connect()

    def connect(self):
        try:
            self._client.connect(**self._con_id)
        except IOError as e:
            print(e)
            return False
        except ConnectionError as e:
            print(e)
            return False
        else:
            self._connected = True
            return True

    def update(self):
        if not self._connected:
            if not self.connect():
                return 1

        st = self._client.status()
        if st['state'] == 'play' or st['state'] == 'pause':
            so = self._client.currentsong()
            self._val = "%s - %s" % (so['artist'], so['title'])
        else:
            self._val = ''
        self.format()
        return 0


class WiMixer(Wi):
    def __init__(self, args = ["amixer","sget","Master"], format = ''):
        Wi.__init__(self, format)
        self._args = args
        pass

    def update(self):
        p = Popen(self._args, stdout=PIPE).communicate()[0]
        out = re.search("([0-9]*%)",p).group(1)
        mute = re.search("(\[[onf]*\])",p).group(1)
        if mute == "[off]":
            self._val = 'mute'
        else:
            self._val = out
        self.format()
        return 0


class WiCpu(Wi):
    def __init__(self, cores = 2, format = ''):
        Wi.__init__(self, format)
        self._cores = cores
        self._total = [0]*cores
        self._active = [0]*cores

    def format(self):
        self._fval = ''
        for i in list(range(self._cores)):
            self._fval += self._fmt.format(i+1, int(self._val[i]))
        return self._fval

    def update(self):
        usage = [0]*self._cores
        for line in open("/proc/stat"):
            r = re.search("^cpu([0-9])",line)
            if r is None:
                continue
            n = int(r.group(1))
            #space to avoid matching the first digit (cpuN)
            s = re.findall(" ([0-9]+)",line)
            total_new = 0
            for i in s:
                total_new += float(i)
            active_new = float(s[0]) + float(s[1]) + float(s[2])

            diff_total = total_new - self._total[n]
            diff_active = active_new - self._active[n]
            usage[n] = math.floor(diff_active / diff_total * 100)
            #store totals
            self._total[n] = total_new
            self._active[n] = active_new

        self._val = usage
        self.format()
        return 0


class WiMem(Wi):
    def __init__(self, format = ''):
        Wi.__init__(self, format)

    def update(self):
        for line in open("/proc/meminfo"):
            r = re.search("([a-zA-Z]+):[^0-9]+([0-9]+).+",line)
            if r is None:
                continue
            m = r.group(1)
            n = int(r.group(2))
            if m == "MemTotal":
                total = n
            elif m == "MemFree":
                free = n
            elif m == "Buffers":
                buf = n
            elif m == "Cached":
                cached = n
                break

        self._val = int((total - free - buf - cached)/1024)
        self.format()
        return 0


class WiEth(Wi):
    def __init__(self, iface = 'wlan0', format = ''):
        Wi.__init__(self, format)
        self._iface = iface
        self._rx = 0
        self._tx = 0
        self._time = 0

    def format(self):
        self._fval = self._fmt.format(int(self._val[0]),int(self._val[1]))
        return self._fval

    def update(self):
        for line in open("/proc/net/dev"):
            r = re.search("wlan0", line)
            if r is None:
                continue
            s = re.findall(" ([0-9]+)", line)
            rx = int(s[0])
            tx = int(s[8])

            now = time.time()
            interval = now - self._time
            rx_rate = (rx - self._rx) / interval / 1024
            tx_rate = (tx - self._tx) / interval / 1024
            self._val = [rx_rate, tx_rate]
            #store results
            self._rx = rx
            self._tx = tx
            self._time = now

        self.format()
        return 0


class Task(object):
    def __init__(self, func, name, delay, args=()):
        self._args = args
        self._function = func
        self._name = name
        micro = int((delay - math.floor(delay)) * 1000000)
        self._delay = timedelta(seconds=int(delay), microseconds=micro)
        self._next_run = datetime.now() #to force first run now

    def should_run(self):
        return datetime.now() >= self._next_run

    def run(self):
        delay = self._function(*(self._args))
        if delay == 0:
            self._next_run = datetime.now() + self._delay
        else:
            self._next_run = datetime.now() + timedelta(seconds=delay)


### signals ###
# to print stats
def sig_usr1(signum, frame):
    global tasks
    now = datetime.now()
    for t in tasks:
        print(t._name + " will run in " + str(t._next_run - now))
    return
# to force execution
def sig_usr2(signum, frame):
    global tasks
    for t in tasks:
        t.run()
    return

signal.signal(signal.SIGUSR1, sig_usr1)
signal.signal(signal.SIGUSR2, sig_usr2)

### main ###
gm = WiGmail(g_users, format=g_fmt_gmail)
we = WiWeather(g_weather, format=g_fmt_weather)
mp = WiMpd(format=g_fmt_mpd)
mi = WiMixer(format=g_fmt_mixer)
cp = WiCpu(g_cores, format=g_fmt_cpu);
me = WiMem(format=g_fmt_mem);
et = WiEth(g_iface, format=g_fmt_eth);

tasks = [ Task(gm.update,'gmail',91), Task(we.update,'weather',1801), Task(mp.update,'mpd',1), Task(mi.update,'mixer',1), Task(cp.update,'cpu',2), Task(me.update,'mem',13), Task(et.update,'net',2) ]

while True:
    try:
        for t in tasks:
            if t.should_run():
                t.run()

            now = datetime.now().strftime("%e/%m %H:%M")
            os.system('wmfs -s "%s %s %s %s %s %s %s \\#AA4499\\ %s"' % (cp._fval,me._fval,et._fval,gm._fval,we._fval,mp._fval,mi._fval,now) )

    except IOError as e:
        print(e)
    except Exception as e:
        print(e)
    finally:
        time.sleep(1)

Last edited by aleks223 (2010-12-30 18:00:35)

Offline

#11 2010-12-30 22:41:17

NYFinest
Member
From: New York
Registered: 2010-07-23
Posts: 19

Re: The WMFS Thread (Window Manager From Scratch)

I have a couple of questions for those who use WMFS. Does it provide a system tray for applets? how about floating windows? Also, how steep is the learning curve if any? I'm looking for a new WM since i'm not really fond of awesome's lua and as far as i'm aware dwm doesn't have a system tray.
I would like to thank everyone in advance for their replies. smile


Lenovo X201T
Arch x86_64

Offline

#12 2010-12-30 22:53:59

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

Yes (see my screenie). Yes - there are nine default layouts (floating is called "free"). No steeper than any other tiler... smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#13 2010-12-31 01:25:22

NYFinest
Member
From: New York
Registered: 2010-07-23
Posts: 19

Re: The WMFS Thread (Window Manager From Scratch)

Thanks, I didn't see the screenshot earlier my mistake. I like what I see, now I assume the icon you have next to the time is dropbox correct? Also, while the windows are tiled can you have another app floating around at the same time? For example, If i'm using my tablet browsing the internet and have cellwriter pop up moved around and/or closed.

I appreciate your help, Thanks smile


Lenovo X201T
Arch x86_64

Offline

#14 2010-12-31 01:56:10

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

As the wiki article says, you can use a combination of tags, rules and keybinds to do pretty much anything. You are talking about "toggle free" I assume...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#15 2010-12-31 07:55:59

skrite
Member
Registered: 2009-09-07
Posts: 160

Re: The WMFS Thread (Window Manager From Scratch)

Hey great thread here, i have just installed wmfs. I am really digging it.

Offline

#16 2010-12-31 12:20:49

NYFinest
Member
From: New York
Registered: 2010-07-23
Posts: 19

Re: The WMFS Thread (Window Manager From Scratch)

jasonwryan thanks for the help, much appreciated. I will be tinkering with WMFS this weekend. smile


Lenovo X201T
Arch x86_64

Offline

#17 2011-01-04 08:42:29

The_infinite_loop
Member
From: México
Registered: 2009-04-10
Posts: 16
Website

Re: The WMFS Thread (Window Manager From Scratch)

Hi everyone I'm trying WMFS, I really like it but I'm having a problem with xcompmgr and urxvt. I can't get true transparency in urxvt, I've tried many things within .Xdefaults but simply doesn't work. Googling I just found a thread in archlinux.fr, they have the same issues :\.
Hope you can help.


MacBook 2,1, 3GB RAM.

They say it changes... When the Sun goes down.

Offline

#18 2011-01-04 08:47:51

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

I think it unlikely it is a WMFS issue. Do you have it working in other wms?

See this post: https://bbs.archlinux.org/viewtopic.php … 85#p865585


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#19 2011-01-04 09:15:02

broken pipe
Member
Registered: 2010-12-10
Posts: 243

Re: The WMFS Thread (Window Manager From Scratch)

wmfs is such a great tiling window manager! is there any way to stack windows? or just the 9 tiling modes?

Offline

#20 2011-01-04 09:29:48

The_infinite_loop
Member
From: México
Registered: 2009-04-10
Posts: 16
Website

Re: The WMFS Thread (Window Manager From Scratch)

Hi jason, I've just tried the same config with openbox, fluxbox and ratpoison which I had before WMFS.

- Ratpoison: Shows transparency but I can't verify if it's true transparency since it's a tiling WM.
- Fluxbox: Fails with the exact same configuration urxvt loads with no transparency.
- Openbox: Finaly in Openbox urxvt shows true transparency:

http://dl.dropbox.com/u/272119/Dibujos/ … _scrot.png

Here's the link to the Archlinux fr forum: http://translate.google.com/translate?h … c6448.html

And here's my ~/.Xdefaults:

#Font.
Xft.dpi  :  75.0
URxvt*font:    xft:DejaVu LGC Sans Mono:pixelsize=13
!URxvt.font:     xft:DejaVu Sans Mono:antialias=false:pixelsize=11

#Transparency.
URxvt*depth:32
URxvt*buffered  :  true
URxvt*background  :  rgba:0000/0000/0000/cccc
!URxvt.tintColor  :  grey30
URxvt*transparent  :  false
!URxvt*fading  :  2%
!URxvt*fadeColor  :  grey
URxvt*shading  :  200

#Scrolls.
#URxvt*scrollstyle  :  plain
URxvt*scrollBar  :  False

#Terminal Main Colors.
!URxvt*background: #000000
URxvt*foreground: #ffffff

#Gnome Terminal like colors.
#Black.
URxvt*color0  :  #000000
URxvt*color8  :  #555555
#Red.
URxvt*color1  :  #AA0000
URxvt*color9  :  #FF5555
#Green.
URxvt*color2  :  #00AA00
URxvt*color10 :  #55FF55
#Yellow.
URxvt*color3  :  #AA5500
URxvt*color11 :  #FFFF55
#Blue.
URxvt*color4  :  #0000AA
URxvt*color12 :  #5555FF
#Magenta.
URxvt*color5  :  #AA00AA
URxvt*color13 :  #FF55FF
#Cyan.
URxvt*color6  :  #00AAAA
URxvt*color14 :  #55FFFF
#White.
URxvt*color7  :  #AAAAAA
URxvt*color15 :  #FFFFFF

#Open links with Opera.
URxvt*perl-ext-common  :  default,matcher
URxvt*urlLauncher      :  opera
URxvt*matcher.button   :  1

#Fixing font (not needed anymore).
#URxvt*letterSpace: 0

Thank you for the quick response.


-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code --


MacBook 2,1, 3GB RAM.

They say it changes... When the Sun goes down.

Offline

#21 2011-01-04 18:50:15

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: The WMFS Thread (Window Manager From Scratch)

What happens if you turn pseudo on?

URxvt.transparent: true

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#22 2011-01-04 18:52:53

aleks223
Member
Registered: 2010-03-27
Posts: 178
Website

Re: The WMFS Thread (Window Manager From Scratch)

WMFS hasn't true transparency, so i think here is the reason.....

Offline

#23 2011-01-05 01:35:40

The_infinite_loop
Member
From: México
Registered: 2009-04-10
Posts: 16
Website

Re: The WMFS Thread (Window Manager From Scratch)

Well I think I'll try pseudo, I really like WMFS. Thank you for the quick response and if you can make WMFS support true transparency that would be great smile.


MacBook 2,1, 3GB RAM.

They say it changes... When the Sun goes down.

Offline

#24 2011-01-05 13:02:52

LukeGee
Member
Registered: 2009-12-27
Posts: 13

Re: The WMFS Thread (Window Manager From Scratch)

Hi there,

well, some time ago I discovered the "Window manager from scratch". (http://wmfs.info).

I used Awesome und dwm before but since I disovered wmfs I'm only using it. In my opinion it's a very good mixture of awesome and dwm. I always hated the bloat Config of Awesome (Certainly the lua config offers an enormous set of configurable things, but I don't need them). And dwm was a bit too tiny und uncomfortable for me.

WMFS is awesome, it has a very nice and usable config und all features I need. It also has a systray (dwm does not have one per default), even if I don't use it.

My Configs are here: https://github.com/lukasg/dotfiles/tree/master/wmfs

302010-10-29-220857_1920x1200_scrot.png

Offline

#25 2011-01-05 14:14:32

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: The WMFS Thread (Window Manager From Scratch)

LukeGee wrote:

WMFS is awesome, it has a very nice and usable config und all features I need. It also has a systray (dwm does not have one per default), even if I don't use it.

Not that I have anything against wmfs, nor am I trying to turn you (or anyone else) away from it, but I wrote a customization of DWM to include launcher and systray without the use of external programs (like dmenu and trayer). You can check it out here.

I still prefer dwm mainly for the look and feel (like little squares for tags with running clients). I find that wmfs and dwm has very similar coding structure, so I may decide to steal some more of wmfs' features where I like them.

Offline

Board footer

Powered by FluxBB