Skip to content

Instantly share code, notes, and snippets.

@aeghn
Created April 7, 2020 04:08
Show Gist options
  • Save aeghn/83bdd0b6edd231b1f886a2570133e830 to your computer and use it in GitHub Desktop.
Save aeghn/83bdd0b6edd231b1f886a2570133e830 to your computer and use it in GitHub Desktop.
Workaround for showing window title in i3 bar
#!/bin/bash
get_temp_ws_name() {
i3-msg -t get_workspaces | jshon -a -e name -u | grep -Ev "^[[:digit:]]+$"
}
old_title=$(get_temp_ws_name)
if [ $? -ne 0 ]; then
i3-msg "workspace temp"
i3-sensible-terminal
sleep 1
i3-msg "workspace temp"
fi
coproc xtitle -s
while read -r new_title <&${COPROC[0]}; do
[ -z "$old_title" ] && old_title=$(get_temp_ws_name)
[ -z "$new_title" ] && new_title="No focus" || new_title=$(sed -e "s/&/\&/g" -e "s/\"/“/g" <<< "${new_title}")
i3-msg "rename workspace \"${old_title}\" to \"${new_title}\""
old_title="$new_title"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment