创建快捷方式或热键以在Linux上使扬声器静音

After writing about how to create a shortcut or hotkey to mute the speakers in Windows, I got a couple of requests for how to do the same thing in Linux, which turns out to be really simple if you are running the latest version of Ubuntu or Gnome.

在写完有关如何在Windows中创建使扬声器静音的快捷方式或热键的文章之后,我收到了一些关于如何在Linux中执行相同操作的请求,如果您运行的是最新版本的Ubuntu或Windows XP ,这真的很简单。侏儒

If your version doesn’t have the easy option you can still do the same thing in many versions of Linux with a simple command line.

如果您的版本没有easy选项,您仍然可以使用简单的命令行在许多Linux版本中执行相同的操作。

Setting the Hotkey on Ubuntu

在Ubuntu上设置热键

Simply go to System \ Preferences \ Keyboard Shortcuts and then assign a hotkey to the Sound \ Volume mute item.

只需转到“系统” \“首选项” \“键盘快捷键”,然后为“声音” \“音量”静音项分配一个热键。

image

Once you use the hotkey you’ll see a little dialog pop up to show you what the current volume state is (You can quickly hit the hotkey again to toggle back and forth)

使用热键后,您会看到一个弹出对话框,显示当前的音量状态(您可以再次快速按下热键来回切换)

image

Using the Command Line / Scripts

使用命令行/脚本

Alternatively, you can assign a shortcut key to a script that uses the amixer utility to toggle the mute state. To test this out, just open up a terminal window and then use this command:

或者,您可以为使用amixer实用程序切换静音状态的脚本分配快捷键。 要进行测试,只需打开一个终端窗口,然后使用以下命令:

amixer sset Master toggle

混频器sset主切换

You’ll see the output right there in the console, telling you whether it’s now set to off or on:

您将在控制台中看到输出,并告诉您现在是关闭还是打开:

image

And your volume icon should show that the volume has now been muted.

并且您的音量图标应显示该音量已被静音。

image

You can create a shortcut to run this command by right-clicking anywhere and using Create Launcher, adding in the full command from above into the Command box.

您可以通过右键单击任意位置并使用“创建启动器”来创建运行此命令的快捷方式,从上方将完整命令添加到“命令”框中。

image

If you are running Gnome and want to add a shortcut key, you can use this article to assign one. If you are running an older version of KDE, then you’ll want to create a shortcut in the KDE Menu Editor and assign the hotkey there.

如果您正在运行Gnome,并且想要添加快捷键,则可以使用本文分配一个。 如果您正在运行旧版本的KDE,则需要在KDE菜单编辑器中创建一个快捷方式并在其中分配热键。

翻译自: https://www.howtogeek.com/howto/linux/create-a-shortcut-or-hotkey-to-mute-the-speakers-on-linux/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值