qtile / qtile

:cookie: A full-featured, hackable tiling window manager written and configured in Python (X11 + Wayland)
http://qtile.org
MIT License
4.81k stars 699 forks source link

Can't start qtile wayland from gdm #4942

Closed rmcmilli closed 3 months ago

rmcmilli commented 3 months ago

Issue description

I created a wayland session file per the docs at /usr/share/wayland-sessions/qtile-wayland.desktop.

[Desktop Entry]
Name=Qtile (Wayland)
Comment=Qtile Session
Exec=qtile start -b wayland
Type=Application
Keywords=wm;tiling

The entry shows up in gdm but trying to login immediately returns to the login screen.

I can launch qtile-x11 from gdm without issue with the xsession docs from the page above.

I can also launch qtile-wayland from tty with qtile start -b wayland.

Version

0.27.1.dev4-gff90e5cf.d20240728

Backend

Wayland (experimental)

Config

#   ___ _____ ___ _     _____    ____             __ _
#  / _ \_   _|_ _| |   | ____|  / ___|___  _ __  / _(_) __ _
# | | | || |  | || |   |  _|   | |   / _ \| '_ \| |_| |/ _` |
# | |_| || |  | || |___| |___  | |__| (_) | | | |  _| | (_| |
#  \__\_\|_| |___|_____|_____|  \____\___/|_| |_|_| |_|\__, |
#                                                      |___/

# Icons: https://fontawesome.com/search?o=r&m=free
## old python qtile version: 0.26.1.dev25+g29695c71.d20240625
import os
import re
import socket
import subprocess
import psutil
import json
from libqtile import hook
from libqtile import qtile
from typing import List
from libqtile import bar, layout, widget
from libqtile.config import (
    Click,
    Drag,
    Group,
    Key,
    Match,
    Screen,
    ScratchPad,
    DropDown,
    KeyChord,
)
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
from libqtile.utils import send_notification
from libqtile.widget import Spacer, Backlight
from libqtile.widget.image import Image
from libqtile.dgroups import simple_key_binder
from pathlib import Path
from libqtile.log_utils import logger

# from qtile_extras import widget
from qtile_extras.widget.decorations import RectDecoration
from qtile_extras.widget.decorations import PowerLineDecoration

# --------------------------------------------------------
# Your configuration
# --------------------------------------------------------

# Keyboard layout in autostart.sh

# Show wlan status bar widget (set to False if wired network)
# show_wlan = True
show_wlan = True

# Show bluetooth status bar widget
show_bluetooth = True
# show_bluetooth = False

# --------------------------------------------------------
# General Variables
# --------------------------------------------------------

# Get home path
home = str(Path.home())

# --------------------------------------------------------
# Check for Desktop/Laptop
# --------------------------------------------------------

# 3 = Desktop
platform = int(os.popen("cat /sys/class/dmi/id/chassis_type").read())

# --------------------------------------------------------
# Set default apps
# --------------------------------------------------------

# terminal = "alacritty"
# terminal = "gnome-terminal"
# terminal = "kitty -o allow_remote_control=yes"
# Define terminal based on compositor
if qtile.core.name == "x11":
    terminal = "kitty -o allow_remote_control=yes"
elif qtile.core.name == "wayland":
    # terminal = "foot"
    terminal = "kitty -o allow_remote_control=yes"
# --------------------------------------------------------
# Keybindings
# --------------------------------------------------------

mod = "mod4"  # SUPER KEY

