Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k views
in Technique[技术] by (71.8m points)

dwm arch linux. How to make key bindings to run Terminal programs

So i was using i3. Now i want to see dwm. Made keybidings to run firefox on Modkey+w. It works well, but now when i want to do simmilar commands for nvim, ranger, cmus (all terminal programs) it isn't working. Can't run them from dmenu also. Is it ok, or i just fuckedup with my config files??

static const Rule rules[] = {
    /* xprop(1):
     *  WM_CLASS(STRING) = instance, class
     *  WM_NAME(STRING) = title
     */
    /* class      instance    title       tags mask     isfloating   monitor */
    { "Gimp",     NULL,       NULL,       0,            1,           -1 },
    { "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
    { "nvim",       NULL,       NULL,       1 << 8,       0,           -1 },
    { "ranger",     NULL,       NULL,       1 << 8,       0,           -1 },

};
static const char *web[]  = { "/usr/bin/firefox", NULL };
static const char *nvim[]  = { "/usr/share/nvim", NULL };
static const char *ranger[]  = { "/usr/bin/ranger", NULL };

{ MODKEY,                       XK_w,        spawn,                  {.v = web } },
{ MODKEY,                       XK_r,        spawn,                  {.v = ranger } },
{ MODKEY|ShiftMask,                       XK_v,          spawn,                  {.v = nvim } },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Nvim and Ranger run in the terminal, so just running the binaries won't do anything. You'll need to run them in your terminal. How that works depends on your terminal, but it is likely something like your-terminal -e ranger, or static const char *ranger[] = {"xterm", "-e", "/usr/bin/ranger", NULL }; for example.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...