26 lines
852 B
Bash
Executable File
26 lines
852 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
# i3-resurrect-restore-all]
|
|
# restoring all available saved workspaces
|
|
# arguments: No arguments. Assumes .i3 it places at ~/
|
|
# expected input/output - sample input -> output ( a few lines)
|
|
# example suggested usage: myscript filename > bigoutputfile
|
|
|
|
#save current workspace
|
|
cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.visible == true) | .name')
|
|
|
|
# extract workspace name which is defined between two underscored
|
|
workspaces=$(ls -l ~/.config/i3/i3-resurrect/*.json | grep -Po '.*_\K(.*)_' | sed 's/_//' | uniq)
|
|
echo "Found workspaces: $workspaces"
|
|
|
|
# restore workspaces
|
|
for ws in ${workspaces[*]}; do
|
|
echo "restoring $ws"
|
|
i3-resurrect restore -w $ws -d ~/.config/i3/i3-resurrect
|
|
done
|
|
|
|
notify-send "i3-resurrect" "Restored all workspaces"
|
|
i3-msg workspace $cur_workspace
|