0

I have been trying since about a week with installing arch and Qtile, but the problem is that everytime I install it, even if I change the file default_config.py with what i want, when i reboot it shows the default config of qtile.

I don't know why it happens cause i tried compiling the file config.py and it doesn't show a problem on sintaxis nor anything else.

I leave here my config:

import os
import re
import json
import socket
import subprocess
from os import listdir
from os import path

from typing import List  # noqa: F401

from libqtile.command import lazy

from libqtile import layout, bar, widget, hook

from libqtile.config import Key, Screen, Group, Drag, Click

qtile_path= path.join(path.expanduser("~"), ".config", "qtile")

icons_path= path.join(qtile_path, "icons")

img = {}

# map image name to its path
img_path = path.join(qtile_path, "img")
for i in listdir(img_path):
    img[i.split(".")[0]] = path.join(img_path, i)

mod = "mod4"                                            # Set the mod key as SUPER/WINDOWS
myTerm = "alacritty"                                    # My terminal of choice
myConfig = path.join(qtile_path, "config.py")           # The Qtile config file location
#"/home/bluetrainer/.config/qtile/config.py"    

colors = [ [
        "#0f101a",
        "#0f101a"
    ],
     [
        "#5c5c5c",
        "#5c5c5c"
    ],
     [
        "#f1ffff",
        "#f1ffff"
    ],
    [
        "#F07178",
        "#F07178"
    ],
    [
        "#a151d3",
        "#a151d3"
    ],
     [
    "#282a36", 
    "#282a36"
    ], # panel background
     [
    "#434758",
    "#434758"
    ], # background for current screen tab
     [
    "#ffffff", 
    "#ffffff"
    ], # font color for group names
    [
    "#ff5555",
    "#ff5555"
    ], # border line color for current tab
    [
    "#8d62a9", 
    "#8d62a9"
    ], # border line color for other tab and odd widgets
     [
    "#668bd7",
    "#668bd7"
    ], # color for the even widgets
     [
    "#e1acff",
    "#e1acff"
    ] # window name
]

keys = [
     ### The essentials MOD4 + CONTROL + KEY
         Key(
             [mod, "control"], "o",
             lazy.shutdown(),
             desc='Shutdown pc'
             ),
         Key(
             [mod, "control"], "k",
             lazy.window.kill(),
             desc='Kill active window'
             ),
         Key(
             [mod, "control"], "r",
             lazy.restart(),
             desc='Restart Qtile'
             ),
         Key(
             [mod], "Tab",
             lazy.next_layout(),
             desc='Toggle through layouts'
             ),

    ### Switch focus to specific monitor (out of two) MOD4 + SHIFT + CONTROL + KEY
         Key([mod, "shift", "control"], "q",
             lazy.to_screen(0),
             desc='Keyboard focus to monitor 1'
             ), 
         Key([mod, "shift", "control"], "w",
             lazy.to_screen(1),
             desc='Keyboard focus to monitor 2'
             ), 
    ### Switch focus of monitors MOD4 + . / MOD4 + ,
         Key([mod], "period",
             lazy.next_screen(),
             desc='Move focus to next monitor'
             ),
         Key([mod], "comma",
             lazy.prev_screen(),
             desc='Move focus to prev monitor'
             ),
    ### Treetab controls MOD4 + CONTROL + U /J
         Key([mod, "control"], "u",
             lazy.layout.section_up(),
             desc='Move up a section in treetab'
             ),
         Key([mod, "control"], "j",
             lazy.layout.section_down(),
             desc='Move down a section in treetab'
             ),
    ### Window controls MOD4 + SHIFT + KEY
         Key(
             [mod, "shift"], "s",
             lazy.layout.down(),
             desc='Move focus down in current stack pane'
             ),
         Key(
             [mod, "shift"], "w",
             lazy.layout.up(),
             desc='Move focus up in current stack pane'
             ),
         Key(
             [mod, "shift"], "d",
             lazy.layout.right(),
             desc='Move focus right in current stack pane'
             ),
         Key(
             [mod, "shift"], "a",
             lazy.layout.left(),
             desc='Move focus left in current stack pane'
             ),
         Key(
             [mod, "shift"], "d",
             lazy.layout.shuffle_down(),
             desc='Move windows down in current stack'
             ),
         Key(
             [mod, "shift"], "e",
             lazy.layout.shuffle_up(),
             desc='Move windows up in current stack'
             ),
         Key(
             [mod, "shift"], "n",
             lazy.layout.normalize(),
             desc='normalize window size ratios'
             ),
         Key(
             [mod, "shift"], "m",
             lazy.layout.maximize(),
             desc='toggle window between minimum and maximum sizes'
             ),
         Key(
             [mod, "shift"], "f",
             lazy.window.toggle_floating(),
             desc='toggle floating'
             ),

     ### Stack controls
         Key(
             [mod, "shift"], "space",
             lazy.layout.rotate(),
             lazy.layout.flip(),
             desc='Switch which side main pane occupies (XmonadTall)'
             ),
         Key(
             [mod, "control"], "space",
             lazy.layour.rotate(),
             desc='Swap panes of split stack'
             ),
         Key(
             [mod], "space",
             lazy.layout.next(),
             desc='Switch window focus to other pane(s) of stack'
             ),
         Key(
             [mod, "control"], "Return",
             lazy.layout.toggle_split(),
             desc='Toggle between split and unsplit sides of stack'
             ),
     ### Dmenu scripts launched with ALT + CTRL + KEY
         Key(
             ["mod1", "control"], "b",
             lazy.spawn("firefox"),
             desc='Starts firefox browser'
             ),
         Key(
             ["mod1", "control"], "f",
             lazy.spawn("thunar"),
             desc='Starts firefox browser'
             ),
         Key(
             ["mod1", "control"], "Return",
             lazy.spawn(myTerm),
             desc='Launches Terminal'
             ),
             # ------------ Hardware Configs ------------

    # Volume
    Key([], "XF86AudioLowerVolume", lazy.spawn(
        "pactl set-sink-volume @DEFAULT_SINK@ -5%"
    )),
    Key([], "XF86AudioRaiseVolume", lazy.spawn(
        "pactl set-sink-volume @DEFAULT_SINK@ +5%"
    )),
    Key([], "XF86AudioMute", lazy.spawn(
        "pactl set-sink-mute @DEFAULT_SINK@ toggle"
    )),

    #Brightness
    Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl set +10%")),
    Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl set 10%-"))
]

