mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-05 05:12:05 -04:00
keybinds: dont pass dirs
This commit is contained in:
@@ -19,8 +19,6 @@ func NewMiracleProvider(configPath string) *MiracleProvider {
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err == nil {
|
||||
configPath = filepath.Join(configDir, "miracle-wm")
|
||||
} else {
|
||||
configPath = "$HOME/.config/miracle-wm"
|
||||
}
|
||||
}
|
||||
return &MiracleProvider{configPath: configPath}
|
||||
|
||||
@@ -3,6 +3,7 @@ package providers
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/keybinds"
|
||||
@@ -18,11 +19,19 @@ func NewSwayProvider(configPath string) *SwayProvider {
|
||||
_, scrollEnvSet := os.LookupEnv("SCROLLSOCK")
|
||||
|
||||
if configPath == "" {
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
configDir = ""
|
||||
}
|
||||
if scrollEnvSet {
|
||||
configPath = "$HOME/.config/scroll"
|
||||
if configDir != "" {
|
||||
configPath = filepath.Join(configDir, "scroll")
|
||||
}
|
||||
isScroll = true
|
||||
} else {
|
||||
configPath = "$HOME/.config/sway"
|
||||
if configDir != "" {
|
||||
configPath = filepath.Join(configDir, "sway")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isScroll = strings.Contains(configPath, "scroll")
|
||||
|
||||
@@ -15,8 +15,13 @@ func TestSwayProviderName(t *testing.T) {
|
||||
|
||||
func TestSwayProviderDefaultPath(t *testing.T) {
|
||||
provider := NewSwayProvider("")
|
||||
if provider.configPath != "$HOME/.config/sway" {
|
||||
t.Errorf("configPath = %q, want %q", provider.configPath, "$HOME/.config/sway")
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
t.Skip("UserConfigDir not available")
|
||||
}
|
||||
expected := filepath.Join(configDir, "sway")
|
||||
if provider.configPath != expected {
|
||||
t.Errorf("configPath = %q, want %q", provider.configPath, expected)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user