keys = [
    # Focus
    Key([mod], "Left", lazy.layout.left(), desc="Move focus to left"),
    Key([mod], "Right", lazy.layout.right(), desc="Move focus to right"),
    Key([mod], "Down", lazy.layout.down(), desc="Move focus down"),
    Key([mod], "Up", lazy.layout.up(), desc="Move focus up"),
    Key(
        [mod],
        "space",
        lazy.layout.next(),
        desc="Move window focus to other window around",
    ),
    # Move
    Key(
        [mod, "shift"],
        "Left",
        lazy.layout.shuffle_left(),
        desc="Move window to the left",
    ),
    Key(
        [mod, "shift"],
        "Right",
        lazy.layout.shuffle_right(),
        desc="Move window to the right",
    ),
    Key([mod, "shift"], "Down", lazy.layout.shuffle_down(), desc="Move window down"),
    Key([mod, "shift"], "Up", lazy.layout.shuffle_up(), desc="Move window up"),
    # Swap
    Key([mod, "shift"], "h", lazy.layout.swap_left()),
    Key([mod, "shift"], "l", lazy.layout.swap_right()),
    # Key([mod], "Print", lazy.spawn(home + "/dotfiles/qtile/scripts/screenshot.sh")),
    # Size
    Key([mod, "control"], "Down", lazy.layout.shrink(), desc="Grow window to the left"),
    Key([mod, "control"], "Up", lazy.layout.grow(), desc="Grow window to the right"),
    Key([mod, "control"], "Left", lazy.layout.grow_left(), desc="Grow window to the left"),
    Key([mod, "control"], "Right", lazy.layout.grow_right(), desc="FGrow window to the right"),
    Key([mod, "control", "shift"], "Left", lazy.layout.client_to_previous(), desc="Focus previous stack"),
    Key([mod, "control", "shift"], "Right", lazy.layout.client_to_next(), desc="Focus next stack"),
    Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
    # Floating
    Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating"),
    # Split
    Key(
        [mod, "shift"],
        "Return",
        lazy.layout.toggle_split(),
        desc="Toggle between split and unsplit sides of stack",
    ),
    # Toggle Layouts
    Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
    # Fullscreen
    Key([mod], "f", lazy.window.toggle_fullscreen()),
    # System
    Key([mod], "q", lazy.window.kill(), desc="Kill focused window"),
    Key([mod, "shift"], "r", lazy.reload_config(), desc="Reload the config"),
    # Key([mod, "control"], "q", lazy.spawn(home + "/dotfiles/qtile/scripts/powermenu.sh"), desc="Open Powermenu"),
    Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
    # Apps
    Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
    Key([mod, "control"], "Return", lazy.spawn("rofi -show drun"), desc="Launch Rofi"),
    Key(
        [mod],
        "b",
        lazy.spawn(home + "/Documents/Projects/git/dotfiles/.settings/browser.sh"),
        desc="Launch Browser",
    ),
    # Key(
    #     [mod, "shift"],
    #     "w",
    #     lazy.spawn(
    #         home + "/Documents/Projects/git/dotfiles/qtile/scripts/wallpaper.sh"
    #     ),
    #     desc="Update Theme and Wallpaper",
    # ),
    # Key(
    #     [mod, "control"],
    #     "w",
    #     lazy.spawn(
    #         home + "/Documents/Projects/git/dotfiles/qtile/scripts/wallpaper.sh select"
    #     ),
    #     desc="Select Theme and Wallpaper",
    # ),
    # Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl -q s +20%")),
    # Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl -q s 20%-")),
    Key([], "Print", lazy.spawn("spectacle -r"), desc="Take Screenshot"),
    # System MGMT
    Key([], "XF86AudioRaiseVolume", lazy.widget["volume"].increase_vol()),
    Key([], "XF86AudioLowerVolume", lazy.widget["volume"].decrease_vol()),
    Key([], "XF86AudioMute", lazy.widget["volume"].mute()),
    Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl -d amdgpu_bl1 s +10")),
    Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl -d amdgpu_bl1 s 10-")),
    Key(
        [mod],
        "XF86AudioRaiseVolume",
        lazy.spawn("ddcutil setvcp 10 + 10 --sleep-multiplier .2 --bus 14"),
    ),
    Key(
        [mod],
        "XF86AudioLowerVolume",
        lazy.spawn("ddcutil setvcp 10 - 10 --sleep-multiplier .2 --bus 14"),
    ),
    # Key([mod], "l", lazy.spawn("slock")),
    # Key([mod], "l", lazy.spawn("/bin/bash /home/ronmcmilli/.local/bin/lock.sh")),
]

# --------------------------------------------------------
# Pywal Colors
# --------------------------------------------------------

