Skip to content

Instantly share code, notes, and snippets.

@neilbags
Created June 14, 2024 07:16
Show Gist options
  • Save neilbags/913cbe2c541edea64b85c78711d47ece to your computer and use it in GitHub Desktop.
Save neilbags/913cbe2c541edea64b85c78711d47ece to your computer and use it in GitHub Desktop.
Rename a workspace dynamically in sway using wofi for input
#!/bin/bash
# Get the current workspace number
current_workspace=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | .name')
# Extract the number from the current workspace name
workspace_number=$(echo $current_workspace | grep -o '^[0-9]*')
new_name=`wofi --dmenu --prompt='Workspace Name:'`
if [ -n "$new_name" ]; then
new_name=:$new_name
fi
swaymsg rename workspace to $workspace_number$new_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment