• Uncategorized

About c : How-to-use-pipe-in-dwm-dynamic-window-manager-config-in-linux

Question Detail

I am configuring my shortcut keys directly to dwm config file (config.def.h).
For eg: To add shortcut to open thunderbird:
static const char *mailclient[] = { "thunderbird", NULL };

and then you add a key-binding to it in static Key keys[ ]:
{ Mod4Mask, XK_m, spawn, {.v = mailclient} },

But what i want to do is open the mail client and send the notification “Thunderbird Opened”; which can simply be done in terminal by thunderbird | notify-send "Thunderbird Opened".
So, how to append “| notify-send "Thunderbird Opened” in above shortcut in dwm config?

Question Answer

Solution Found:

Should create a char array literal rather than a pointer.

i.e, use: static const char mailclient[] = "thunderbird && notify-send 'Thunderbird Opened'";
in place of: static const char *mailclient[] = { "thunderbird", NULL };
and
Use: { Mod4Mask, XK_m, spawn, SHCMD(mailclient) },
in place of: { Mod4Mask, XK_m, spawn, {.v = mailclient} },

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.