colors = os.path.expanduser("~/.cache/wal/colors.json")
colordict = json.load(open(colors))
Color0 = colordict["colors"]["color0"]
Color1 = colordict["colors"]["color1"]
Color2 = colordict["colors"]["color2"]
Color3 = colordict["colors"]["color3"]
Color4 = colordict["colors"]["color4"]
Color5 = colordict["colors"]["color5"]
Color6 = colordict["colors"]["color6"]
Color7 = colordict["colors"]["color7"]
Color8 = colordict["colors"]["color8"]
Color9 = colordict["colors"]["color9"]
Color10 = colordict["colors"]["color10"]
Color11 = colordict["colors"]["color11"]
Color12 = colordict["colors"]["color12"]
Color13 = colordict["colors"]["color13"]
Color14 = colordict["colors"]["color14"]
Color15 = colordict["colors"]["color15"]

# --------------------------------------------------------
# Setup Layout Theme
# --------------------------------------------------------

layout_theme = {
    "border_width": 2,
    "margin": 15,
    "border_focus": Color2,
    "border_focus_stack": Color6,
    #    "border_focus": "FFFFFF",
    "border_normal": "CCCCCC",
    "single_border_width": 2,
}

# --------------------------------------------------------
# Layouts
# --------------------------------------------------------

layouts = [
    layout.MonadTall(**layout_theme),
    layout.Columns(**layout_theme, split=False),
    layout.MonadThreeCol(**layout_theme),
    # layout.Spiral(**layout_theme, new_client_position="bottom"),
    # layout.MonadWide(**layout_theme),
    layout.Max(**layout_theme),
    # layout.RatioTile(**layout_theme),
    # layout.Floating(),
]

# --------------------------------------------------------
# Setup Widget Defaults
# --------------------------------------------------------

widget_defaults = dict(
    # font="Fira Sans SemiBold",
    font="Source Code Pro, SauceCodePro Nerd Font",
    # font="Source Code Pro",
    fontsize=14,
    padding=3,
)
extension_defaults = widget_defaults.copy()

# --------------------------------------------------------
# Groups
# --------------------------------------------------------

groups = [
    Group("1", layout="monadthreecol", screen_affinity=1),
    Group("2", layout="monadthreecol", screen_affinity=1),
    Group("3", layout="monadthreecol", screen_affinity=1),
    Group("4", layout="columns", screen_affinity=1),
    Group("5", layout="monadtall", screen_affinity=0),
    Group("6", layout="monadtall", screen_affinity=0),
    Group("7", layout="monadtall", screen_affinity=0),
    Group("8", layout="monadtall", screen_affinity=0),
]

# dgroups_key_binder = simple_key_binder(mod)

# --------------------------------------------------------
# Group Boxes
# --------------------------------------------------------
groupbox1 = widget.GroupBox(
    visible_groups=['1', '2', '3', '4'],
    block_highlight_text_color="000000",
    foreground="ffffff",
    rounded=True,
    this_current_screen_border=Color2,
    active="ffffff",
    )
groupbox2 = widget.GroupBox(
    visible_groups=['5', '6', '7', '8'],
    block_highlight_text_color="000000",
    foreground="ffffff",
    rounded=True,
    this_current_screen_border=Color2,
    active="ffffff",
    )

# --------------------------------------------------------
# Scratchpads
# --------------------------------------------------------

