mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-13 14:36:32 -04:00
fix(windowrules): honor $XDG_CONFIG_HOME for config paths
- Window rule read/write/includes detection and setup hardcoded `$HOME/.config` so rules weren't applied when `XDG_CONFIG_HOME` pointed elsewhere. - Fixes #2289
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -146,10 +147,7 @@ func runWindowrulesList(cmd *cobra.Command, args []string) {
|
||||
|
||||
switch compositor {
|
||||
case "niri":
|
||||
configDir, err := utils.ExpandPath("$HOME/.config/niri")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to expand niri config path: %v", err)
|
||||
}
|
||||
configDir := filepath.Join(utils.XDGConfigHome(), "niri")
|
||||
|
||||
parseResult, err := providers.ParseNiriWindowRules(configDir)
|
||||
if err != nil {
|
||||
@@ -182,10 +180,7 @@ func runWindowrulesList(cmd *cobra.Command, args []string) {
|
||||
result.DMSStatus = parseResult.DMSStatus
|
||||
|
||||
case "hyprland":
|
||||
configDir, err := utils.ExpandPath("$HOME/.config/hypr")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to expand hyprland config path: %v", err)
|
||||
}
|
||||
configDir := filepath.Join(utils.XDGConfigHome(), "hypr")
|
||||
|
||||
parseResult, err := providers.ParseHyprlandWindowRules(configDir)
|
||||
if err != nil {
|
||||
@@ -315,16 +310,10 @@ func runWindowrulesReorder(cmd *cobra.Command, args []string) {
|
||||
func getWindowRulesProvider(compositor string) windowrules.WritableProvider {
|
||||
switch compositor {
|
||||
case "niri":
|
||||
configDir, err := utils.ExpandPath("$HOME/.config/niri")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
configDir := filepath.Join(utils.XDGConfigHome(), "niri")
|
||||
return providers.NewNiriWritableProvider(configDir)
|
||||
case "hyprland":
|
||||
configDir, err := utils.ExpandPath("$HOME/.config/hypr")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
configDir := filepath.Join(utils.XDGConfigHome(), "hypr")
|
||||
return providers.NewHyprlandWritableProvider(configDir)
|
||||
default:
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user