mirror of
https://github.com/makew0rld/amfora.git
synced 2024-09-11 05:55:27 +03:00
parent
06b649d81a
commit
97ee1aa368
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Text no longer disappears under the left margin when scrolling (regression in v1.8.0) (#197)
|
- Text no longer disappears under the left margin when scrolling (regression in v1.8.0) (#197)
|
||||||
- Default search engine changed to geminispace.info from gus.guru
|
- Default search engine changed to geminispace.info from gus.guru
|
||||||
- The user's terminal theme colors are used by default (#181)
|
- The user's terminal theme colors are used by default (#181)
|
||||||
|
- By default, non-gemini URI schemes are opened in the default application. This requires a config change for previous users, see the [wiki](https://github.com/makeworld-the-better-one/amfora/wiki/Handling-Other-URL-Schemes) (#207)
|
||||||
|
|
||||||
## Removed
|
## Removed
|
||||||
- Favicon support (#199)
|
- Favicon support (#199)
|
||||||
|
@ -259,7 +259,7 @@ func Init() error {
|
|||||||
viper.SetDefault("keybindings.bind_beginning", []string{"Home", "g"})
|
viper.SetDefault("keybindings.bind_beginning", []string{"Home", "g"})
|
||||||
viper.SetDefault("keybindings.bind_end", []string{"End", "G"})
|
viper.SetDefault("keybindings.bind_end", []string{"End", "G"})
|
||||||
viper.SetDefault("keybindings.shift_numbers", "")
|
viper.SetDefault("keybindings.shift_numbers", "")
|
||||||
viper.SetDefault("url-handlers.other", "off")
|
viper.SetDefault("url-handlers.other", "default")
|
||||||
viper.SetDefault("cache.max_size", 0)
|
viper.SetDefault("cache.max_size", 0)
|
||||||
viper.SetDefault("cache.max_pages", 20)
|
viper.SetDefault("cache.max_pages", 20)
|
||||||
viper.SetDefault("cache.timeout", 1800)
|
viper.SetDefault("cache.timeout", 1800)
|
||||||
|
@ -197,7 +197,9 @@ underline = true
|
|||||||
|
|
||||||
# This is a special key that defines the handler for all URL schemes for which
|
# This is a special key that defines the handler for all URL schemes for which
|
||||||
# no handler is defined.
|
# no handler is defined.
|
||||||
other = 'off'
|
# It uses the special value "default", which will try and use the default
|
||||||
|
# application on your computer for opening this kind of URI.
|
||||||
|
other = 'default'
|
||||||
|
|
||||||
|
|
||||||
# [[mediatype-handlers]] section
|
# [[mediatype-handlers]] section
|
||||||
|
@ -194,7 +194,9 @@ underline = true
|
|||||||
|
|
||||||
# This is a special key that defines the handler for all URL schemes for which
|
# This is a special key that defines the handler for all URL schemes for which
|
||||||
# no handler is defined.
|
# no handler is defined.
|
||||||
other = 'off'
|
# It uses the special value "default", which will try and use the default
|
||||||
|
# application on your computer for opening this kind of URI.
|
||||||
|
other = 'default'
|
||||||
|
|
||||||
|
|
||||||
# [[mediatype-handlers]] section
|
# [[mediatype-handlers]] section
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/makeworld-the-better-one/amfora/rr"
|
"github.com/makeworld-the-better-one/amfora/rr"
|
||||||
"github.com/makeworld-the-better-one/amfora/structs"
|
"github.com/makeworld-the-better-one/amfora/structs"
|
||||||
"github.com/makeworld-the-better-one/amfora/subscriptions"
|
"github.com/makeworld-the-better-one/amfora/subscriptions"
|
||||||
|
"github.com/makeworld-the-better-one/amfora/sysopen"
|
||||||
"github.com/makeworld-the-better-one/amfora/webbrowser"
|
"github.com/makeworld-the-better-one/amfora/webbrowser"
|
||||||
"github.com/makeworld-the-better-one/go-gemini"
|
"github.com/makeworld-the-better-one/go-gemini"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@ -75,6 +76,13 @@ func handleOther(u string) {
|
|||||||
switch handler {
|
switch handler {
|
||||||
case "", "off":
|
case "", "off":
|
||||||
Error("URL Error", "Opening "+parsed.Scheme+" URLs is turned off.")
|
Error("URL Error", "Opening "+parsed.Scheme+" URLs is turned off.")
|
||||||
|
case "default":
|
||||||
|
_, err := sysopen.Open(u)
|
||||||
|
if err != nil {
|
||||||
|
Error("Application Error", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Info("Opened in default application")
|
||||||
default:
|
default:
|
||||||
// The config has a custom command to execute for URLs
|
// The config has a custom command to execute for URLs
|
||||||
fields := strings.Fields(handler)
|
fields := strings.Fields(handler)
|
||||||
|
@ -8,5 +8,5 @@ import "fmt"
|
|||||||
// Open opens `path` in default system viewer, but not on this OS.
|
// Open opens `path` in default system viewer, but not on this OS.
|
||||||
func Open(path string) (string, error) {
|
func Open(path string) (string, error) {
|
||||||
return "", fmt.Errorf("unsupported OS for default system viewer. " +
|
return "", fmt.Errorf("unsupported OS for default system viewer. " +
|
||||||
"Set a catch-all [[mediatype-handlers]] command in the config")
|
"Set a catch-all command in the config")
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ func Open(path string) (string, error) {
|
|||||||
switch {
|
switch {
|
||||||
case xorgDisplay == "" && waylandDisplay == "":
|
case xorgDisplay == "" && waylandDisplay == "":
|
||||||
return "", fmt.Errorf("no display server was found. " +
|
return "", fmt.Errorf("no display server was found. " +
|
||||||
"You may set a default [[mediatype-handlers]] command in the config")
|
"You may set a default command in the config")
|
||||||
case xdgOpenNotFoundErr == nil:
|
case xdgOpenNotFoundErr == nil:
|
||||||
// Use start rather than run or output in order
|
// Use start rather than run or output in order
|
||||||
// to make application run in background.
|
// to make application run in background.
|
||||||
@ -31,6 +31,6 @@ func Open(path string) (string, error) {
|
|||||||
return "Opened in default system viewer", nil
|
return "Opened in default system viewer", nil
|
||||||
default:
|
default:
|
||||||
return "", fmt.Errorf("could not determine default system viewer. " +
|
return "", fmt.Errorf("could not determine default system viewer. " +
|
||||||
"Set a catch-all [[mediatype-handlers]] command in the config")
|
"Set a catch-all command in the config")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user