groups.append(
    ScratchPad(
        "0",
        [
            DropDown(
                "Messages",
                # "sh -c 'XAPP_FORCE_GTKWINDOW_ICON=message firefox --class webapp-Messages3745 --profile $HOME/.local/share/ice/firefox/Messages3745 --no-remote http://messages.google.com'",
                "qutebrowser http://messages.google.com --target window",
                x=0.3,
                y=0.1,
                width=0.40,
                height=0.6,
                on_focus_lost_hide=False,
                match=Match(wm_class='qutebrowser'),
            ),  # webapp-manager
            # DropDown("gChat", "gtk-launch webapp-gChat6432", x=0.3, y=0.1, width=0.40, height=0.4, on_focus_lost_hide=False ),
            DropDown(
                "gChat",
                # "sh -c 'XAPP_FORCE_GTKWINDOW_ICON=webapp-manager firefox --class WebApp-gChat6432 --profile $HOME/.local/share/ice/firefox/gChat6432 --no-remote http://chat.google.com'",
                "qutebrowser http://chat.google.com --target window",
                x=0.3,
                y=0.1,
                width=0.40,
                height=0.6,
                on_focus_lost_hide=False,
                match=Match(wm_class='qutebrowser'),
            ),
            # DropDown("chatgpt", "chromium --app=https://chat.openai.com", x=0.3, y=0.1, width=0.40, height=0.6, on_focus_lost_hide=False ),
            # DropDown("mousepad", "mousepad", x=0.3, y=0.1, width=0.40, height=0.4, on_focus_lost_hide=False ),
            # DropDown(
            #     "terminal",
            #     # "kitty",
            #     lazy.spawn(terminal),
            #     x=0.3,
            #     y=0.1,
            #     width=0.40,
            #     height=0.6,
            #     on_focus_lost_hide=False,
            # ),
            DropDown(
                "terminal",
                "kitty",
                x=0.3,
                y=0.1,
                width=0.40,
                height=0.6,
                on_focus_lost_hide=False,
            ),
            DropDown(
                "terminal2",
                "foot",
                x=0.3,
                y=0.1,
                width=0.40,
                height=0.6,
                on_focus_lost_hide=False,
            ),
            DropDown("scrcpy", "scrcpy --tcpip=100.81.200.106", x=0.8, y=0.05, width=0.15, height=0.6, on_focus_lost_hide=False ),
        ],
    )
)

keys.extend(
    [
        Key([mod, "shift"], "C", lazy.group["0"].dropdown_toggle("gChat")),
        Key([mod, "shift"], "M", lazy.group["0"].dropdown_toggle("Messages")),
        Key([mod], "F11", lazy.group["0"].dropdown_toggle("mousepad")),
        Key([mod, "shift"], "T", lazy.group["0"].dropdown_toggle("terminal")),
        Key([mod, "shift"], "p", lazy.group["0"].dropdown_toggle("scrcpy")),
    ]
)

# Define settings based on compositor
if qtile.core.name == "x11":
    keys.extend(
        [
            Key([mod, "shift"], "T", lazy.group["0"].dropdown_toggle("terminal")),
            Key(
                [mod, "shift"],
                "w",
                lazy.spawn(
                    home + "/Documents/Projects/git/dotfiles/qtile/scripts/wallpaper.sh"
                ),
                desc="Update Theme and Wallpaper",
            ),
            Key(
                [mod, "control"],
                "w",
                lazy.spawn(
                    home + "/Documents/Projects/git/dotfiles/qtile/scripts/wallpaper.sh select"
                ),
                desc="Update Theme and Wallpaper",
            ),
            # Key([mod], "l", lazy.spawn("/bin/bash /home/ronmcmilli/.local/bin/lock.sh")),
            Key([mod], "l", lazy.spawn("xset s activate")),
        ]
    )
elif qtile.core.name == "wayland":
    keys.extend(
        [
            # Key([mod, "shift"], "T", lazy.group["0"].dropdown_toggle("terminal2")),
            Key([mod, "shift"], "T", lazy.group["0"].dropdown_toggle("terminal")),
            Key(
                [mod, "shift"],
                "w",
                lazy.spawn(
                    home + "/Documents/Projects/git/dotfiles/qtile/scripts/wallpaper-wayland.sh"
                ),
                desc="Update Theme and Wallpaper",
            ),
            Key(
                [mod, "control"],
                "w",
                lazy.spawn(
                    home + "/Documents/Projects/git/dotfiles/qtile/scripts/wallpaper-wayland.sh select"
                ),
                desc="Update Theme and Wallpaper",
            ),
            Key([mod], "l", lazy.spawn("/bin/bash /home/ronmcmilli/.local/bin/lock-wayland.sh")),
            # Key([mod], "l", lazy.spawn("xset s activate")),
        ]
    )

# --------------------------------------------------------
# Decorations
# https://qtile-extras.readthedocs.io/en/stable/manual/how_to/decorations.html
# --------------------------------------------------------

