You are not logged in.
ozzem: this is a screenshots thread...
Offline
@grimpirate: What's that menu you're running?
I fail to read
Yet, I can't seem to download it, the tarball has been deleted from the server. Mind reuploading or shooting me a message? I'd love to try it out!
Also, mine:
Last edited by parazyd (2014-10-15 12:45:33)
Offline
Pink and gold, patched for XFT fonts. From tiny bitmaps to the chunky, cheerful Ubuntu Mono. Oh, and an .xbm dwm icon for my dzen2.
[Edited a link, whoops!]
Last edited by lorin (2015-01-30 04:10:04)
github ○
Offline
Just switched to DWM after about 4 years of XMonad. I'm really liking it, the tags concept feels a lot more intuitive than the workspaces from XMonad did to me. I also love how simple the config is.
I'm using a custom dwmstatus.c program I wrote to output status infor to dzen2. I chose dzen for the click and icon support. If anyone has any suggestions on modifications to the script to make it perform better, i'd appreciate them. Also, if someone could tell me how to spawn the dzen process straight from my dwmstatus.c program, i'd be extremely grateful. I'm getting sick of using a script to start it.
Anyways, here's dwmstatus.c:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Change this value to set how fast dwmstatus will be updated (seconds)
#define INTERVAL .1
/* Spawns a shell command and returns it's output */
char *
SHCMD(char *cmd)
{
FILE* process = popen(cmd, "r");
char buffer[1000];
rewind(process);
fscanf(process, "%[^\n]", buffer);
pclose(process);
int sz = strlen(buffer);
char *output = malloc(sz);
memset(output, 0, sizeof(output));
strncpy(output, buffer, sz);
strstr(output, "\n");
return output;
}
int
main(int argc, char *argv[])
{
/* Main Loop */
for (;;sleep(INTERVAL))
{
char *updates = SHCMD("cat /home/komrade/log/updates.log");
char *volume = SHCMD("amixer -c 29 | awk '/^ Mono.*/ {print $5==\"[off]\"?\"---\":$4}' | sed -e 's/\\[//g' -e 's/\\]//g'");
char *kernel = SHCMD("uname -r");
char *timestr = SHCMD("date +'%I:%M%P'");
printf(\
"^fg(#6095C5)^ca(1,/home/komrade/etc/dwm/menu.sh)^i(/home/komrade/etc/dwm/icons/dwm.xbm)^fg() ^ca()"\
"^fg(#686868)^r(2x19)^fg()^ca(1,/home/komrade/etc/dwm/dzenPacman.sh) ^fg(#6095C5)^i(/home/komrade/etc/dwm/icons/pacman1.xbm)^fg() %s ^ca()"\
"^fg(#686868)^r(2x19)^fg()^ca(1,pavucontrol) ^fg(#6095C5)^i(/home/komrade/etc/dwm/icons/vol1.xbm)^fg() ^fg(#E5B0FF)%s^fg() ^ca()"\
"^fg(#686868)^r(2x19)^fg()^ca(1,/home/komrade/etc/dwm/dzenSysinfo.sh) ^fg(#6095C5)^i(/home/komrade/etc/dwm/icons/arch1.xbm)^fg() %s ^ca()"\
"^fg(#686868)^r(2x19)^fg()^ca(1,/home/komrade/etc/dwm/dzenCal.sh) ^fg(#6095C5)^i(/home/komrade/etc/dwm/icons/clock1.xbm)^fg() %s ^ca()\n"\
, updates, volume, kernel, timestr);
fflush(stdout);
free(updates);
free(volume);
free(kernel);
free(timestr);
}
}
Clicking the dwm icon will spawn a dzen app launcher
Clicking the pacman icon will spawn a dzen showing all packages needing upgrades, the current package version, and the version the package is being upgraded to
Clicking the volume icon would spawn pavucontrol if this were my desktop and nothing if it is my IBM ThinkPad T60 (which i used to post this)
Clicking the output of uname -r will spawn a dzen with various system info (pictured)
Clicking the time will spawn a dzen showing a calendar of the current month with the current day and holidays highlighted in different colors
Finally, my config.h:
/* See LICENSE in dwm source code package for copyright and license details. */
/* This is the config.h for dwm with icons and colors in font.*/
/* This dwm config is a modified version of gnusosas (gnusosa@gnusosa.net) dwm-config. Mainly scaled down. */
/* http://github.com/kusk/dwm */
/* This file can be distributed under the same license that dwm works with */
#include <X11/XF86keysym.h>
/* appearance */
static const char font[] = "-*-bitocra-*-*-*-*-*-*-*-*-*-*-*-*";
#define NUMCOLORS 8
static const char colors[NUMCOLORS][ColLast][8] = {
// border foreground background
{ "#1A1A1A", "#FFFFFF", "#303030" }, // 01 - normal
{ "#17bbe3", "#98CBFE", "#3F3F3F" }, // 02 - selected
{ "#B3354C", "#303030", "#D370A3" }, // 03 - urgent
{ "#1A1A1A", "#1A1A1A", "#020202" }, // 04 - black
{ "#802635", "#802635", "#020202" }, // 05 - red
{ "#608040", "#608040", "#020202" }, // 06 - green
{ "#877C43", "#877C43", "#020202" }, // 07 - yellow
{ "#4C4C4C", "#4C4C4C", "#020202" }, // 08 - gray
};
static const unsigned int borderpx = 1; // border pixel of windows
static const unsigned int snap = 5; // snap pixel
static const unsigned int gappx = 4; /* gap pixel between windows */
static const Bool showbar = True; // False means no bar
static const Bool topbar = False; // False means bottom bar
static Bool useicons = True; // False means use ascii symbols
static const char scratchpadname[] = "Scratchpad";
static const char ncmpcpppadname[] = "ncmpcpp";
/* layout(s) */
static const float mfact = 0.50; // 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[] = {
// icon symbol arrange function
{ "/home/komrade/etc/dwm/icons/tile.xbm", "þ", tile },
{ "/home/komrade/etc/dwm/icons/bstack.xbm", "ü", bstack },
{ "/home/komrade/etc/dwm/icons/float.xbm", "ý", NULL }, // no layout function means floating behavior
{ "/home/komrade/etc/dwm/icons/monocle.xbm", "ÿ", monocle },
};
static const MonocleNumberedIcon monoclenumberedicons[] = {
{ "/home/komrade/etc/dwm/icons/monocle.xbm" },
};
/* tagging */
static const Tag tags[] = {
// name layout mfact nmaster
{ " 1 ", &layouts[0], 0.65, -1 },
{ " 2 ", &layouts[0], -1, -1 },
{ " 3 ", &layouts[0], 0.65, -1 },
{ " 4 ", &layouts[0], 0.65, -1 },
{ " 5 ", &layouts[0], -1, -1 },
};
/* window rules */
static const Rule rules[] = {
/* class instance title tags mask iscentered isfloating monitor */
{ "Gimp", NULL, NULL, 1 << 4, False, True, -1 },
{ "Firefox", NULL, NULL, 1 << 4, False, False, -1 },
{ "Pavucontrol", NULL, NULL, 0, True, True, 1 },
{ "Pcmanfm", NULL, NULL, 1 << 2, False, False, -1 },
{ "URxvt", NULL, "download", 0, True, True, 1 },
{ "URxvt", NULL, "ncmpcpp", 0, True, True, -1 },
{ "Nitrogen", NULL, NULL, 0, True, True, 1 },
{ "URxvt", NULL, "vim", 1 << 3, False, False, -1 },
{ "Google-chrome-stable", NULL, NULL, 1 << 1, False, False, -1 },
{ "tabbed", "term", NULL, 1, False, False, -1 },
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, view, {.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", "-i", "-fn", font, "-nb", colors[0][ColBG], "-nf", colors[0][ColFG],"-sb", colors[1][ColBG], "-sf", colors[1][ColFG], NULL };
static const char *termcmd[] = { "tabbed", "-n", "term", "urxvt", "-embed", NULL };
static const char *scratchpadcmd[] = { "urxvt", "-title", scratchpadname, "-geometry", "80x20", NULL };
static const char *ncmpcpppadcmd[] = { "urxvt", "-title", ncmpcpppadname, "-geometry", "100x40", "-e", "ncmpcpp", NULL };
static const char *pcmanfmcmd[] = { "pcmanfm", NULL };
static const char *browsercmd[] = { "google-chrome-stable", NULL };
static const char *incogcmd[] = { "google-chrome-stable", "--incognito", NULL };
static const char *editcmd[] = { "urxvt", "-e", "vim", NULL };
static const char *sublcmd[] = { "subl", NULL };
static const char *quitcmd[] = { "pkill", "xinit", NULL };
static Key keys[] = {
// modifier key function argument
{ MODKEY, XK_i, incnmaster, {.i = +1 } }, //#Mod+i:Increments number of windows in master area
{ MODKEY, XK_d, incnmaster, {.i = -1 } }, //#Mod+d:Decrements Number of windows in master area
{ MODKEY, XK_p, spawn, {.v = dmenucmd } }, //#Mod+p:Launches dmenu for user input
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, //#Mod+Shift+Return:Spawns urxvt embedded in tabbed
{ MODKEY, XK_f, spawn, {.v = pcmanfmcmd } }, //#Mod+f:Spawns pcmanfm
{ MODKEY, XK_w, spawn, {.v = browsercmd } }, //#Mod+w:Spawns google-chrome-stable
{ MODKEY|ShiftMask, XK_w, spawn, {.v = incogcmd } }, //#Mod+Shift+w:Spawns an incognito window of google-chrome-stable
{ MODKEY, XK_e, spawn, {.v = editcmd } }, //#Mod+e:Spawns vim
{ MODKEY|ShiftMask, XK_e, spawn, {.v = sublcmd } }, //#Mod+Shift+e:Spawns sublime-text
{ MODKEY, XK_Return, zoom, {0} }, //#Mod+Return:Swaps current window with master
{ MODKEY, XK_Tab, focusstack, {.i = +1 } }, //#Mod+Tab:Moves one window forward in stack focus
{ MODKEY, XK_k, focusstack, {.i = -1 } }, //#Mod+k:Moves one window backward in stack focus
{ MODKEY, XK_h, setmfact, {.f = -0.05} }, //#Mod+h:Decrements master area size by 5% of the screen
{ MODKEY, XK_l, setmfact, {.f = +0.05} }, //#Mod+l:Increments master area size by 5% of the screen
{ MODKEY|ShiftMask, XK_c, killclient, {0} }, //#Mod+Shift+c:Kills currently focused window
{ Mod1Mask, XK_z, togglescratch, {.v = scratchpadcmd} }, //#Alt_L+z:Spawns/Summons urxvt scratchpad
{ Mod1Mask, XK_m, togglescratch, {.v = ncmpcpppadcmd} }, //#Alt_L+z:Spawns/Summons ncmpcpp in a urxvt scratchpad
{ MODKEY, XK_b, togglebar, {0} }, //#Mod+b:Toggle dwm info bar
{ MODKEY, XK_space, setlayout, {0} }, //#Mod+Space:Cycle Layouts
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, //#Mod+Shift+Space:Toggle floating on focused window
{ MODKEY, XK_0, view, {.ui = ~0 } }, //#Mod+0:Toggle all tags visible
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, //#Mod+Shift+0:Toggle focused window visible on all tags
{ MODKEY, XK_comma, focusmon, {.i = -1 } }, //#Mod+,:Focus previous monitor
{ MODKEY, XK_period, focusmon, {.i = +1 } }, //#Mod+.:Focus next monitor
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, //#Mod+Shift+,:Move focused window to last monitor
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, //#Mod+Shift+.:Move focused window to next monitor
TAGKEYS( XK_1, 0) //#Mod+[1..5]:Toggle chosen tag view visible
TAGKEYS( XK_2, 1) //#Mod+Control+[1..5]:View only chosen tag
TAGKEYS( XK_3, 2) //#Mod+Shift+[1..5]:Switch focused window to chosen tag
TAGKEYS( XK_4, 3) //#Mod+Control+Shift:Add chosen tag to focused window's tag list
TAGKEYS( XK_5, 4) //#Mod+Mouse2:Toggle focused window to and from floating mode
{ MODKEY, XK_q, quit, {0} }, //#Mod+q:Restart dwm (.xinitrc loop)
{ MODKEY|ShiftMask, XK_q, spawn, {.v = quitcmd } }, //#Mod+Shift+q:Kill X11
{ 0, XF86XK_Launch1, spawn, {.v = scratchpadcmd }}, //#ThinkVantage:Spawns/Summons urxvt scratchpad
};
// click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin
static Button buttons[] = {
// click event mask button function argument
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkWinTitle, 0, Button1, focusstack, {.i = +1 } },
{ ClkWinTitle, 0, Button3, focusstack, {.i = -1 } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} }, //Mod+Mouse1:Drag focused floating window under pointer
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} }, //Mod+Mouse2:Toggle focused window to and from floating mode
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, //Mod+Mouse3:Resize focused floating window under pointer
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
The comments in the form of "//#<keys>:<description>" are parsed by a script I have that displays all my keybindings in case i forget one. You can read more here. Also, thanks lorin for the awesome dwm icon
EDIT: Would anyone be able to tell me how to limit the length of the focused window title in the status bar to, say, 85 characters? Right now if the title text is too long it gets overlapped by my dzen bar, and it's slightly annoying.
Last edited by komrad_toast (2015-01-27 18:51:46)
(github)
Offline
Offline
@parazyd - Thanks! Here's a more recent shot
http://i61.tinypic.com/25rp2jk.png
Very nice wallpaper, do you have a link?
"We may say most aptly, that the Analytical Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves." - Ada Lovelace
Offline
komrad_toast wrote:@parazyd - Thanks! Here's a more recent shot
http://i61.tinypic.com/25rp2jk.pngVery nice wallpaper, do you have a link?
Offline
Offline
@parazyd - Thanks! Here's a more recent shot
http://i61.tinypic.com/25rp2jk.pngAll my configs and scripts are on my github (which I suppose I should add to my sig). I have changed a lot since that last screenshot, though.
Very nicely done, komrad.
Offline
I just started using Dwm yesterday and this is my basic config. This actually dwm-vain.
Offline
Pretty simple, just some changes to dwmstatus.
dwmstatus.c
#define _BSD_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <sys/time.h>
#include <time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <ifaddrs.h>
#include <linux/if_link.h>
#include <X11/Xlib.h>
char *tzcentral = "America/Rainy_River";
int old_stats[10];
static Display *dpy;
char *
smprintf(char *fmt, ...)
{
va_list fmtargs;
char *ret;
int len;
va_start(fmtargs, fmt);
len = vsnprintf(NULL, 0, fmt, fmtargs);
va_end(fmtargs);
ret = malloc(++len);
if (ret == NULL) {
perror("malloc");
exit(1);
}
va_start(fmtargs, fmt);
vsnprintf(ret, len, fmt, fmtargs);
va_end(fmtargs);
return ret;
}
void
settz(char *tzname)
{
setenv("TZ", tzname, 1);
}
char *
mktimes(char *fmt, char *tzname)
{
char buf[129];
time_t tim;
struct tm *timtm;
memset(buf, 0, sizeof(buf));
settz(tzname);
tim = time(NULL);
timtm = localtime(&tim);
if (timtm == NULL) {
perror("localtime");
exit(1);
}
if (!strftime(buf, sizeof(buf)-1, fmt, timtm)) {
fprintf(stderr, "strftime == 0\n");
exit(1);
}
return smprintf("%s", buf);
}
void
setstatus(char *str)
{
XStoreName(dpy, DefaultRootWindow(dpy), str);
XSync(dpy, False);
}
char *
loadavg(void)
{
double avgs[3];
if (getloadavg(avgs, 3) < 0) {
perror("getloadavg");
exit(1);
}
return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]);
}
char *
cpu_usage(void)
{
FILE *f;
int i = 0, stats[10], delta[10];
f = fopen("/proc/stat", "r");
if(f == NULL)
return smprintf("ERROR");
/* Get current stats*/
fscanf(f, "%*s");
for(i = 0; i < 10; ++i)
{
char str[10];
fscanf(f, "%s", str);
stats[i] = atoi(str);
/* Compare it with old_stats to create delta */
delta[i] = stats[i] - old_stats[i];
/* Create new old_stats */
old_stats[i] = stats[i];
}
int total_used = delta[0] + delta[1] + delta[2] + delta[4] + delta[5] + delta[6] + delta[7] + delta[8] + delta[9];
int total = total_used + delta[3];
fclose(f);
return smprintf("%2.0f%%", (float)total_used*100/total);
}
char *
getbattery(void)
{
FILE* f;
char bat[5];
f = fopen("/sys/class/power_supply/BAT0/capacity", "r");
fscanf(f, "%s", bat);
fclose(f);
return smprintf("%s", bat);
}
char *
getifaddr(void)
{
struct ifaddrs *ifaddr, *ifa;
int i = 0, s;
char host[NI_MAXHOST], output[200] = { 0 }, buf[100];
if(getifaddrs(&ifaddr) == 1)
return 0xff;
for(ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next)
{
if(strncmp(ifa->ifa_name, "virbr", 5) != 0 && strncmp(ifa->ifa_name, "lo", 2) != 0 && ifa->ifa_addr->sa_family == AF_INET )
{
s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
sprintf(buf, " %s: %s |", ifa->ifa_name, host);
strcat(output, buf);
}
}
freeifaddrs(ifaddr);
return smprintf("%s", output);
}
int
main(void)
{
char *status;
/*char *avgs;*/
char *tmcentral;
char *cpu;
char *battery;
char *ifaddr;
int i = 0;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n");
return 1;
}
/* Clear old_stats for cpu usage*/
for(i = 0; i < 10; ++i)
old_stats[i] = 0;
for (;;sleep(1)) {
/*avgs = loadavg();*/
cpu = cpu_usage();
tmcentral = mktimes("%Y-%m-%d %H:%M:%S", tzcentral);
battery = getbattery();
ifaddr = getifaddr();
status = smprintf("%s BAT %s | CPU %s | %s",
ifaddr, battery, cpu, tmcentral);
setstatus(status);
/*free(avgs);*/
free(tmcentral);
free(status);
free(ifaddr);
}
XCloseDisplay(dpy);
return 0;
}
----- Think out of the Box. ------
Archer since 2010.
My projects: http://github.com/kinokoio
Offline
This is my latest set of themes.
Configs: dwm, conky, dzen2, cmus, xresources, zsh
Last edited by grandtheftjiujitsu (2015-06-18 15:10:16)
Offline
https://i.imgur.com/sB8ghO8.jpg
It is my 3rd day with dwm since I moved to it from Openbox.
thanks for your fork. i'm using it myself. found it when trying to find a working uselessgap patch. you did a great job.
Offline
aaroncaffrey wrote:https://i.imgur.com/sB8ghO8.jpg
It is my 3rd day with dwm since I moved to it from Openbox.
thanks for your fork. i'm using it myself. found it when trying to find a working uselessgap patch. you did a great job.
Thanks, I'm glad you like it. It's me from other account.
I haven't done too many changes since my first week, the most notable change (that's not related to dwm) was the move to vim as my primary programming editor, a couple weeks after my blog post was published added "underline", "save float", "uselessgap3" and "push" patches. On next month added overall cpu usage function in my dwm-bar.c program.
Once I configure something that feels comfortable, I rarely do changes later on.
Offline
orlfman wrote:aaroncaffrey wrote:https://i.imgur.com/sB8ghO8.jpg
It is my 3rd day with dwm since I moved to it from Openbox.
thanks for your fork. i'm using it myself. found it when trying to find a working uselessgap patch. you did a great job.
Thanks, I'm glad you like it. It's me from other account.
That makes three by my count: https://wiki.archlinux.org/index.php/Fo … r_accounts
Offline
router wrote:orlfman wrote:thanks for your fork. i'm using it myself. found it when trying to find a working uselessgap patch. you did a great job.
Thanks, I'm glad you like it. It's me from other account.
That makes three by my count: https://wiki.archlinux.org/index.php/Fo … r_accounts
Hi Jason,
Since my first day I was honest person that respects everyone else. router was my second account because I had no other options to retrieve my password.
Hello guys,
Please accept my apologies. Had to create a new account as my old one was using xxx email provider that blocked my account and wasn't able to retrieve my lengthy password.
I've been always respecting you as active forum moderator and even get in touch with you twice, the first one was around year ago (to tell you "thanks for sharing your dotfiles") and the second one was around month ago (to tell you about my program, because you are using dwm too).
Bye everyone
Then you should have contacted a mod about your account: rather than continuing to create new ones...
As it is, you are violating our Etiquette, and just making work for us to clean up after you.
Offline
Offline