dotfiles/dotfiles/bin/switch_to_app

16 lines
328 B
Bash
Executable File

#!/bin/bash
# Get the if of the window
# Get a list of all opened windows
# Keep only the ID and Class columns
# Grep the desired window
# Keep only its ID
window_id=$(wmctrl -lx | awk '{print $1 " " $3}' | grep -i $1 | head -1 | cut -d " " -f 1)
if [[ -n $window_id ]]; then
wmctrl -ia $window_id
else
$1
fi