博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux窗口切换快捷键_分配快捷键以在Linux上激活打开的应用程序窗口
阅读量:2508 次
发布时间:2019-05-11

本文共 3072 字,大约阅读时间需要 10 分钟。

linux窗口切换快捷键

linux窗口切换快捷键

We’ve already shown you how to , but for today’s lesson we’ll take it a step beyond—and assign a shortcut key that switches an open application to be the currently focused window.

我们已经向您展示了如何 ,但是在今天的课程中,我们将进一步介绍它,并指定将打开的应用程序切换为当前焦点窗口的快捷键。

The idea is that instead of using the mouse or flipping through a set of windows in the Alt+Tab switcher, you can quickly assign a hotkey to your most important windows and switch to them with a single keystroke, saving yourself a lot of time. To accomplish this task on Linux, we’ll use the excellent AutoKey utility.

这个想法是,您无需使用鼠标或在Alt + Tab切换器中浏览一组窗口,而是可以将热键快速分配给最重要的窗口,并通过一次按键即可切换到它们,从而节省了很多时间。 为了在Linux上完成此任务,我们将使用出色的AutoKey实用程序。

Note: if you want the Windows way to do this, you can .

注意:如果您希望使用Windows的方式来执行此操作,则可以 。

场景 (The Scenario)

Since I do most of my work in Google Chrome, I need to have it accessible as quickly as possible and I generally assign the Alt+G key combination to switch to my open Chrome window.

由于我的大部分工作都是在Google Chrome浏览器中完成的,因此我需要尽快对其进行访问,并且通常会分配Alt + G组合键切换到打开的Chrome窗口。

image

安装自动密钥 (Installing AutoKey)

You’ll want to open up the Synaptic Package Manager and do a quick search for autokey, check the box, and then install the package. You could also install it using the apt-get command like this:

您将要打开Synaptic软件包管理器并快速搜索autokey ,选中该复选框,然后安装该软件包。 您也可以使用apt-get命令安装它,如下所示:

sudo apt-get install autokey

sudo apt-get install autokey

image5

将快捷键分配给应用程序窗口 (Assigning a Shortcut Key to an Application Window)

Open up the AutoKey configuration screen from the system tray icon, and then create a New Script from the menu, and then paste in the following code:

从系统任务栏图标打开“自动键配置”屏幕,然后从菜单中创建“新脚本”,然后粘贴以下代码:

window.activate(‘Google Chrome’)

window.activate('Google Chrome')

You’ll want to use the Set button next to the Hotkey setting, and assign your preferred hotkey—mine is Alt+G, though you’ll want to make sure that you use a lowercase g while setting the hotkey—if you set it using an uppercase letter it won’t behave right.

您将要使用“热键”设置旁边的“设置”按钮,并分配您首选的热键(我的是Alt + G,尽管要确保在设置热键时使用小写的g)(如果设置了该键)使用大写字母将无法正常工作。

image

Once you save the setting and minimize or close the AutoKey configuration screen, you can hit the Alt+G shortcut key combination anytime you want to switch to the open window.

保存设置并最小化或关闭“自动键”配置屏幕后,您随时可以切换到打开的窗口,按Alt + G快捷键组合。

这是如何运作的? (How Does This Work?)

When you hit the shortcut key that you’ve assigned, AutoKey will run the script that you’ve added—in this case, it’s a simple Python script that uses the wmctrl functions to control open windows. Here’s the syntax for the window.activate function, which switches the specified window to be the active window:

当您按下分配的快捷键时,AutoKey将运行您添加的脚本-在这种情况下,这是一个简单的Python脚本,使用wmctrl函数控制打开的窗口。 这是window.activate函数的语法,该函数将指定的窗口切换为活动窗口:

window.activate(‘partial window title here’)

window.activate('部分窗口标题在这里')

Basically all you need to do is match part of the window title, and in the case of Google Chrome, the window title always has “- Google Chrome” at the end.

基本上,您需要做的就是匹配窗口标题的一部分,对于Google Chrome,窗口标题的末尾总是带有“-Google Chrome”。

翻译自:

linux窗口切换快捷键

转载地址:http://ljfwd.baihongyu.com/

你可能感兴趣的文章
通讯框架后续完善3
查看>>
SharedPreference工具类
查看>>
css文本样式-css学习之旅(4)
查看>>
Java多线程3:Thread中的静态方法
查看>>
找出字符串中第一个只出现一次的字母
查看>>
到底什么样的企业才适合实施SAP系统?
查看>>
事件驱动模型
查看>>
.NET 项目SVN 全局排除设置
查看>>
[语法]全面理解抽象类(abstract class),抽象方法(abstract method),虚方法(virtual method),接口(interface)...
查看>>
PostgreSQL远程连接配置管理/账号密码分配(解决:致命错误: 用户 "postgres" Ident 认证失败)...
查看>>
Java防止SQL注入2(通过filter过滤器功能进行拦截)
查看>>
SQL Server判断语句(IF ELSE/CASE WHEN )
查看>>
Qt: The State Machine Framework 学习
查看>>
实验四.1
查看>>
tf.Session()、tf.InteractiveSession()
查看>>
zoeDylan.ImgChange 图片切换插件
查看>>
第五课 Linux高级命令
查看>>
hibernate的id生成策略
查看>>
HTML5 小总结2(手打)
查看>>
20165221-week2课上测试补做
查看>>