qtile: Qtile crashes on restart

Issue description

I’ll admit, I was doing a kind of stress test on qtile to setup the bar, changing colors and such. But still, qtile crashing every 10 restarts or so was getting annoying. Maybe I should have more patience xD.

Edit: Now it’s really getting annoying… I can’t debug or do anything if I can’t restart qtile.

Qtile version

arch 0.18.1-3

Stack traces

2021-10-26 03:41:25,041 ERROR libqtile base.py:_wrapper():L307 got exception from widget timer
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/libqtile/widget/base.py", line 305, in _wrapper
    method(*method_args)
  File "/usr/lib/python3.9/site-packages/libqtile/widget/base.py", line 569, in timer_setup
    future = self.qtile.run_in_executor(self.poll)
  File "/usr/lib/python3.9/site-packages/libqtile/core/manager.py", line 826, in run_in_executor
    return self._eventloop.run_in_executor(None, func, *args)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 807, in run_in_executor
    self._check_default_executor()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 514, in _check_default_executor
    raise RuntimeError('Executor shutdown has been called')
RuntimeError: Executor shutdown has been called

2021-10-26 13:40:31,252 ERROR libqtile base.py:_wrapper():L307 got exception from widget timer
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/libqtile/widget/base.py", line 305, in _wrapper
    method(*method_args)
  File "/usr/lib/python3.9/site-packages/libqtile/widget/base.py", line 569, in timer_setup
    future = self.qtile.run_in_executor(self.poll)
  File "/usr/lib/python3.9/site-packages/libqtile/core/manager.py", line 826, in run_in_executor
    return self._eventloop.run_in_executor(None, func, *args)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 807, in run_in_executor
    self._check_default_executor()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 514, in _check_default_executor
    raise RuntimeError('Executor shutdown has been called')
RuntimeError: Executor shutdown has been called

Configuration

import os
import subprocess
from typing import List
from libqtile import bar, layout, widget, hook, qtile
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.command import lazy, client


def focus_previous_group(qtile):
    group = qtile.current_screen.group
    group_index = qtile.groups.index(group)
    previous_group = group.get_previous_group(skip_empty=True)
    previous_group_index = qtile.groups.index(previous_group)
    if previous_group_index < group_index:
        qtile.current_screen.set_group(previous_group)


def focus_next_group(qtile):
    group = qtile.current_screen.group
    group_index = qtile.groups.index(group)
    next_group = group.get_next_group(skip_empty=True)
    next_group_index = qtile.groups.index(next_group)
    if next_group_index > group_index:
        qtile.current_screen.set_group(next_group)

mod = "mod4"
terminal = "terminator"

keys = [
    Key([mod], "Up", lazy.group.prev_window()),
    Key([mod], "Down", lazy.group.next_window()),
    Key([mod], "Left", lazy.function(focus_previous_group)),
    Key([mod], "Right", lazy.function(focus_next_group)),

    Key([mod, "control"], "Right",
        lazy.layout.grow_right(),
        lazy.layout.grow(),
        lazy.layout.increase_ratio(),
        lazy.layout.delete(),
        ),
    Key([mod, "control"], "Left",
        lazy.layout.grow_left(),
        lazy.layout.shrink(),
        lazy.layout.decrease_ratio(),
        lazy.layout.add(),
        ),
    Key([mod, "control"], "Up",
        lazy.layout.grow_up(),
        lazy.layout.grow(),
        lazy.layout.decrease_nmaster(),
        ),
    Key([mod, "control"], "Down",
        lazy.layout.grow_down(),
        lazy.layout.shrink(),
        lazy.layout.increase_nmaster(),
        ),

    Key([mod, "shift"], "Up",    lazy.layout.shuffle_up()),
    Key([mod, "shift"], "Left",  lazy.layout.shuffle_left()),
    Key([mod, "shift"], "Right", lazy.layout.shuffle_right()),
    Key([mod, "shift"], "Down",  lazy.layout.shuffle_down()),
    Key([mod],          "Tab",   lazy.next_layout()),
    Key([mod, "shift"], "Tab",   lazy.prev_layout()),
    Key([mod], "n",              lazy.layout.normalize()),

    Key([mod], "KP_Enter",            lazy.window.toggle_fullscreen()),
    Key([mod, "shift"], "KP_Enter",   lazy.window.toggle_floating()),

    Key([mod], "q", lazy.window.kill()),

    Key([mod, "shift"], "r", lazy.restart()),
    Key([mod, "shift"], "q", lazy.shutdown()),
    Key([mod], "v", lazy.validate_config()),

    Key([mod], "Return",
        lazy.spawn(terminal)),
    Key([mod], "f",
        lazy.spawn("nemo")),
    # Key([mod], "a",
    #     lazy.spawn("nwggrid")),
    Key([mod], "a",
        lazy.spawn("rofi -show drun -terminal terminator")),
    Key([mod], "x",
        lazy.spawn("nwgbar")),
    Key([mod], "c",
        lazy.spawn("google-chrome-stable")),

    Key([],    "Print",
        lazy.spawn("flameshot screen -p /home/ervin/Pictures")),

    Key([], "XF86AudioRaiseVolume",
        lazy.spawn("/home/ervin/.scripts/vol_up")),
    Key([], "XF86AudioMute",
        lazy.spawn("/home/ervin/.scripts/vol_mute")),
    Key([], "XF86AudioLowerVolume",
        lazy.spawn("/home/ervin/.scripts/vol_down")),
    Key([], "XF86AudioPrev",
        lazy.spawn("/home/ervin/.scripts/spotify_left")),
    Key([], "XF86AudioPlay",
        lazy.spawn("/home/ervin/.scripts/spotify_pause")),
    Key([], "XF86AudioNext",
        lazy.spawn("/home/ervin/.scripts/spotify_right")),
    Key([], "XF86MonBrightnessUp",
        lazy.spawn("brightnessctl s 10%+")),
    Key([], "XF86MonBrightnessDown",
        lazy.spawn("brightnessctl s 10%-"))
]

