Configuration de dwm

Bon, je change un peu mon premier post, pour que ce sujet puisse être un endroit de partage sur nos configurations de dwm. Alors voici ce que cela donne pour moi :
voici mon config.h :

[code]/* See LICENSE file for copyright and license details. */

/* appearance /
static const char font[] = "-
--medium----10-------";
static const char normbordercolor[] = “#cccccc”;
static const char normbgcolor[] = “#000000”;
static const char normfgcolor[] = “#ffffff”;
static const char selbordercolor[] = “#565656”;
static const char selbgcolor[] = “#979797”;
static const char selfgcolor[] = “#ffffff”;
static const unsigned int borderpx = 1; /
border pixel of windows /
static const unsigned int snap = 32; /
snap pixel /
static const Bool showbar = True; /
False means no bar /
static const Bool topbar = True; /
False means bottom bar */

/* tagging */
static const char *tags[] = { “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, };

static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ “Gimp”, NULL, NULL, 0, True, -1 },
{ “Gajim”, NULL, NULL, 1 << 6, False, -1 },
{ “MPlayer”, NULL, NULL, 0, True, -1 },
{ “gmplayer”, NULL, NULL, 0, True, -1 },
{ “Iceweasel”, NULL, “Téléchargements”, 1 << 8, False, -1 },
{ “Transmission”, NULL, NULL, 1 << 8, False, -1 },
{ “Icedove-bin”, NULL, NULL, 1 << 7, False, -1 },
{ “Fbpanel”, NULL, NULL, ~0, True, -1 },
{ “stalonetray”, NULL, NULL, ~0, True, -1 },
};

/* layout(s) /
static const float mfact = 0.62; /
factor of master area size [0.05…0.95] /
static const Bool resizehints = True; /
True means respect size hints in tiled resizals */

static const Layout layouts[] = {
/* symbol arrange function /
{ “[]=”, tile }, /
first entry is default /
{ “><>”, NULL }, /
no layout function means floating behavior */
{ “[M]”, monocle },
};

/* key definitions */
#define MODKEY Mod4Mask
#define MONTESON 0x1008ff13
#define TAGKEYS(KEY,TAG)
{ MODKEY, KEY, view, {.ui = 1 << TAG} },
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} },
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} },
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion /
#define SHCMD(cmd) { .v = (const char
[]){ “/bin/sh”, “-c”, cmd, NULL } }

/* commands */
static const char *dmenucmd[] = { “dmenu_run”, “-fn”, font, “-nb”, normbgcolor, “-nf”, normfgcolor, “-sb”, selbgcolor, “-sf”, selfgcolor, NULL };
static const char *termcmd[] = { “urxvt”, NULL };
static const char *firefox[] = { “iceweasel”, NULL };
static const char *gajim[] = { “gajim”, NULL };
static const char *icedove[] = { “icedove”, NULL };
static const char *thunar[] = { “thunar”, NULL };
static const char *gmplayer[] = { “gmplayer”, NULL };
static const char *transmission[] = { “transmission”, NULL };
static const char *monteson[] = { “amixer”, “set”, “Master”, “2dB+”, “unmute”, NULL };
static const char *baisseson[] = { “amixer”, “set”, “Master”, “2dB-”, “unmute”, NULL };
static const char *muteson[] = { “amixer”, “-q”, “set”, “Master”, “toggle”, NULL };
static const char *mpdprev[] = { “mpc”, “prev”, NULL };
static const char *mpdnext[] = { “mpc”, “next”, NULL };
static const char *mpdtoggle[] = { “mpc”, “toggle”, NULL };
static const char *sonata[] = { “sonata”, NULL };

