themes kitten: ignore custom theme files if they are stdout
This commit is contained in:
parent
91700b3e42
commit
046fbb860b
@ -829,7 +829,18 @@ func (self *Themes) add_from_dir(dirpath string) error {
|
|||||||
}
|
}
|
||||||
for _, e := range entries {
|
for _, e := range entries {
|
||||||
if !e.IsDir() && strings.HasSuffix(e.Name(), ".conf") {
|
if !e.IsDir() && strings.HasSuffix(e.Name(), ".conf") {
|
||||||
if _, err = self.AddFromFile(filepath.Join(dirpath, e.Name())); err != nil {
|
path := filepath.Join(dirpath, e.Name())
|
||||||
|
// ignore files if they are the current processes, stdout
|
||||||
|
// allows using kitten theme --dump-theme > ~/.config/kitty/themes/name.conf
|
||||||
|
if st, err := os.Stat(path); err == nil {
|
||||||
|
if st2, err := os.Stdout.Stat(); err == nil && os.SameFile(st, st2) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if path == os.Stdout.Name() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, err = self.AddFromFile(path); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user