You are not logged in.

#26 2009-07-08 14:11:34

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

Re: Show off your Dwm configuration!

SpeedVin wrote:
zowki wrote:

Welcome all dwm users! Post a screenshot of your desktop and optionally along with your configuration files.

Heres mine:

Clean desktop
http://shaunsite.googlepages.com/thumb2.png

Busy desktop
http://shaunsite.googlepages.com/thumb1.png

I combine the work and play workspaces to prevent myself from doing both! wink
Running programs: vim, w3m, urxvt, conky
Font: Terminus

I have question to you how do you dmenu like this please share your config smile

Its in .xinitrc

xsetroot -name  "$(date +"%a %b %d %r")"

How's my programming? Call 1-800-DEV-NULL

Offline

#27 2009-07-08 14:55:21

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: Show off your Dwm configuration!

zowki wrote:
SpeedVin wrote:
zowki wrote:

Welcome all dwm users! Post a screenshot of your desktop and optionally along with your configuration files.

Heres mine:

Clean desktop
http://shaunsite.googlepages.com/thumb2.png

Busy desktop
http://shaunsite.googlepages.com/thumb1.png

I combine the work and play workspaces to prevent myself from doing both! wink
Running programs: vim, w3m, urxvt, conky
Font: Terminus

I have question to you how do you dmenu like this please share your config smile

Its in .xinitrc

xsetroot -name  "$(date +"%a %b %d %r")"

Thank you for sharing it! smile


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#28 2009-07-15 08:10:41

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: Show off your Dwm configuration!

Hello today i updated my DWM to 5.6 I see some little changes in my config.h , but no visual changes smile


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#29 2009-07-15 13:33:18

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Show off your Dwm configuration!

SpeedVin wrote:

Hello today i updated my DWM to 5.6 I see some little changes in my config.h , but no visual changes smile

Better Xinerama support seems to be the big news in this release:

http://lists.suckless.org/dev/0907/0563.html


thayer williams ~ cinderwick.ca

Offline

#30 2009-07-15 14:55:59

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: Show off your Dwm configuration!

thayer wrote:
SpeedVin wrote:

Hello today i updated my DWM to 5.6 I see some little changes in my config.h , but no visual changes smile

Better Xinerama support seems to be the big news in this release:

http://lists.suckless.org/dev/0907/0563.html

Thanks I know about it and do know what will be add in next realase?

Last edited by SpeedVin (2009-08-01 10:07:23)


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#31 2009-07-15 15:16:45

whordijk
Member
From: the Netherlands
Registered: 2008-12-12
Posts: 147
Website

Re: Show off your Dwm configuration!

I copied the colour scheme from zowki:

config.h

/* See LICENSE file for copyright and license details. */

/* appearance */
static const char font[]            = "-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#333333";
static const char normbgcolor[]     = "#051121";
static const char normfgcolor[]     = "#FFFFFF";
static const char selbordercolor[]  = "#1793D1";
static const char selbgcolor[]      = "#1793D1";
static const char selfgcolor[]      = "#FFFFFF";
static unsigned int borderpx        = 1;        /* border pixel of windows */
static unsigned int snap            = 32;       /* snap pixel */
static Bool showbar                 = True;     /* False means no bar */
static Bool topbar                  = True;     /* False means bottom bar */

/* tagging */
static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */

static Rule rules[] = {
    /* class      instance    title       tags mask     isfloating */
    { "Gimp",     NULL,       NULL,       0,            True },
    { "Firefox",  NULL,       NULL,       1 << 8,       True },
};

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

