示例#1
0
def test_widgetbox_with_systray_reconfigure_screens_box_open(
        manager_nospawn, minimal_conf_noscreen, backend_name):
    """Check that Systray does not crash when inside an open widgetbox."""
    if backend_name == "wayland":
        pytest.skip("Skipping test on Wayland.")

    config = minimal_conf_noscreen
    config.screens = [
        libqtile.config.Screen(
            top=libqtile.bar.Bar([WidgetBox([Systray()])], 10))
    ]

    manager_nospawn.start(config)

    topbar = manager_nospawn.c.bar["top"]
    assert len(topbar.info()["widgets"]) == 1

    manager_nospawn.c.widget["widgetbox"].toggle()
    assert len(topbar.info()["widgets"]) == 2

    manager_nospawn.c.reconfigure_screens()

    assert len(topbar.info()["widgets"]) == 2
    names = [w["name"] for w in topbar.info()["widgets"]]
    assert names == ["widgetbox", "systray"]
示例#2
0
def test_widgetbox_with_systray_reconfigure_screens_box_closed(
        manager_nospawn, minimal_conf_noscreen, backend_name):
    """Check that Systray does not crash when inside a closed widgetbox."""
    if backend_name == "wayland":
        pytest.skip("Skipping test on Wayland.")

    config = minimal_conf_noscreen
    config.screens = [
        libqtile.config.Screen(
            top=libqtile.bar.Bar([WidgetBox([Systray()])], 10))
    ]

    manager_nospawn.start(config)

    topbar = manager_nospawn.c.bar["top"]
    assert len(topbar.info()["widgets"]) == 1

    manager_nospawn.c.reconfigure_screens()

    assert len(topbar.info()["widgets"]) == 1

    # Check that we've still got a Systray widget in the box.
    _, name = manager_nospawn.c.widget["widgetbox"].eval(
        "self.widgets[0].name")
    assert name == "systray"
示例#3
0
def init_widgets():
    prompt = "{0}@{1}: ".format(os.environ["USER"], hostname)
    widgets = [
        Prompt(prompt=prompt,
               font="DejaVu Sans Mono",
               padding=10,
               background=GREY),
        TextBox(text="◤ ",
                fontsize=45,
                padding=-8,
                foreground=GREY,
                background=DARK_GREY),
        CurrentLayoutIcon(scale=0.6, padding=-4),
        TextBox(text=" ", padding=2),
        GroupBox(fontsize=8,
                 padding=4,
                 borderwidth=1,
                 urgent_border=DARK_BLUE,
                 disable_drag=True,
                 highlight_method="block",
                 this_screen_border=DARK_BLUE,
                 other_screen_border=DARK_ORANGE,
                 this_current_screen_border=BLUE,
                 other_current_screen_border=ORANGE),
        TextBox(text="◤",
                fontsize=45,
                padding=-1,
                foreground=DARK_GREY,
                background=GREY),
        TaskList(borderwidth=0,
                 highlight_method="block",
                 background=GREY,
                 border=DARK_GREY,
                 urgent_border=DARK_BLUE),
        Systray(background=GREY),
        TextBox(text="◤",
                fontsize=45,
                padding=-1,
                foreground=GREY,
                background=DARK_GREY),
        TextBox(text=" ⚠", foreground=BLUE, fontsize=18),
        Notify(),
        TextBox(text=" ⌚", foreground=BLUE, fontsize=18),
        Clock(format="%A %d-%m-%Y %H:%M")
    ]
    if hostname in ("spud", "saiga"):
        widgets[-2:-2] = [
            TextBox(text=" ↯", foreground=BLUE, fontsize=14),
            Battery(update_delay=2)
        ]
    if DEBUG:
        widgets += [Sep(), CurrentLayout()]
    return widgets
