summaryrefslogtreecommitdiffstats
path: root/i3-dump-layout-all
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2024-10-14 21:34:04 +0200
committerFlorian Pritz <bluewind@xinu.at>2024-10-14 21:54:03 +0200
commitd5ffb01d87852eb74f6b17ae06ac0c476010065b (patch)
tree1ac6a86d874f30c968ba26bf0f8a5954fa0c67a6 /i3-dump-layout-all
parentd10ee7703e20ef844907e90797ad66bf0fb984da (diff)
downloadbin-d5ffb01d87852eb74f6b17ae06ac0c476010065b.tar.gz
bin-d5ffb01d87852eb74f6b17ae06ac0c476010065b.tar.xz
Add new scripts
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'i3-dump-layout-all')
-rwxr-xr-xi3-dump-layout-all26
1 files changed, 26 insertions, 0 deletions
diff --git a/i3-dump-layout-all b/i3-dump-layout-all
new file mode 100755
index 0000000..743328f
--- /dev/null
+++ b/i3-dump-layout-all
@@ -0,0 +1,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
+