JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

How to boost your productivity with launchers

Introduction

A launcher is a text box that pops us when you use a particular key combination. It boasts your productivity because it keeps your hands on your keyboard. You can avoid the temptation to grip the mouse by typing into the text box to launch applications, find files, play music, search the web, run shell and system commands (locking, shutdown), etc.

Alfred

  1. Basic use: You can find files in Finder (find mydocument.pdf), open files (open mydocument.pdf), define a word (define conspiracy), do quick mathematical calculations (4*8, =sin(Pi/2)), perform system actions (lock, restart, shutdown, volup -Volumen Up-, voldown -Volumen Down-, mute -Toggle mute-), quickly open terminal and run shell commands (>ls, >cd Dropbox/), search the web (google/bing/youtube news Ukraine), etc.
  2. Clipboard Manager (clipboard, ⌥⌘C). Alfred ships with a clipboard manager, but you have to enable it in Alfred’s Preferences, under Features, Clipboard History. Use the Cmd + S hotkey to save a text clip from the clipboard manager as a snippet.

    The PC-keyboard equivalent of Alt on a Mac is called the Option key (⌥). The windows key is the command key, ⌘.

  3. Snippets (snip). You can create often used text snippets, emojis, symbols, quotes, etc. To create a new snippet: Alfred’s Preferences, Features, Snippets, click the + button on the bottom of the right box. Name (Signature), Keyword (sign), Snippet (“This is your signature, bla…bla… bla…”). It will be created inside the Dynamic Context collection, and this collection’s prefix is “::”. To use it, type snip ::sign. Make sure that you enable “Automatically expand snippets by default”.
  4. Custom Web Searches. It allows you to set up a shortcut to start a search on any website. Alfred’s Preferences, Web Search, Search URL (e.g., https://justtothepoint.com/search/?query={query}), Title (JustToThePoint), Keyword (jttp).

Everything and Wox

Albert Launcher

Albert Launcher is a fast and flexible desktop agnostic launcher.

It comes with a set of extensions: Applications (it allows you to launch any application), Calculator, Browser Bookmarks, Files (search for any file or folder and open it), WebSearch (open any url and do web search on Google, Bing, Youtube, etc.), System (standards commands, reboot, shutdown, etc.).

You should install Gnome Dictionary (sudo snap install gnome-dictionary) and CopyQ Clipboard Manager and enable them in Albert: Albert, Extensions, Python, Gnome Dictionary (trigger: def word) and CopyQ (trigger cq).

Rofi

Rofi is a free and open source window switcher, a full-featured application launcher, and a dmenu replacement. Rofi is fully configurable, from the keyboard shortcuts to the look and feel. ![Image](/software/images/computerBenProductivity.jpeg ./software/images/computerBenProductivity2.jpg)

Installation

  1. Ubuntu, Debian: sudo apt install rofi
  2. Arch: sudo pacman -S rofi

Use

There are many modes Rofi can work in:

  1. run. You can obtain a list of the executables available in your $PATH and launch them. drun is similar, but the list is created from the installed desktop files.
  2. window. It allows you to switch between currently active windows in the X server.
  3. ssh. It allows you to access remote systems quickly. It creates a lists of remote hosts based on ~/.ssh/config and ~/.ssh/known_hosts.

To launch Rofi directly in a certain mode, specify a mode with rofi -show mode, e.g., rofi -show run, or you can also specify an ordered list of modes, e.g., rofi -modi “run,drun” -show run. It shows the run dialog, and allow switching to desktop file run dialog(drun). Ctrl + tab switches between modes.

Rofi Theme

You can select a Rofi theme, by typing, rofi-theme-selector, e.g. Pop-Dark. Press Alt + A to accept the new theme.

Rofi configuration

The default configuration file is ~/.config/rofi/config.rasi. You can easily obtain a template configuration by using the following command: rufi -dump-config > ~/.config/rofi/config.rasi

configuration {
	display-drun: "Applications:";
	display-window: "Windows:";
	modi: "window,drun,run,emoji";
	kb-cancel: "Escape,Alt+F1";
	color-normal: "#1c2023, #919ba0, #1c2023, #a4a4a4, #1c2023";
	color-urgent: "argb:00000000, #f43753, argb:00000000, argb:00000000, #e29a49";
	color-active: "argb:00000000, #49bbfb, argb:00000000, argb:00000000, #e29a49";
	color-window: "#1c2023, #919ba0, #1c2023";
	show-icons: true;
	icon-theme: "Papirus";
 }

Plugins

bindsym $mod+d exec "rofi -modi run,drun,emoji,window -show run"
bindsym $mod+Shift+d exec rofi -show p -modi p:$HOME/.local/bin/rofi-power-menu -theme Paper -font "JetBrains Mono NF 16" -width 20 -lines 6
bindsym $mod+Shift+y exec rofi-pass

Rofi is extremely flexible. Let’s unleash its potencial.

First, we can use it to open some dot files for editing. Credits: rofi-edit

#!/bin/bash
# @description My main actions file
myTerm=alacritty
myEdit=atom
myBrowser=brave

# Perform a search using the duckduckgo and Google search engines. 
duckit(){
	option=$(rofi -dmenu -i -p "Type a term to search:") || exit 1
	if [[ ${option} == "" ]]
	then
		$myBrowser "https://duckduckgo.com" "https://google.com"
	else
		$myBrowser "https://duckduckgo.com/?q=$option&t=ffab&atb=v1-1" "https://google.com/search?q=$option"
	fi
}

# pactl is a basic pulseaudio control tool. It sets the volume of the default sink.
volctl() {
    pactl set-sink-volume @DEFAULT_SINK@ $1
}

# It increases the volume of the default sink by 20 percent.
up() {
    volctl "+20%"
}

# It decrease the volume of the default sink by 20 percent.
down() {
    volctl "-20%"
}

# It mutes and unmute the default sound output.
mute() {
    pactl set-sink-mute @DEFAULT_SINK@ toggle
}

menu(){
	printf "1. edit alacritty\n"
	printf "2. edit espanso\n"
	printf "3. edit i3\n"
	printf "4. edit .zshrc\n"
	printf "5. edit this script (rofi-main.sh).\n"
	printf "6. poweroff\n"
	printf "7. reboot\n"
	printf "8. suspend\n"
	printf "9. i3 shortcuts\n"
	printf "10. espanso shortcuts.\n"
	printf "11. My bash scripts.\n"
	printf "12. rofi-pass\n"
	printf "13. emojis.\n"
	printf "14. Define word.\n"
	printf "15. duckduckgo.\n"
	printf "16. locate and visualize\n"
	printf "17. clipboard\n"
	printf "18. tasks\n"
	printf "19. Volumen up\n"
	printf "20. Volumen down\n"
	printf "21. Mute\n"
	printf "22. pavucontrol\n"
	printf "23. screenshot\n"
}

main(){
    choice=$(menu | rofi -dmenu | cut -d. -f1)

	case $choice in
		1) $myEdit "$HOME/.config/alacritty/alacritty.yml" ;;
		2) $myEdit "$HOME/.config/espanso/match/base.yml" ;;
		3) $myEdit "$HOME/.config/i3/config" ;;
		4) $myEdit "$HOME/.zshrc" ;;
		5) $myEdit "$HOME/.local/bin/rofi-main.sh" ;;
		6) systemctl poweroff ;;
		7) systemctl reboot ;;
		8) systemctl suspend ;;

It assumes you have polkit installed to allow unprivileged users to run power management commands: systemctl reboot (shut down and reboot the system), systemctl poweroff (shut down and power-off the system), and systemctl suspend (suspend the system).

		9) egrep ^bind ~/.config/i3/config  | cut -d " " -f 2- | rofi -i -dmenu -p "Shortcuts" ;;

Having trouble remembering all of your i3’s shortcuts? No problem. This is a typical line: bindsym $mod+Shift+q kill.

Therefore, firstly we pipe every line that starts with bind from i3’s configuration file (egrep ^bind ~/.config/i3/config). Secondly, we are going to remove some unnecessary clutter by using cut -d " " -f 2- (-d uses " " as a delimiter instead of TAB, -f 2 select only the second 2 field , -f 2- select the second field until the end of the line). Finally, we use rofi to display all our shortcuts. rofi -i dmenu is Rofi’s dmenu mode.

		10) grep "trigger: " ~/.config/espanso/match/base.yml |  sed 's/- trigger: "\(.*\)"/\1/g' | rofi -i -dmenu -p "Shortcuts" ;;

We are using grep to retrieve all our Espanso’s triggers. grep “trigger: " ~/.config/espanso/match/base.yml returns a list with the following format: - trigger: “:name”. Then, we are using sed to perform a global (/g) search and replace: ’s/regexp/replacement/flags’. We define the first and only group (.*\) between the two double quotes. Finally, we replace the line with this group (\1), so - trigger: “:name” becomes :name.

It is kind of confusing because the opening “(” and closing “)” parenthesis need to be escaped.

		11) grep -r "description" .local/bin  |  cut -d " " -f 1,3- | rofi -i -dmenu -p "Shortcuts" 

This line retrieves all the files and lines with a “description” string in our script folder, so we can remember our scripts’ purposes. The description, e.g., # @description My main action file, explains the script’s purpose.

		12) rofi-pass ;; # Use pass and rofi to get a quick password manager
		13) rofi -show emoji -modi emoji ;; # Use rofi-emoji to pick emoji in an easy way
		14) QUERY=$(rofi -dmenu -p 'Type in the word to search:') && sdcv -n "$QUERY" | rofi -dmenu ;;

It creates a dictionary using rofi as the “front-end” and “sdcv” as the “back-end”. sdcv is a simple, cross-platform text-based utility for working with dictionaries in StarDict format. Installation: sudo pacman -S sdcv, yay -S stardict-wordnet.

First, we open up a prompt to type in the word to look up (QUERY=$(rofi -dmenu -p ‘Type in the word to search:’)), and save the word the user types in the pop-up window in the QUERY variable. Next, we put this word into sdcv, and pipe its output in a rofi window.

		15) duckit ;;
		16) xdg-open "$(locate home | rofi -dmenu -i -p "locate:")" ;;
		# A very fast way to find files by name (locate) and run them
		17) rofi -modi "clipboard:greenclip print" -show clipboard -run-command ‘{cmd};;
		18) task | rofi -i -dmenu -p "Next tasks" ;;
		19) up ;;
		20) down ;;
		21) mute ;;
		# PulseAudio Volume Control (pavucontrol) is a GTK based volume control tool for the PulseAudio sound server
		22) pavucontrol ;;
		# scrot is a minimalist command line screen capturing application. It takes a screenshot and saves it in Dropbox.
		23) scrot -s ~/Dropbox/%b%d::%H%M%S.png ;;
	esac
}

main

Taskwarrior is a free and open source software that manages your TODO list from the command line, i.e., a command line todo manager. We pipe its output in a rofi window so we can get a list of all tasks.

rofi -modi “clipboard:greenclip print” -show clipboard -run-command ‘{cmd}’ adds a clipboard to Rofi using greenclip.

More ideas: Rofi-Beats is a rofi-like menu for playing lofi radio stations on MacOS and GNU/Linux.

Bitcoin donation

JustToThePoint Copyright © 2011 - 2024 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.