Today I discovered an application launcher for Linux called rofi, which can quickly switch windows and launch programs. I used it in conjunction with wmctrl
.
My usage process:
- Archlinux install
yay -S rofi
-
Add custom shortcut key binding, set hotkey as
alt
+space
to triggerrofi -show
. -
Press
alt
+space
, then useshift
+left
orright
to switch mode.
Change theme and display icons:
- Generate configuration file
mkdir -p ~/.config/rofi
rofi -dump-config > ~/.config/rofi/config.rasi
- Display icons
sed -i '8c show-icons: true;' ~/.config/rofi/config.rasi
- Change theme
Refer to https://github.com/lr-tech/rofi-themes-collection#installing-themes
My wmctrl
configuration example:
Use
xprop WM_CLASS
to get the prefix.
alias chrome="wmctrl -x -a google-chrome || google-chrome-stable > /dev/null 2>&1 &"
alias note="wmctrl -x -a obsidian || /usr/bin/obsidian > /dev/null 2>&1 &"
alias codew="wmctrl -x -a code || /opt/code/code > /dev/null 2>&1 &"
alias idea="wmctrl -x -a jetbrains-idea || /opt/idea/bin/idea.sh > /dev/null 2>&1 &"
alias discord="wmctrl -x -a discord || /opt/discord/Discord > /dev/null 2>&1 &"