#GROUPS

groups = [Group(i) for i in ["NET", "DEV", "TERM", "FILE", "MEDIA", "MISC"]]

for i, group in enumerate(groups):
    # Each workspace is identified by a number starting at 1
    actual_key = str(i + 1)
    keys.extend([
        # Switch to workspace N (actual_key)
        Key([mod], actual_key, lazy.group[group.name].toscreen()),
        # Send window to workspace N (actual_key)
        Key([mod, "shift"], actual_key, lazy.window.togroup(group.name))
    ])

# for i in groups:
    # keys.extend([
        # # mod1 + letter of group = switch to group
        # Key([mod], i.name, lazy.group[i.name].toscreen()),

        # # mod1 + shift + letter of group = switch to & move focused window to group
        # Key([mod, "shift"], i.name, lazy.window.togroup(i.name)),
    # ])

#LAYOUTS

layout_theme = {"border_width" : 1,
                "margin" : 4,
                "border_focus" : colors[3][0], 
                "border_normal": colors[4][0]
                }

layouts = [
    layout.Max(**layout_theme),
    layout.MonadTall(**layout_theme),
    layout.MonadWide(**layout_theme),
    layout.Matrix(columns=2, **layout_theme),
    layout.VerticalTile(border_width= 2,
                margin= 6,
                border_focus= colors[3][0], 
                border_normal= colors[0][0], 
                name= "verticaltile"
                ),
    layout.Floating(**layout_theme),
    layout.Tile(shift_windows = True, **layout_theme),
    layout.Stack(num_stacks = 2)
]


#WIDGETS

# Reusable configs for displaying different widgets on different screens
def base(fg=2, bg=0):
    return {
        'foreground': colors[fg][0],
        'background': colors[bg][0]
    }


sep={
    **base(),
    'linewidth': 0,
    'padding': 5,
}
group_box={
    **base(),
    'font': 'Ubuntu Bold',
    'fontsize': 10,
    'margin_y': 5,
    'margin_x': 0,
    'padding_y': 8,
    'padding_x': 5,
    'borderwidth': 1,
    'active': colors[2][0],
    'inactive': colors[2][0],
    'rounded': False,
    'highlight_method': 'block',
    'this_current_screen_border': colors[3][0],
    'this_screen_border': colors[1][0],
    'other_current_screen_border': colors[0][0],
    'other_screen_border': colors[0][0]
}
window_name={
    **base(fg='primary'),
    'font': 'Ubuntu Bold',
    'fontsize': 11,
    'padding': 5
}
systray={
    'background': colors[0][0],
    'padding': 5
}
text_box={
    'font': 'Ubuntu Bold',
    'fontsize': 15,
    'padding': 5
}
pacman={
    'execute' : "alacritty",
    'update_interval' : 1800,
    'foreground' : colors[2][0],
    'background' : colors[0][0]
}
net={
    'interface' : "wlp2s0",
    'format' : "{down} ↓↑ {up}",
    'foreground' : colors[2][0],
    'background' : colors[0][0],
    'padding' : 5
}
current_layout_icon={
    'custom_icon_paths' : [icons_path],
    'foreground' :  colors[2][0],
    'background' : colors[0][0],
    'padding' : 0,
    'scale' : 0.7
}
current_layout={
    'foreground' : colors[3][0],
    'background' : colors[4][0],
    'padding' : 5
}
clock ={
    'format' : "%A, %B %d  [ %H:%M ]"
}


