<commit_before>#!/bin/sh
max_len=25
window_title="$(xdotool getactivewindow getwindowname 2>/dev/null)" 
if  [[ $? -gt 0 ]]; then
	echo ""
	exit
fi

window_title_short=$(echo "$window_title" | grep -oP ".*? -" | head -1)
if [[ ! -z "$window_title_short" ]]; then
	window_title="$window_title_short"
	window_title=${window_title::-2}
fi

if [[ ${#window_title} -gt $max_len ]]; then
	window_title="${window_title:0:$((max_len-1))}…"
fi

echo $window_title
<commit_msg>polybar: Fix globbing but in window_title script<commit_after>#!/bin/sh
max_len=25
set -f # Prevent string substitution of e.g. *
window_title="$(xdotool getactivewindow getwindowname 2>/dev/null)"
if  [[ $? -gt 0 ]]; then
	echo ""
	exit
fi

window_title_short=$(echo '$window_title' | grep -oP ".*? -" | head -1)
if [[ ! -z "$window_title_short" ]]; then
	window_title="$window_title_short"
	window_title=${window_title::-2}
fi

if [[ ${#window_title} -gt $max_len ]]; then
	window_title="${window_title:0:$((max_len-1))}…"
fi

echo $window_title

{'fraction_non_alphanumeric': 0.18719211822660098, 'fraction_numerical': 0.015763546798029555, 'mean_word_length': 5.35, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1271965', 'n_tokens_mistral': 411, 'n_tokens_neox': 394, 'n_words': 83}