merged with master
This commit is contained in:
commit
1697346729
4 changed files with 14 additions and 14 deletions
9
Makefile
9
Makefile
|
@ -1,14 +1,15 @@
|
||||||
.POSIX:
|
.POSIX:
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
output: dwmblocks.o
|
dwmblocks: dwmblocks.o
|
||||||
gcc dwmblocks.o -lX11 -o dwmblocks
|
$(CC) dwmblocks.o -lX11 -o dwmblocks
|
||||||
dwmblocks.o: dwmblocks.c config.h
|
dwmblocks.o: dwmblocks.c config.h
|
||||||
gcc -c -lX11 dwmblocks.c
|
$(CC) -c dwmblocks.c
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.gch dwmblocks
|
rm -f *.o *.gch dwmblocks
|
||||||
install: output
|
install: dwmblocks
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f dwmblocks $(DESTDIR)$(PREFIX)/bin
|
cp -f dwmblocks $(DESTDIR)$(PREFIX)/bin
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwmblocks
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwmblocks
|
||||||
|
|
|
@ -31,9 +31,7 @@ but is faster. Just add 34 to your typical signal number.
|
||||||
My volume module *never* updates on its own, instead I have this command run
|
My volume module *never* updates on its own, instead I have this command run
|
||||||
along side my volume shortcuts in dwm to only update it when relevant.
|
along side my volume shortcuts in dwm to only update it when relevant.
|
||||||
|
|
||||||
Note that if you signal an unexpected signal to dwmblocks, it will probably
|
Note that all modules must have different signal numbers.
|
||||||
crash. So if you disable a module, remember to also disable any cronjobs or
|
|
||||||
other scripts that might signal to that module.
|
|
||||||
|
|
||||||
# Clickable modules
|
# Clickable modules
|
||||||
|
|
||||||
|
|
4
config.h
4
config.h
|
@ -14,7 +14,3 @@ static const Block blocks[] = {
|
||||||
{"", "battery", 5, 3},
|
{"", "battery", 5, 3},
|
||||||
{"", "clock", 1, 1},
|
{"", "clock", 1, 1},
|
||||||
};
|
};
|
||||||
|
|
||||||
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
|
|
||||||
static char *delim = "|";
|
|
||||||
|
|
||||||
|
|
11
dwmblocks.c
11
dwmblocks.c
|
@ -114,6 +114,10 @@ void getsigcmds(int signal)
|
||||||
void setupsignals()
|
void setupsignals()
|
||||||
{
|
{
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
|
for(int i = SIGRTMIN; i <= SIGRTMAX; i++)
|
||||||
|
signal(i, SIG_IGN);
|
||||||
|
|
||||||
for(int i = 0; i < LENGTH(blocks); i++)
|
for(int i = 0; i < LENGTH(blocks); i++)
|
||||||
{
|
{
|
||||||
if (blocks[i].signal > 0)
|
if (blocks[i].signal > 0)
|
||||||
|
@ -210,6 +214,7 @@ void sighandler(int signum)
|
||||||
void buttonhandler(int sig, siginfo_t *si, void *ucontext)
|
void buttonhandler(int sig, siginfo_t *si, void *ucontext)
|
||||||
{
|
{
|
||||||
char button[2] = {'0' + si->si_value.sival_int & 0xff, '\0'};
|
char button[2] = {'0' + si->si_value.sival_int & 0xff, '\0'};
|
||||||
|
pid_t process_id = getpid();
|
||||||
sig = si->si_value.sival_int >> 8;
|
sig = si->si_value.sival_int >> 8;
|
||||||
if (fork() == 0)
|
if (fork() == 0)
|
||||||
{
|
{
|
||||||
|
@ -220,14 +225,14 @@ void buttonhandler(int sig, siginfo_t *si, void *ucontext)
|
||||||
if (current->signal == sig)
|
if (current->signal == sig)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
char *command[] = { "/bin/sh", "-c", current->command, NULL };
|
char shcmd[1024];
|
||||||
|
sprintf(shcmd,"%s && kill -%d %d",current->command, current->signal+34,process_id);
|
||||||
|
char *command[] = { "/bin/sh", "-c", shcmd, NULL };
|
||||||
setenv("BLOCK_BUTTON", button, 1);
|
setenv("BLOCK_BUTTON", button, 1);
|
||||||
setsid();
|
setsid();
|
||||||
execvp(command[0], command);
|
execvp(command[0], command);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
getsigcmds(sig);
|
|
||||||
writestatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue