In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to use Linux automation tools to improve productivity, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Use AutoKey to configure your keyboard, correct common typos, enter common phrases, and so on.
AutoKey is an open source Linux desktop automation tool, and once it becomes part of your workflow, you wonder what to do without it. It can be a transformative tool to increase productivity, or just a way to reduce the physical stress associated with typing.
This article will examine how to install and start using AutoKey, introduce some simple methods that can be used immediately in the workflow, and explore some advanced features that may be of interest to advanced users of AutoKey.
Install and set up AutoKey
AutoKey is an off-the-shelf package in many Linux distributions. The installation guide for the project contains instructions for many platforms, as well as instructions for building from source code. This paper uses Fedora as the operating platform.
There are two variants of AutoKey: autokey-gtk designed for GTK-based environments like GNOME, and autokey-qt based on QT.
You can install any variant from the command line:
Sudo dnf install autokey-gtk
After the installation is complete, run it using autokey-gtk (or autokey-qt).
Explore the interface
Before setting AutoKey to run in the background and perform operations automatically, you first need to configure it. Call up the user interface (UI) configuration:
Autokey-gtk-c
AutoKey provides some examples of preset configurations. You may want to keep them as a backup when you are familiar with UI, but you can delete them as needed.
AutoKey user interface
The left pane contains a folder-style phrase and a hierarchy of scripts. The phrase "Phrases" represents the text you want AutoKey to enter. "script Scripts" is a dynamic, programmatic equivalent that can be written in Python and get basically the same results as keyboard keystrokes sent to the active window.
The right pane builds and configures phrases and scripts.
Once you are satisfied with the configuration, you may want to run AutoKey automatically when you log in so that you don't have to start it every time. You can configure it by checking "automatically start AutoKeyAutomatically start AutoKey at login on login" in the "preferences Preferences" menu ("Edit-> preferences Edit-> Preferences").
Start AutoKey automatically when you log in
Use AutoKey to correct common typesetting errors
Fixing common typesetting errors is an easy problem for AutoKey to solve. For example, I always type "gerp" instead of "grep". Here is how to configure AutoKey to solve these types of problems for you.
Create a new subfolder where you can group all typesetting error correction configurations. Select My Phrases in the left pane, and then select File-> New-> subfolder File-> New-> Subfolder. Name the subfolder "Typos".
Create a new phrase in File-> New-> phrase File-> New-> Phrase. And call it "grep".
Configure AutoKey to insert the correct keyword by highlighting the phrase "grep" and then typing "grep" in the Enter phrase contents section of the input phrase content (replacing the default "Enter phrase contents" text).
Next, set how AutoKey triggers this phrase by defining an abbreviation. Click the "set Set" button next to the abbreviation Abbreviations at the bottom of the user interface.
In the pop-up dialog box, click the add Add button, and then add "gerp" as the new abbreviation. Check "remove typed abbreviations Remove typed abbreviation"; this option causes AutoKey to replace any typing with the word "gerp" with "grep". Do not check "trigger Trigger when typed as part of a word when typing part of a word" so that if you type a word that contains "grep" (such as "fingerprint"), you will not try to convert it to "fingreprint". This feature is valid only if you type "grep" as a separate word.
Set abbreviations in AutoKey
Restrict corrections to specific applications
You may want to apply corrections only when typesetting errors occur in some applications, such as terminal windows. You can configure it by setting the window filter Window Filter. Click the set Set button to define it.
The easiest way to set the window filter Window Filter is to have AutoKey detect the window type for you:
Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community
Start a new terminal window.
Return to AutoKey and click "
Detect window properties Detect Window Properties
"Button.
Click the terminal window.
This automatically populates the window filter, and the possible window class value is gnome-terminal-server.Gnome-terminal. This is enough, so click "OK".
AutoKey window filter
Save and test
When you are satisfied with the new configuration, be sure to save it. Click File File, and then select Save (Save) for the changes to take effect.
Now take the important test! In your terminal window, type "gerp" followed by a space, and it will automatically correct to "grep". To verify that the window filter is running, try typing the word "gerp" in the browser URL bar or another application. It hasn't changed.
You might think that using shell aliases can easily solve this problem, and I totally agree! Unlike aliases, AutoKey can correct errors according to the rules as long as it is command-line oriented, no matter what application you use.
For example, another common typing error I typed in browsers, integrated development environments, and terminals: "openshfit" was replaced by "openshift". Aliases do not completely solve this problem, and AutoKey can correct it in any case.
Type a common phrase
There are many other ways you can call AutoKey phrases to help you. For example, as a site reliability engineer (SRE) working on OpenShift, I often enter the Kubernetes namespace name on the command line:
Oc get pods-n openshift-managed-upgrade-operator
These namespaces are static, so they are ideal phrases that AutoKey can insert for me when typing specific commands.
To do this, I created a short phrase subfolder called "Namespaces" and added a phrase entry for each namespace I frequently typed.
Assign hotkey
Next, and most crucially, I assigned a "hotkey hotkey" to the subfolder. Every time I press the hotkey, it opens a menu where I can select the phrase I want to insert (either use the "arrow key" + enter key or use a number). This reduces the number of keystrokes that I can enter these commands with just a few keystrokes.
The preconfigured example of AutoKey in the My Phrases folder is configured using Ctrl+F7 hotkeys. If you keep the example in the default configuration of AutoKey, please give it a try. You should see a menu of all available phrases here. Use the numbers or arrow keys to select the desired item.
Advanced automatic typing
AutoKey's scripting engine allows users to run Python scripts that can be called by the same acronym and hotkey system. These scripts can perform operations such as switching windows, sending keystrokes, or performing mouse clicks through supported API functions.
This feature is welcomed by AutoKey users and custom scripts have been released for other users to adopt. For example, the NumpadIME script converts the numeric keypad into an old mobile-style text input method, and Emojis-AutoKey can easily insert phrases such as:: smile: into their equivalent emoticons.
This is a small script I set up that enters Tmux copy mode to copy the first word from the previous line into the paste buffer:
From time import sleep # sends the Tmux command prefix (b changed to s) keyboard.send_keys ("+ s") # Enter copy modekeyboard.send_key ("[") sleep # Move cursor up one linekeyboard.send_keys ("k") sleep # Move cursor to start of linekeyboard.send_keys ("0") sleep # Start markkeyboard.send_keys (") sleep # Move cursor to end of wordkeyboard.send_ Keys ("e") sleep (0.01) # Add to copy bufferkeyboard.send_keys ("+ m")
There are sleep functions because Tmux sometimes fails to keep up with the speed at which AutoKey sends keystrokes, and their impact on the overall execution time is negligible.
After reading the above, have you mastered how to use Linux automation tools to improve productivity? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 261
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.