Continue work
This commit is contained in:
parent
499f4c3a57
commit
f5d6e3dae1
304
qtile/config.py
304
qtile/config.py
|
@ -1,168 +1,70 @@
|
||||||
from libqtile import bar
|
from libqtile import bar, layout
|
||||||
from libqtile import hook
|
from qtile_extras import widget
|
||||||
from libqtile import layout
|
from libqtile.config import Click, Drag, Group, Key, Match, Screen
|
||||||
from libqtile import widget
|
from libqtile.lazy import lazy
|
||||||
from libqtile.command import lazy
|
|
||||||
from libqtile.config import Click
|
|
||||||
from libqtile.config import Drag
|
|
||||||
from libqtile.config import Group
|
|
||||||
from libqtile.config import Key
|
|
||||||
from libqtile.config import Screen
|
|
||||||
from libqtile.utils import guess_terminal
|
from libqtile.utils import guess_terminal
|
||||||
|
from qtile_extras.widget.decorations import PowerLineDecoration
|
||||||
# this import requires python-xlib to be installed
|
|
||||||
from Xlib import display as xdisplay
|
|
||||||
|
|
||||||
|
|
||||||
class Colors:
|
class Colors:
|
||||||
background = "#1f2430"
|
background = "#1f2430"
|
||||||
accent = "#002F5F"
|
accent = "#002F5F"
|
||||||
|
|
||||||
|
|
||||||
panel_height = 27
|
panel_height = 27
|
||||||
panel_font_size = 12
|
panel_font_size = 12
|
||||||
|
|
||||||
font = "Ubuntu"
|
font = "Ubuntu"
|
||||||
widget_defaults = dict(
|
widget_defaults = dict(
|
||||||
font=font, padding=0, fontsize=panel_font_size, borderwidth=0
|
font=font, padding=0, fontsize=panel_font_size, borderwidth=0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
powerline_left = {
|
||||||
def get_num_monitors():
|
"decorations": [
|
||||||
try:
|
PowerLineDecoration(path="arrow_right")
|
||||||
display = xdisplay.Display()
|
|
||||||
screen = display.screen()
|
|
||||||
resources = screen.root.xrandr_get_screen_resources()
|
|
||||||
return len(resources.outputs)
|
|
||||||
except Exception:
|
|
||||||
# always setup at least one monitor
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
num_monitors = get_num_monitors()
|
|
||||||
|
|
||||||
def powerline_arrow(direction, color1, color2):
|
|
||||||
if direction == "r":
|
|
||||||
return [
|
|
||||||
widget.TextBox(
|
|
||||||
text=u"\ue0b0",
|
|
||||||
foreground=color1,
|
|
||||||
background=color2,
|
|
||||||
fontsize=panel_height,
|
|
||||||
font = "NovaMono for Powerline"
|
|
||||||
),
|
|
||||||
widget.Sep(padding=5, linewidth=0, background=color2),
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
return [
|
|
||||||
widget.Sep(padding=7, linewidth=0, background=color1),
|
|
||||||
widget.TextBox(
|
|
||||||
text=u"\ue0b2",
|
|
||||||
foreground=color2,
|
|
||||||
background=color1,
|
|
||||||
fontsize=panel_height,
|
|
||||||
font = "NovaMono for Powerline"
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def get_panel(monitor_id):
|
|
||||||
widgets = [
|
|
||||||
*powerline_arrow("r", Colors.accent, Colors.background),
|
|
||||||
widget.GroupBox(
|
|
||||||
rounded=False,
|
|
||||||
inactive="#ffffff",
|
|
||||||
background=Colors.background,
|
|
||||||
highlight_method="block",
|
|
||||||
highlight_color=Colors.accent,
|
|
||||||
this_current_screen_border=Colors.accent,
|
|
||||||
borderwidth=4,
|
|
||||||
font="Ubuntu",
|
|
||||||
),
|
|
||||||
*powerline_arrow("r", Colors.background, None),
|
|
||||||
widget.WindowName(foreground="a0a0a0"),
|
|
||||||
*powerline_arrow("l", None, Colors.background),
|
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if monitor_id == 0:
|
|
||||||
widgets.append(
|
|
||||||
widget.Systray(icon_size=24, background=Colors.background, padding=5)
|
|
||||||
)
|
|
||||||
|
|
||||||
widgets.extend(
|
screens = [
|
||||||
[
|
Screen(
|
||||||
*powerline_arrow("l", Colors.background, Colors.accent),
|
top=bar.Bar(
|
||||||
*powerline_arrow("l", Colors.accent, Colors.background),
|
widgets = [
|
||||||
widget.Volume(borderwidth=0, background=Colors.background, emoji=True),
|
widget.TaskList(),
|
||||||
widget.Volume(borderwidth=0, background=Colors.background, emoji=False),
|
widget.GroupBox(
|
||||||
*powerline_arrow("l", Colors.background, Colors.accent),
|
rounded=False,
|
||||||
widget.Clock(
|
inactive="#ffffff",
|
||||||
foreground="#ffffff",
|
active=Colors.background,
|
||||||
background=Colors.accent,
|
highlight_method="block",
|
||||||
format="%Y-%m-%d %H:%M:%S ",
|
highlight_color=Colors.accent,
|
||||||
),
|
this_current_screen_border=Colors.accent,
|
||||||
widget.Sep(padding=10, linewidth=0, background=Colors.accent),
|
font="Ubuntu bold",
|
||||||
]
|
padding=9,
|
||||||
|
),
|
||||||
|
widget.Spacer(),
|
||||||
|
widget.Systray(icon_size=24, background=Colors.background, padding=5, **powerline),
|
||||||
|
widget.CPU(background=Colors.background, format="CPU {load_percent}%", **powerline),
|
||||||
|
widget.CPU(background=Colors.accent, format="{freq_max}GHz", **powerline),
|
||||||
|
widget.Volume(borderwidth=0, background=Colors.background, emoji=False, **powerline),
|
||||||
|
widget.Clock(
|
||||||
|
foreground="#ffffff",
|
||||||
|
background=Colors.accent,
|
||||||
|
format="%a %b %d, %H:%M:%S",
|
||||||
|
**powerline
|
||||||
|
),
|
||||||
|
widget.Sep(padding=7, linewidth=0, background=Colors.accent),
|
||||||
|
],
|
||||||
|
size=panel_height, background=Colors.background, opacity=0.9
|
||||||
|
),
|
||||||
|
wallpaper="/home/user/.config/qtile/wallpaper.png",
|
||||||
|
wallpaper_mode="stretch"
|
||||||
)
|
)
|
||||||
|
]
|
||||||
return bar.Bar(
|
|
||||||
widgets, size=panel_height, background=Colors.background, opacity=0.9
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
screens = []
|
|
||||||
|
|
||||||
for m in range(num_monitors):
|
|
||||||
screens.append(Screen(top=get_panel(m)))
|
|
||||||
|
|
||||||
|
|
||||||
# @hook.subscribe.screen_change
|
|
||||||
# def restart_on_randr(ev):
|
|
||||||
# libqtile.qtile.cmd_restart()
|
|
||||||
|
|
||||||
|
|
||||||
@hook.subscribe.client_new
|
|
||||||
def dialogs(window):
|
|
||||||
if (
|
|
||||||
window.window.get_wm_type() == "dialog"
|
|
||||||
or window.window.get_wm_transient_for()
|
|
||||||
):
|
|
||||||
window.floating = True
|
|
||||||
|
|
||||||
|
|
||||||
@hook.subscribe.client_new
|
|
||||||
def float_steam(window):
|
|
||||||
wm_class = window.window.get_wm_class()
|
|
||||||
w_name = window.window.get_name()
|
|
||||||
if wm_class == ("Steam", "Steam") and (
|
|
||||||
w_name != "Steam"
|
|
||||||
# w_name == "Friends List"
|
|
||||||
# or w_name == "Screenshot Uploader"
|
|
||||||
# or w_name.startswith("Steam - News")
|
|
||||||
or "PMaxSize" in window.window.get_wm_normal_hints().get("flags", ())
|
|
||||||
):
|
|
||||||
window.floating = True
|
|
||||||
|
|
||||||
|
|
||||||
@hook.subscribe.client_new
|
|
||||||
def float_firefox(window):
|
|
||||||
wm_class = window.window.get_wm_class()
|
|
||||||
w_name = window.window.get_name()
|
|
||||||
if wm_class == ("Places", "firefox") and w_name == "Library":
|
|
||||||
window.floating = True
|
|
||||||
|
|
||||||
|
|
||||||
@lazy.function
|
|
||||||
def float_to_front(qtile):
|
|
||||||
for group in qtile.groups:
|
|
||||||
for window in group.windows:
|
|
||||||
if window.floating:
|
|
||||||
window.cmd_bring_to_front()
|
|
||||||
|
|
||||||
|
|
||||||
mod = "mod4"
|
mod = "mod4"
|
||||||
terminal = guess_terminal()
|
terminal = guess_terminal()
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
|
# A list of available commands that can be bound to keys can be found
|
||||||
|
# at https://docs.qtile.org/en/latest/manual/config/lazy.html
|
||||||
|
# Switch between windows
|
||||||
Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
|
Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
|
||||||
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
|
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
|
||||||
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
|
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
|
||||||
|
@ -194,75 +96,83 @@ keys = [
|
||||||
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
|
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
|
||||||
# Toggle between different layouts as defined below
|
# Toggle between different layouts as defined below
|
||||||
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
|
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
|
||||||
Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
|
Key([mod], "q", lazy.window.kill(), desc="Kill focused window"),
|
||||||
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
|
Key([mod, "shift"], "r", lazy.reload_config(), desc="Reload the config"),
|
||||||
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
||||||
Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
|
Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
groups = [Group(i) for i in "123456789"]
|
||||||
|
|
||||||
|
for i in groups:
|
||||||
|
keys.extend(
|
||||||
|
[
|
||||||
|
# mod1 + letter of group = switch to group
|
||||||
|
Key(
|
||||||
|
[mod],
|
||||||
|
i.name,
|
||||||
|
lazy.group[i.name].toscreen(),
|
||||||
|
desc="Switch to group {}".format(i.name),
|
||||||
|
),
|
||||||
|
# mod1 + shift + letter of group = switch to & move focused window to group
|
||||||
|
Key(
|
||||||
|
[mod, "shift"],
|
||||||
|
i.name,
|
||||||
|
lazy.window.togroup(i.name, switch_group=True),
|
||||||
|
desc="Switch to & move focused window to group {}".format(i.name),
|
||||||
|
),
|
||||||
|
# Or, use below if you prefer not to switch to that group.
|
||||||
|
# # mod1 + shift + letter of group = move focused window to group
|
||||||
|
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
|
||||||
|
# desc="move focused window to group {}".format(i.name)),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
layouts = [
|
||||||
|
layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4),
|
||||||
|
layout.Max(),
|
||||||
|
# Try more layouts by unleashing below layouts.
|
||||||
|
# layout.Stack(num_stacks=2),
|
||||||
|
# layout.Bsp(),
|
||||||
|
# layout.Matrix(),
|
||||||
|
# layout.MonadTall(),
|
||||||
|
# layout.MonadWide(),
|
||||||
|
# layout.RatioTile(),
|
||||||
|
# layout.Tile(),
|
||||||
|
# layout.TreeTab(),
|
||||||
|
# layout.VerticalTile(),
|
||||||
|
# layout.Zoomy(),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Drag floating layouts.
|
||||||
mouse = [
|
mouse = [
|
||||||
Drag(
|
Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
|
||||||
[mod],
|
Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
|
||||||
"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()),
|
Click([mod], "Button2", lazy.window.bring_to_front()),
|
||||||
]
|
]
|
||||||
|
|
||||||
groups = [Group(i) for i in "123456789"]
|
dgroups_key_binder = None
|
||||||
|
dgroups_app_rules = [] # type: list
|
||||||
border = dict(
|
follow_mouse_focus = True
|
||||||
border_width=6, margin=10, single_margin=200, border_focus=Colors.background
|
|
||||||
)
|
|
||||||
|
|
||||||
layouts = [layout.MonadTall(**border), layout.Columns(**border)]
|
|
||||||
|
|
||||||
main = None
|
|
||||||
follow_mouse_focus = False
|
|
||||||
bring_front_click = False
|
bring_front_click = False
|
||||||
cursor_warp = False
|
cursor_warp = False
|
||||||
floating_layout = layout.Floating(
|
floating_layout = layout.Floating(
|
||||||
float_rules=[
|
float_rules=[
|
||||||
{"wmclass": "confirm"},
|
# Run the utility of `xprop` to see the wm class and name of an X client.
|
||||||
{"wmclass": "dialog"},
|
*layout.Floating.default_float_rules,
|
||||||
{"wmclass": "download"},
|
Match(wm_class="confirmreset"), # gitk
|
||||||
{"wmclass": "error"},
|
Match(wm_class="makebranch"), # gitk
|
||||||
{"wmclass": "file_progress"},
|
Match(wm_class="maketag"), # gitk
|
||||||
{"wmclass": "notification"},
|
Match(wm_class="ssh-askpass"), # ssh-askpass
|
||||||
{"wmclass": "splash"},
|
Match(title="branchdialog"), # gitk
|
||||||
{"wmclass": "toolbar"},
|
Match(title="pinentry"), # GPG key password entry
|
||||||
{"wmclass": "confirmreset"}, # gitk
|
|
||||||
{"wmclass": "makebranch"}, # gitk
|
|
||||||
{"wmclass": "maketag"}, # gitk
|
|
||||||
{"wname": "branchdialog"}, # gitk
|
|
||||||
{"wname": "pinentry"}, # GPG key password entry
|
|
||||||
{"wmclass": "ssh-askpass"}, # ssh-askpass
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
auto_fullscreen = True
|
auto_fullscreen = True
|
||||||
focus_on_window_activation = "smart"
|
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 = False
|
||||||
wmname = "LG3D"
|
wmname = "LG3D"
|
||||||
|
|
||||||
|
|
||||||
@hook.subscribe.startup_once
|
|
||||||
def startup():
|
|
||||||
pass
|
|
||||||
|
|
||||||
# import subprocess
|
|
||||||
# subprocess.Popen(["picom"])
|
|
||||||
# subprocess.Popen(["systemctl", "--user", "import-environment", "DISPLAY"])
|
|
||||||
# subprocess.Popen(["xsettingsd"])
|
|
||||||
# subprocess.Popen(["nitrogen", "--restore"])
|
|
||||||
# subprocess.Popen(["unclutter", "--root"])
|
|
||||||
# subprocess.Popen(["nm-applet"])
|
|
||||||
# subprocess.Popen(["xautolock", "-time", " 5", "-locker", "screenlock"])
|
|
||||||
# subprocess.Popen(["dex", "-a", "-s", "/home/droccia/.config/autostart/"])
|
|
||||||
|
|
Loading…
Reference in New Issue