sources/tech/20210322 Productivity with Ulauncher.md
13 KiB
Productivity with Ulauncher
Photo by Freddy Castro on Unsplash
Application launchers are a category of productivity software that not everyone is familiar with, and yet most people use the basic concepts without realizing it. As the name implies, this software launches applications, but they also other capablities.
Examples of dedicated Linux launchers include dmenu, Synapse, and Albert. On MacOS, some examples are Quicksilver and Alfred. Many modern desktops include basic versions as well. On Fedora Linux, the Gnome 3 activities overview uses search to open applications and more, while MacOS has the built-in launcher Spotlight.
While these applications have great feature sets, this article focuses on productivity with Ulauncher.
What is Ulauncher?
Ulauncher is a new application launcher written in Python, with the first Fedora package available in March 2020 for Fedora Linux 32. The core focuses on basic functionality with a nice interface for extensions. Like most application launchers, the key idea in Ulauncher is search. Search is a powerful productivity boost, especially for repetitive tasks.
Typical menu-driven interfaces work great for discovery when you aren’t sure what options are available. However, when the same action needs to happen repeatedly, it is a real time sink to navigate into 3 nested sub-menus over and over again. On the other side, hotkeys give immediate access to specific actions, but can be difficult to remember. Especially after exhausting all the obvious mnemonics. Is Control+C “copy”, or is it “cancel”? Search is a middle ground giving a means to get to a specific command quickly, while supporting discovery by typing only some remembered word or fragment. Exploring by search works especially well if tags and descriptions are available. Ulauncher supplies the search framework that extensions can use to build all manner of productivity enhancing actions.
Getting started
Getting the core functionality of Ulauncher on any Fedora OS is trivial; install using dnf:
sudo dnf install ulauncher
Once installed, use any standard desktop launching method for the first start up of Ulauncher. A basic dialog should pop up, but if not try launching it again to toggle the input box on. Click the gear icon on the right side to open the preferences dialog.
A number of options are available, but the most important when starting out are Launch at login and the hotkey. The default hotkey is Control+space, but it can be changed. Running in Wayland needs additional configuration for consistent operation; see the Ulauncher wiki for details. Users of “Focus on Hover” or “Sloppy Focus” should also enable the “Don’t hide after losing mouse focus” option. Otherwise, Ulauncher disappears while typing in some cases.
Ulauncher basics
The idea of any application launcher, like Ulauncher, is fast access at any time. Press the hotkey and the input box shows up on top of the current application. Type out and execute the desired command and the dialog hides until the next use. Unsurprisingly, the most basic operation is launching applications. This is similar to most modern desktop environments. Hit the hotkey to bring up the dialog and start typing, for example te, and a list of matches comes up. Keep typing to further refine the search, or navigate to the entry using the arrow keys. For even faster access, use Alt+# to directly choose a result.
Ulauncher can also do quick calculations and navigate the file-system. To calculate, hit the hotkey and type a math expression. The result list dynamically updates with the result, and hitting Enter copies the value to the clipboard. Start file-system navigation by typing / to start at the root directory or ~/ to start in the home directory. Selecting a directory lists that directory’s contents and typing another argument filters the displayed list. Locate the right file by repeatedly descending directories. Selecting a file opens it, while Alt+Enter opens the folder containing the file.
Ulauncher shortcuts
The first bit of customization comes in the form of shortcuts. The Shortcuts tab in the preferences dialog lists all the current shortcuts. Shortcuts can be direct commands, URL aliases, URLs with argument substitution, or small scripts. Basic shortcuts for Wikipedia, StackOverflow, and Google come pre-configured, but custom shortcuts are easy to add.
For instance, to create a duckduckgo search shortcut, click Add Shortcut in the Shortcuts preferences tab and add the name and keyword duck with the query https://duckduckgo.com/?q=%s. Any argument given to the duck keyword replaces %s in the query and the URL opened in the default browser. Now, typing duck fedora will bring up a duckduckgo search using the supplied terms, in this case fedora.
A more complex shortcut is a script to convert UTC time to local time. Once again click Add Shortcut and this time use the keyword utc. In the Query or Script text box, include the following script:
#!/bin/bash
tzdate=$(date -d "$1 UTC")
zenity --info --no-wrap --text="$tzdate"
This script takes the first argument (given as $1) and uses the standard date utility to convert a given UTC time into the computer’s local timezone. Then zenity pops up a simple dialog with the result. To test this, open Ulauncher and type utc 11:00. While this is a good example showing what’s possible with shortcuts, see the ultz extension for really converting time zones.
Introducing extensions
While the built-in functionality is great, installing extensions really accelerates productivity with Ulauncher. Extensions can go far beyond what is possible with custom shortcuts, most obviously by providing suggestions as arguments are typed. Extensions are Python modules which use the Ulauncher extension interface and can either be personally-developed local code or shared with others using GitHub. A collection of community developed extensions is available at https://ext.ulauncher.io/. There are basic standalone extensions for quick conversions and dynamic interfaces to online resources such as dictionaries. Other extensions integrate with external applications, like password managers, browsers, and VPN providers. These effectively give external applications a Ulauncher interface. By keeping the core code small and relying on extensions to add advanced functionality, Ulauncher ensures that each user only installs the functionality they need.
Installing a new extension is easy, though it could be a more integrated experience. After finding an interesting extension, either on the Ulauncher extensions website or anywhere on GitHub, navigate to the Extensions tab in the preferences window. Click Add Extension and paste in the GitHub URL. This loads the extension and shows a preferences page for any available options. A nice hint is that while browsing the extensions website, clicking on the Github star button opens the extension’s GitHub page. Often this GitHub repository has more details about the extension than the summary provided on the community extensions website.
Firefox bookmarks search
One useful extension is Ulauncher Firefox Bookmarks, which gives fuzzy search access to the current user’s Firefox bookmarks. While this is similar to typing *<search-term> in Firefox’s omnibar, the difference is Ulauncher gives quick access to the bookmarks from anywhere, without needing to open Firefox first. Also, since this method uses search to locate bookmarks, no folder organization is really needed. This means pages can be “starred” quickly in Firefox and there is no need to hunt for an appropriate folder to put it in.
Clipboard search
Using a clipboard manager is a productivity boost on its own. These managers maintain a history of clipboard contents, which makes it easy to retrieve earlier copied snippets. Knowing there is a history of copied data allows the user to copy text without concern of overwriting the current contents. Adding in the Ulauncher clipboard extension gives quick access to the clipboard history with search capability without having to remember another unique hotkey combination. The extension integrates with different clipboard managers: GPaste, clipster, or CopyQ. Invoking Ulauncher and typing the c keywords brings up a list of recent copied snippets. Typing out an argument starts to narrow the list of options, eventually showing the sought after text. Selecting the item copies it to the clipboard, ready to paste into another application.
Google search
The last extension to highlight is Google Search. While a Google search shortcut is available as a default shortcut, using an extension allows for more dynamic behavior. With the extension, Google supplies suggestions as the search term is typed. The experience is similar to what is available on Google’s homepage, or in the search box in Firefox. Again, the key benefit of using the extension for Google search is immediate access while doing anything else on the computer.
Being productive
Productivity on a computer means customizing the environment for each particular usage. A little configuration streamlines common tasks. Dedicated hotkeys work really well for the most frequent actions, but it doesn’t take long before it gets hard to remember them all. Using fuzzy search to find half-remembered keywords strikes a good balance between discoverability and direct access. The key to productivity with Ulauncher is identifying frequent actions and installing an extension, or adding a shortcut, to make doing it faster. Building a habit to search in Ulauncher first means there is a quick and consistent interface ready to go a key stroke away.
via: https://fedoramagazine.org/ulauncher-productivity/
作者:Troy Curtis Jr 选题:lujun9972 译者:译者ID 校对:校对者ID