static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_F2, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|Mod1Mask, XK_f, spawn, {.v = firefox } },
{ MODKEY|Mod1Mask, XK_m, spawn, {.v = icedove } },
{ MODKEY|Mod1Mask, XK_t, spawn, {.v = transmission } },
{ MODKEY|Mod1Mask, XK_s, spawn, {.v = sonata } },
{ MODKEY|Mod1Mask, XK_v, spawn, {.v = gmplayer } },
{ MODKEY|Mod1Mask, XK_h, spawn, {.v = thunar } },
{ MODKEY|Mod1Mask, XK_i, spawn, {.v = gajim } },
{ ControlMask, 0xff53, spawn, {.v = mpdnext } },
{ ControlMask, 0xff51, spawn, {.v = mpdprev } },
{ ControlMask, 0xff54, spawn, {.v = mpdtoggle } },
{ MODKEY, XK_F8, spawn, {.v = monteson } },
{ MODKEY , XK_F7, spawn, {.v = baisseson } },
{ MODKEY , XK_F9, spawn, {.v = muteson } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY, XK_Escape, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( 0x26, 0)
TAGKEYS( 0xe9, 1)
TAGKEYS( 0x22, 2)
TAGKEYS( 0x27, 3)
TAGKEYS( 0x28, 4)
TAGKEYS( 0x2d, 5)
TAGKEYS( 0xe8, 6)
TAGKEYS( 0x5f, 7)
TAGKEYS( 0xe7, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};

/* button definitions /
/
click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin /
static Button buttons[] = {
/
click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

[/code]

Et le screen :

En ce qui me concerne, j’aimerais changer les raccourcis pour gérer le volume sonore, pour n’utiliser que les touches XF86AudioRaiseVolume ,XF86AudioLowerVolume, XF86AudioMute . Cependant, comme il semble essentiel d’avoir une combinaison de touches dans le config.h … Si vous avez la solutions n’hésitez pas! :slightly_smiling:

c’est résolu, tout est expliqué ici :

dwm.suckless.org/customisation/tagmask

Dwm, c’est bien ?

en tant que tiling wm, c’est le meilleur que j’ai testé. Il y a plein de documentation sur leur site (encore faut-il lire). Ce n’est pas très compliqué à configurer.
Je le préfère à wmii, car il me permet les mêmes choses, sans la barre au dessus des fenetres. Je peux avoir une barre de status avec xsetroot. J’ai tout un tas de raccourcis claviers…
Je le préfère à awesome, car ce dernier est trop complet, et ça devient trop lourd à gérer (ou alors, il faut avoir 4 écrans assez grands, ce qui n’est pas mon cas sur mon simple laptop).
Et enfin, xmonad m’aurait bien plus, mais je ne comprenais vraiment rien à sa configuration.
Et bonus pour dwm : tous les outils sont inclus dedans! pas besoin de xmodbar ou autre à installer qui serait nécessaire avec les autres (éventuellement).
Tu pourras trouver tout un tas de patch, exemples sur le net…

voila, après, à toi de prendre ce qui te plaît le plus!

Ok je vais creuser. Tu as testé ion3 sinon ?

n’hésites pas à faire part de tes trouvailles! il y a tant de choses possibles avec dwm!
Tiens, si tu veux tenter, j’ai pour ma part modifié le fichier /usr/share/xsession/dwm , pour qu’il lance un script perso qui ressemble beaucoup à un .xinitrc :

while true do xsetroot -name "$(echo -n 'Bat:' $(acpi -b | grep -Eo '[0-9]+%') '|' $(cat /home/xavier/sauvegarde/mails) '|' '/ :' $(df -h / | awk '{print $5}' | grep -Eo '[0-9]+%') '|' '/home :' $(df -h /home | awk '{print $5}' | grep -Eo '[0-9]+%') '|' 'Mem :' $(echo "scale=2;100 - (((`grep 'MemFree' /proc/meminfo | awk '{print $2}'`+`grep '^Cached' /proc/meminfo | awk '{print $2}'`)/`grep 'MemTotal' /proc/meminfo | awk '{print $2}'`)*100)" | bc)'%' '|' 'CPU :' $(/home/xavier/Documents/Scripts/Cpu.sh) '|' $(/home/xavier/Documents/Scripts/mpd_statut.sh) '|' $(/bin/date +%k:%M' - '%d/%m/%Y))" sleep 1 done & /home/xavier/Documents/Scripts/gmail2.sh & hsetroot -fill /home/xavier/Images/Wallpapers/jambudvipa.png & mpd & export OOO_FORCE_DESKTOP=gnome & exec dwm

Sinon, pour ion3, je ne l’ai pas testé. Pourquoi? avant tout pour la réputation du développeur, et il semblerait que la license est un peu louche. Bref, je n’ai pas trop cherché plus loin, peut-être à tord…

ion3, j’ai pas testé non plus, mais on en dit souvent du bien… sauf ce qui a rapport au dev et à la licence :laughing:

Sinon je pense tester dwm le w-e prochain, parce que découvrir et configurer un nouveau wm, c’est le genre de truc bien chronophage !

Bonjour, alors Thuban, c’est reparti pour dwm?
Je m’y suis remis aussi depuis peu, ça pète !
Je constate que tu as aussi changé le rapport master/stack de 0,55 à 0,62.
C’est plus proche du nombre d’or, ça fait un bureau plus harmonieux.
Tu utilises quelle version?

Eh oui, reparti pour dwm. Et comme le dit llapingachos, c’est le genre de chose qui est un peu trop passionnant! (mauvais pour les études ça! :slightly_smiling: ). J’avais envie de retrouver un truc simple, sans la grosse barre d’awesome, pour que mes fenetres remplissent tout mon écran.
Et puis je sais pas vous, mais je trouve dwm mieux pensé au niveau des raccourcis claviers comparé à ses forks.
Tiens, ce que je vous propose, c’est de poster vos config.h, ainsi que autres configurations de dwm dans ce post histoire de se filer nos astuces.

@ eol : Lorsque j’aurais du temps, il faudra que je me repenche sur tes scripts avec dmenu, j’avais pas vraiment tout compris la première fois. J’aimerais en faire un lanceur pour chaque type de fichier (.pdf, .avi, .png, .odt …)
Sinon, j’utilise la dernière version qui est dans sid : la 5.7.1-1. Je ne sais pas quelles améliorations on été apportées par rapport aux autres versions?

En rejetant un oeil au topic, j’ai vu l’edit de ton premier post, ça me semble être une bonne idée,
un peu comme le topic qu’on peut voir sur le forum d’arch.
Je colle aussi mon config.h[code]
/* See LICENSE file for copyright and license details. */

/* appearance /
static const char font[] = "-
--medium----14-------";
static const char normbordercolor[] = “#000000”;
static const char normbgcolor[] = “#000000”;
static const char normfgcolor[] = “#ffffff”;
static const char selbordercolor[] = “#00ff00”;
static const char selbgcolor[] = “#000000”;
static const char selfgcolor[] = “#00ff00”;
static const unsigned int borderpx = 1; /
border pixel of windows /
static const unsigned int snap = 32; /
snap pixel /
static const Bool showbar = False; /
False means no bar /
static const Bool topbar = True; /
False means bottom bar */

/* tagging */
static const char *tags[] = { “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9” };

static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ “Gimp”, NULL, NULL, 0, True, -1 },
{ “Firefox”, NULL, NULL, 1 << 8, False, -1 },
};

