如何在很棒的 WM 上使用快捷方式运行 bash

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14273607/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 04:14:24  来源:igfitidea点击:

How to run a bash with shortcut on awesome WM

linuxbashubuntushortcutawesome-wm

提问by hertkof

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

我是 Awesome WM 的新手,并尝试添加自定义快捷方式来运行 bash 文件,但它不起作用。

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

I add this behind of "Standard Program".

我在“标准程序”后面添加了这个。

Thank you

谢谢

回答by laite

First of all, I assume that you are using awesome 3.4.something since you tagged this as ubuntu. 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.

首先,我假设您使用的是 awesome 3.4.something ,因为您将其标记为ubuntu。然后:您没有为快捷方式指定键,只有修饰符。最后:您应该对要运行的命令使用完整路径并将其放在双引号中。

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

请参阅绑定 Shift-e 以从用户主文件夹运行脚本的示例:

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

回答by Chunliang Lyu

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

你需要提供完整的路径awful.util.spawn,比如说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+kas your shortcut, you need the following line:

另一个错误是您需要提供密钥作为awful.key. 因此,如果要绑定Win+Control+Shift+k为快捷方式,则需要以下行:

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

回答by milarepa

try:

尝试:

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

可怕的.util.spawn_with_shell("./layout-ir.sh")