示例#4
0
def init_widgets():
    prompt = "{0}@{1}: ".format(os.environ["USER"], hostname)
    widgets = [
        Prompt(prompt=prompt,
               font="DejaVu Sans Mono",
               padding=10,
               background=GREY),
        TextBox(text="◤ ",
                fontsize=45,
                padding=-8,
                foreground=GREY,
                background=DARK_GREY),
        CurrentLayoutIcon(scale=0.6, padding=-4),
        Spacer(width=10),
        GroupBox(fontsize=8,
                 padding=4,
                 borderwidth=1,
                 urgent_border=DARK_BLUE,
                 disable_drag=True,
                 highlight_method="block",
                 this_screen_border=DARK_BLUE,
                 other_screen_border=DARK_ORANGE,
                 this_current_screen_border=BLUE,
                 other_current_screen_border=ORANGE),
        TextBox(text="◤",
                fontsize=45,
                padding=-1,
                foreground=DARK_GREY,
                background=GREY),
        TaskList(borderwidth=0,
                 highlight_method="block",
                 background=GREY,
                 border=DARK_GREY,
                 urgent_border=DARK_BLUE),
        Systray(background=GREY),
        TextBox(text="◤",
                fontsize=45,
                padding=-1,
                foreground=GREY,
                background=DARK_GREY),
        Notify(fmt=" 🔥 {}"),
        Clock(fmt=" ⌚ {}", format="%A %d-%m-%Y %H:%M")
    ]
    if os.path.isdir("/sys/module/battery"):
        widgets.insert(-1, Battery(fmt=" ⚡️ {}", update_delay=2))
    if DEBUG:
        widgets += [Sep(), CurrentLayout()]
    return widgets
示例#5
0
def init_widgets():
    widgets = [
        CurrentLayoutIcon(scale=0.6, padding=8),
        GroupBox(fontsize=8, padding=4, borderwidth=1, urgent_border=DARK_BLUE,
                 disable_drag=True, highlight_method="block",
                 this_screen_border=DARK_BLUE, other_screen_border=DARK_ORANGE,
                 this_current_screen_border=BLUE,
                 other_current_screen_border=ORANGE),

        TextBox(text="◤", fontsize=45, padding=-1, foreground=DARK_GREY,
                background=GREY),

        TaskList(borderwidth=0, highlight_method="block", background=GREY,
                 border=DARK_GREY, urgent_border=DARK_BLUE,
                 markup_floating="<i>{}</i>", markup_minimized="<s>{}</s>"),

        Systray(background=GREY),
        TextBox(text="◤", fontsize=45, padding=-1,
                foreground=GREY, background=DARK_GREY),
        Notify(fmt=" 🔥 {} "),
        PulseVolume(fmt=" {}", emoji=True, volume_app="pavucontrol"),
        PulseVolume(volume_app="pavucontrol"),
        Clock(format=" ⏱ %H:%M  <span color='#666'>%A %d-%m-%Y</span>  ")
    ]
    if os.path.isdir("/sys/module/battery"):
        widgets.insert(-1, Battery(format=" {char} {percent:2.0%} ",
                                   charge_char="⚡", discharge_char="🔋",
                                   full_char="⚡", unknown_char="⚡",
                                   empty_char="⁉️ ", update_interval=2,
                                   show_short_text=False,
                                   default_text=""))
        widgets.insert(-1, Battery(fmt="<span color='#666'>{}</span> ",
                                   format="{hour:d}:{min:02d}",
                                   update_interval=2, show_short_text=True,
                                   default_text=""))
    if DEBUG:
        widgets += [Sep(), CurrentLayout()]
    return widgets
