From 47b6776c2cb9b017ad95acb5aae8e34b8776fc7c Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 17 Sep 2026 10:05:55 +0200 Subject: gui: sort the plan by name, size, age, action or rule --- gui/internal/model/prefs.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gui/internal/model/prefs.go') diff --git a/gui/internal/model/prefs.go b/gui/internal/model/prefs.go index 6b3a6cb..2d2dc04 100644 --- a/gui/internal/model/prefs.go +++ b/gui/internal/model/prefs.go @@ -36,6 +36,9 @@ type Prefs struct { ShowSize bool `json:"show_size"` ShowAge bool `json:"show_age"` ShowRule bool `json:"show_rule"` + // Sort is the order a freshly scanned plan is read in; the picker in + // the toolbar changes it for the window in front of you. + Sort string `json:"sort"` // Layout is how the Plan tab is arranged: "side" puts the file list // beside the explanation, "stacked" puts it above, with the preview // beside the explanation underneath. @@ -60,7 +63,7 @@ const ( // DefaultPrefs is what a window does before anything is chosen. func DefaultPrefs() Prefs { return Prefs{Colours: true, Preview: true, SelectAll: true, - ShowSize: true, ShowAge: true, ShowRule: true, + ShowSize: true, ShowAge: true, ShowRule: true, Sort: SortDefault, PreviewHeight: DefaultPreviewHeight, PreviewWidth: DefaultPreviewWidth, ListWidth: DefaultListWidth, ListHeight: DefaultListHeight, Layout: LayoutSide} @@ -91,6 +94,9 @@ func LoadPrefs() Prefs { if p.Layout != LayoutSide && p.Layout != LayoutStacked { p.Layout = LayoutSide } + if !IsSortOrder(p.Sort) { + p.Sort = SortDefault + } return p } -- cgit v1.3