summaryrefslogtreecommitdiff
path: root/scriptlets/thunar_batch_opener.sh
blob: 04fe54d9857c64becceee551b6867053cfd68b62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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