#!/bin/bash workspace_num=-1 workspace_name="" swaymsg -t subscribe -m '[ "workspace", "window" ]' | while IFS= read -r event ; do if [ "$(jq -r '.change' <<< $event)" == 'focus' ] ; then if [ "$(jq -r '.container' <<< $event)" == 'null' ] ; then # Workspace workspace_num="$(jq -r '.current.num' <<< $event)" workspace_name="$(jq -r '.current.name' <<< $event)" elif [ workspace_num != -1 ] ; then # Window app_name="$(jq -r '.container.app_id' <<< $event)" if [ $app_name == 'null' ] ; then app_name="$(jq -r '.container.window_properties.instance' <<< $event)" fi if [ "$app_name" == "kitty" ] ; then app_name="" elif [ "$app_name" == "chromium" ] ; then app_name="" elif [ "$app_name" == "discord" ] ; then app_name="" elif [ "$app_name" == "spotify" ] ; then app_name="" elif [ "$app_name" == "GEMOC Studio" ] ; then app_name="" fi new_workspace_name="$workspace_num:$app_name" swaymsg rename workspace "$workspace_name" to "$new_workspace_name" workspace_name="$new_workspace_name" fi fi done