def workspaces():
    return [
        widget.Sep(**separator),
        widget.GroupBox(**group_box),
        widget.Sep(**separator),
        widget.WindowName(**window_name)
    ]

def powerline_base():
    return [
        widget.CurrentLayoutIcon(
            **base(bg = 4),
            **current_layout_icon
        ),
        widget.CurrentLayout(
            **base(bg = 4),
            **current_layout
        ),
        widget.Image(
            filename = img[3][0]
        ),
        widget.TextBox(
            **base(bg = 3),
            **text_box,
            text = ' 🕒'
        ),
        widget.Clock(
            **base(bg=3),
            **clock
        )
    ]

laptop_widgets = [
    *workspaces(),

    widget.Sep(
        **separator
    ),
    widget.Systray(
        **systray
    ),
    widget.Sep(
        **separator
    ),
    widget.Image(
       filename = img['bg-to-secondary']
    ),
    widget.TextBox(
        **base(bg=4),
        **text_box,
        text = ' ⟳'
    ),
    widget.Pacman(
        **base(bg=4),
        **pacman
    ),
    widget.Image(
        filename = img[3]
    ),
    widget.TextBox(
        **base(bg=3),
        **text_box,
        text = ' ↯'
    ),
    widget.Net(
        **base(bg=3),
        **net
    ),
    widget.Image(
        filename = img[4]
    ),
    *powerline_base()
 ]

monitor_widgets = [
    *workspaces(),
    widget.Image(
        filename = img['bg-to-secondary']
    ),
    *powerline_base()
]

widget_defaults = {
    'font': 'Ubuntu Mono',
    'fontsize': 13,
    'padding': 2
}

extension_defaults = widget_defaults.copy()

#SCREENS

screens = [
    Screen(top=bar.Bar(laptop_widgets, 24, opacity=0.95))
]

# check connected monitors
monitors_status = subprocess.run(
    "xrandr | grep 'connected' | cut -d ' ' -f 2",
    shell=True,
    stdout=subprocess.PIPE
).stdout.decode("UTF-8").split("\n")[:-1]

if monitors_status.count("connected") == 2:
    screens.append(
        Screen(top=bar.Bar(monitor_widgets, 24, opacity=0.95))
    )

# screens = [
    # Screen(
        # bottom=bar.Bar(
            # [
                # widget.GroupBox(),
                # widget.Prompt(),
                # widget.WindowName(),
                # widget.TextBox("default config", name="default"),
                # widget.Systray(),
                # widget.Clock(format='%Y-%m-%d %a %I:%M %p'),
            # ],
            # 24,
        # ),
    # ),
# ]

#MOUSE

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


#OTHER STUFF

dgroups_key_binder = None
dgroups_app_rules = []  # type: List
main = None
follow_mouse_focus = True
bring_front_click = fALSE
cursor_warp = False

##### FLOATING WINDOWS #####
floating_layout = layout.Floating(float_rules=[
        {'wmclass': 'confirm'},
        {'wmclass': 'dialog'},
        {'wmclass': 'download'},
        {'wmclass': 'error'},
        {'wmclass': 'file_progress'},
        {'wmclass': 'notification'},
        {'wmclass': 'splash'},
        {'wmclass': 'toolbar'},
        {'wmclass': 'confirmreset'},  # gitk
        {'wmclass': 'makebranch'},  # gitk
        {'wmclass': 'maketag'},  # gitk
        {'wname': 'branchdialog'},  # gitk
        {'wname': 'pinentry'},  # GPG key password entry
        {'wmclass': 'ssh-askpass'},  # ssh-askpass
    ], 
    border_focus=colors[4][0]
)
auto_fullscreen = True
focus_on_window_activation = "smart"

##### STARTUP APPLICATIONS #####
@hook.subscribe.startup_once
def startup():
    #home = os.path.expanduser('~')
    script = path.join(qtile_path, "autostart.sh")
    #subprocess.call([home + '/.config/qtile/autostart.sh'])
    subprocess.call([script])

# 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"

Can somebody tell me what is the problem? Have I need to install something more than just "qtile" and lightdm lightdm-gtk-greeter lightdm-gtk-greeter-config and begin lightdm.service?

Thank you for your time :)

1 Answer 1

0

you need to copy /usr/share/doc/qtile/default_config.py to /home/yournameuser/.config/qtile/config.py I let you the comands that you need in order: mkdir -p /home/yourusername/.config/qtile/

cp /usr/share/doc/qtile/default_config.py /home/yourusername/.config/qtile/config.py

(you must have installed the package "qtile")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .