def complete(self, txt: str, aliases: dict[str, str] | None = None) -> str:
        """Returns the next completion for txt, or None if there is no completion"""
        if self.lookup is None:
            # Lookup is a set of (display value, actual value) tuples.
            self.lookup = []
            if txt and txt[0] in "~/":
                path = os.path.expanduser(txt)
                if os.path.isdir(path):
                    files = glob.glob(os.path.join(path, "*"))
                    prefix = txt
                else:
                    files = glob.glob(path + "*")
                    prefix = os.path.dirname(txt)
                prefix = prefix.rstrip("/") or "/"
                for f in files:
                    if self.executable(f):
                        display = os.path.join(prefix, os.path.basename(f))
                        if os.path.isdir(f):
                            display += "/"
                        self.lookup.append((display, f))
            else:
                dirs = os.environ.get("PATH", self.DEFAULTPATH).split(":")
                for d in dirs:
                    try:
                        d = os.path.expanduser(d)
                        for cmd in glob.iglob(os.path.join(d, f"{txt}*")):
                            if self.executable(cmd):
                                self.lookup.append(
                                    (os.path.basename(cmd), cmd),
                                )
                    except OSError:
                        pass

            if aliases:
                for alias in aliases:
                    if alias.startswith(txt):
                        self.lookup.append((alias, aliases[alias]))

            self.lookup.sort()
            self.offset = -1
            self.lookup.append((txt, txt))
        self.offset += 1
        if self.offset >= len(self.lookup):
            self.offset = 0
        ret = self.lookup[self.offset]
        self.thisfinal = ret[1]
        return ret[0]
Returns the next completion for txt, or None if there is no completion
libqtile/widget/prompt.py