groups = []

group_names = 'coding media www social settings etc'.split()
group_labels = ["", "", "", "", "", ""]
group_layouts = ["bsp", "monadtall", "zoomy", "zoomy", "bsp", "bsp"]

for i in range(len(group_names)):
    groups.append(
        Group(
            name=group_names[i],
            layout=group_layouts[i].lower(),
            label=group_labels[i],
        ))


@hook.subscribe.client_new
def assign_app_group(client):
    d = {}
    d[group_names[0]] = [
        "terminator",
        "atom",
        "subl",
        "geany",
        "brackets",
        "code-oss",
        "code",
        "thunar",
        "nemo",
        "caja",
        "nautilus",
        "org.gnome.nautilus",
        "pcmanfm",
        "pcmanfm-qt",
        "Atom",
        "Subl",
        "Geany",
        "Brackets",
        "Code-oss",
        "Code",
        "Thunar",
        "Nemo",
        "Caja",
        "Nautilus",
        "org.gnome.Nautilus",
        "Pcmanfm",
        "Pcmanfm-qt",
        ]
    d[group_names[1]] = [
        "Spotify",
        "Pragha",
        "Clementine",
        "Deadbeef",
        "Audacious",
        "spotify",
        "pragha",
        "clementine",
        "deadbeef",
        "audacious",
        "anbox",
        "TelegramDesktop",
        "Discord",
        "telegramDesktop",
        "discord",
        "Vlc",
        "vlc",
        "Mpv",
        "mpv",
        "obs",
        ]
    d[group_names[2]] = [
        "Firefox",
        "Chromium",
        "firefox",
        "chromium",
        "google-chrome",
        "qbittorrent"
        ]
    d[group_names[3]] = [
        "ferdi",
        ]
    d[group_names[4]] = [
        "gnome-control-center",
        "blueman-manager",
        "nitrogen",
        "pling-store"
        ]

    wm_class = client.window.get_wm_class()[0]

    for i in range(len(d)):
        if wm_class in list(d.values())[i]:
            group = list(d.keys())[i]
            client.togroup(group)
            client.group.cmd_toscreen(toggle=False)

for i, name in enumerate(group_names, 1):
    keys.extend([
        Key([mod], str(i), lazy.group[name].toscreen()),
        Key([mod, 'shift'], str(i), lazy.window.togroup(name))])


layouts = [
    layout.Bsp(
        margin=5,
        fontsize=20,
        border_width=2,
        border_focus="#3ca4c9"),
    layout.Zoomy(  # !!CHECK DOCS FOR THIS ONE!!
        margin=5,
        columnwidth=150,
        fontsize=20,
        border_width=2,
        border_focus="#3ca4c9"),
    layout.Max(
        margin=5,
        fontsize=20,
        border_width=2,
        border_focus="#3ca4c9"),
    layout.MonadTall(
        margin=5,
        fontsize=20,
        border_width=2,
        border_focus="#3ca4c9"),
    layout.MonadWide(
        margin=5,
        border_width=2,
        border_focus="#3ca4c9"),
]

widget_defaults = dict(
    font='CodeNewRoman Nerd Font Mono Bold',
    fontsize=15,
    padding=3,
)
extension_defaults = widget_defaults.copy()

colors_nord = ["#2e3440",   # 0
               "#3b4252",   # 1
               "#434c5e",   # 2
               "#4c566a",   # 3
               "#d8dee9",   # 4
               "#e5e9f0",   # 5
               "#eceff4",   # 6
               "#8fbcbb",   # 7
               "#88c0d0",   # 8
               "#81a1c1",   # 9
               "#5e81ac",   # 10
               "#bf616a",   # 11
               "#d08770",   # 12
               "#ebcb8b",   # 13
               "#a3be8c",   # 14
               "#b48ead",   # 15
               ]