/* layout(s) /
static const float mfact = 0.62; /
factor of master area size [0.05…0.95] /
static const Bool resizehints = False; /
True means respect size hints in tiled resizals /
static const int nmaster = 1; /
default number of clients in the master area */

static const Layout layouts[] = {
/* symbol arrange function */
{ “-|=”, ntile },
{ “-|-”, nbstack },
{ “[M]”, monocle },
};

/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG)
{ MODKEY, KEY, view, {.ui = 1 << TAG} },
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} },
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} },
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion /
#define SHCMD(cmd) { .v = (const char
[]){ “/bin/sh”, “-c”, cmd, NULL } }

/* commands */
static const char *dmenucmd[] = { “dmenu_run”, “-fn”, font, “-nb”, normbgcolor, “-nf”, normfgcolor, “-sb”, selbgcolor, “-sf”, selfgcolor, NULL };
static const char *termcmd[] = { “urxvtc”, NULL };
static const char *rtermcmd[] = { “/bin/sh”, “-c”, “sudo urxvt”, NULL };
static const char *directorycmd[] = { “lsd”, NULL };
static const char *racinecmd[] = { “racine”, NULL };
static const char *actionscmd[] = { “actions”, NULL };
static const char *internetcmd[] = { “launchid”, NULL };
static const char *surfcmd[] = { “surftools”, NULL };
static const char *clipmenucmd[] = { “clipmenu”, NULL };
static const char *mailcmd[] = { “/bin/sh”, “-c”, “urxvtc -e mutt”, NULL };

static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_c, spawn, {.v = clipmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_t, spawn, {.v = rtermcmd } },
{ MODKEY, XK_l, spawn, {.v = directorycmd } },
{ MODKEY, XK_r, spawn, {.v = racinecmd } },
{ MODKEY, XK_x, spawn, {.v = actionscmd } },
{ MODKEY, XK_i, spawn, {.v = internetcmd } },
{ MODKEY, XK_s, spawn, {.v = surfcmd } },
{ MODKEY, XK_m, spawn, {.v = mailcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_Tab, focusstack, {.i = +1 } },
{ MODKEY, XK_oe, focusstack, {.i = -1 } },
{ MODKEY, XK_Left, setmfact, {.f = -0.05} },
{ MODKEY, XK_Right, setmfact, {.f = +0.05} },
{ MODKEY, XK_Up, view_prev_tag, {0} },
{ MODKEY, XK_Down, view_next_tag, {0} },
{ MODKEY, XK_comma, incnmaster, {.i = +1 } },
{ MODKEY, XK_semicolon, incnmaster, {.i = -1 } },
{ MODKEY, XK_colon, setnmaster, {.i = 2 } },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_v, view, {0} },
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_n, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_h, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY, XK_o, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_o, tag, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_comma, focusmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_semicolon, focusmon, {.i = +1 } },
{ MODKEY|ControlMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ControlMask, XK_semicolon, tagmon, {.i = +1 } },
TAGKEYS( XK_ampersand, 0)
TAGKEYS( XK_eacute, 1)
TAGKEYS( XK_quotedbl, 2)
TAGKEYS( XK_apostrophe, 3)
TAGKEYS( XK_parenleft, 4)
TAGKEYS( XK_minus, 5)
TAGKEYS( XK_egrave, 6)
TAGKEYS( XK_underscore, 7)
TAGKEYS( XK_ccedilla, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};

/* button definitions /
/
click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin /
static Button buttons[] = {
/
click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};[/code]

Ce qu’on ne voit pas forcément dans le config.h :
J’ai enlevé les fonctions dont je ne me sert pas dans dwm.c et j’ai rajouté quelques patchs.
Au final, le dwm patché n’est pas plus gros qu’un original intact.

Les patchs ajoutés sont :
-attachabove qui me permet d’ouvrir une nouvelle fenêtre soit dans la zone master soit dans la zone stack
-nmaster-sym qui me donne un layout supplémentaire, le même que par défaut mais horizontalement au lieu de verticalement,
il me donne aussi la possibilité pour chacun de ces layout, d’augmenter ou diminuer le nombre de fenêtre dans la zone master à volonté.
-pertag me permet d’avoir des layout différents dans chaque vue
-prev-next_view pour passer dans la vue précédente ou suivante sans avoir à aller chercher les chiffres du clavier.

Ils sont tous disponibles sur suckless.org sauf le dernier

Pour l’instant le patch pertag ne se rappelle pas le nombre de fenêtre dans le master d’une vue à l’autre par contre
il s’en rapelle d’un écran à l’autre.

C’est facile, il ya juste à adapter la partie avec ls à l’extension des fichiers, j’ai rajouté un patch pour dmenu dans le post qui lui donne une option d’autoconfirmation, même plus plus besoin d’appuyer sur entrée pour valider tes choix, les déplacement dans les répertoires et autres scripts s’en retrouvent accéléré.
Plus rapide que bash et tab! :smiley:

Sinon pour dwm, j’utilise le 5.7.2, il n’ y a pas beaucoup de changement par rapport à celle que tu utilises.

intéressant ces patch, surtout celui pour la position horizontale. Tu pourrais nous montrer ce que ça donne pour le premier patch?

Hum… pour le dmenu… je ne trouve pas cela si simple moi :smiley: . Il faut que je prenne bien le temps.

Pour la position horizontale tout est là : http://dwm.suckless.org/patches/nmaster

je n’ai pas été très explicite. Je me demandais ce que donnaire attachabove?

J’avais failli répondre sur attachabove mais j’étais pas sûr lequel t’intéressais vraiment.
Pour attachabove, quand tu as le focus sur le master, les nouvelles fenêtres que tu ouvres seront dans le master, quand tu as le focus dans le stack, les fenêtres que tu ouvres seront dans le stack.

wahou, vraiment super nmaster, je viens de tester! c’est parfait maintenant! il faut que je regarde aux autres patchs voir ce que cela donne!

je me demandais, à quoi te servent ces déclarations :

static const float mfact = 0.62; /* factor of master area size [0.05..0.95] */ static const Bool resizehints = False; /* True means respect size hints in tiled resizals */

pour d’autre patchs?

pour attachabove, il s’agit d’un .diff … Je ne sais pas comment inclure ce genre de patches… Tu veux bien m’expliquer s’il te plaît?

[quote=“thuban”]Pour attachabove, il s’agit d’un .diff … Je ne sais pas comment inclure ce genre de patches… Tu veux bien m’expliquer s’il te plaît?[/quote]http://dwm.suckless.org/patches/

[quote=“thuban”]je me demandais, à quoi te servent ces déclarations :
Code:
static const float mfact = 0.62; /* factor of master area size [0.05…0.95] /
static const Bool resizehints = False; /
True means respect size hints in tiled resizals */
pour d’autre patchs?[/quote]Tu as remarqué que la première tu l’as aussi, pour la deuxième, inverse la valeur et tu devrais voir une différence,
en tout cas je préfère l’avoir à False qu’à True.

Tiens un petit résumé des changements entre le mien et l’original :

[code]— a/dwm.c 2009-10-05 16:40:00.000000000 +0200
+++ b/dwm.c 2009-10-05 16:39:09.000000000 +0200
@@ -61,6 +61,7 @@ enum { NetSupported, NetWMName, NetLast
enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms /
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /
clicks */
+enum {MaxMon = 8};

typedef union {
int i;
@@ -120,26 +121,6 @@ typedef struct {
void (*arrange)(Monitor *);
} Layout;

-struct Monitor {

  • char ltsymbol[16];
  • float mfact;
  • int num;
  • int by; /* bar geometry */
  • int mx, my, mw, mh; /* screen size */
  • int wx, wy, ww, wh; /* window area */
  • unsigned int seltags;
  • unsigned int sellt;
  • unsigned int tagset[2];
  • Bool showbar;
  • Bool topbar;
  • Client *clients;
  • Client *sel;
  • Client *stack;
  • Monitor *next;
  • Window barwin;
  • const Layout *lt[2];
    -};

typedef struct {
const char *class;
const char *instance;
@@ -155,6 +136,7 @@ static Bool applysizehints(Client *c, in
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
+static void attachabove(Client *c);
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
@@ -186,7 +168,9 @@ static long getstate(Window w);
static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, Bool focused);
static void grabkeys(void);
+static void incnmaster(const Arg *arg);
static void initfont(const char *fontstr);
+static void initnmaster(void);
static Bool isprotodel(Client *c);
static void keypress(XEvent *e);
static void killclient(const Arg *arg);
@@ -194,13 +178,13 @@ static void manage(Window w, XWindowAttr
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static void monocle(Monitor *m);
-static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
static Monitor *ptrtomon(int x, int y);
+static void nbstack(Monitor *m);
+static void ntile(Monitor *m);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static void resize(Client *c, int x, int y, int w, int h, Bool interact);
-static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
@@ -208,6 +192,7 @@ static void sendmon(Client *c, Monitor *
static void setclientstate(Client *c, long state);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
+static void setnmaster(const Arg *arg);
static void setup(void);
static void showhide(Client *c);
static void sigchld(int unused);
@@ -215,9 +200,7 @@ static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static int textnw(const char *text, unsigned int len);
-static void tile(Monitor *);
static void togglebar(const Arg *arg);
-static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c);
@@ -232,6 +215,9 @@ static void updatestatus(void);
static void updatetitle(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void view_next_tag(const Arg *);
+static void view_prev_tag(const Arg *);
+static void view_adjacent_tag(const Arg *, int);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent ee);
@@ -246,6 +232,8 @@ static int screen;
static int sw, sh; /
X display screen geometry width, height /
static int bh, blw = 0; /
bar geometry */
static int (*xerrorxlib)(Display *, XErrorEvent *);
+static int nmasters[MaxMon];
+static int initnm = 0;
static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent ) = {
[ButtonPress] = buttonpress,
@@ -273,6 +261,31 @@ static Window root;
/
configuration, allows nested code to access above variables */
#include “config.h”

+struct Monitor {

  • char ltsymbol[16];
  • float mfact;
  • int num;
  • int by; /* bar geometry */
  • int mx, my, mw, mh; /* screen size */
  • int wx, wy, ww, wh; /* window area */
  • unsigned int seltags;
  • unsigned int sellt;
  • unsigned int tagset[2];
  • Bool showbar;
  • Bool topbar;
  • Client *clients;
  • Client *sel;
  • Client *stack;
  • Monitor *next;
  • Window barwin;
  • const Layout *lt[2];
  • int curtag;
  • int prevtag;
  • const Layout *lts[LENGTH(tags) + 1];
  • double mfacts[LENGTH(tags) + 1];
  • Bool showbars[LENGTH(tags) + 1];
    +};

/* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };

@@ -407,6 +420,19 @@ attach(Client *c) {
}

void
+attachabove(Client *c) {

  • if(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating) {
  •   attach(c);
    
  •   return;
    
  • }
  • Client *at;
  • for (at = c->mon->clients; at->next != c->mon->sel; at = at->next);
  • c->next = at->next;
  • at->next = c;
    +}

+void
attachstack(Client *c) {
c->snext = c->mon->stack;
c->mon->stack = c;
@@ -982,6 +1008,16 @@ grabkeys(void) {
}

void
+incnmaster(const Arg *arg) {

  • if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
  •   return;
    
  • nmasters[selmon->num] += arg->i;
  • if(nmasters[selmon->num] < 0)
  •   nmasters[selmon->num] = 0;
    
  • arrange(selmon);
    +}

+void
initfont(const char *fontstr) {
char *def, **missing;
int i, n;
@@ -1046,6 +1082,17 @@ isuniquegeom(XineramaScreenInfo unique,
#endif /
XINERAMA */

void
+initnmaster(void) {

  • int i;
  • if(initnm)
  •   return;
    
  • for(i = 0; i < MaxMon; i++)
  •   nmasters[i] = nmaster;
    
  • initnm = 1;
    +}

+void
keypress(XEvent *e) {
unsigned int i;
KeySym keysym;
@@ -1141,7 +1188,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = trans != None || c->isfixed;
if(c->isfloating)
XRaiseWindow(dpy, c->win);

  • attach©;
  • attachabove©;
    attachstack©;
    XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
    XMapWindow(dpy, c->win);
    @@ -1185,61 +1232,6 @@ monocle(Monitor *m) {
    resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
    }

-void
-movemouse(const Arg *arg) {

  • int x, y, ocx, ocy, nx, ny;
  • Client *c;
  • Monitor *m;
  • XEvent ev;
  • if(!(c = selmon->sel))
  •   return;
    
  • restack(selmon);
  • ocx = c->x;
  • ocy = c->y;
  • if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
  • None, cursor[CurMove], CurrentTime) != GrabSuccess)
  •   return;
    
  • if(!getrootptr(&x, &y))
  •   return;
    
  • do {
  •   XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
    
  •   switch (ev.type) {
    
  •   case ConfigureRequest:
    
  •   case Expose:
    
  •   case MapRequest:
    
  •   	handler[ev.type](&ev);
    
  •   	break;
    
  •   case MotionNotify:
    
  •   	nx = ocx + (ev.xmotion.x - x);
    
  •   	ny = ocy + (ev.xmotion.y - y);
    
  •   	if(snap && nx >= selmon->wx && nx <= selmon->wx + selmon->ww
    
  •   	&& ny >= selmon->wy && ny <= selmon->wy + selmon->wh) {
    
  •   		if(abs(selmon->wx - nx) < snap)
    
  •   			nx = selmon->wx;
    
  •   		else if(abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
    
  •   			nx = selmon->wx + selmon->ww - WIDTH(c);
    
  •   		if(abs(selmon->wy - ny) < snap)
    
  •   			ny = selmon->wy;
    
  •   		else if(abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
    
  •   			ny = selmon->wy + selmon->wh - HEIGHT(c);
    
  •   		if(!c->isfloating && selmon->lt[selmon->sellt]->arrange
    
  •   		&& (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
    
  •   			togglefloating(NULL);
    
  •   	}
    
  •   	if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
    
  •   		resize(c, nx, ny, c->w, c->h, True);
    
  •   	break;
    
  •   }
    
  • } while(ev.type != ButtonRelease);
  • XUngrabPointer(dpy, CurrentTime);
  • if((m = ptrtomon(c->x + c->w / 2, c->y + c->h / 2)) != selmon) {
  •   sendmon(c, m);
    
  •   selmon = m;
    
  •   focus(NULL);
    
  • }
    -}

Client *
nexttiled(Client *c) {
for(; c && (c->isfloating || !ISVISIBLE©); c = c->next);
@@ -1257,6 +1249,100 @@ ptrtomon(int x, int y) {
}

void
+nbstack(Monitor *m) {

  • int x, y, h, w, mh, nm;
  • unsigned int i, n;
  • Client *c;
  • initnmaster();
  • /* override layout symbol */
  • snprintf(m->ltsymbol, sizeof m->ltsymbol, “T%dT”, nmasters[m->num]);
  • for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  • c = nexttiled(m->clients);
  • nm = m->num < MaxMon ? nmasters[m->num] : nmaster;
  • if(nm > n)
  •   nm = n;
    
  • /* master */
  • if(nm > 0) {
  •   mh = m->mfact * m->wh;
    
  •   w = m->ww / nm;
    
  •   if(w < bh)
    
  •   	w = m->ww;
    
  •   x = m->wx;
    
  •   for(i = 0; i < nm; i++, c = nexttiled(c->next)) {
    
  •   	resize(c, x, m->wy, ((i + 1 == nm) ? m->wx + m->ww - x : w) - 2 * c->bw,
    
  •   	       (n == nm ? m->wh : mh) - 2 * c->bw, False);
    
  •   	if(w != m->ww)
    
  •   		x = c->x + WIDTH(c);
    
  •   }
    
  •   n -= nm;
    
  • } else
  •   mh = 0;
    
  • if(n == 0)
  •   return;
    
  • /* tile stack */
  • x = m->wx;
  • y = m->wy + mh;
  • w = m->ww / n;
  • h = m->wh - mh;
  • if(w < bh)
  •   w = m->ww;
    
  • for(i = 0; c; c = nexttiled(c->next), i++) {
  •   resize(c, x, y, ((i + 1 == n) ? m->wx + m->ww - x : w) - 2 * c->bw,
    
  •          h - 2 * c->bw, False);
    
  •   if(w != m->ww)
    
  •   	x = c->x + WIDTH(c);
    
  • }
    +}

+void
+ntile(Monitor *m) {

  • int x, y, h, w, mw, nm;
  • unsigned int i, n;
  • Client *c;
  • initnmaster();
  • /* override layout symbol */
  • snprintf(m->ltsymbol, sizeof m->ltsymbol, “%d]=”, nmasters[m->num]);
  • for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  • c = nexttiled(m->clients);
  • nm = m->num < MaxMon ? nmasters[m->num] : nmaster;
  • if(nm > n)
  •   nm = n;
    
  • /* master */
  • if(nm > 0) {
  •   mw = m->mfact * m->ww;
    
  •   h = m->wh / nm;
    
  •   if(h < bh)
    
  •   	h = m->wh;
    
  •   y = m->wy;
    
  •   for(i = 0; i < nm; i++, c = nexttiled(c->next)) {
    
  •   	resize(c, m->wx, y, (n == nm ? m->ww : mw) - 2 * c->bw,
    
  •   	       ((i + 1 == nm) ? m->wy + m->wh - y : h) - 2 * c->bw, False);
    
  •   	if(h != m->wh)
    
  •   		y = c->y + HEIGHT(c);
    
  •   }
    
  •   n -= nm;
    
  • } else
  •   mw = 0;
    
  • if(n == 0)
  •   return;
    
  • /* tile stack */
  • x = m->wx + mw;
  • y = m->wy;
  • w = m->ww - mw;
  • h = m->wh / n;
  • if(h < bh)
  •   h = m->wh;
    
  • for(i = 0; c; c = nexttiled(c->next), i++) {
  •   resize(c, x, y, w - 2 * c->bw,
    
  •          ((i + 1 == n) ? m->wy + m->wh - y : h) - 2 * c->bw, False);
    
  •   if(h != m->wh)
    
  •   	y = c->y + HEIGHT(c);
    
  • }
    +}

+void
propertynotify(XEvent *e) {
Client *c;
Window trans;
@@ -1312,56 +1398,6 @@ resize(Client *c, int x, int y, int w, i
}

void
-resizemouse(const Arg *arg) {

  • int ocx, ocy;
  • int nw, nh;
  • Client *c;
  • Monitor *m;
  • XEvent ev;
  • if(!(c = selmon->sel))
  •   return;
    
  • restack(selmon);
  • ocx = c->x;
  • ocy = c->y;
  • if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
  •               None, cursor[CurResize], CurrentTime) != GrabSuccess)
    
  •   return;
    
  • XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
  • do {
  •   XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
    
  •   switch(ev.type) {
    
  •   case ConfigureRequest:
    
  •   case Expose:
    
  •   case MapRequest:
    
  •   	handler[ev.type](&ev);
    
  •   	break;
    
  •   case MotionNotify:
    
  •   	nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
    
  •   	nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
    
  •   	if(snap && nw >= selmon->wx && nw <= selmon->wx + selmon->ww
    
  •   	&& nh >= selmon->wy && nh <= selmon->wy + selmon->wh)
    
  •   	{
    
  •   		if(!c->isfloating && selmon->lt[selmon->sellt]->arrange
    
  •   		&& (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
    
  •   			togglefloating(NULL);
    
  •   	}
    
  •   	if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
    
  •   		resize(c, c->x, c->y, nw, nh, True);
    
  •   	break;
    
  •   }
    
  • } while(ev.type != ButtonRelease);
  • XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
  • XUngrabPointer(dpy, CurrentTime);
  • while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
  • if((m = ptrtomon(c->x + c->w / 2, c->y + c->h / 2)) != selmon) {
  •   sendmon(c, m);
    
  •   selmon = m;
    
  •   focus(NULL);
    
  • }
    -}

-void
restack(Monitor *m) {
Client *c;
XEvent ev;
@@ -1450,7 +1486,7 @@ setlayout(const Arg *arg) {
if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
selmon->sellt ^= 1;
if(arg && arg->v)

  •   selmon->lt[selmon->sellt] = (Layout *)arg->v;
    
  •   selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag] = (Layout *)arg->v;
    
    strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
    if(selmon->sel)
    arrange(selmon);
    @@ -1458,6 +1494,14 @@ setlayout(const Arg *arg) {
    drawbar(selmon);
    }

+void
+setnmaster(const Arg *arg) {

  • if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
  •   return;
    
  • nmasters[selmon->num] = arg->i > 0 ? arg->i : 0;
  • arrange(selmon);
    +}

/* arg > 1.0 will set mfact absolutly */
void
setmfact(const Arg *arg) {
@@ -1475,6 +1519,8 @@ setmfact(const Arg *arg) {
void
setup(void) {
XSetWindowAttributes wa;

  • Monitor *m;

  • unsigned int i;

    /* clean up any zombies immediately */
    sigchld(0);
    @@ -1509,7 +1555,27 @@ setup(void) {
    XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
    if(!dc.font.set)
    XSetFont(dpy, dc.gc, dc.font.xfont->fid);

  • /* init tags */

  • for(m = mons; m; m = m->next)

  •   m->curtag = m->prevtag = 1;
    
  • /* init mfacts */

  • for(m = mons; m; m = m->next) {

  •   for(i=0; i < LENGTH(tags) + 1 ; i++) {
    
  •   	m->mfacts[i] = m->mfact;
    
  •   }
    
  • }

  • /* init layouts */

  • for(m = mons; m; m = m->next) {

  •   for(i=0; i < LENGTH(tags) + 1; i++) {
    
  •   	m->lts[i] = &layouts[0];
    
  •   }
    
  • }
    /* init bars */

  • for(m = mons; m; m = m->next) {

  •   for(i=0; i < LENGTH(tags) + 1; i++) {
    
  •   	m->showbars[i] = m->showbar;
    
  •   }
    
  • }
    updatebars();
    updatestatus();
    /* EWMH support per view */
    @@ -1589,63 +1655,37 @@ textnw(const char *text, unsigned int le
    }

void
-tile(Monitor *m) {

  • int x, y, h, w, mw;
  • unsigned int i, n;
  • Client *c;
  • for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  • if(n == 0)
  •   return;
    
  • /* master */
  • c = nexttiled(m->clients);
  • mw = m->mfact * m->ww;
  • resize(c, m->wx, m->wy, (n == 1 ? m->ww : mw) - 2 * c->bw, m->wh - 2 * c->bw, False);
  • if(–n == 0)
  •   return;
    
  • /* tile stack */
  • x = (m->wx + mw > c->x + c->w) ? c->x + c->w + 2 * c->bw : m->wx + mw;
  • y = m->wy;
  • w = (m->wx + mw > c->x + c->w) ? m->wx + m->ww - x : m->ww - mw;
  • h = m->wh / n;
  • if(h < bh)
  •   h = m->wh;
    
  • for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
  •   resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
    
  •          ? m->wy + m->wh - y - 2 * c->bw : h - 2 * c->bw), False);
    
  •   if(h != m->wh)
    
  •   	y = c->y + HEIGHT(c);
    
  • }
    -}

-void
togglebar(const Arg *arg) {

  • selmon->showbar = !selmon->showbar;
  • selmon->showbar = selmon->showbars[selmon->curtag] = !selmon->showbar;
    updatebarpos(selmon);
    XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
    arrange(selmon);
    }

void
-togglefloating(const Arg *arg) {

  • if(!selmon->sel)
  •   return;
    
  • selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
  • if(selmon->sel->isfloating)
  •   resize(selmon->sel, selmon->sel->x, selmon->sel->y,
    
  •          selmon->sel->w, selmon->sel->h, False);
    
  • arrange(selmon);
    -}

-void
toggletag(const Arg *arg) {
unsigned int newtags;

  • unsigned int i;

    if(!selmon->sel)
    return;
    newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
    if(newtags) {
    selmon->sel->tags = newtags;

  •   if(newtags == ~0) {
    
  •   	selmon->prevtag = selmon->curtag;
    
  •   	selmon->curtag = 0;
    
  •   }
    
  •   if(!(newtags & 1 << (selmon->curtag - 1))) {
    
  •   	selmon->prevtag = selmon->curtag;
    
  •   	for (i=0; !(newtags & 1 << i); i++);
    
  •   	selmon->curtag = i + 1;
    
  •   }
    
  •   selmon->sel->tags = newtags;
    
  •   selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
    
  •   selmon->mfact = selmon->mfacts[selmon->curtag];
    
  •   if (selmon->showbar != selmon->showbars[selmon->curtag])
    
  •   	togglebar(NULL);
      arrange(selmon);
    

    }
    }
    @@ -1912,14 +1952,68 @@ updatewmhints(Client *c) {

void
view(const Arg *arg) {

  • unsigned int i;
  • if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
    return;
    selmon->seltags ^= 1; /* toggle sel tagset */
  • if(arg->ui & TAGMASK)
  • if(arg->ui & TAGMASK) {
    selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
  •   selmon->prevtag = selmon->curtag;
    
  •   if(arg->ui == ~0)
    
  •   	selmon->curtag = 0;
    
  •   else {
    
  •   	for (i=0; !(arg->ui & 1 << i); i++);
    
  •   	selmon->curtag = i + 1;
    
  •   }
    
  • } else {
  •   selmon->prevtag= selmon->curtag ^ selmon->prevtag;
    
  •   selmon->curtag^= selmon->prevtag;
    
  •   selmon->prevtag= selmon->curtag ^ selmon->prevtag;
    
  • }
  • selmon->lt[selmon->sellt]= selmon->lts[selmon->curtag];
  • selmon->mfact = selmon->mfacts[selmon->curtag];
  • if(selmon->showbar != selmon->showbars[selmon->curtag])
  •   togglebar(NULL);
    
    arrange(selmon);
    }

+void
+view_adjacent_tag(const Arg *arg, int distance)
+{

  • int i, curtags;
  • int seltag = 0;
  • Arg a;
  • curtags = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
  • for (i = 0; i < LENGTH(tags); i++) {
  •    if ((curtags & (1 << i)) != 0) {
    
  •        seltag = i;
    
  •        break;
    
  •    }
    
  • }
  • seltag = (seltag + distance) % (int)LENGTH(tags);
  • if (seltag < 0)
  •    seltag += LENGTH(tags);
    
  • a.i = (1 << seltag);
  • view(&a);
    +}

+void
+view_next_tag(const Arg *arg)
+{

  • view_adjacent_tag(arg, +1);
    +}

+void
+view_prev_tag(const Arg *arg)
+{

  • view_adjacent_tag(arg, -1);
    +}

Client *
wintoclient(Window w) {
Client *c;[/code]

Bonjour, est-ce que c’est résolu ce que tu écrit au dessus?
Sinon, remplace MODKEY, par 0, ça devrait être bon.

[quote=“thuban”]e me demandais, à quoi te servent ces déclarations :
Code:
static const Bool resizehints = False; /* True means respect size hints in tiled resizals */[/quote]
Je sais pas si tu avais compris ma réponse l’autre fois, je la refais en plus clair.
Si tu as cette déclaration à True et que lance 3 urxvt par exemple, tu verras un espace fin entre eux,
Si tu as cette déclaration à False, ces espaces seront inexistants.

Je me demandais aussi, je vois que tu lances certains programmes sur des vues particulières, est-ce que ces vues sont alors automatiquement sélectionnées?
Sinon ça vaudrait le coup de trouver une astuce.

Ce n’était pas résolu avant ton arrivée. Je ne sais pas où tu as trouvé le truc du 0, mais ça fonctionne! cependant, il n’aime pas les “XF86AudioRaiseVolume”… à la compilation (undeclared…) . Mais bon, j’ai remplacé ça par des 0x1008ff13 etc.

En ce qui concerne les apllications qui s’ouvrent dans un tag spécifique, lorsque on les ouvre, la vue n’est pas automatiquement sélectionnée. C’est vrai que ça pourrait-être pratique dans certains cas. Je chercherais à l’occasion.

Merci pour les précisions! je n’ai pas trop répondu car je n’ai pas eu beaucoup de temps dernièrement. Je vais chercher à rajouter, comme ici, une marge pour afficher mon conky, qui est plus précis que mes commandes bash :
bbs.archlinux.org/viewtopic.php?id=74599&p=1

Ensuite je me mets aux scripts pour dmenu! :slightly_smiling:

bonne journée!