简体   繁体   中英

How to run a bash with shortcut on awesome WM

I'm new in Awesome WM and try to add a custom shortcut to run a bash file but it does not work.

awful.key({ modkey, "Control", "Shift" }, function () awful.util.spawn(./layout-ir.sh) end),

I add this behind of "Standard Program".

Thank you

First of all, I assume that you are using awesome 3.4.something since you tagged this as . Then: You don't specify key for your shortcut, only modifiers. And lastly: you should use full path for command you want to run and put it in double quotations.

See example for binding Shift-e to run script from user home folder:

awful.key({ modkey,   "Shift" }, "e", function () awful.util.spawn("sh /home/USERNAME/myscript.sh") end),

You need to provide full path to awful.util.spawn , say awful.util.spawn("~/.bin/layout-ir.sh") .

Another mistake is you need to provide the key as second parameter for awful.key . So if you want to bind Win+Control+Shift+k as your shortcut, you need the following line:

awful.key({ modkey, "Control", "Shift" }, "k", function () awful.util.spawn("~/.bin/layout-ir.sh") end),

try:

awful.util.spawn_with_shell("./layout-ir.sh")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM