Continue work
This commit is contained in:
parent
499f4c3a57
commit
f5d6e3dae1
280
qtile/config.py
280
qtile/config.py
|
@ -1,168 +1,70 @@
|
|||
from libqtile import bar
|
||||
from libqtile import hook
|
||||
from libqtile import layout
|
||||
from libqtile import widget
|
||||
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 import bar, layout
|
||||
from qtile_extras import widget
|
||||
from libqtile.config import Click, Drag, Group, Key, Match, Screen
|
||||
from libqtile.lazy import lazy
|
||||
from libqtile.utils import guess_terminal
|
||||
|
||||
# this import requires python-xlib to be installed
|
||||
from Xlib import display as xdisplay
|
||||
|
||||
from qtile_extras.widget.decorations import PowerLineDecoration
|
||||
|
||||
class Colors:
|
||||
background = "#1f2430"
|
||||
accent = "#002F5F"
|
||||
|
||||
|
||||
panel_height = 27
|
||||
panel_font_size = 12
|
||||
|
||||
font = "Ubuntu"
|
||||
widget_defaults = dict(
|
||||
font=font, padding=0, fontsize=panel_font_size, borderwidth=0
|
||||
)
|
||||
|
||||
|
||||
def get_num_monitors():
|
||||
try:
|
||||
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"
|
||||
),
|
||||
powerline_left = {
|
||||
"decorations": [
|
||||
PowerLineDecoration(path="arrow_right")
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
def get_panel(monitor_id):
|
||||
screens = [
|
||||
Screen(
|
||||
top=bar.Bar(
|
||||
widgets = [
|
||||
*powerline_arrow("r", Colors.accent, Colors.background),
|
||||
widget.TaskList(),
|
||||
widget.GroupBox(
|
||||
rounded=False,
|
||||
inactive="#ffffff",
|
||||
background=Colors.background,
|
||||
active=Colors.background,
|
||||
highlight_method="block",
|
||||
highlight_color=Colors.accent,
|
||||
this_current_screen_border=Colors.accent,
|
||||
borderwidth=4,
|
||||
font="Ubuntu",
|
||||
font="Ubuntu bold",
|
||||
padding=9,
|
||||
),
|
||||
*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(
|
||||
[
|
||||
*powerline_arrow("l", Colors.background, Colors.accent),
|
||||
*powerline_arrow("l", Colors.accent, Colors.background),
|
||||
widget.Volume(borderwidth=0, background=Colors.background, emoji=True),
|
||||
widget.Volume(borderwidth=0, background=Colors.background, emoji=False),
|
||||
*powerline_arrow("l", Colors.background, Colors.accent),
|
||||
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="%Y-%m-%d %H:%M:%S ",
|
||||
format="%a %b %d, %H:%M:%S",
|
||||
**powerline
|
||||
),
|
||||
widget.Sep(padding=10, linewidth=0, background=Colors.accent),
|
||||
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"
|
||||
terminal = guess_terminal()
|
||||
|
||||
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], "l", lazy.layout.right(), desc="Move focus to right"),
|
||||
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
|
||||
|
@ -194,75 +96,83 @@ keys = [
|
|||
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
|
||||
# Toggle between different layouts as defined below
|
||||
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
|
||||
Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
|
||||
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
|
||||
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.shutdown(), desc="Shutdown Qtile"),
|
||||
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 = [
|
||||
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(),
|
||||
),
|
||||
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()),
|
||||
]
|
||||
|
||||
groups = [Group(i) for i in "123456789"]
|
||||
|
||||
border = dict(
|
||||
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
|
||||
dgroups_key_binder = None
|
||||
dgroups_app_rules = [] # type: list
|
||||
follow_mouse_focus = True
|
||||
bring_front_click = False
|
||||
cursor_warp = False
|
||||
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
|
||||
# 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
|
||||
]
|
||||
)
|
||||
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 = False
|
||||
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