示例#6
0
    def init_widgets(self) -> list:
        """Inits and returns the widgets for primary monitor."""

        return [
            Spacer(**self._widget_settings["spacer"]),
            TextBox(**self._widget_settings["launcher"]),
            Spacer(**self._widget_settings["spacer"]),
            GroupBox(**self._widget_settings["group_box"]),
            CurrentLayoutIcon(**self._widget_settings["current_layout_icon"]),
            Spacer(**self._widget_settings["spacer"]),
            WindowName(**self._widget_settings["window_name"]),
            Spacer(**self._widget_settings["spacer_stretch"]),
            Systray(**self._widget_settings["systray"]),
            Spacer(**self._widget_settings["spacer"]),
            PulseVolume(**self._widget_settings["pulse_volume"]),
            Clock(**self._widget_settings["calendar"]),
            Clock(**self._widget_settings["clock"]),
            Battery(**self._widget_settings["battery"])
            if self.theme_config.widgets["show_battery"] else Spacer(
                **self._widget_settings["spacer"]),
            QuickExit(**self._widget_settings["quick_exit"]),
            Spacer(**self._widget_settings["spacer"]),
        ]
示例#7
0
文件: config.py 项目: Hewame/Dotfiles
 GroupBox(**w_gbox, ),
 TextBox(
     text="🐸",
     fontsize="16",
     padding=5,
 ),
 WindowCount(),
 Prompt(**w_prompt),
 WindowName(foreground=colorz[1]),
 TextBox(
     text="📂",
     fontsize="16",
     padding=5,
     mouse_callbacks={'Button1': open_fm},
 ),
 Systray(icon_size=20),
 TextBox(
     text="[",
     foreground=colorz[2],
     fontsize=18,
 ),
 Net(**w_net, ),
 TextBox(
     text="]",
     foreground=colorz[2],
     fontsize=18,
 ),
 TextBox(
     text="[",
     foreground=colorz[4],
     fontsize=18,
示例#8
0
                filename=expanduser("~/.config/qtile/icons/p6.png"),
                margin=0,
                background=bar_colors[0],
            ),
            Image(
                filename=expanduser("~/.config/qtile/icons/calendar.png"),
                background=bar_colors[6],
                margin=4,
            ),
            GenPollText(
                func=lambda: check_output(
                    expanduser("~/.config/qtile/scripts/clock")).decode("utf-8"
                                                                        ),
                update_interval=1,
                foreground=bar_colors[0],
                background=bar_colors[6],
            ),
            Systray(background=bar_colors[0]),
        ],
        size=20,
        opacity=0.75,
    ), ),
]


# Startup applications
@hook.subscribe.startup
def autostart():
    home = expanduser("~/.config/qtile/autostart.sh")
    subprocess.call([home])
