示例#1
0
def test_lemonbar(monkeypatch):
    def mockpopen(cmd, *args, **kwargs):
        return cmd
    monkeypatch.setattr(subprocess, "Popen", mockpopen)

    launched_cmd = lemonbar(
        "lemonbar", geometry="250x250+5+5",
        fonts=[
            "DejaVu Sans Mono for Powerline:size=10",
            "FontAwesome:size=12"
        ], fg="#FFFFFFFF", bg="#FF000000", clickable=20, others=["-u", "2"]
    )
    expected_cmd = [
        "lemonbar", "-g", "250x250+5+5",
        "-f", "DejaVu Sans Mono for Powerline:size=10",
        "-f", "FontAwesome:size=12", "-F", "#FFFFFFFF", "-B", "#FF000000",
        "-a", "20", "-u", "2"
    ]

    assert launched_cmd == expected_cmd
示例#2
0
    def init_bar(self):
        """
        Spawn lemonbar and store the pipe in self._bar

        Before starting, tries to terminate self._bar in case of refresh
        """
        if self._stop.is_set():
            return None
        screen_geometry = self.geometry
        if screen_geometry:
            w, h, x, y = screen_geometry
            w -= self.offset[0] + self.offset[1]
            h = self.height
            x += self.offset[0]
            y += self.offset[2]
            geometry = (w, h, x, y)
        else:
            geometry = (None, self.height)
        bar_cmd = getattr(self, "bar_cmd", None) or self.panel.bar_cmd
        self._bar = tools.lemonbar(
            bar_cmd=bar_cmd, geometry=geometry, fonts=self.fonts,
            fg=self.fg, bg=self.bg, clickable=self.clickable
        )