restructured

This commit is contained in:
paul-loedige
2020-12-08 17:35:32 +01:00
parent 9a839e3589
commit a3fe988728
7 changed files with 210 additions and 292 deletions
-79
View File
@@ -1,79 +0,0 @@
# coding = utf-8
from libqtile import bar, widget
from libqtile.config import Click
import defines
#region custom_widgets
import psutil
class MemoryC(widget.base.ThreadedPollText):
orientations = widget.base.ORIENTATION_HORIZONTAL
defaults = [
("format", "{MemUsed}GB/{MemTotal}GB", "Formatting for field names."),
("update_interval", 1.0, "Update interval for the Memory"),
]
def __init__(self, **config):
super().__init__(**config)
self.add_defaults(MemoryC.defaults)
def tick(self):
self.update(self.poll())
return self.update_interval
def poll(self):
mem = psutil.virtual_memory()
swap = psutil.swap_memory()
val = {}
val["MemUsed"] = mem.used // 1024 // 1024 // 102.4 / 10
val["MemTotal"] = mem.total // 1024 // 1024 // 102.4 / 10
val["MemPercent"] = mem.percent
val["MemFree"] = mem.free // 1024 // 1024 // 102.4 / 10
val["Buffers"] = mem.buffers // 1024 // 1024 // 102.4 / 10
val["Active"] = mem.active // 1024 // 1024 // 102.4 / 10
val["Inactive"] = mem.inactive // 1024 // 1024 // 102.4 / 10
val["Shmem"] = mem.shared // 1024 // 1024 // 102.4 / 10
val["SwapTotal"] = swap.total // 1024 // 1024 // 102.4 / 10
val["Swapfree"] = swap.free // 1024 // 1024 // 102.4 / 10
val["SwapUsed"] = swap.used // 1024 // 1024 // 102.4 / 10
val["SwapPercent"] = swap.percent
return self.format.format(**val)
#endregion
widget_defaults = dict(
font='sans',
fontsize=14,
padding=3,
)
extension_defaults = widget_defaults.copy()
main_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(),
widget.Prompt(),
widget.WindowName(),
widget.Systray(),
widget.TextBox("Vol:"),
widget.Volume(),
widget.CheckUpdates(),
widget.CPU(format='CPU: {load_percent}% @ {freq_current}GHz'),
MemoryC(format="RAM: {MemUsed}GB ({MemPercent}%)"),
MemoryC(format="Swap: {SwapUsed}GB ({SwapPercent}%)"),
widget.NetGraph(),
widget.Clock(format='%Y-%m-%d %H:%M'),
],24)
left_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(),
widget.WindowName(),
widget.Clock(format='%Y-%m-%d %H:%M'),
],24)
top_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(),
widget.WindowName(),
widget.Clock(format='%Y-%m-%d %H:%M'),
],24)
+210 -32
View File
@@ -1,46 +1,224 @@
#region Copyright Notice import os
import subprocess
import psutil
# Copyright (c) 2010 Aldo Cortesi from libqtile import layout, bar, widget
# Copyright (c) 2010, 2014 dequis from libqtile.config import Key, Drag, Click, Group, Screen
# Copyright (c) 2012 Randall Ma from libqtile.command import lazy
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2013 horsik
# Copyright (c) 2013 Tao Sauvage
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#region defines
term = 'termite'
focus_color = '#bd93f9'
border_width = 2
mod = 'mod4'
#region colors
foreground_color = ['#f8f8f2','#f8f8f2']
background_color0 = ['#000000','#000000']
background_color8 = ['#4d4d4d','#4d4d4d']
# red
red_color1 = ['#ff5555','#ff5555']
red_color9 = ['#ff6e67','#ff6e67']
# green
green_color2 = ['#50fa7b','#50fa7b']
green_color10 = ['#5af78e','#5af78e']
# yellow
yellow_color3 = ['#f1fa8c','#f1fa8c']
yellow_color11 = ['#f4f99d','#f4f99d']
# blue
blue_color4 = ['#bd93f9','#bd93f9']
blue_color12 = ['#caa9fa','#caa9fa']
# magenta
magenta_color5 = ['#ff79c6','#ff79c6']
magenta_color13 = ['#ff92d0','#ff92d0']
# cyan
cyan_color6 = ['#8be9fd','#8be9fd']
cyan_color14 = ['#9aedfe','#9aedfe']
# white
white_color7 = ['#bfbfbf','#bfbfbf']
white_color15 = ['#e6e6e6','#e6e6e6']
#endregion
#endregion #endregion
import os #region Keys
keys = [
#moving focus aroung
Key([mod], "h", lazy.layout.left()),
Key([mod], "l", lazy.layout.right()),
Key([mod], "j", lazy.layout.down()),
Key([mod], "k", lazy.layout.up()),
Key([mod,"mod1"], "k", lazy.to_screen(0)),
Key([mod,"mod1"], "j", lazy.to_screen(1)),
Key([mod,"mod1"], "l", lazy.to_screen(1)),
Key([mod,"mod1"], "h", lazy.to_screen(2)),
#import custom files # moving windows around
from keys import keys, mouse Key([mod, "shift"], "h", lazy.layout.swap_left()),
from screens import screens Key([mod, "shift"], "l", lazy.layout.swap_right()),
from layouts import layouts Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
# resize windows
Key([mod], "plus", lazy.layout.grow()),
Key([mod], "minus", lazy.layout.shrink()),
Key([mod], "n", lazy.layout.normalize()),
Key([mod], "o", lazy.layout.maximize()),
Key([mod], "space", lazy.window.toggle_fullscreen()),
# app hotkeys
Key([mod], "Return", lazy.spawn(term), desc="Launch terminal"),
Key([mod],"f", lazy.spawn("firefox"),desc="Launch firefox"),
Key([mod],"e", lazy.spawn("pcmanfm"),desc="Launch pcmanfm"),
Key([mod],"c", lazy.spawn("code"),desc="Launch visual studio code"),
# Toggle between different layouts as defined below
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
Key([mod], "BackSpace", lazy.window.kill(), desc="Kill focused window"),
# qtile hotkeys
Key([mod, "control"], "r", lazy.restart(), desc="Restart qtile"),
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown qtile"),
Key([mod], "r", lazy.spawncmd(),desc="Spawn a command using a prompt widget"),
# Media hotkeys
Key([], 'XF86AudioRaiseVolume', lazy.spawn('pulseaudio-ctl up 1')),
Key([], 'XF86AudioLowerVolume', lazy.spawn('pulseaudio-ctl down 1')),
Key([], 'XF86AudioMute', lazy.spawn('pulseaudio-ctl mute')),
]
# 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())
]
#endregion
#region Groups
group_names = [("WWW", {'layout': 'monadtall'}),
("DEV", {'layout': 'monadtall'}),
("SYS", {'layout': 'monadtall'}),
("DOC", {'layout': 'monadtall'}),
("VBOX", {'layout': 'monadtall'}),
("CHAT", {'layout': 'monadtall'}),
("MUS", {'layout': 'monadtall'}),
("VID", {'layout': 'monadtall'}),
("GFX", {'layout': 'floating'})]
groups = [Group(name, **kwargs) for name, kwargs in group_names]
for i, (name, kwargs) in enumerate(group_names, 1):
keys.extend([
Key(["mod1","control"], str(i), lazy.group[name].toscreen(),
desc="Switch to group {}".format(name)),
Key(['mod1','control', "shift"], str(i), lazy.window.togroup(name),
desc="move focused window to group {}".format(name)),
])
#endregion
#region Layouts
layouts = [
layout.MonadTall(
align=1,
border_focus = focus_color,
border_width = border_width,
new_at_current = True,
),
layout.Floating(
border_focus = focus_color,
border_width = border_width,
),
layout.Max(),
layout.MonadWide(
border_focus = focus_color,
border_width = border_width,
new_at_current = True,
),
]
floating_layout = layout.Floating(
border_focus = focus_color,
border_width = border_width,
float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
{'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
])
#endregion
#region Bars and Widgets
widget_defaults = dict(
font='Ubuntu Mono',
fontsize=14,
padding=3,
)
extension_defaults = widget_defaults.copy()
main_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(),
widget.Prompt(),
widget.WindowName(),
widget.Systray(),
widget.TextBox("Vol:"),
widget.Volume(),
widget.CheckUpdates(),
widget.CPU(format='CPU: {load_percent}% @ {freq_current}GHz'),
# MemoryC(format="RAM: {MemUsed}GB ({MemPercent}%)"),
# MemoryC(format="Swap: {SwapUsed}GB ({SwapPercent}%)"),
widget.NetGraph(),
widget.Clock(format='%Y-%m-%d %H:%M'),
],24)
left_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(),
widget.WindowName(),
widget.Clock(format='%Y-%m-%d %H:%M'),
],24)
top_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(),
widget.WindowName(),
widget.Clock(format='%Y-%m-%d %H:%M'),
],24)
#endregion
#region Screens
screens = [
Screen(bottom=top_bar),
Screen(top=main_bar),
Screen(top=left_bar),
]
#endregion
#region miscelanious #region miscelanious
dgroups_key_binder = None dgroups_key_binder = None
dgroups_app_rules = [] # type: List dgroups_app_rules = [] # type: List
main = None # WARNING: this is deprecated and will be removed soon main = None # WARNING: this is deprecated and will be removed soon
follow_mouse_focus = True follow_mouse_focus = True
bring_front_click = False bring_front_click = True
cursor_warp = False cursor_warp = False
auto_fullscreen = True auto_fullscreen = True
focus_on_window_activation = "smart" focus_on_window_activation = "smart"
-33
View File
@@ -1,33 +0,0 @@
term = 'termite'
focus_color = '#bd93f9'
border_width = 2
mod = 'mod4'
foreground_color = ['#f8f8f2','#f8f8f2']
background_color0 = ['#000000','#000000']
background_color8 = ['#4d4d4d','#4d4d4d']
# red
red_color1 = ['#ff5555','#ff5555']
red_color9 = ['#ff6e67','#ff6e67']
# green
green_color2 = ['#50fa7b','#50fa7b']
green_color10 = ['#5af78e','#5af78e']
# yellow
yellow_color3 = ['#f1fa8c','#f1fa8c']
yellow_color11 = ['#f4f99d','#f4f99d']
# blue
blue_color4 = ['#bd93f9','#bd93f9']
blue_color12 = ['#caa9fa','#caa9fa']
# magenta
magenta_color5 = ['#ff79c6','#ff79c6']
magenta_color13 = ['#ff92d0','#ff92d0']
# cyan
cyan_color6 = ['#8be9fd','#8be9fd']
cyan_color14 = ['#9aedfe','#9aedfe']
# white
white_color7 = ['#bfbfbf','#bfbfbf']
white_color15 = ['#e6e6e6','#e6e6e6']
-13
View File
@@ -1,13 +0,0 @@
#!/usr/bin/env python
from libqtile.config import Group#, ScratchPad, DropDown
from defines import term
groups = [Group(i) for i in "asdfuiop"]
#groups = [
# Group("code", spawn="code", layout="monadtall", persist=True),
# Group("chat", spawn=["firefox https://web.whatsapp.com/","discord"],layout="monadwide",persist=True),
# Group("spot", spawn="spotify",layout="max", persist=True),
# ScratchPad("scratch",[DropDown('term',term)])
#]
-78
View File
@@ -1,78 +0,0 @@
#!/usr/bin/env python
# coding = utf-8
import os
import subprocess
from libqtile.config import Key, Drag, Click
from libqtile.command import lazy
from groups import groups
from defines import mod, term
keys = [
#moving focus aroung
Key([mod], "h", lazy.layout.left()),
Key([mod], "l", lazy.layout.right()),
Key([mod], "j", lazy.layout.down()),
Key([mod], "k", lazy.layout.up()),
Key([mod,"mod1"], "k", lazy.to_screen(0)),
Key([mod,"mod1"], "j", lazy.to_screen(1)),
Key([mod,"mod1"], "l", lazy.to_screen(1)),
Key([mod,"mod1"], "h", lazy.to_screen(2)),
# moving windows around
Key([mod, "shift"], "h", lazy.layout.swap_left()),
Key([mod, "shift"], "l", lazy.layout.swap_right()),
Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
# resize windows
Key([mod], "plus", lazy.layout.grow()),
Key([mod], "minus", lazy.layout.shrink()),
Key([mod], "n", lazy.layout.normalize()),
Key([mod], "o", lazy.layout.maximize()),
Key([mod], "space", lazy.window.toggle_fullscreen()),
# app hotkeys
Key([mod], "Return", lazy.spawn(term), desc="Launch terminal"),
Key([mod],"f", lazy.spawn("firefox"),desc="Launch firefox"),
Key([mod],"e", lazy.spawn("pcmanfm"),desc="Launch pcmanfm"),
Key([mod],"c", lazy.spawn("code"),desc="Launch visual studio code"),
# Toggle between different layouts as defined below
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
Key([mod], "BackSpace", lazy.window.kill(), desc="Kill focused window"),
# qtile hotkeys
Key([mod, "control"], "r", lazy.restart(), desc="Restart qtile"),
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown qtile"),
Key([mod], "r", lazy.spawncmd(),desc="Spawn a command using a prompt widget"),
# Media hotkeys
Key([], 'XF86AudioRaiseVolume', lazy.spawn('pulseaudio-ctl up 1')),
Key([], 'XF86AudioLowerVolume', lazy.spawn('pulseaudio-ctl down 1')),
Key([], 'XF86AudioMute', lazy.spawn('pulseaudio-ctl mute')),
]
# 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())
]
for i in groups:
keys.extend([
Key(["mod1","control"], i.name, lazy.group[i.name].toscreen(),
desc="Switch to group {}".format(i.name)),
#Key(["mod1","control", "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.
Key(['mod1','control', "shift"], i.name, lazy.window.togroup(i.name),
desc="move focused window to group {}".format(i.name)),
])
-45
View File
@@ -1,45 +0,0 @@
#!/usr/bin/env python
from libqtile import layout
from defines import focus_color,border_width
layouts = [
layout.MonadTall(
align=1,
border_focus = focus_color,
border_width = border_width,
new_at_current = True,
),
layout.Floating(
border_focus = focus_color,
border_width = border_width,
),
layout.Max(),
layout.MonadWide(
border_focus = focus_color,
border_width = border_width,
new_at_current = True,
),
]
floating_layout = layout.Floating(
border_focus = focus_color,
border_width = border_width,
float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
{'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
])
-12
View File
@@ -1,12 +0,0 @@
#!/usr/bin/env python
# coding = utf-8
from libqtile.config import Screen
from bars import main_bar, left_bar, top_bar
screens = [
Screen(bottom=top_bar),
Screen(top=main_bar),
Screen(top=left_bar),
]