summaryrefslogtreecommitdiffstats
path: root/i3-dump-layout-all
blob: 743328fe96e727dafd0c11d4bf113ad12ff6ff3e (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
#!/bin/bash

set -e

for i in {1..20}; do
	i3-resurrect save -w $i --swallow=class,instance,title
done

backupdir=~/.i3/i3-resurrect-backups
keep_backups=30

mkdir -p "$backupdir"
cp -r ~/.i3/i3-resurrect $backupdir/0

if [[ -d "$backupdir/$keep_backups" ]]; then
	rm -rf "$backupdir/$keep_backups"
fi

i=$((keep_backups - 1))
while ((i >= 0)); do
	if [[ -d "$backupdir/$i/" ]]; then
		mv -n "$backupdir/$i/" "$backupdir/$((i + 1))"/
	fi
	i=$((i - 1))
done