示例#9
0
def init_widgets_list():
    """Init widgets list."""
    widgets_list = [
        widget.Sep(linewidth=0,
                   padding=6,
                   foreground=colors[2],
                   background=colors[0]),
        widget.Image(filename="~/.config/qtile/icons/python-white.png",
                     scale="False",
                     mouse_callbacks={
                         'Button1': lambda: qtile.cmd_spawn(TERM_EMULATOR)
                     }),
        widget.Sep(linewidth=0,
                   padding=6,
                   foreground=colors[2],
                   background=colors[0]),
        widget.GroupBox(font="Ubuntu Bold",
                        fontsize=9,
                        margin_y=3,
                        margin_x=0,
                        padding_y=5,
                        padding_x=3,
                        borderwidth=3,
                        active=colors[2],
                        inactive=colors[7],
                        rounded=False,
                        highlight_color=colors[1],
                        highlight_method="line",
                        this_current_screen_border=colors[6],
                        this_screen_border=colors[4],
                        other_current_screen_border=colors[6],
                        other_screen_border=colors[4],
                        foreground=colors[2],
                        background=colors[0]),
        widget.Prompt(prompt=prompt,
                      font="Ubuntu Mono",
                      padding=10,
                      foreground=colors[3],
                      background=colors[1]),
        widget.Sep(linewidth=0,
                   padding=40,
                   foreground=colors[2],
                   background=colors[0]),
        widget.WindowName(foreground=colors[6],
                          background=colors[0],
                          padding=0),
        widget.TextBox(text='',
                       background=colors[0],
                       foreground=colors[4],
                       padding=0,
                       fontsize=37),
        widget.Net(interface="enp6s0",
                   format='{down} ↓↑ {up}',
                   foreground=colors[2],
                   background=colors[4],
                   padding=5),
        Systray(background=colors[0], padding=5),
        widget.Sep(linewidth=0,
                   padding=6,
                   foreground=colors[0],
                   background=colors[0]),
        widget.TextBox(text='',
                       background=colors[4],
                       foreground=colors[5],
                       padding=0,
                       fontsize=37),
        widget.TextBox(text=" ⟳",
                       padding=2,
                       foreground=colors[2],
                       background=colors[4],
                       fontsize=14),
        widget.CheckUpdates(
            update_interval=1800,
            distro="Arch_checkupdates",
            display_format="{updates} Updates",
            foreground=colors[2],
            mouse_callbacks={
                'Button1':
                lambda: qtile.cmd_spawn(TERM_EMULATOR + ' -e sudo pacman -Syu')
            },
            background=colors[4]),
        widget.TextBox(text='',
                       background=colors[4],
                       foreground=colors[5],
                       padding=0,
                       fontsize=37),
        widget.TextBox(text=" 🖬",
                       foreground=colors[2],
                       background=colors[5],
                       padding=0,
                       fontsize=14),
        widget.Memory(foreground=colors[2],
                      background=colors[5],
                      mouse_callbacks={
                          'Button1':
                          lambda: qtile.cmd_spawn(TERM_EMULATOR + ' -e htop')
                      },
                      padding=5),
        widget.TextBox(text='',
                       background=colors[5],
                       foreground=colors[4],
                       padding=0,
                       fontsize=37),
        widget.TextBox(text=" ₿",
                       padding=0,
                       foreground=colors[2],
                       background=colors[4],
                       fontsize=12),
        widget.BitcoinTicker(foreground=colors[2],
                             background=colors[4],
                             padding=5),
        widget.TextBox(text='',
                       background=colors[4],
                       foreground=colors[5],
                       padding=0,
                       fontsize=37),
        widget.TextBox(text=" Vol:",
                       foreground=colors[2],
                       background=colors[5],
                       padding=0),
        widget.Volume(foreground=colors[2], background=colors[5], padding=5),
        widget.TextBox(text='',
                       background=colors[5],
                       foreground=colors[4],
                       padding=0,
                       fontsize=37),
        widget.CurrentLayoutIcon(
            custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")],
            foreground=colors[0],
            background=colors[4],
            padding=0,
            scale=0.7),
        widget.CurrentLayout(foreground=colors[2],
                             background=colors[4],
                             padding=5),
        widget.TextBox(text='',
                       background=colors[4],
                       foreground=colors[5],
                       padding=0,
                       fontsize=37),
        widget.Clock(foreground=colors[2],
                     background=colors[5],
                     format="%A, %B %d - %H:%M "),
    ]
    return widgets_list
    def init_top_single(self, tray=True):

        wl = []

        wl += [self.space.large_black()]
        wl += [
            GroupBox(
                font=self.font.bold,
                fontsize=9,
                margin_y=0,
                margin_x=0,
                # padding_y = 6,
                padding_x=3,
                borderwidth=2,
                # hide_unused = True,
                active=self.color.white,
                inactive=self.color.lightgrey,
                urgent_text=self.color.white,
                highlight_method="line",
                highlight_color=["2B303B", "14161B"],
                urgent_alert_method="line",
                rounded=False,
                urgent_border=self.color.red,
                this_current_screen_border=self.color.blue,
                other_screen_border=self.color.magenta,
                this_screen_border=self.color.orange,
                other_current_screen_border=self.color.magenta,
                disable_drag=True,
                use_mouse_wheel=False)
        ]

        wl += [
            Prompt(prompt="λ : ",
                   padding=5,
                   bell_style="visual",
                   foreground=self.color.magenta,
                   background=self.color.black)
        ]

        wl += [self.space.large_black()]

        wl += [
            WindowName(fontsize=11,
                       padding=0,
                       show_state=False,
                       foreground=self.color.darkgreen)
        ]

        wl += [self.space.large_black()]

        wl += [TextBox(fontsize=16, text="")]
        wl += [Net(interface="eth0")]

        wl += [self.separator.bold_white()]
        wl += [TextBox(text="")]
        wl += [
            ThermalSensor(tag_sensor="CPU",
                          threshold=85,
                          update_interval=1,
                          foreground_alert=self.color.red,
                          foreground=self.color.white)
        ]

        wl += [self.separator.bold_white()]
        wl += [TextBox(text="")]
        wl += [
            Battery(format="{char} {percent:0.1%}",
                    update_interval=5,
                    low_percentage=0.10,
                    unknown_char="",
                    full_char="",
                    charge_char="+",
                    discharge_char="-",
                    empty_char="",
                    low_foreground=self.color.red)
        ]

        wl += [self.separator.bold_white()]
        wl += [TextBox(font=self.font.bold, text="")]
        wl += [
            Memory(
                # fmt = "{MemUsed}M/{MemTotal}M - {SwapUsed}M",
                fmt="{MemUsed}M - {SwapUsed}M",
                update_interval=1)
        ]

        wl += [self.separator.bold_white()]
        wl += [TextBox(font=self.font.bold, text="")]
        wl += [CurrentLayout()]

        wl += [self.separator.bold_white()]
        wl += [TextBox(font=self.font.bold, text="")]
        wl += [
            CheckUpdates(distro="Arch_checkupdates",
                         display_format="{updates}",
                         update_interval=900,
                         colour_have_updates=self.color.white,
                         colour_no_updates=self.color.white)
        ]

        if tray:
            wl += [self.separator.bold_white()]
            wl += [Systray(padding=3, icon_size=19)]
        # if not tray:
        # 	wl += [self.separator.bold_white()]
        # wl += [CurrentLayoutIcon(
        # 	padding = 0,
        # 	custom_icon_paths = [expanduser("~/.config/qtile/icons")],
        # 	scale = 0.6
        # )]

        wl += [self.separator.bold_white()]
        wl += [TextBox(font=self.font.bold, text="")]
        wl += [Clock(format="%a, %b %d - %H:%M")]
        wl += [self.space.large_black()]

        return wl
    def init_top_double(self, tray=True):

        wl = []

        wl += [self.space.large_black()]
        wl += [
            GroupBox(
                font=self.font.bold,
                fontsize=9,
                margin_y=0,
                margin_x=0,
                # padding_y = 6,
                padding_x=3,
                borderwidth=2,
                # hide_unused = True,
                active=self.color.white,
                inactive=self.color.lightgrey,
                urgent_text=self.color.white,
                highlight_method="line",
                highlight_color=["2B303B", "14161B"],
                urgent_alert_method="line",
                rounded=False,
                urgent_border=self.color.red,
                this_current_screen_border=self.color.blue,
                other_screen_border=self.color.magenta,
                this_screen_border=self.color.orange,
                other_current_screen_border=self.color.magenta,
                disable_drag=True,
                use_mouse_wheel=False)
        ]

        wl += [
            Prompt(prompt="λ : ",
                   padding=5,
                   bell_style="visual",
                   foreground=self.color.magenta,
                   background=self.color.black)
        ]

        wl += [self.space.large_black()]

        wl += [
            WindowName(fontsize=11,
                       padding=0,
                       show_state=False,
                       foreground=self.color.darkgreen)
        ]

        wl += [self.space.large_black()]

        wl += [TextBox(fontsize=16, text="")]
        wl += [Net(interface="eth0")]

        if tray:
            wl += [self.separator.bold_white()]
            wl += [Systray(padding=3, icon_size=19)]
        # if not tray:
        # 	wl += [self.separator.bold_white()]
        # wl += [CurrentLayoutIcon(
        # 	padding = 0,
        # 	custom_icon_paths = [expanduser("~/.config/qtile/icons")],
        # 	scale = 0.6
        # )]
        wl += [self.space.large_black()]

        return wl