我大约一周以来一直在尝试安装 arch 和 Qtile,但问题是每次安装它时,即使我用我想要的内容更改文件 default_config.py,当我重新启动时它也会显示 qtile 的默认配置。
我不知道为什么会发生这种情况,因为我尝试编译文件 config.py 并且它在 sintaxis 或其他任何东西上都没有显示问题。
我在这里留下我的配置:
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 = '
答案1
您需要将 /usr/share/doc/qtile/default_config.py 复制到 /home/yournameuser/.config/qtile/config.py 我按顺序提供了您需要的命令:
mkdir -p /home/yourusername/.config/qtile/
cp /usr/share/doc/qtile/default_config.py /home/yourusername/.config/qtile/config.py
(您必须安装“qtile”软件包)