#!/bin/bash browser="thunar" winfile="$HOME/stuf/windows.txt" mapfile -t < "$winfile" SAVEIFS=$IFS FLAG=0 IFS=$'\n' while IFS= read -r tab do [[ -z "$tab" ]] && FLAG=1 && continue if [[ $FLAG -eq 1 ]]; then FLAG=0 xfconf-query -c thunar -p /misc-open-new-window-as-tab -s false else xfconf-query -c thunar -p /misc-open-new-window-as-tab -s true fi "$browser" "$( sed -r "s|\\\$HOME|$HOME|g" <<< "$tab" )" sleep 0.5 FLAG=0 done < "$winfile" IFS=$SAVEIFS xfconf-query -c thunar -p /misc-open-new-window-as-tab -s true