static 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 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 Key keys[] = {
    /* modifier                     key        function        argument */
    { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
    { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
    { 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|ShiftMask,             XK_c,      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 } },
    TAGKEYS(                        XK_1,                      0)
    TAGKEYS(                        XK_2,                      1)
    TAGKEYS(                        XK_3,                      2)
    TAGKEYS(                        XK_4,                      3)
    TAGKEYS(                        XK_5,                      4)
    TAGKEYS(                        XK_6,                      5)
    TAGKEYS(                        XK_7,                      6)
    TAGKEYS(                        XK_8,                      7)
    TAGKEYS(                        XK_9,                      8)
    { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
};

/* button definitions */
/* click can be a tag number (starting at 0),
 * 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} },
};

I chose to not have a seperate conky bar, but rather to pipe info into the dwm status bar. Conky displays my mpd status, the number of new emails (using a pyhton script), day, date and time:

.conkyrc

out_to_x  no
out_to_console yes

TEXT
$if_mpd_playing $mpd_status : $mpd_smart  |  $endif Mail : ${execi 300 python ~/.scripts/gmail.py}  |  ${time %a %b %d %I:%M%P}

.scripts/gmail.py

import os
import string

#Enter your username and password below within double quotes
# eg. username="username" and password="password"
username="****"
password="****"

com="wget -O - https://"+username+":"+password+"@mail.google.com/mail/feed/atom --no-check-certificate"

temp=os.popen(com)
msg=temp.read()
index=string.find(msg,"<fullcount>")
index2=string.find(msg,"</fullcount>")
fc=int(msg[index+11:index2])

if fc==0:
   print "0 new"
else:
   print str(fc)+" new"

And to conclude, my .xinitrc to make sure all these things work nicely together, set ctrl-alt-backspace to terminate X, set my wallpaper and startup mpdscribble and numlockx:

.xinitcr

#! /bin/sh
setxkbmap -option terminate:ctrl_alt_bksp

eval `cat ~/.fehbg` &

conky | while true; read line; do xsetroot -name "$line"; done &

mpdscribble &
numlockx &

exec dwm

Screenshot:
*snip*

Last edited by whordijk (2010-06-19 09:17:45)

Offline

#32 2009-07-15 23:01:29

capnmoney
Member
From: ~
Registered: 2008-10-17
Posts: 108
Website

Re: Show off your Dwm configuration!

Is there an easier way to get a seperate status bar? Editing config.h is no problem, but I'd rather leave dwm.c alone.

Thanks for any suggestions.

Offline

#33 2009-07-15 23:06:36

whordijk
Member
From: the Netherlands
Registered: 2008-12-12
Posts: 147
Website

Re: Show off your Dwm configuration!

capnmoney wrote:

Is there an easier way to get a seperate status bar? Editing config.h is no problem, but I'd rather leave dwm.c alone.

Thanks for any suggestions.

A separate status bar can be achieved by writing an adequate .conkyrc and running conky. However, the problem with that is that when dwm is set at tiling mode, the windows will overlap this bar. In order to crop the area on which the windows are being tiled, adjustments in dwm.c need to be made so a space for the conky status bar can be defined. I don't know if there is another solution for this: it seems to me this is the most logical one!

Offline

#34 2009-07-16 19:49:13

buttons
Member
From: NJ, USA
Registered: 2007-08-04
Posts: 618

Re: Show off your Dwm configuration!

capnmoney wrote:

Is there an easier way to get a seperate status bar? Editing config.h is no problem, but I'd rather leave dwm.c alone.

Thanks for any suggestions.

Unfortunately, the only way I found to do this was to edit dwm.c to shorten the bar. That way I could layer dzen underneath it:

http://bbs.archlinux.org/viewtopic.php? … 91#p585591


Cthulhu For President!

Offline

#35 2009-07-17 06:15:26

Mr Pink57
Member
From: a van down by the river
Registered: 2009-05-30
Posts: 91
Website

Re: Show off your Dwm configuration!

http://img.photobucket.com/albums/v319/ … estkop.png

/* See LICENSE file for copyright and license details. */

/* appearance */
static const char font[]            = "-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#000000";
static const char normbgcolor[]     = "#1994d1";
static const char normfgcolor[]     = "#ffffff";
static const char selbordercolor[]  = "#000000";
static const char selbgcolor[]      = "#000000";
static const char selfgcolor[]      = "#ffffff";
static unsigned int borderpx        = 1;        /* border pixel of windows */
static unsigned int snap            = 32;       /* snap pixel */
static Bool showbar                 = True;     /* False means no bar */
static Bool topbar                  = False;     /* False means bottom bar */

/* tagging */
static const char tags[][MAXTAGLEN] = { "bash", "www", "mail", "chat", "graphics", "thunar", "geany", "misc" };
static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */

static Rule rules[] = {
    /* class      instance    title       tags mask     isfloating */
    { "Gimp",     NULL,       NULL,       1 << 4,            False },
    { "Swiftfox",  NULL,       NULL,       1 << 1,       False },
    { "URxvt",    NULL,    NULL,    1,    False},
    { "Pidgin",    NULL,    NULL,    1 << 3,    False },
    { "Thunar",    NULL,    NULL,    1 << 5, False },
    { "Geany",    NULL,    NULL,    1 << 6, False },
    { "Smplayer",    NULL,    NULL,    1 << 7,    True },
    { "Abiword", NULL,     NULL,     1 << 7,  False },
    { "Gnumeric", NULL,     NULL,     1 << 7,  False },
    { "Thunderbird",    NULL,    NULL,    1 << 2,    True },
    { "Inkscape",    NULL,    NULL,    1 << 4,    False },
    { "Scribus",    NULL,    NULL,    1 << 4, False },
    { "Brasero",    NULL,    NULL,    1 << 7, True },
};

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

static 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 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 *swiftfoxcmd[] = { "swiftfox", NULL };
static const char *gimpcmd[] = { "gimp", NULL };
static const char *pidgincmd[] = { "pidgin", NULL };
static const char *thunarcmd[] = { "thunar", NULL};
static const char *geanycmd[] = { "geany", NULL};
static const char *smplayercmd[] = { "smplayer", NULL};
static const char *abiwordcmd[] = {    "abiword", NULL};
static const char *gnumericcmd[] = { "gnumeric", NULL};
static const char *thunderbirdcmd[] = { "thunderbird3", NULL};
static const char *inkscapecmd[] = { "inkscape", NULL};
static const char *scribuscmd[] = { "scribus", NULL};
static const char *braserocmd[] = { "brasero", NULL};

static Key keys[] = {
    /* modifier                     key        function        argument */
    { MODKEY|ShiftMask,             XK_p,      spawn,          {.v = dmenucmd } },
    { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
    { 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|ShiftMask,             XK_c,      killclient,     {0} },
    { MODKEY|ShiftMask,             XK_t,      setlayout,      {.v = &layouts[0]} },
    { MODKEY|ShiftMask,             XK_f,      setlayout,      {.v = &layouts[1]} },
    { MODKEY|ShiftMask,             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 } },
    TAGKEYS(                        XK_1,                      0)
    TAGKEYS(                        XK_2,                      1)
    TAGKEYS(                        XK_3,                      2)
    TAGKEYS(                        XK_4,                      3)
    TAGKEYS(                        XK_5,                      4)
    TAGKEYS(                        XK_6,                      5)
    TAGKEYS(                        XK_7,                      6)
    TAGKEYS(                        XK_8,                      7)
    TAGKEYS(                        XK_9,                      8)
    { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
    { MODKEY,    XK_f,    spawn,    {.v = swiftfoxcmd} }, 
    { MODKEY,    XK_g,     spawn,    {.v = gimpcmd} },
    { MODKEY,    XK_p,     spawn,    {.v = pidgincmd} },
    { MODKEY|ShiftMask,    XK_t,    spawn,    {.v = thunarcmd} },
    { MODKEY|ShiftMask,    XK_g,    spawn,  {.v = geanycmd} },
    { MODKEY,    XK_x,    spawn,    {.v = smplayercmd} },    
    { MODKEY,    XK_a,    spawn,    {.v = abiwordcmd} },
    { MODKEY|ShiftMask,    XK_s,    spawn,    {.v = gnumericcmd} },
    { MODKEY,    XK_m,    spawn,    {.v = thunderbirdcmd} },
    { MODKEY,    XK_i,    spawn,    {.v = inkscapecmd} },
    { MODKEY,    XK_s,    spawn,    {.v = scribuscmd} },
    { MODKEY|ShiftMask,    XK_b,    spawn,    {.v = braserocmd} },
};

/* button definitions */
/* click can be a tag number (starting at 0),
 * 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} },
};

What is

static unsigned int borderpx        = 1;        /* border pixel of windows */

this line do exactly?

pink


Even a broken clock is right twice a day.

Diplomacy without force is like music without instruments.

Offline

#36 2009-07-17 06:32:55

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: Show off your Dwm configuration!

This line give it 1 pixel line betwen windows you see in what window you work wink


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#37 2009-07-20 15:33:12

FALK
Member
From: Denmark
Registered: 2008-03-24
Posts: 95

Re: Show off your Dwm configuration!

Anyone got a patch for cycling tags with modkey+arrows (or any other key for that matter)?

Offline

#38 2009-07-20 17:14:11

BetterLeftUnsaid
Member
From: My Happy Place
Registered: 2007-11-04
Posts: 78

Re: Show off your Dwm configuration!

FALK wrote:

Anyone got a patch for cycling tags with modkey+arrows (or any other key for that matter)?

http://www.mail-archive.com/dwm@suckles … 05168.html

Works for me, although I haven't tried 5.6 yet.

Offline

#39 2009-07-20 23:06:34

FALK
Member
From: Denmark
Registered: 2008-03-24
Posts: 95

Re: Show off your Dwm configuration!

BetterLeftUnsaid wrote:
FALK wrote:

Anyone got a patch for cycling tags with modkey+arrows (or any other key for that matter)?

http://www.mail-archive.com/dwm@suckles … 05168.html

Works for me, although I haven't tried 5.6 yet.

Great, thanks. Modified it for 5.6:

diff --git a/config.def.h b/config.def.h
index cca37df..699a8bf 100644
--- a/config.def.h
+++ b/config.def.h
@@ -71,6 +71,8 @@ static Key keys[] = {
     { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
     { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
     { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
+    { MODKEY,                       XK_Left,   view_prev_tag,  {0} },
+    { MODKEY,                       XK_Right,  view_next_tag,  {0} },
     TAGKEYS(                        XK_1,                      0)
     TAGKEYS(                        XK_2,                      1)
     TAGKEYS(                        XK_3,                      2)
diff --git a/dwm.1 b/dwm.1
index 7eb231f..b166dea 100644
--- a/dwm.1
+++ b/dwm.1
@@ -130,6 +130,14 @@ tag.
 .B Mod1\-0
 View all windows with any tag.
 .TP
+.B Mod1\-Left
+View all windows with tag previous than current.  E.g.
+if tag 4 is selected, previous tag would be 3.
+.TP
+.B Mod1\-Right
+View all windows with tag next than current.  E.g.
+if tag 4 is selected, next tag would be 5.
+.TP
 .B Mod1\-Control\-[1..n]
 Add/remove all windows with
 .BR nth
diff --git a/dwm.c b/dwm.c
index 220a12f..e6efe71 100644
--- a/dwm.c
+++ b/dwm.c
@@ -229,6 +229,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);
@@ -1934,6 +1937,42 @@ zoom(const Arg *arg) {
     arrange();
 }
 
+static 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);
+}
+
+static void
+view_next_tag(const Arg *arg)
+{
+    view_adjacent_tag(arg, +1);
+}
+
+static void
+view_prev_tag(const Arg *arg)
+{
+    view_adjacent_tag(arg, -1);
+}
+
+
 int
 main(int argc, char *argv[]) {
     if(argc == 2 && !strcmp("-v", argv[1]))

Offline

#40 2009-07-25 17:10:35

firecat53
Member
From: Sammamish, Wa
Registered: 2007-05-14
Posts: 1,440
Website

Re: Show off your Dwm configuration!

The code in updategeom has changed and not being a C programmer, I can't quite get how to modify the code to get a small bottom gap for a separate conky instance. I tried changing in dwm.c

m->mh = m->wh = info[i].height - BOTTOM_BAR_HEIGHT;

and in config.h

#define BOTTOM_BAR_HEIGHT 21

But these changes don't work. I'm just not finding anyone yet who has showed how they did it in dwm 5.6 since it just recently changed.

Thanks!
Scott

Last edited by firecat53 (2009-07-25 17:11:30)

Offline

#41 2009-07-25 19:17:43

portix
Member
Registered: 2009-01-13
Posts: 757

Re: Show off your Dwm configuration!

Try

sh = DisplayHeight(dpy, screen) - BOTTOM_BAR_HEIGHT;

in line 1436.

Offline

#42 2009-07-25 19:41:31

firecat53
Member
From: Sammamish, Wa
Registered: 2007-05-14
Posts: 1,440
Website

Re: Show off your Dwm configuration!

@portix:  Perfect! Thanks!

Edit: Moved additional question to new thread.

Thanks!
Scott

Last edited by firecat53 (2009-07-26 02:47:27)

Offline

#43 2009-07-29 21:07:38

linkmaster03
Member
Registered: 2008-12-27
Posts: 269

Re: Show off your Dwm configuration!

Does anyone know what's wrong with my attempt at converting this patch to 5.6.1?

diff -up -N a/colorstatus.c b/colorstatus.c
--- a/colorstatus.c    1969-12-31 19:00:00.000000000 -0500
+++ b/colorstatus.c    2009-07-29 16:51:00.039936573 -0400
@@ -0,0 +1,145 @@
+int
+drawstatustext(int x, int ww) {
+    char cd[] = "[c]", id[] = "[i]";
+    char buf1[256] = {0};
+    Bool parse = True;
+    Bool cs = False, is = False;
+    int stextw = 0;
+    
+    strcpy(buf1, stext);
+    while(parse) {
+        char *cp = 0, *ip = 0;
+        
+        cp = strstr(buf1, cd);
+        ip = strstr(buf1, id);
+        if(cp != NULL || ip != NULL) {
+            char buf2[256] = {0}, buf3[256] = {0};
+            size_t clen2 = -1, ilen2 = -1, len2 = 0, dlen = 0, offset3 = 0, len3 = 0;
+            
+            if(cp != NULL)
+                clen2 = cp - buf1;
+            if(ip != NULL)
+                ilen2 = ip - buf1;
+            if(clen2 < 0) {
+                len2 = ilen2;
+                dlen = strlen(id);
+            }
+            else if(ilen2 < 0) {
+                len2 = clen2;
+                dlen = strlen(cd);
+            }
+            else if(clen2 < ilen2) {
+                len2 = clen2;
+                dlen = strlen(cd);
+            }
+            else {
+                len2 = ilen2;
+                dlen = strlen(id);
+            }
+            strncpy(buf2, buf1, len2);
+            offset3 = len2 + dlen;
+            len3 = strlen(buf1) - offset3;
+            strncpy(buf3, buf1 + offset3, len3);
+            if(buf2 != NULL && strlen(buf2) > 0)
+                stextw = stextw + TEXTW(buf2);
+            
+            memset(buf1, '\0', sizeof(buf1));
+            strcpy(buf1, buf3);
+        }
+        else {
+            stextw = stextw + TEXTW(buf1);
+            parse = False;
+        }
+    }
+    dc.x = ww - stextw;
+    
+    memset(buf1, '\0', sizeof(buf1));
+    strcpy(buf1, stext);
+    parse = True;
+    while(parse) {
+        char *cp = 0, *ip = 0;
+        
+        cp = strstr(buf1, cd);
+        ip = strstr(buf1, id);
+        if(cp != NULL || ip != NULL) {
+            char buf2[256] = {0}, buf3[256] = {0};
+            size_t clen2 = -1, ilen2 = -1, len2 = 0, dlen = 0, offset3 = 0, len3 = 0;
+            Bool cs3 = cs, is3 = is;
+            
+            if(cp != NULL)
+                clen2 = cp - buf1;
+            if(ip != NULL)
+                ilen2 = ip - buf1;
+            if(clen2 < 0) {
+                len2 = ilen2;
+                dlen = strlen(id);
+                is3 = !is;
+            }
+            else if(ilen2 < 0) {
+                len2 = clen2;
+                dlen = strlen(cd);
+                cs3 = !cs;
+            }
+            else if(clen2 < ilen2) {
+                len2 = clen2;
+                dlen = strlen(cd);
+                cs3 = !cs;
+            }
+            else {
+                len2 = ilen2;
+                dlen = strlen(id);
+                is3 = !is;
+            }
+            
+            strncpy(buf2, buf1, len2);
+            offset3 = len2 + dlen;
+            len3 = strlen(buf1) - offset3;
+            strncpy(buf3, buf1 + offset3, len3);
+            if(buf2 != NULL && strlen(buf2) > 0) {
+                dc.w = TEXTW(buf2);
+                if(cs) {
+                    if(is)
+                        drawtext(buf2, dc.sel, True);
+                    else
+                        drawtext(buf2, dc.sel, False);
+                }
+                else {
+                    if(is)
+                        drawtext(buf2, dc.norm, True);
+                    else
+                        drawtext(buf2, dc.norm, False);
+                }
+                dc.x = dc.x + dc.w;
+            }
+            
+            cs = cs3;
+            is = is3;
+            memset(buf1, '\0', sizeof(buf1));
+            strcpy(buf1, buf3);
+        }
+        else {
+            dc.w = TEXTW(buf1);
+            dc.x = ww - dc.w;
+            if(dc.x < x) {
+                dc.x = x;
+                dc.w = ww - x;
+            }
+            if(cs) {
+                if(is)
+                    drawtext(buf1, dc.sel, True);
+                else
+                    drawtext(buf1, dc.sel, False);
+            }
+            else {
+                if(is)
+                    drawtext(buf1, dc.norm, True);
+                else
+                    drawtext(buf1, dc.norm, False);
+            }
+            parse = False;
+        }
+    }
+    
+    return(stextw);
+}
+
diff -up -N a/dwm.c b/dwm.c
--- a/dwm.c    2009-07-29 16:19:33.599231174 -0400
+++ b/dwm.c    2009-07-29 16:54:52.965695142 -0400
@@ -269,6 +269,7 @@ static Window root;
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
+#include "colorstatus.c"
 
 /* compile-time check if all tags fit into an unsigned int bit array. */
 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
@@ -652,6 +653,7 @@ drawbar(Monitor *m) {
     unsigned int i, n = 0, occ = 0, urg = 0;
     unsigned long *col;
     Client *c;
+    int stextw = 0;
 
     for(c = m->clients; c; c = c->next) {
         if(ISVISIBLE(c))
@@ -679,13 +681,8 @@ drawbar(Monitor *m) {
     drawtext(ntext, dc.norm, False);
     x = (dc.x += dc.w);
     if(m == selmon) { /* status is only drawn on selected monitor */
-        dc.w = TEXTW(stext);
-        dc.x = m->ww - dc.w;
-        if(dc.x < x) {
-            dc.x = x;
-            dc.w = m->ww - x;
-        }
-        drawtext(stext, dc.norm, False);
+        stextw = drawstatustext(x, ww);
+        dc.x = ww - stextw;
     }
     else
         dc.x = m->ww;

I tried passing ww as an argument to drawstatustext() because at first drawstatustext() was saying it couldn't find ww. Anyways, if I apply the above patch and try to compile, I get this:

dwm.c: In function 'drawbar':
dwm.c:684: error: 'ww' undeclared (first use in this function)
dwm.c:684: error: (Each undeclared identifier is reported only once
dwm.c:684: error: for each function it appears in.)
make: *** [dwm.o] Error 1

I find that odd because ww is used other places in drawbar(). I'm not a C programmer; I only know basic syntax. Can anyone try to find out why my converted patch isn't working?

Offline

#44 2009-07-29 21:28:44

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,537

Re: Show off your Dwm configuration!

linkmaster03 wrote:

Does anyone know what's wrong with my attempt at converting this patch to 5.6.1?

I tried passing ww as an argument to drawstatustext() because at first drawstatustext() was saying it couldn't find ww. Anyways, if I apply the above patch and try to compile, I get this:

dwm.c: In function 'drawbar':
dwm.c:684: error: 'ww' undeclared (first use in this function)
dwm.c:684: error: (Each undeclared identifier is reported only once
dwm.c:684: error: for each function it appears in.)
make: *** [dwm.o] Error 1

I find that odd because ww is used other places in drawbar(). I'm not a C programmer; I only know basic syntax. Can anyone try to find out why my converted patch isn't working?

It's now called m->ww . This change is from the multi-monitor support that was added recently - each monitor can have its own width.

Offline

#45 2009-07-29 23:26:11

linkmaster03
Member
Registered: 2008-12-27
Posts: 269

Re: Show off your Dwm configuration!

ataraxia: Thanks, it works now! smile Now I'll need to figure out the code and find out why the color tags are leaving spaces in their place even though they are not visible... tongue

Offline

#46 2009-07-31 12:05:31

BabyDoc
Member
From: Belgium
Registered: 2008-03-20
Posts: 74

Re: Show off your Dwm configuration!

portix wrote:

Try

sh = DisplayHeight(dpy, screen) - BOTTOM_BAR_HEIGHT;

in line 1436.

Is there anything else that needs to be changed, besides this and give BOTTOM_BAR_HEIGHT a correct value in config.h?
I tried this but it doesn't work, using dwm 5.6.


Existence is futile.

Offline

#47 2009-07-31 16:29:46

firecat53
Member
From: Sammamish, Wa
Registered: 2007-05-14
Posts: 1,440
Website

Re: Show off your Dwm configuration!

@BabyDoc -- No, it works for me it 5.6 and 5.6.1 with just those two items. However, there's one other person who's reported it not working. I looked at his config and dwm.c, and I couldn't see that he was doing anything wrong. It will only work if your windows are in tiling or monocle mode. Floating mode allows windows to be any size, so they will cover that area if their size is too big when they are first opened.

Good luck!
Scott

Offline

#48 2009-07-31 17:14:00

BabyDoc
Member
From: Belgium
Registered: 2008-03-20
Posts: 74

Re: Show off your Dwm configuration!

Well at least I know I ain't the only one with that problem then.
The problem persists in 5.6.1 to, I guess I'll keep digging.


Existence is futile.

Offline

#49 2009-07-31 17:23:33

Dethredic
Member
Registered: 2009-01-24
Posts: 361
Website

Re: Show off your Dwm configuration!

@BabyDoc
I'm the one having the same troubles:
http://bbs.archlinux.org/viewtopic.php? … 11#p593311

EDIT: I found a fix. check the link.

Last edited by Dethredic (2009-07-31 21:54:53)

Offline

#50 2009-08-01 10:06:22

BabyDoc
Member
From: Belgium
Registered: 2008-03-20
Posts: 74

Re: Show off your Dwm configuration!

Dethredic wrote:

@BabyDoc
I'm the one having the same troubles:
http://bbs.archlinux.org/viewtopic.php? … 11#p593311

EDIT: I found a fix. check the link.

Thanks for the help Dethredic, fixed it for me to.


Existence is futile.

Offline

Board footer

Powered by FluxBB