You are not logged in.
I would really love to see a layout per tag saved into the config.h and reloaded automatically after every starts. It's the last thing I need before movin' to MonsterWM.
Nice work anyway.
The thing is, that if it's stored in config.h, it would need some parsing and monsterwm would need to be compiled again.
More better solution would be keeping a configuration file where the layouts are saved, but this goes against monsterwm design.
Last edited by Cloudef (2012-03-26 11:53:13)
Offline
yep, parsing is an issue, but you can go around that having something like:
/* config.h */
#define DESKTOPS 3
static const initlayouts[] = { TILE, GRID, MONOCLE, };
/* mosterwm.c @ setup */
for (int i = 0; i < DESKTOPS && i < LENGTH(initlayouts); i++) {
select_desktop(i);
mode = initlayouts[i];
}
which would work, but I don't know if I like it much
Last edited by c00kiemon5ter (2012-03-26 12:01:55)
.:[ git me! ] :.
Offline
Offline
for tagging there is dwm?
although having the ability of setting my "web" desktop to maximized automagically would be awesome.
Offline
try the initlayouts branch.
it's what Ypnose requested.
.:[ git me! ] :.
Offline
will do thanks
Offline
Hey c00kiemon5ter: did you see my previous post regarding window titles? Would it better to put 'feature requests' like that on github?
Thanks!
Scott
Offline
hadn't seen that, done. check the window titles branch
also I updated the gist to include a new init script that will catch the window titles and show them centered on some_sorta_bar. diff is on lines 10,11,12 and 47
if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+.*$ ]]; then # include the title '.*'
read -ra desktops <<< "$wmout" && unset r t # title needs to be reset
t="${desktops[@]:(-1)}" # store title on var t
...
xsetroot -name "&L $r $i &C$t &R $datetime" # center on some_sorta_bar
note that I haven't tested it much, it worked for a quick test.
Last edited by c00kiemon5ter (2012-03-26 16:39:56)
.:[ git me! ] :.
Offline
Offline
Offline
I was thinking about something: how would monsterwm operate with dual monitor env? Would it show one desktop on 2 (or more) screens or it will use just one screen?
@c00kiemon5ter
When you applied this patch, did you changed also part for "resize_stack"? It seems that it is working the same way as "resize_master" (it is saving it's geometry after changing modes) but it seems that step for changing stack is way smaller than step for master. By "step" i mean px or % of screen changed with every usage of that shortcut (in this case, alt+j|k for master and alt+o|p for stack). Is there a way to make them grow/shring equally?
Last edited by kuraku (2012-03-30 00:08:09)
Offline
Offline
Thanks dude. I was going to try that. I swear.
edit: Here's my current setup. I'm really liking it!
Nice, which font you are using?
Offline
stlarch wrote:Thanks dude. I was going to try that. I swear.
edit: Here's my current setup. I'm really liking it!
Nice, which font you are using?
Looks like a ohsnap font, grab it from here
Offline
Just finished with this panel modification.. took a couple of hours from me because I have no experience about coding in any language. Now I'm officially a copycat, it seems everything's working well without any breakages. Wait what it seems it's morning already.
http://ompldr.org/tZDV4OQ
Shinryuu an I have that wallpaper? Also I launched monsterwm for the first time and there was no bar showing me my tags/window spaces. Can anyone guide me? I don't see how to customize them in config.h
Offline
@cirnOS
Monsterwm doesn't have a physical bar. You'll need a extrenal application such as dzen.
See examples here: https://gist.github.com/1905427
I found shell script piping to dzen quite heavy under embedded device as such scripts keep spawning extrenal processes under constant while loop.
Here as example is fast C code for tag bar handler that you can pipe to dzen2.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
/* either color code or empty for default fg */
#define URGENT "#FF0000"
#define CURRENT "#D11783"
#define DEFAULT "#5E7175"
#define LAYOUT "#FEA63C"
#define SEPERATOR "::"
#define SEPERATOR_FG ""
#define WINDOWS LAYOUT
#define VIMODE CURRENT
#define eol() printf("\n");
#define whitespace() printf(" ");
typedef struct desktop_t
{
const char *n, *c;
int current, urgent, windows;
} desktop_t;
typedef struct layout_t
{
const char *n, *c;
} layout_t;
static desktop_t desktop[] = {
{ .n = "に", .c = DEFAULT },
{ .n = "せ", .c = DEFAULT },
{ .n = "も", .c = DEFAULT },
{ .n = "の", .c = DEFAULT },
{ .n = NULL }
};
static layout_t layout[] = {
{ .n = "[T]", .c = LAYOUT },
{ .n = "[M]", .c = LAYOUT },
{ .n = "[b]", .c = LAYOUT },
{ .n = "[G]", .c = LAYOUT },
{ .n = NULL }
};
static void die(const char *errstr, ...) {
va_list ap;
va_start(ap, errstr); vfprintf(stderr, errstr, ap); va_end(ap);
exit(EXIT_FAILURE);
}
static int strsplit(char ***dst, char *str, char *token) {
char *saveptr, *ptr, *start;
int32_t t_len, i;
if (!(saveptr=strdup(str)))
return 0;
*dst=NULL;
t_len=strlen(token);
i=0;
for (start=saveptr,ptr=start;;ptr++) {
if (!strncmp(ptr,token,t_len) || !*ptr) {
while (!strncmp(ptr,token,t_len)) {
*ptr=0;
ptr+=t_len;
}
if (!((*dst)=realloc(*dst,(i+2)*sizeof(char*))))
return 0;
(*dst)[i]=start;
(*dst)[i+1]=NULL;
i++;
if (!*ptr)
break;
start=ptr;
}
}
return i;
}
static void strsplit_clear(char ***dst) {
if ((*dst)[0])
free((*dst)[0]);
free((*dst));
}
static void printdata(int m, int v)
{
int i;
char *color;
/* print desktops */
for (i = 0; desktop[i].n; ++i) {
color = (char*)desktop[i].c;
if (desktop[i].current) color = CURRENT;
else if (desktop[i].urgent) color = URGENT;
printf("^fg(%s)%s%s%.0d%s%s^fg()",
color, desktop[i].n, desktop[i].windows?" ^fg("WINDOWS")[":"", desktop[i].windows, desktop[i].windows?"]":"",
desktop[i+1].n?"^fg("SEPERATOR_FG") "SEPERATOR" ":" ");
}
printf("^fg(%s)%s^fg() ", LAYOUT, layout[m].n);
printf("%s", v?"^fg("VIMODE")[V]":"[s]");
eol();
fflush(stdout);
}
int main(int argc, char **argv)
{
FILE *f;
size_t bytes;
int fd, tags = 0, i = 0, co = 0;
int d = 0, w = 0, m = 0, c = 0, u = 0, v = 0;
int desks = 0, layouts = 0, mode = 0;
char buffer[256], **data = NULL;
/* check args */
if (argc < 2)
die("usage: %s [fifo]\n", argv[0]);
/* remove if old fifo */
if ((f = fopen(argv[1], "r"))) {
fclose(f);
unlink(argv[1]);
}
/* make fifo */
if (mkfifo(argv[1], 0600) == -1)
die("could not create fifo\n");
/* open fifo */
if ((fd = open(argv[1], O_RDONLY)) == -1)
die("could not open fifo\n");
/* count layouts && desks */
for (desks = 0; desktop[desks].n; ++desks) {
desktop[desks].current = 0;
desktop[desks].urgent = 0;
desktop[desks].windows = 0;
}
for (layouts = 0; layout[layouts].n; ++layouts);
memset(buffer, 0, sizeof(buffer));
/* tagbar itself (pipe to dzen) */
while ((bytes = read(fd, buffer, sizeof(buffer))) >= 0)
{
/* check if eof */
if (!bytes) {
close(fd);
if ((fd = open(argv[1], O_RDONLY)) == -1)
die("could not reopen fifo\n");
continue;
}
/* not right kind of data */
if (buffer[1] != ':' || buffer[3] != ':' ||
buffer[5] != ':' || buffer[7] != ':') {
memset(buffer, 0, bytes);
printdata(mode<layouts?mode:0, v);
continue;
}
/* strsplit */
tags = strsplit(&data, buffer, " ");
whitespace();
for(i = 0; i != tags; ++i) {
/* sscanf data */
co = sscanf(data[i], "%d:%d:%d:%d:%d:%d",
&d, &w, &m, &c, &u, &v);
if (co < 6) break;
if (d >= desks) break;
/* desktop flags */
if (u) desktop[d].urgent = 1;
else desktop[d].urgent = 0;
if (c) {
desktop[d].current = 1;
mode = m;
} else desktop[d].current = 0;
desktop[d].windows = w;
}
/* failed sscanf? */
if (co < 6) {
printf("ERROR");
eol();
fflush(stdout);
}
else
printdata(mode<layouts?mode:0, v);
strsplit_clear(&data);
memset(buffer, 0, bytes);
}
/* close */
close(fd);
unlink(argv[1]);
return EXIT_SUCCESS;
}
Last edited by Cloudef (2012-04-07 07:47:01)
Offline
Thanks clouded, my fault for not reading. I'll take a look at those next time I get a chance.
Offline
Shinryuu wrote:Just finished with this panel modification.. took a couple of hours from me because I have no experience about coding in any language. Now I'm officially a copycat, it seems everything's working well without any breakages. Wait what it seems it's morning already.
http://ompldr.org/tZDV4OQShinryuu an I have that wallpaper? Also I launched monsterwm for the first time and there was no bar showing me my tags/window spaces. Can anyone guide me? I don't see how to customize them in config.h
Yo! Here's the wallpaper, http://ompldr.org/vZGFkdg/27169.png
Offline
I can't use it cloudef :S ./bar tells me "permission denied". I did "gcc -o bar bar.c"
Your option seems much better than a regular script
Offline
I was thinking about something: how would monsterwm operate with dual monitor env? Would it show one desktop on 2 (or more) screens or it will use just one screen?
@c00kiemon5ter
When you applied this patch, did you changed also part for "resize_stack"? It seems that it is working the same way as "resize_master" (it is saving it's geometry after changing modes) but it seems that step for changing stack is way smaller than step for master. By "step" i mean px or % of screen changed with every usage of that shortcut (in this case, alt+j|k for master and alt+o|p for stack). Is there a way to make them grow/shring equally?
hey
I think I can do that, I'll probably revert to use an "amount of pixel" step, it's more accurate, I guess. I'll into it tomorrow.
for the dual monitor, multimonitor support means that you can load a single instance of the wm, and have both screen working, and clients communicating (ie you can copy from one window on monitor 1 and paste on another window on monitor 2, or move windows between clients etc). This would work, much like dwm works.
Now, afaik, depending on your graphics card you can use the monitors as one big screen (tweenview) or as mirrors or as I don't know what, which the wm can't control, it's vga specific. I never had a second screen, so I haven't dig that much and can't be sure.
So if your vga isn't in some "special" mode, the way monsterwm is now, would probably load on one screen.
Anyways, I think multimonitor support isn't that hard, and I would implement it in a separate branch, if I could test it.
.:[ git me! ] :.
Offline
kuraku wrote:it seems that step for changing stack is way smaller than step for master. By "step" i mean px or % of screen changed with every usage of that shortcut (in this case, alt+j|k for master and alt+o|p for stack). Is there a way to make them grow/shring equally?
I think I can do that, I'll probably revert to use an "amount of pixel" step, it's more accurate, I guess. I'll into it tomorrow.
alright, pushed, back to using pixel size values. should be equal now
on other news, refering mostly to non-linux users
I now use <err.h> and handle arguments (-h -v and invalids) a bit differently.
it should be fine on both Linux and BSD, so nothing much to worry about,
but in case of errors on compilation keep it in mind. about err.h portability:
CONFORMING TO
These functions are nonstandard BSD extensions.
Last edited by c00kiemon5ter (2012-04-08 02:50:22)
.:[ git me! ] :.
Offline
I can't use it cloudef :S ./bar tells me "permission denied". I did "gcc -o bar bar.c"
Your option seems much better than a regular script
Try chmod +x bar, though it's weird if gcc din't do this already.
Also you can't really use the code as it is. Needs little modification since the monsterwm on my Pandora outputs some extra information.
This should work with vanilla:
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
/* either color code or empty for default fg */
#define URGENT "#FF0000"
#define CURRENT "#D11783"
#define DEFAULT "#5E7175"
#define LAYOUT "#FEA63C"
#define SEPERATOR "::"
#define SEPERATOR_FG ""
#define WINDOWS LAYOUT
#define eol() printf("\n");
#define whitespace() printf(" ");
typedef struct desktop_t
{
const char *n, *c;
int current, urgent, windows;
} desktop_t;
typedef struct layout_t
{
const char *n, *c;
} layout_t;
static desktop_t desktop[] = {
{ .n = "に", .c = DEFAULT },
{ .n = "せ", .c = DEFAULT },
{ .n = "も", .c = DEFAULT },
{ .n = "の", .c = DEFAULT },
{ .n = NULL }
};
static layout_t layout[] = {
{ .n = "[T]", .c = LAYOUT },
{ .n = "[M]", .c = LAYOUT },
{ .n = "[b]", .c = LAYOUT },
{ .n = "[G]", .c = LAYOUT },
{ .n = NULL }
};
static void die(const char *errstr, ...) {
va_list ap;
va_start(ap, errstr); vfprintf(stderr, errstr, ap); va_end(ap);
exit(EXIT_FAILURE);
}
static int strsplit(char ***dst, char *str, char *token) {
char *saveptr, *ptr, *start;
int32_t t_len, i;
if (!(saveptr=strdup(str)))
return 0;
*dst=NULL;
t_len=strlen(token);
i=0;
for (start=saveptr,ptr=start;;ptr++) {
if (!strncmp(ptr,token,t_len) || !*ptr) {
while (!strncmp(ptr,token,t_len)) {
*ptr=0;
ptr+=t_len;
}
if (!((*dst)=realloc(*dst,(i+2)*sizeof(char*))))
return 0;
(*dst)[i]=start;
(*dst)[i+1]=NULL;
i++;
if (!*ptr)
break;
start=ptr;
}
}
return i;
}
static void strsplit_clear(char ***dst) {
if ((*dst)[0])
free((*dst)[0]);
free((*dst));
}
static void printdata(int m)
{
int i;
char *color;
/* print desktops */
for (i = 0; desktop[i].n; ++i) {
color = (char*)desktop[i].c;
if (desktop[i].current) color = CURRENT;
else if (desktop[i].urgent) color = URGENT;
printf("^fg(%s)%s%s%.0d%s%s^fg()",
color, desktop[i].n, desktop[i].windows?" ^fg("WINDOWS")[":"", desktop[i].windows, desktop[i].windows?"]":"",
desktop[i+1].n?"^fg("SEPERATOR_FG") "SEPERATOR" ":" ");
}
printf("^fg(%s)%s^fg() ", LAYOUT, layout[m].n);
eol();
fflush(stdout);
}
int main(int argc, char **argv)
{
FILE *f;
size_t bytes;
int fd, tags = 0, i = 0, co = 0;
int d = 0, w = 0, m = 0, c = 0, u = 0;
int desks = 0, layouts = 0, mode = 0;
char buffer[256], **data = NULL;
/* check args */
if (argc < 2)
die("usage: %s [fifo]\n", argv[0]);
/* remove if old fifo */
if ((f = fopen(argv[1], "r"))) {
fclose(f);
unlink(argv[1]);
}
/* make fifo */
if (mkfifo(argv[1], 0600) == -1)
die("could not create fifo\n");
/* open fifo */
if ((fd = open(argv[1], O_RDONLY)) == -1)
die("could not open fifo\n");
/* count layouts && desks */
for (desks = 0; desktop[desks].n; ++desks) {
desktop[desks].current = 0;
desktop[desks].urgent = 0;
desktop[desks].windows = 0;
}
for (layouts = 0; layout[layouts].n; ++layouts);
memset(buffer, 0, sizeof(buffer));
/* tagbar itself (pipe to dzen) */
while ((bytes = read(fd, buffer, sizeof(buffer))) >= 0)
{
/* check if eof */
if (!bytes) {
close(fd);
if ((fd = open(argv[1], O_RDONLY)) == -1)
die("could not reopen fifo\n");
continue;
}
/* not right kind of data */
if (buffer[1] != ':' || buffer[3] != ':' ||
buffer[5] != ':' || buffer[7] != ':') {
memset(buffer, 0, bytes);
printdata(mode<layouts?mode:0);
continue;
}
/* strsplit */
tags = strsplit(&data, buffer, " ");
whitespace();
for(i = 0; i != tags; ++i) {
/* sscanf data */
co = sscanf(data[i], "%d:%d:%d:%d:%d",
&d, &w, &m, &c, &u);
if (co < 5) break;
if (d >= desks) break;
/* desktop flags */
if (u) desktop[d].urgent = 1;
else desktop[d].urgent = 0;
if (c) {
desktop[d].current = 1;
mode = m;
} else desktop[d].current = 0;
desktop[d].windows = w;
}
/* failed sscanf? */
if (co < 5) {
printf("ERROR");
eol();
fflush(stdout);
} else
printdata(mode<layouts?mode:0);
strsplit_clear(&data);
memset(buffer, 0, bytes);
}
/* close */
close(fd);
unlink(argv[1]);
return EXIT_SUCCESS;
}
This is my startup script on pandora (monstertag is the above C program):
#!/usr/bin/env bash
# autostart here
autostart() {
# wicd
pidof wicd-gtk || wicd-gtk -t &> /dev/null &
# volumeicon
pidof volumeicon || volumeicon &> /dev/null &
}
# check old fifo
ff="/tmp/monsterwm.fifo"
[[ -p "$ff" ]] && rm "$ff"
# start monsterwm with status bars
monstertag "$ff" | dzen2 -h 18 -w 320 -ta l -e -p &
monsterbar | dzen2 -h 18 -x 320 -w $((800-320)) -ta r -e -p &
# wait monstertag to create fifo
while [[ ! -p "$ff" ]]; do sleep 1; done
while [ 1 ]; do
autostart
monsterwm | tee -a "$ff"
[[ ${PIPESTATUS[0]} -eq 2 ]] && break
pidof X || break
done
# remove fifo
[[ -p "$ff" ]] && rm "$ff"
Last edited by Cloudef (2012-04-08 09:52:20)
Offline
I couldn't previously understand why the tag/state part of some_sorta_bar wasen't instantaneously updating and had a 2 sec delay, whereas dzen was instantaneously updating, and I had configured some_sorta_bar to update whenever the fifo changed, and not with a reguar timeout...
Now I then found out that it was obviously because that with dzen, I had two dzen instances, one for left and one for right, and in the right statusbar I had e.g. acpi running to display battery state, and which took about 2 secs, but it didn't interfere with the left bar which showed tag/state info, but on my some_sorta_bar setup, I had the acpi part in the main loop(in the $datetime var) which also showed tag/state info...
I just used the example for some_sorta_bar from c00kie's gist-page, and then just added extra commands to the $datetime var, like e.g. the acpi command...
So, I was thinking if someone could kindly help me out about how I could make some_sorta_bar show tag/state info instantaneous, and still having e.g. the acpi command etc. on the right?
Sorry for nobish question in advance, but im not very advanced in scripting, and i've allready tried a lot of ways which didn't work right...
Thanks!
Offline