screens = [
    Screen(
        top=bar.Bar(
            [
                widget.Image(
                    filename="~/.config/qtile/icons/arch.svg",
                    margin=5,
                    mouse_callbacks=
                    {'Button1': lambda: qtile.cmd_spawn("rofi -show drun")}
                    ),
                widget.Spacer(
                    length=3),
                widget.CurrentLayoutIcon(
                    scale=0.6
                    ),
                widget.Spacer(
                    length=3),
                widget.GroupBox(
                    font='Font Awesome 5 Free Solid',
                    fontsize=12,
                    highlight_method='block',
                    block_highlight_text_color=colors_nord[4],
                    inactive=colors_nord[3],
                    active=colors_nord[4],
                    padding_y=7,
                    rounded="true"
                    ),
                widget.Spacer(
                    length=3),
                widget.GenPollText(
                    fmt="{}",
                    update_interval=0.1,
                    foreground=colors_nord[10],
                    func=lambda:
                    subprocess.check_output("/home/ervin/.scripts/window_name").decode("utf-8")
                    ),
                widget.Spacer(
                    length=bar.STRETCH
                    ),
                widget.Clock(
                    format='%A, %B %d - %H:%M',
                    padding=2,
                    foreground=colors_nord[10],
                    # fontsize=18
                    ),
                widget.Spacer(
                    length=bar.STRETCH
                    ),
                widget.TextBox(
                    font='Font Awesome 5 Free Solid',
                    text="",
                    padding_y=-20,
                    foreground=colors_nord[15]
                    ),
                widget.PulseVolume(
                    foreground=colors_nord[15]
                    ),
                widget.Spacer(
                    length=10),
                widget.TextBox(
                    font='Font Awesome 5 Free Solid',
                    text="",
                    padding=2,
                    foreground=colors_nord[13]
                    ),
                widget.Spacer(
                    length=3),
                widget.Backlight(
                    padding=0,
                    backlight_name="intel_backlight",
                    foreground=colors_nord[13]
                    ),
                widget.Spacer(
                    length=10),
                widget.Systray(
                    icon_size=19,
                    # background="#2e3440.9",
                    margin=1
                    ),
                widget.Spacer(
                    length=10),
                widget.Battery(
                    format="{percent:2.0%}",
                    update_interval=5,
                    foreground=colors_nord[14]
                    ),
                # widget.GenPollText(
                #     update_interval=1,
                #     foreground=colors_nord[14],
                #     font="Font Awesome 5 Free Solid",
                #     func=lambda:
                #     subprocess.check_output("/home/ervin/.scripts/bat_icon").decode('utf-8')
                # ),
                widget.GenPollText(
                    update_interval=1,
                    foreground=colors_nord[14],
                    font="Font Awesome 5 Free Solid",
                    fontsize=11,
                    func=lambda:
                    subprocess.check_output("/home/ervin/.scripts/bat_charging_icon").decode('utf-8')
                ),
                widget.Spacer(
                    length=10),
                widget.TextBox(
                    text="",
                    font="Font Awesome 5 Free Solid",
                    mouse_callbacks=
                    {'Button1':
                        lambda:
                        subprocess.run('nwgbar')},
                    foreground=colors_nord[11]
                    ),
                widget.Spacer(
                    length=21),
            ],
            30,
            margin=5,
            background="#2e3440.9",
            opacity=1.0,
        ),
    ),
]

# Drag floating layouts.
mouse = [
    Drag([mod], "Button1", lazy.window.set_position_floating(),
         start=lazy.window.get_position()),
    Drag([mod], "Button3", lazy.window.set_size_floating(),
         start=lazy.window.get_size()),
    Click([mod], "Button2", lazy.window.bring_to_front())
]


@hook.subscribe.startup_once
def autostart():
    home = os.path.expanduser('~/.config/qtile/autostart.sh')
    subprocess.call([home])

follow_mouse_focus = True
bring_front_click = False
cursor_warp = False
floating_layout =layout.Floating(
    float_rules=[
        *layout.Floating.default_float_rules,
        Match(wm_class='confirmreset'),  # gitk
        Match(wm_class='makebranch'),  # gitk
        Match(wm_class='maketag'),  # gitk
        Match(wm_class='ssh-askpass'),  # ssh-askpass
        Match(title='branchdialog'),  # gitk
        Match(title='pinentry'),  # GPG key password entry
    ],
    border_color="#fff")
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True

# If things like steam games want to auto-minimize themselves when losing
# focus, should we respect this or not?
auto_minimize = True

# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the
# mailing lists, GitHub issues, and other WM documentation that suggest setting
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

Thanks for the detective work.

image image I believe I have found the culprit. If i leave just PulseVolume on the bar, qtile restarts randomly, no log, no anything. If i switch it to Volume, i can do whatever i want, reload or restart, nothing happens.

Does the same thing happen with the default config?

No. I will try to use PulseVolume with the default config and see what happens.

Master may also no longer have that stack trace appearing when doing lots of restarts because widget shutdown is handled better.

Sounds good. Feel free to reopen if you still have issues.