I don't like to answer my own question, but to give an idea of what an answer might be here's my first stab at this (in the form of a toolbar), just try running UtilityDock[]
and click "Branch"
after saving it.
(Note: I think the best answer wouldn't make use of a toolbar)
UtilityDock := (c =
Cell[BoxData[
ToBoxes[Grid[{{Item[
Row[{" ",
DynamicModule[{state = 1},
Button[Dynamic[If[state == 1, "Hover", "Sink"]],
Dynamic@If[state == 1,
SetOptions[EvaluationNotebook[],
"WindowFloating" -> True]; state = 2,
SetOptions[EvaluationNotebook[],
"WindowFloating" -> False]; state = 1],
BaseStyle -> {15, FontFamily -> "Bank Gothic", White},
Appearance -> None]], Style[" | ", White],
DynamicModule[{state = 1},
Button[Dynamic[If[state == 1, "Collapse", "Expand"]],
Dynamic@If[state == 1,
SetOptions[EvaluationNotebook[],
"WindowSize" -> {Automatic, 40}]; state = 2,
SetOptions[EvaluationNotebook[],
"WindowSize" -> {Automatic, 700}];
state = 1],
BaseStyle -> {15, FontFamily -> "Bank Gothic", White},
Appearance -> None]], Style[" | ", White],
Button["Branch", (SetDirectory[
NotebookDirectory[EvaluationNotebook[]]];
thisName =
StringTake[
Last[FileNameSplit[NotebookFileName[InputNotebook[]]]], {1, -4}];
latestBranch =
Max@Join[{0}, (ToExpression /@
Flatten[
StringCases[
Thread@
StringTake[
Pick[FileNames[],
Not /@
StringFreeQ[FileNames[], thisName]], {1, -4}],
"B" ~~ x_ :> x]])];
Print[ToString[latestBranch + 1]];
NotebookSave[EvaluationNotebook[],
FileNameJoin[{NotebookDirectory[],
thisName <> " B" <> ToString[latestBranch + 1] <>
".nb"}]];
NotebookSave[EvaluationNotebook[],
FileNameJoin[{NotebookDirectory[],
thisName <> ".nb"}]];),
BaseStyle -> {15, FontFamily -> "Bank Gothic", White},
Appearance -> None]}], ItemSize -> Scaled[0.8],
Alignment -> Left],
Item[Row[{
ActionMenu[
"Zoom", {"75" :>
SetOptions[EvaluationNotebook[],
"Magnification" -> 0.75],
"100" :>
SetOptions[EvaluationNotebook[], "Magnification" -> 1],
"150" :>
SetOptions[EvaluationNotebook[],
"Magnification" -> 1.5],
"200" :>
SetOptions[EvaluationNotebook[],
"Magnification" -> 2]},
BaseStyle -> {15, FontFamily -> "Bank Gothic", White},
Appearance -> None], " "}]
, ItemSize -> Scaled[0.2], Alignment -> Right]}},
BaselinePosition -> Scaled[0.3], ItemSize -> All]]],
"DockedCell", Background -> Black, ImageMargins -> 0,
CellMargins -> {{0, 0}, {0, 0}},
CellFrameMargins -> {{0, 0}, {0, 0}}];
SetOptions[EvaluationNotebook[], "DockedCells" -> c]);
ScheduledTask
every X minutes to automatically branch the notebook... $\endgroup$