diff --git a/tools/themes/collection.go b/tools/themes/collection.go index 1676ad80a..c0e63d576 100644 --- a/tools/themes/collection.go +++ b/tools/themes/collection.go @@ -829,7 +829,18 @@ func (self *Themes) add_from_dir(dirpath string) error { } for _, e := range entries { 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 } }