decor_left = {
    "decorations": [
        PowerLineDecoration(
            # path="arrow_left"
            # path="rounded_left"
            # path="forward_slash"
            path="back_slash"
        )
    ],
}

decor_right = {
    "decorations": [
        PowerLineDecoration(
            # path="arrow_right"
            # path="rounded_right"
            path="forward_slash"
            # path="back_slash"
        )
    ],
}

decoration_group_white = {
    "decorations": [
        RectDecoration(
            colour="ffffff.6",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group1 = {
    "decorations": [
        RectDecoration(
            colour=Color1 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group2 = {
    "decorations": [
        RectDecoration(
            colour=Color2 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group3 = {
    "decorations": [
        RectDecoration(
            colour=Color3 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group4 = {
    "decorations": [
        RectDecoration(
            colour=Color4 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group6 = {
    "decorations": [
        RectDecoration(
            colour=Color6 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 6,
}

decoration_group8 = {
    "decorations": [
        RectDecoration(
            colour=Color8 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group9 = {
    "decorations": [
        RectDecoration(
            colour=Color9 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group10 = {
    "decorations": [
        RectDecoration(
            colour=Color10 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

decoration_group12 = {
    "decorations": [
        RectDecoration(
            colour=Color12 + ".9",
            radius=10,
            filled=True,
            padding_y=4,
            group=True,
        )
    ],
    "padding": 10,
}

# --------------------------------------------------------
# Widgets
# --------------------------------------------------------

widget_list_split_1 = [
    widget.TextBox(
        **decoration_group1,
        text="Apps",
        foreground="ffffff",
        desc="",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("rofi -show drun")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.TextBox(
        **decoration_group_white,
        text="󰚢",
        foreground="000000.6",
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                "sh -c 'XAPP_FORCE_GTKWINDOW_ICON=webapp-manager firefox ---class webapp-Messages3745 --profile $HOME/.local/share/ice/firefox/Messages3745 --no-remote http://messages.google.com'"
            )
        },
    ),
    widget.TextBox(
        **decoration_group_white,
        text=" ",
        foreground="000000.6",
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                "bash " + home + "/Documents/Projects/git/dotfiles/.settings/browser.sh"
            )
        },
    ),
    widget.TextBox(
        **decoration_group_white,
        text="  ",
        foreground="000000.6",
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                "bash "
                + home + "/Documents/Projects/git/dotfiles/.settings/filemanager.sh"
            )
        },
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.WindowName(
        **decoration_group2,
        max_chars=18,
        width=170,
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Mpris2(
        **decoration_group3,
        fmt="   {}",
        stopped_text="Stopped",
        scroll=True,
        width=160,
    ),
    widget.Sep(
        linewidth=0,
        padding=0,
    ),
    widget.Spacer(),
    groupbox2,
    widget.Spacer(),
    # widget.TextBox(
    # ),
    widget.Sep(
        linewidth=0,
        padding=0,
    ),
    # widget.Systray(
    widget.StatusNotifier(
        # background='00000000',
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.TextBox(
        **decoration_group3,
        text="󰎟",
        width=34,
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn("dunstctl history-pop", shell=True),
            "Button3": lambda: qtile.cmd_spawn("dunstctl close-all", shell=True),
        },
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Memory(
        **decoration_group10,
        measure_mem="G",
        format="  {MemUsed:.0f}{mm}/{MemTotal:.0f}{mm}",
        # format="  {MemUsed:.0f}{mm} ({MemTotal:.0f}{mm})",
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Volume(
        **decoration_group12,
        fmt=" : {}",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("pavucontrol")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    # widget.Bluetooth(
        # **decoration_group2,
    #     mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("blueman-manager")},
    #     default_text="{num_connected_devices} ",
    #     fontsize="14",
    #     fmt="󰂯 {}",
    # ),
    # widget.Sep(
    #     linewidth=0,
    # ),
    widget.NetGraph(
        **decoration_group4,
        graph_color="000000",
        fill_color=Color10 + ".4",
        border_width=0,
        margin_x=5,
        margin_y=5,
        line_width=1,
        width=30,
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("nm-connection-editor")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Clock(
        **decoration_group4,
        format=" %I:%M %p",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("gnome-calendar")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.CurrentLayoutIcon(
        **decoration_group6,
        fmt="{}",
        scale=0.6,
    ),
    widget.WindowCount(
        **decoration_group6,
    ),
    widget.Sep(
        linewidth=0,
    ),
    # widget.UPowerWidget(
        # **decoration_group6,
    #     battery_height=15,
    #     battery_width=25,
    #     margin=8,
    # ),
    widget.Battery(
        **decoration_group8,
        charge_char="󰂐",
        discharge_char="󰂍",
        empty_char="󰂎",
        format="{char} {percent:2.0%} {hour:d}h{min:02d}m",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("gnome-power-statistics")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.TextBox(
        **decoration_group2,
        text="",
        width=38,
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                home + "/Documents/Projects/git/dotfiles/qtile/scripts/powermenu.sh"
            )
        },
    ),
]

widget_list_split_2 = [
    widget.TextBox(
        **decoration_group1,
        text="Apps",
        foreground="ffffff",
        desc="",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("rofi -show drun")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.TextBox(
        **decoration_group_white,
        text="󰚢",
        foreground="000000.6",
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                "sh -c 'XAPP_FORCE_GTKWINDOW_ICON=webapp-manager firefox ---class webapp-Messages3745 --profile $HOME/.local/share/ice/firefox/Messages3745 --no-remote http://messages.google.com'"
            )
        },
    ),
    widget.TextBox(
        **decoration_group_white,
        text=" ",
        foreground="000000.6",
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                "bash " + "$HOME/Documents/Projects/git/dotfiles/.settings/browser.sh"
            )
        },
    ),
    widget.TextBox(
        **decoration_group_white,
        text="  ",
        foreground="000000.6",
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                "bash "
                + "$HOME/Documents/Projects/git/dotfiles/.settings/filemanager.sh"
            )
        },
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.WindowName(
        **decoration_group2,
        max_chars=18,
        width=170,
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Mpris2(
        **decoration_group3,
        fmt="   {}",
        stopped_text="Stopped",
        scroll=True,
        width=160,
    ),
    widget.Sep(
        linewidth=0,
        padding=0,
    ),
    widget.Spacer(),
    groupbox1,
    widget.Spacer(),
    # widget.TextBox(
    # ),
    widget.Sep(
        linewidth=0,
        padding=0,
    ),
    # widget.Systray(
    widget.StatusNotifier(
        # background='00000000',
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.TextBox(
        **decoration_group3,
        text="󰎟",
        width=34,
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn("dunstctl history-pop", shell=True),
            "Button3": lambda: qtile.cmd_spawn("dunstctl close-all", shell=True),
        },
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Memory(
        **decoration_group10,
        measure_mem="G",
        format="  {MemUsed:.0f}{mm}/{MemTotal:.0f}{mm}",
        # format="  {MemUsed:.0f}{mm} ({MemTotal:.0f}{mm})",
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Volume(
        **decoration_group12,
        fmt=" : {}",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("pavucontrol")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    # widget.Bluetooth(
        # **decoration_group2,
    #     mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("blueman-manager")},
    #     default_text="{num_connected_devices} ",
    #     fontsize="14",
    #     fmt="󰂯 {}",
    # ),
    # widget.Sep(
    #     linewidth=0,
    # ),
    widget.NetGraph(
        **decoration_group4,
        graph_color="000000",
        fill_color=Color10 + ".4",
        border_width=0,
        margin_x=5,
        margin_y=5,
        line_width=1,
        width=30,
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("nm-connection-editor")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.Clock(
        **decoration_group4,
        format=" %I:%M %p",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("gnome-calendar")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.CurrentLayoutIcon(
        **decoration_group6,
        fmt="{}",
        scale=0.6,
    ),
    widget.WindowCount(
        **decoration_group6,
    ),
    widget.Sep(
        linewidth=0,
    ), 
    # widget.UPowerWidget(
        # **decoration_group6,
    #     battery_height=15,
    #     battery_width=25,
    #     margin=8,
    # ),
    widget.Battery(
        **decoration_group8,
        charge_char="󰂐",
        discharge_char="󰂍",
        empty_char="󰂎",
        format="{char} {percent:2.0%} {hour:d}h{min:02d}m",
        mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("gnome-power-statistics")},
    ),
    widget.Sep(
        linewidth=0,
    ),
    widget.TextBox(
        **decoration_group2,
        text="",
        width=38,
        fontsize=18,
        mouse_callbacks={
            "Button1": lambda: qtile.cmd_spawn(
                home + "/Documents/Projects/git/dotfiles/qtile/scripts/powermenu.sh"
            )
        },
    ),
]

# Hide Modules if not on laptop
# if show_wlan == False:
#     del widget_list[13:14]

# if show_bluetooth == False:
#     del widget_list[12:13]

# --------------------------------------------------------
# User Functions
# --------------------------------------------------------
## https://docs.qtile.org/en/latest/manual/faq.html#how-can-i-get-my-groups-to-stick-to-screens
def go_to_group(name: str):
    def _inner(qtile):
        if len(qtile.screens) == 1:
            qtile.groups_map[name].toscreen()
            return

        if name in '1234':
            # qtile.focus_screen(0)
            qtile.focus_screen(1)
            qtile.groups_map[name].toscreen()
        else:
            # qtile.focus_screen(1)
            qtile.focus_screen(0)
            qtile.groups_map[name].toscreen()

    return _inner

for i in groups:
    keys.append(Key([mod], i.name, lazy.function(go_to_group(i.name))))

def go_to_group_and_move_window(name: str):
    def _inner(qtile):
        if len(qtile.screens) == 1:
            qtile.current_window.togroup(name, switch_group=True)
            return

        if name in "1234":
            qtile.current_window.togroup(name, switch_group=False)
            # qtile.focus_screen(0)
            qtile.focus_screen(1)
            qtile.groups_map[name].toscreen()
        else:
            qtile.current_window.togroup(name, switch_group=False)
            # qtile.focus_screen(1)
            qtile.focus_screen(0)
            qtile.groups_map[name].toscreen()

    return _inner

for i in groups:
    keys.append(Key([mod, "shift"], i.name, lazy.function(go_to_group_and_move_window(i.name))))

def init_widgets_screen1():
    widgets_screen1 = widget_list_split_1
    # if len(qtile.screens) > 1:
    #     del widgets_screen1[15:17]
    return widgets_screen1

def init_widgets_screen2():
    widgets_screen2 = widget_list_split_2
    # del widgets_screen2[15:17]
    return widgets_screen2

# --------------------------------------------------------
# Screens
# --------------------------------------------------------

screens = [
    ## Screen-0 Laptop Screen
    Screen(
        top=bar.Bar(
            init_widgets_screen1(),
            40,
            padding=20,
            opacity=0.95,
            border_width=[0, 0, 0, 0],
            margin=[10, 15, 0, 15],
            background="#00000000",
        ),
    ),
    ## Screens 1+ Other screens
    Screen(
        top=bar.Bar(
            init_widgets_screen2(),
            40,
            padding=20,
            opacity=0.95,
            border_width=[0, 0, 0, 0],
            margin=[10, 15, 0, 15],
            background="#00000000",
        ),
    ),
]

# --------------------------------------------------------
# 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()),
]

# --------------------------------------------------------
# Define floating layouts
# --------------------------------------------------------qqq

floating_layout = layout.Floating(
    border_width=2,
    border_focus=Color2,
    border_normal="FFFFFF",
    float_rules=[
        # Run the utility of `xprop` to see the wm class and name of an X client.
        *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
        Match(wm_class="blueman-manager"),  # Bluetooth manager
        Match(wm_class="pavucontrol"),  # Audio Output Manager
        Match(wm_class="gnome-power-statistics"),  # Power stats
        Match(wm_class="gnome-calendar"),  # Calendar
    ],
)

# --------------------------------------------------------
# General Setup
# --------------------------------------------------------

dgroups_app_rules = []  # type: list
follow_mouse_focus = True
# follow_mouse_focus = False
# bring_front_click = False
bring_front_click = True
cursor_warp = False
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.

# --------------------------------------------------------
# Windows Manager Name
# --------------------------------------------------------

wmname = "QTILE"
# --------------------------------------------------------
# Hooks
# --------------------------------------------------------

# HOOK startup
@hook.subscribe.startup_once
def autostart():
# Define autostart based on compositor
    # autostartscript = "/home/ronmcmilliE/.config/qtile/autostart.sh"
    if qtile.core.name == "x11":
        autostartscript = "/home/ronmcmilli/.config/qtile/autostart.sh"
    elif qtile.core.name == "wayland":
        autostartscript = "/home/ronmcmilli/.config/qtile/autostart-wayland.sh"
    home = os.path.expanduser(autostartscript)
    subprocess.Popen([home])

# HOOK Sleep
# @hook.subscribe.suspend
# def lock_on_sleep():
# # Define autostart based on compositor
#     # autostartscript = "/home/ronmcmilliE/.config/qtile/autostart.sh"
#     if qtile.core.name == "x11":
#         qtile.spawn("/home/ronmcmilli/.local/bin/lock.sh")
#     elif qtile.core.name == "wayland":
#         qtile.spawn("/home/ronmcmilli/.local/bin/lock-wayland.sh")
#     # qtile.spawn("slock")
#     # qtile.spawn("/home/ronmcmilli/.local/bin/lock.sh")
# def pause_notifs():
    # lazy.spawn("dunstctl set-paused true")

# # HOOK screens reconfigured
# @hook.subscribe.screens_reconfigured
# def screen_reconf():
#     qtile.spawn("xrandr --output DP-3 --auto --above eDP-1")
    # lazy.reload_config(),
    # if len(qtile.screens) > 1:
    #     groupbox1.visible_groups = ['1', '2', '3','4']
    # else:
    #     groupbox1.visible_groups = ['1', '2', '3', '4', '5', '6', '7', '8']
    # if hasattr(groupbox1, 'bar'):
    #     groupbox1.bar.draw()
    # send_notification("qtile", "Screens have been reconfigured")
    # qtile.cmd_spawn("notify-send Screens have been reconfigured")
    # lazy.reload_config()

# def screen_reconf():
# async def _():
@hook.subscribe.screens_reconfigured
def screen_reconf():
    # lazy.reload_config()
    if len(qtile.screens) > 1:
    #     ## Laptop screen
        groupbox2.visible_groups = ['5', '6', '7','8']
        widget_list_split_1 = widget_list_split_1.remove(widget.Systray)
    #     # lambda 
        if hasattr(groupbox1, 'bar'):
            groupbox1.bar.draw()
        if hasattr(groupbox2, 'bar'):
            groupbox2.bar.draw()
    else:
        ## Laptop screen
        groupbox2.visible_groups = ['1', '2', '3', '4', '5', '6', '7', '8']
        if hasattr(groupbox2, 'bar'):
            groupbox2.bar.draw()
    # if hasattr(groupbox2, 'bar'):
    #     groupbox2.bar.draw()
    # if hasattr(groupbox1, 'bar'):
    #     groupbox1.bar.draw()
        # pass
    # lazy.reload_config()
    # qtile.cmd_spawn("/home/ronmcmilli/Documents/Projects/git/dotfiles/qtile/scripts/wallpaper.sh init")
    qtile.cmd_spawn("dunstify 'Screens have been reconfigured'")

@hook.subscribe.screen_change
def screen_change(enent, qtile):
    # qtile.reconfigure_screens()
    # widget_list_split_1.remove('Systray')
    qtile.reconfigure_screens()

@hook.subscribe.startup
def start_applets():
    qtile.reconfigure_screens()
    # qtile.spawn("nm-applet")
    qtile.spawn("killall blueman-applet")
    qtile.spawn("blueman-applet")

Logs

No response

Required

rmcmilli commented 3 months ago

I use the github version, the wayland-session file wasn't pointing at the proper location in ~.local/bin. Once I fixed that I was able to login.