diff --git a/docs/configuration.md b/docs/configuration.md index adb73c41..c097f536 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -997,6 +997,7 @@ Preview: | search-engine | string | no | duckduckgo | | new-tab | boolean | no | false | | autofocus | boolean | no | false | +| target | string | no | _blank | | placeholder | string | no | Type here to search… | | bangs | array | no | | @@ -1018,6 +1019,9 @@ When set to `true`, swaps the shortcuts for showing results in the same or new t ##### `autofocus` When set to `true`, automatically focuses the search input on page load. +##### `target` +The target to use when opening the search results in a new tab. Possible values are `_blank`, `_self`, `_parent` and `_top`. + ##### `placeholder` When set, modifies the text displayed in the input field before typing. @@ -2158,9 +2162,15 @@ Preview: #### Properties -| Name | Type | Required | -| ---- | ---- | -------- | -| groups | array | yes | +| Name | Type | Required | Default | +| ---- | ---- | -------- | ------- | +| groups | array | yes | | +| style | string | no | list | + +##### `style` +The display style of the bookmarks. Possible values are: +- `list` - Traditional list view (default) +- `cards` - Grid of cards with icons and descriptions. Cards automatically adjust their height based on content. ##### `groups` An array of groups which can optionally have a title and a custom color. diff --git a/docs/custom-api.md b/docs/custom-api.md index d42d1fc5..3a37df26 100644 --- a/docs/custom-api.md +++ b/docs/custom-api.md @@ -378,6 +378,7 @@ The following helper functions provided by Glance are available: - `offsetNow(offset string) time.Time`: Returns the current time with an offset. The offset can be positive or negative and must be in the format "3h" "-1h" or "2h30m10s". - `duration(str string) time.Duration`: Parses a string such as `1h`, `24h`, `5h30m`, etc into a `time.Duration`. - `parseTime(layout string, s string) time.Time`: Parses a string into time.Time. The layout must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants). You can alternatively use these values instead of the literal format: "unix", "RFC3339", "RFC3339Nano", "DateTime", "DateOnly". +- `parseLocalTime(layout string, s string) time.Time`: Same as the above, except in the absence of a timezone, it will use the local timezone instead of UTC. - `parseRelativeTime(layout string, s string) time.Time`: A shorthand for `{{ .String "date" | parseTime "rfc3339" | toRelativeTime }}`. - `add(a, b float) float`: Adds two numbers. - `sub(a, b float) float`: Subtracts two numbers. diff --git a/internal/glance/cli.go b/internal/glance/cli.go index 47bb2897..0a76e66c 100644 --- a/internal/glance/cli.go +++ b/internal/glance/cli.go @@ -136,7 +136,7 @@ func cliMountpointInfo(requestedPath string) int { fmt.Println("Path:", usage.Path) fmt.Println("FS type:", ternary(usage.Fstype == "", "unknown", usage.Fstype)) - fmt.Printf("Used percent: %.1f%%", usage.UsedPercent) + fmt.Printf("Used percent: %.1f%%\n", usage.UsedPercent) return 0 } diff --git a/internal/glance/static/js/main.js b/internal/glance/static/js/main.js index 41d2ae3a..dca713bb 100644 --- a/internal/glance/static/js/main.js +++ b/internal/glance/static/js/main.js @@ -104,6 +104,7 @@ function setupSearchBoxes() { for (let i = 0; i < searchWidgets.length; i++) { const widget = searchWidgets[i]; const defaultSearchUrl = widget.dataset.defaultSearchUrl; + const target = widget.dataset.target || "_blank"; const newTab = widget.dataset.newTab === "true"; const inputElement = widget.getElementsByClassName("search-input")[0]; const bangElement = widget.getElementsByClassName("search-bang")[0]; @@ -143,7 +144,7 @@ function setupSearchBoxes() { const url = searchUrlTemplate.replace("!QUERY!", encodeURIComponent(query)); if (newTab && !event.ctrlKey || !newTab && event.ctrlKey) { - window.open(url, '_blank').focus(); + window.open(url, target).focus(); } else { window.location.href = url; } diff --git a/internal/glance/templates/bookmarks.html b/internal/glance/templates/bookmarks.html index 1952cdb2..1167787c 100644 --- a/internal/glance/templates/bookmarks.html +++ b/internal/glance/templates/bookmarks.html @@ -1,6 +1,35 @@ {{ template "widget-base.html" . }} {{ define "widget-content" }} +{{ if eq .Style "cards" }} +
+ {{ range .Groups }} +
+ {{ if ne .Title "" }}
{{ .Title }}
{{ end }} + +
+ {{ end }} +
+{{ else }}
{{- range .Groups }}
@@ -28,3 +57,4 @@ {{- end }}
{{ end }} +{{ end }} diff --git a/internal/glance/templates/search.html b/internal/glance/templates/search.html index 6e8fc43d..ae981c63 100644 --- a/internal/glance/templates/search.html +++ b/internal/glance/templates/search.html @@ -3,7 +3,7 @@ {{ define "widget-content-classes" }}widget-content-frameless{{ end }} {{ define "widget-content" }} -