Skip to content

Commit

Permalink
Merge pull request #1997 from shinhs0506/wsl-support
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield authored Jul 4, 2022
2 parents 6e6e8ce + 1eb47de commit 582b199
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/config/config_linux.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
package config

import (
"io/ioutil"
"strings"
)

func isWSL() bool {
data, err := ioutil.ReadFile("/proc/sys/kernel/osrelease")
return err == nil && strings.Contains(string(data), "microsoft")
}

// GetPlatformDefaultConfig gets the defaults for the platform
func GetPlatformDefaultConfig() OSConfig {
if isWSL() {
return OSConfig{
EditCommand: ``,
EditCommandTemplate: "",
OpenCommand: `powershell.exe start explorer.exe {{filename}} >/dev/null`,
OpenLinkCommand: `powershell.exe start {{link}} >/dev/null`,
}
}

return OSConfig{
EditCommand: ``,
EditCommandTemplate: "",
Expand Down

0 comments on commit 582b199

Please sign in to comment.