diff --git a/powerline_shell/segments/env.py b/powerline_shell/segments/env.py index 29ef048a..6954578c 100644 --- a/powerline_shell/segments/env.py +++ b/powerline_shell/segments/env.py @@ -4,7 +4,11 @@ class Segment(BasicSegment): def add_to_powerline(self): - self.powerline.append( - " %s " % os.getenv(self.segment_def["var"]), - self.segment_def.get("fg_color", self.powerline.theme.PATH_FG), - self.segment_def.get("bg_color", self.powerline.theme.PATH_BG)) + env = os.getenv(self.segment_def["var"]) + if env is None and "default" in self.segment_def: + env = self.segment_def["default"] + if env is not None: + self.powerline.append( + " %s " % env, + self.segment_def.get("fg_color", self.powerline.theme.PATH_FG), + self.segment_def.get("bg_color", self.powerline.theme.PATH_BG))