You are not logged in.

#1001 2012-10-03 21:24:14

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

firefox, chromium (and probably other apps -- afaik Opera and dwb dont do that) try to steal
input focus when something happened (ie a new tab, or a reload that was caused by something etc).
(I consider that to be broken behaviour, but it exists)
By "input focus" we mean listening for keyboard, mouse, joystick etc input events.

When that happens xlib notifies that a window requested input focus
and monsterwm must handle that in this logic:
if the window that requested focus is not the current active client (the highlighted window)
then give input focus back to the current active client.

I was mistakenly comparing if the window that requested
focus is the same window itself :S tongue
So, when a new tab was opened on firefox, firefox got input focus and the terminal was unfocused.

I dont know how that happened, on xinerama-* branches it was doing the correct thing
(which is why I couldn't reproduce it initially ..)

Last edited by c00kiemon5ter (2012-10-03 21:26:18)


.:[ git me! ] :.

Offline

#1002 2012-10-03 21:41:39

kuraku
Member
From: planet Earth
Registered: 2012-01-03
Posts: 202

Re: monsterwm! ~ yet another tiny wm

I see. Thank you for clarification.

Monsterwm is using sligtly more less RAM memory than before:

─╼ memusage.py | grep monsterwm
180.0 KiB +  86.0 KiB = 266.0 KiB	monsterwm
------------------------------------------------------------
Private   +   Shared  =  RAM used	Program

Let us remeber the previous results:

188.0 KiB +  83.0 KiB = 271.0 KiB  monsterwm (monocleborders branch, no bar)
------------------------------------------------------------
Private   +  Shared   = RAM used   Program 

Last edited by kuraku (2012-10-04 01:22:39)

Offline

#1003 2012-10-04 05:49:55

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: monsterwm! ~ yet another tiny wm

Interesting, care to share your memusage python script?

Last edited by Shinryuu (2012-10-04 05:50:27)

Offline

#1004 2012-10-04 23:30:46

kuraku
Member
From: planet Earth
Registered: 2012-01-03
Posts: 202

Re: monsterwm! ~ yet another tiny wm

Shinryuu wrote:

Interesting, care to share your memusage python script?

Sure mate: http://www.pixelbeat.org/scripts/ps_mem.py

Offline

#1005 2012-10-05 08:49:35

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: monsterwm! ~ yet another tiny wm

kuraku wrote:
Shinryuu wrote:

Interesting, care to share your memusage python script?

Sure mate: http://www.pixelbeat.org/scripts/ps_mem.py

Awesome! But I get an error, and my Python skills are.... neutral

┌─[jente @ lappy ~] 10:50:25 
└─■ memusage.py
  File "/home/jente/.bin/memusage.py", line 125
    except getopt.GetoptError, e:
                             ^
SyntaxError: invalid syntax

Last edited by Unia (2012-10-05 08:50:55)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1006 2012-10-05 08:55:42

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: monsterwm! ~ yet another tiny wm

Change env to python2.

Offline

#1007 2012-10-05 09:56:02

Ypnose
Member
From: Jailed in the shell
Registered: 2011-04-21
Posts: 353
Website

Re: monsterwm! ~ yet another tiny wm

kuraku: What about cpu usage? It could be interesting to compare with other WM.


Github -- My terminal font Envypn

Offline

#1008 2012-10-05 10:36:54

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: monsterwm! ~ yet another tiny wm

Šaran wrote:

Change env to python2.

Okay big_smile Now what?

┌─[jente @ lappy ~] 12:36:40 
└─■ memusage.py
  File "/home/jente/.bin/memusage.py", line 130
    split_args = False
                     ^
IndentationError: unindent does not match any outer indentation level

Sorry for spamming this otherwise good thread


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1009 2012-10-05 10:52:42

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: monsterwm! ~ yet another tiny wm

You're doing something wrong, as it works when changing python to python2 and running the script as root or sudo...

Due to the error listed, im guessing it's a copy/paste issue, so don't do that and instead download through either rightclicking the link or if you happen to use dwb, then press ;d to download through hints...

Offline

#1010 2012-10-05 10:55:31

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: monsterwm! ~ yet another tiny wm

http://ompldr.org/vZnJndQ
I have uploaded you mine ps_mem.

Offline

#1011 2012-10-05 12:31:23

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: monsterwm! ~ yet another tiny wm

When I was using dzen2 for statusbar, I had had configured bind that spawned another instance piped with conky (wifi, temperatures, weather) over the empty part of bar. It was set to close on click.
Is there any way to add conky (preferably) or some script output to lemonbar on bind. Currently it only shows date and time which is fine most of the time, but sometimes I need extra info.

EDIT:
Can anybody help me adapt my startup script (taken from Simon.Swe) for conky?

#!/usr/bin/env bash

wm=monsterwm
ff="/tmp/$RANDOM.monsterwm.fifo"
tags=('' '' '' '' '')
layouts=('' '' '' '' '') 

[[ -p $ff ]] || mkfifo -m 600 "$ff"

function statusbar {
    echo "\r\f9 $(date +"%a %d") \f2- \f3$(date +"%H:%M") "
}

while read -t 1 -r wmout || true; do
    if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
        read -ra desktops <<< "$wmout"

        tmp=
        for desktop in "${desktops[@]}"; do
            IFS=':' read -r d w m c u <<< "$desktop"
            # Tags labels
            label=${tags[$d]}
            # Current desktop
            ((c)) && fg="4" bg="0" lc="\u0 " rc=" \ur" && layout="\f2"${layouts[$m]} || fg="2" bg="0" lc=" " rc=" "
            # Has windows
            ((w)) && ((! c)) && fg="9" lc="\u0 " rc=" \ur"
            # Urgent windows
            ((u)) && fg="3" bg="0" lc="\u0 " rc=" \ur"

            tmp+="\f$fg\b$bg$lc$label$rc\fr\br"
        done

        tmp+=" $layout"
    fi
    echo "$tmp $(statusbar)"
done < "$ff" | bar &

$wm > "$ff"

rm $ff

I have tried this script, but workspace indicator lags for about a minute after starting wm (icon changes color few seconds after switching workspaces).

Last edited by Šaran (2012-10-07 16:44:32)

Offline

#1012 2012-10-07 10:02:04

kuraku
Member
From: planet Earth
Registered: 2012-01-03
Posts: 202

Re: monsterwm! ~ yet another tiny wm

Can somebody tell me what is the state of xcb port? I would like to try it out and see how well it goes.

Other than that, can somebody tell me what is the the best way to display stats from custom script on a bar/wallpaper? I would like to get my old status bar info. Thank you in advance.

p.s. By "the best way" i mean lightweight. I really dont want to spend more than ~1MB of ram on info like this (i was able to do this in dwm. it used only 120KiB of ram).

Last edited by kuraku (2012-10-07 10:04:06)

Offline

#1013 2012-10-07 11:25:11

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: monsterwm! ~ yet another tiny wm

kuraku wrote:

Can somebody tell me what is the state of xcb port? I would like to try it out and see how well it goes.

Other than that, can somebody tell me what is the the best way to display stats from custom script on a bar/wallpaper? I would like to get my old status bar info. Thank you in advance.

p.s. By "the best way" i mean lightweight. I really dont want to spend more than ~1MB of ram on info like this (i was able to do this in dwm. it used only 120KiB of ram).

Mhh, last commit is over 6 months old according to this, https://github.com/Cloudef/monsterwm-xcb
Oh right, thanks for the ps_mem python script cool

Offline

#1014 2012-10-07 12:18:24

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: monsterwm! ~ yet another tiny wm

kuraku wrote:

Can somebody tell me what is the state of xcb port? I would like to try it out and see how well it goes.

Other than that, can somebody tell me what is the the best way to display stats from custom script on a bar/wallpaper? I would like to get my old status bar info. Thank you in advance.

p.s. By "the best way" i mean lightweight. I really dont want to spend more than ~1MB of ram on info like this (i was able to do this in dwm. it used only 120KiB of ram).

No work on the xcb. It should still work, but it's not up-to-date with master and it has lots of changes to vanilla monsterwm.
c00kie said that he might pick up xcb himself, but at the moment I don't have any plans to do anything with it.

Offline

#1015 2012-10-11 18:34:46

Ypnose
Member
From: Jailed in the shell
Registered: 2011-04-21
Posts: 353
Website

Re: monsterwm! ~ yet another tiny wm

After a break, I finally decided to almost migrate to monsterwm. As I asked many time before, something it's weird with some keys.
Here my keyboard (AZERTY)
1349979803.jpg
I try to bind MOD1 (ALT) or MOD4 (Windows KEY) + "&" for DESKTOPCHANGE but it doesn't switch to another desktop. I used xev keycode, as I do on dwm. For example, "&" character has this code: 0x26.
Exactly the same behavior with "é" and 0xe9

I give you my config.h:

/* see LICENSE for copyright and license */

#ifndef CONFIG_H
#define CONFIG_H

/** modifiers **/
#define MOD1            Mod1Mask    /* ALT key */
#define MOD4            Mod4Mask    /* Super/Windows key */
#define CONTROL         ControlMask /* Control key */
#define SHIFT           ShiftMask   /* Shift key */

/** generic settings **/
#define MASTER_SIZE     0.42
#define SHOW_PANEL      True      /* show panel by default on exec */
#define TOP_PANEL       True      /* False means panel is on bottom */
#define PANEL_HEIGHT    18        /* 0 for no space for panel, thus no panel */
#define DEFAULT_MODE    TILE      /* initial layout/mode: TILE MONOCLE BSTACK GRID FLOAT */
#define ATTACH_ASIDE    True      /* False means new window is master */
#define FOLLOW_WINDOW   False     /* follow the window when moved to a different desktop */
#define FOLLOW_MOUSE    False     /* focus the window the mouse just entered */
#define CLICK_TO_FOCUS  True      /* focus an unfocused window when clicked  */
#define FOCUS_BUTTON    Button3   /* mouse button to be used along with CLICK_TO_FOCUS */
#define BORDER_WIDTH    2         /* window border width */
#define FOCUS           "#ff950e" /* focused window border color    */
#define UNFOCUS         "#444444" /* unfocused window border color  */
#define MINWSZ          50        /* minimum window size in pixels  */
#define DEFAULT_DESKTOP 0         /* the desktop to focus initially */
#define DESKTOPS        5         /* number of desktops - edit DESKTOPCHANGE keys to suit */

/**
 * layouts for each desktops
 */
static const int initlayouts[] = { TILE, BSTACK, GRID, MONOCLE, FLOAT, };

/**
 * open applications to specified desktop with specified mode.
 * if desktop is negative, then current is assumed
 */
static const AppRule rules[] = { \
    /*  class     desktop  follow  float */
    { "MPlayer",     3,    True,   False },
    { "Gimp",        0,    False,  True  },
};

/* helper for spawning shell commands */
#define SHCMD(cmd) {.com = (const char*[]){"/bin/sh", "-c", cmd, NULL}}

/**
 * custom commands
 * must always end with ', NULL };'
 */
static const char *termcmd[] = { "urxvtc",    NULL };
static const char *menucmd[] = { "dmenu_run", NULL };

#define DESKTOPCHANGE(K,N) \
    {  MOD4,             K,              change_desktop, {.i = N}}, \
    {  MOD4|ShiftMask,   K,              client_to_desktop, {.i = N}},

/**
 * keyboard shortcuts
 */
static Key keys[] = {
    /* modifier          key            function           argument */
    {  MOD1,             XK_b,          togglepanel,       {NULL}},
    {  MOD1,             XK_BackSpace,  focusurgent,       {NULL}},
    {  MOD1|SHIFT,       XK_c,          killclient,        {NULL}},
    {  MOD1,             XK_j,          next_win,          {NULL}},
    {  MOD1,             XK_k,          prev_win,          {NULL}},
    {  MOD1,             XK_h,          resize_master,     {.i = -10}}, /* decrease size in px */
    {  MOD1,             XK_l,          resize_master,     {.i = +10}}, /* increase size in px */
    {  MOD1,             XK_o,          resize_stack,      {.i = -10}}, /* shrink   size in px */
    {  MOD1,             XK_p,          resize_stack,      {.i = +10}}, /* grow     size in px */
    {  MOD1|CONTROL,     XK_h,          rotate,            {.i = -1}},
    {  MOD1|CONTROL,     XK_l,          rotate,            {.i = +1}},
    {  MOD1|SHIFT,       XK_h,          rotate_filled,     {.i = -1}},
    {  MOD1|SHIFT,       XK_l,          rotate_filled,     {.i = +1}},
    {  MOD1,             XK_Tab,        last_desktop,      {NULL}},
    {  MOD1,             XK_Return,     swap_master,       {NULL}},
    {  MOD1|SHIFT,       XK_j,          move_down,         {NULL}},
    {  MOD1|SHIFT,       XK_k,          move_up,           {NULL}},
    {  MOD1|SHIFT,       XK_t,          switch_mode,       {.i = TILE}},
    {  MOD1|SHIFT,       XK_m,          switch_mode,       {.i = MONOCLE}},
    {  MOD1|SHIFT,       XK_b,          switch_mode,       {.i = BSTACK}},
    {  MOD1|SHIFT,       XK_g,          switch_mode,       {.i = GRID}},
    {  MOD1|SHIFT,       XK_f,          switch_mode,       {.i = FLOAT}},
    {  MOD1|CONTROL,     XK_r,          quit,              {.i = 0}}, /* quit with exit value 0 */
    {  MOD1|CONTROL,     XK_q,          quit,              {.i = 1}}, /* quit with exit value 1 */
    {  MOD1|SHIFT,       XK_Return,     spawn,             {.com = termcmd}},
    {  MOD4,             XK_v,          spawn,             {.com = menucmd}},
    {  MOD4,             XK_j,          moveresize,        {.v = (int []){   0,  25,   0,   0 }}}, /* move down  */
    {  MOD4,             XK_k,          moveresize,        {.v = (int []){   0, -25,   0,   0 }}}, /* move up    */
    {  MOD4,             XK_l,          moveresize,        {.v = (int []){  25,   0,   0,   0 }}}, /* move right */
    {  MOD4,             XK_h,          moveresize,        {.v = (int []){ -25,   0,   0,   0 }}}, /* move left  */
    {  MOD4|SHIFT,       XK_j,          moveresize,        {.v = (int []){   0,   0,   0,  25 }}}, /* height grow   */
    {  MOD4|SHIFT,       XK_k,          moveresize,        {.v = (int []){   0,   0,   0, -25 }}}, /* height shrink */
    {  MOD4|SHIFT,       XK_l,          moveresize,        {.v = (int []){   0,   0,  25,   0 }}}, /* width grow    */
    {  MOD4|SHIFT,       XK_h,          moveresize,        {.v = (int []){   0,   0, -25,   0 }}}, /* width shrink  */
       DESKTOPCHANGE(     0x26,                             0)
       DESKTOPCHANGE(     0xe9,                             1)
       DESKTOPCHANGE(    XK_F3,                             2)
       DESKTOPCHANGE(    XK_F4,                             3)
       DESKTOPCHANGE(    XK_F5,                             4)
};

/**
 * mouse shortcuts
 */
static Button buttons[] = {
    {  MOD1,    Button1,     mousemotion,   {.i = MOVE}},
    {  MOD1,    Button3,     mousemotion,   {.i = RESIZE}},
    {  MOD4,    Button3,     spawn,         {.com = menucmd}},
};
#endif

/* vim: set expandtab ts=4 sts=4 sw=4 : */

I don't why I'm unable to do these shortcuts.
I do my tests with 2 rxvt-unicode windows. When I use "ALT" + "&" (or "ALT"+ "é"), it calls functions in rxvt windows. It's like monsterwm doesn't recognize the combination.

Last edited by Ypnose (2012-10-11 18:35:23)


Github -- My terminal font Envypn

Offline

#1016 2012-10-11 23:36:37

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

hey Ypnose,

if I use your config and add:

 setxkbdmap -layout fr 

on my .xinitrc then it works fine.

'Win-Key + &' goes to 1st desktop
'Win-Key + é' goes to 2nd

Last edited by c00kiemon5ter (2012-10-11 23:37:15)


.:[ git me! ] :.

Offline

#1017 2012-10-12 08:00:50

Schoewilliam
Member
From: Réunion Island, France.
Registered: 2011-12-28
Posts: 26
Website

Re: monsterwm! ~ yet another tiny wm

Hi cookie,

I'm giving monsterwm a try since yesterday. It works fine, but I can't get keyboard shortcuts work with bépo layout. I couldn't figure it out until I changed my layout to the french standart one (azerty).

I've been writing using bépo layout for 3 years, I don't imagine I could be able to switch back to azerty, so is there any workaround to this issue ? Quite annoying as I was falling in love with monsterwm big_smile


blog (in french) · configs

Offline

#1018 2012-10-12 09:07:48

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

Schoewilliam, I think you should use

setxkbmap -layout fr -variant bepo

.:[ git me! ] :.

Offline

#1019 2012-10-12 09:12:27

gholen
Member
From: Göteborg
Registered: 2011-07-26
Posts: 73
Website

Re: monsterwm! ~ yet another tiny wm

As i try the scratchpad, I got one thing that bothers me. It's really nothing inportant, but here goes. It's supposed to be floating, but it does not, it always goes as tiling (BSTACK). it looks exatly the same as c00ikemon5ter has shown how its supposed to look in config.h. Any thoughts?

Offline

#1020 2012-10-12 09:28:22

Schoewilliam
Member
From: Réunion Island, France.
Registered: 2011-12-28
Posts: 26
Website

Re: monsterwm! ~ yet another tiny wm

c00kiemon5ter wrote:

Schoewilliam, I think you should use

setxkbmap -layout fr -variant bepo

Thanks for replying. The problem's still the same. I'm not able to use most of the shortcuts, such as changing tiling mode, or resize the master client. But they work actually fine when I use azerty layout.


blog (in french) · configs

Offline

#1021 2012-10-12 09:48:44

Ypnose
Member
From: Jailed in the shell
Registered: 2011-04-21
Posts: 353
Website

Re: monsterwm! ~ yet another tiny wm

c00kiemon5ter wrote:

hey Ypnose,

if I use your config and add:

 setxkbmap -layout fr 

on my .xinitrc then it works fine.

'Win-Key + &' goes to 1st desktop
'Win-Key + é' goes to 2nd

It worked. Thanks a lot my friend.


Github -- My terminal font Envypn

Offline

#1022 2012-10-12 09:51:42

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: monsterwm! ~ yet another tiny wm

gholen wrote:

As i try the scratchpad, I got one thing that bothers me. It's really nothing inportant, but here goes. It's supposed to be floating, but it does not, it always goes as tiling (BSTACK). it looks exatly the same as c00ikemon5ter has shown how its supposed to look in config.h. Any thoughts?

two things are needed to have the terminal floating

1. set the terminal's instance name
by default urxvt is used as the terminal, and its name is set to 'scratchpad'

urxvt -name scratchpad

2. use that name to set it to floating on config.h on the rules[] array

    { "scratchpad", -1, False,  True  },     // master branches
    { "scratchpad", -1, -1, False,  True  }, // xinerama branches

now invoking a terminal like: urxvt -name scratchpad (part of what the scratchpad.sh script does)
should bring up the terminal floating and centered.
watch out for typos on "scratchpad", maybe a shorter name would be more easily checked tongue

Schoewilliam wrote:
c00kiemon5ter wrote:

Schoewilliam, I think you should use

setxkbmap -layout fr -variant bepo

Thanks for replying. The problem's still the same. I'm not able to use most of the shortcuts, such as changing tiling mode, or resize the master client. But they work actually fine when I use azerty layout.

it seems to be working fine here. if I do

# ~/.xinitrc file
setxkbpmap -layout fr -variant bepo
exec monsterwm

opening a terminal gives me 'bepoe' for the first row - so the layout is correct
I can open, close, resize clients, resize master and stack area, change layouts etc

Ypnose wrote:

It worked. Thanks a lot my friend.

great!

Last edited by c00kiemon5ter (2012-10-12 09:56:15)


.:[ git me! ] :.

Offline

#1023 2012-10-12 10:19:05

Schoewilliam
Member
From: Réunion Island, France.
Registered: 2011-12-28
Posts: 26
Website

Re: monsterwm! ~ yet another tiny wm

Finally solved. I only did a few mistakes in my .xinitrc.
Thanks, and great work by the way smile

Last edited by Schoewilliam (2012-10-12 10:21:36)


blog (in french) · configs

Offline

#1024 2012-10-12 11:27:34

gholen
Member
From: Göteborg
Registered: 2011-07-26
Posts: 73
Website

Re: monsterwm! ~ yet another tiny wm

c00kiemon5ter: It worked fine: Had it set for xinerama by mistake. Now EVERYTHING IS FINE big_smile

Offline

#1025 2012-10-13 11:26:33

nperry
Member
Registered: 2010-05-16
Posts: 86

Re: monsterwm! ~ yet another tiny wm

Hello all,

First time of trying to get monsterwm working using xinerama-init & bar.

However I'm not 100% sure what is going on. If I go back to tty1 all I see is alot of "Max clients ConnectedCouldn't Connect to X"

monsterwm launcher

#!/usr/bin/env bash

wm=monsterwm
ff="/tmp/monsterwm.fifo"

[[ -p $ff ]] || mkfifo -m 600 $ff

tags=('foo' 'www' 'term' 'im' 'bar')
#layouts=("" "" "" "" "" "")
layouts=("1" "2" "3" "4" "5")

function statusbar {
    ram="$(free -mo | grep -P "Mem"  | awk '{ print int($3-$7-$6)"/"$2 }')"
    battery="$(acpi | awk '{print $3" "$4}' | sed -r 's/%,/%/')"
    date="$(date "+%a %d %B %H:%M")"
    echo "$ram | $battery | $date"
}

while read -t 1 -r wmout || true; do
    if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
        read -ra desktops <<< "$wmout"

        for desktop in "${desktops[@]}"; do
            if (( ${desktop%%:*} == 0 )); then
                lmon+=( $desktop )
            elif (( ${desktop%%:*} == 1 )); then
                rmon+=( $desktop )
            fi
        done

        for ldesktop in "${lmon[@]}"; do
            IFS=':' read -r x y d w m c u <<< "$ldesktop"
            ((c)) && label="${tags[$d]}" layout="\\b7\\f0 ${layouts[$m]} \\b0\\f7"
        done
    fi
    echo "\\l$layout $label\\r\\f7$(statusbar)"
done < "$ff" | bar &

#$wm > $ff
while :; do "$wm" || break; done | tee -a "$ff"

config.h

/* see LICENSE for copyright and license */

#ifndef CONFIG_H
#define CONFIG_H

/** modifiers **/
#define MOD1            Mod1Mask    /* ALT key */
#define MOD4            Mod4Mask    /* Super/Windows key */
#define CONTROL         ControlMask /* Control key */
#define SHIFT           ShiftMask   /* Shift key */

/** generic settings **/
#define MASTER_SIZE     0.52
#define SHOW_PANEL      True      /* show panel by default on exec */
#define TOP_PANEL       True      /* False means panel is on bottom */
#define PANEL_HEIGHT    18        /* 0 for no space for panel, thus no panel */
#define DEFAULT_MODE    TILE      /* initial layout/mode: TILE MONOCLE BSTACK GRID FLOAT */
#define ATTACH_ASIDE    True      /* False means new window is master */
#define FOLLOW_WINDOW   False     /* follow the window when moved to a different desktop */
#define FOLLOW_MONITOR  True      /* follow the window when moved to a different monitor */
#define FOLLOW_MOUSE    True      /* focus the window the mouse just entered */
#define CLICK_TO_FOCUS  True      /* focus an unfocused window when clicked  */
#define FOCUS_BUTTON    Button3   /* mouse button to be used along with CLICK_TO_FOCUS */
#define BORDER_WIDTH    2         /* window border width */
#define FOCUS           "#c5c8c6" /* focused window border color   */
#define UNFOCUS         "#969896" /* unfocused window border color */
#define INFOCUS         "#9c3885" /* focused window border color on unfocused monitor */
#define MINWSZ          50        /* minimum window size in pixels */
#define DEFAULT_MONITOR 0         /* the monitor to focus initially */
#define DEFAULT_DESKTOP 0         /* the desktop to focus initially */
#define DESKTOPS        5         /* number of desktops - edit DESKTOPCHANGE keys to suit */

struct ml {
    int m; /* monitor that the desktop in on  */
    int d; /* desktop which properties follow */
    struct {
        int mode;  /* layout mode for desktop d of monitor m    */
        int masz;  /* incread or decrease master area in px     */
        Bool sbar; /* whether or not to show panel on desktop d */
    } dl;
};

/**
 * define initial values for each monitor and dekstop properties
 *
 * in the example below:
 * - the first desktop (0) on the first monitor (0) will have
 *   tile layout, with its master area increased by 50px and
 *   the panel will be visible.
 * - the third desktop (2) on the second monitor (1) will have
 *   grid layout, with no changes to its master area and
 *   the panel will be hidden.
 */
static const struct ml init[] = { \
    /* monitor  desktop   mode  masz  sbar   */
    {     0,       0,   { TILE,  50,  True  } },
    {     1,       2,   { GRID,  0,   False } },
};

/**
 * open applications to specified monitor and desktop
 * with the specified properties.
 * if monitor is negative, then current is assumed
 * if desktop is negative, then current is assumed
 */
static const AppRule rules[] = { \
    /*  class     monitor  desktop  follow  float */
    { "MPlayer",     0,       3,    True,   False },
    { "Gimp",        1,       0,    False,  True  },
};

/* helper for spawning shell commands */
#define SHCMD(cmd) {.com = (const char*[]){"/bin/sh", "-c", cmd, NULL}}

/**
 * custom commands
 * must always end with ', NULL };'
 */
static const char *termcmd[] = { "urxvt", NULL };
static const char *menucmd[] = { "dmenu_run", NULL };

#define MONITORCHANGE(K,N) \
    {  MOD1,             K,              change_monitor, {.i = N}}, \
    {  MOD1|ShiftMask,   K,              client_to_monitor, {.i = N}},

#define DESKTOPCHANGE(K,N) \
    {  MOD4,             K,              change_desktop, {.i = N}}, \
    {  MOD4|ShiftMask,   K,              client_to_desktop, {.i = N}},

/**
 * keyboard shortcuts
 */
static Key keys[] = {
    /* modifier          key            function           argument */
    {  MOD1,             XK_b,          togglepanel,       {NULL}},
    {  MOD1,             XK_BackSpace,  focusurgent,       {NULL}},
    {  MOD4,             XK_k,          killclient,        {NULL}},
    {  MOD1,             XK_j,          next_win,          {NULL}},
    {  MOD1,             XK_k,          prev_win,          {NULL}},
    {  MOD1,             XK_h,          resize_master,     {.i = -10}}, /* decrease size in px */
    {  MOD1,             XK_l,          resize_master,     {.i = +10}}, /* increase size in px */
    {  MOD1,             XK_o,          resize_stack,      {.i = -10}}, /* shrink   size in px */
    {  MOD1,             XK_p,          resize_stack,      {.i = +10}}, /* grow     size in px */
    {  MOD1|CONTROL,     XK_h,          rotate,            {.i = -1}},
    {  MOD1|CONTROL,     XK_l,          rotate,            {.i = +1}},
    {  MOD1|SHIFT,       XK_h,          rotate_filled,     {.i = -1}},
    {  MOD1|SHIFT,       XK_l,          rotate_filled,     {.i = +1}},
    {  MOD1,             XK_Tab,        last_desktop,      {NULL}},
    {  MOD1,             XK_Return,     swap_master,       {NULL}},
    {  MOD1|SHIFT,       XK_j,          move_down,         {NULL}},
    {  MOD1|SHIFT,       XK_k,          move_up,           {NULL}},
    {  MOD1|SHIFT,       XK_t,          switch_mode,       {.i = TILE}},
    {  MOD1|SHIFT,       XK_m,          switch_mode,       {.i = MONOCLE}},
    {  MOD1|SHIFT,       XK_b,          switch_mode,       {.i = BSTACK}},
    {  MOD1|SHIFT,       XK_g,          switch_mode,       {.i = GRID}},
    {  MOD1|SHIFT,       XK_f,          switch_mode,       {.i = FLOAT}},
    {  MOD1|CONTROL,     XK_r,          quit,              {.i = 0}}, /* quit with exit value 0 */
    {  MOD1|CONTROL,     XK_q,          quit,              {.i = 1}}, /* quit with exit value 1 */
    {  MOD4,             XK_Return,     spawn,             {.com = termcmd}},
    {  MOD4,             XK_o,          spawn,             {.com = menucmd}},
    {  MOD4,             XK_j,          moveresize,        {.v = (int []){   0,  25,   0,   0 }}}, /* move down  */
    {  MOD4,             XK_k,          moveresize,        {.v = (int []){   0, -25,   0,   0 }}}, /* move up    */
    {  MOD4,             XK_l,          moveresize,        {.v = (int []){  25,   0,   0,   0 }}}, /* move right */
    {  MOD4,             XK_h,          moveresize,        {.v = (int []){ -25,   0,   0,   0 }}}, /* move left  */
    {  MOD4|SHIFT,       XK_j,          moveresize,        {.v = (int []){   0,   0,   0,  25 }}}, /* height grow   */
    {  MOD4|SHIFT,       XK_k,          moveresize,        {.v = (int []){   0,   0,   0, -25 }}}, /* height shrink */
    {  MOD4|SHIFT,       XK_l,          moveresize,        {.v = (int []){   0,   0,  25,   0 }}}, /* width grow    */
    {  MOD4|SHIFT,       XK_h,          moveresize,        {.v = (int []){   0,   0, -25,   0 }}}, /* width shrink  */
       DESKTOPCHANGE(    XK_F1,                             0)
       DESKTOPCHANGE(    XK_F2,                             1)
       DESKTOPCHANGE(    XK_F3,                             2)
       DESKTOPCHANGE(    XK_F4,                             3)
       DESKTOPCHANGE(    XK_F5,                             4)
       MONITORCHANGE(    XK_F1,                             0)
       MONITORCHANGE(    XK_F2,                             1)
};

/**
 * mouse shortcuts
 */
static Button buttons[] = {
    {  MOD1,    Button1,     mousemotion,   {.i = MOVE}},
    {  MOD1,    Button3,     mousemotion,   {.i = RESIZE}},
};
#endif

/* vim: set expandtab ts=4 sts=4 sw=4 : */

Offline

Board footer

Powered by FluxBB