Mostly done now, except for some popups and tweaking. We have a top bar with dmenu launcher, 9 workspaces, window buttons, thermal monitor, graphs, battery monitor, wifi monitor, sound monitors, system tray, layout indicator, datetime, update counter and screen indicator. On the bottom is a debug bar (only shown when debug=true in config) which is pretty useless at the moment.
This commit is contained in:
parent
a5ef8739db
commit
2df1347241
24 changed files with 721 additions and 51 deletions
199
kuro/theme.py
199
kuro/theme.py
|
@ -1,6 +1,3 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
from libqtile.config import Key, Screen, Group, Drag, Click
|
||||
from libqtile.command import lazy
|
||||
from libqtile import layout, bar, widget
|
||||
|
@ -21,7 +18,7 @@ except ImportError:
|
|||
raise ImportError("Could not load theme Config or BaseConfig!")
|
||||
|
||||
# Initialize logging
|
||||
log = logging.getLogger(__name__)
|
||||
from libqtile.log_utils import logger as log
|
||||
|
||||
|
||||
class Kuro(BaseTheme):
|
||||
|
@ -36,7 +33,7 @@ class Kuro(BaseTheme):
|
|||
|
||||
super(Kuro, self).initialize()
|
||||
|
||||
# Update keys with keys for groups
|
||||
# Update keys with keys for groups and layouts
|
||||
self.update_keys()
|
||||
|
||||
def init_keys(self):
|
||||
|
@ -57,20 +54,31 @@ class Kuro(BaseTheme):
|
|||
# Swap panes of split stack
|
||||
Key([self.mod, "shift"], "space", lazy.layout.rotate()),
|
||||
|
||||
# Fullscreen toggle
|
||||
Key([self.mod], 'f', lazy.window.toggle_fullscreen()),
|
||||
|
||||
# Toggle between split and unsplit sides of stack.
|
||||
# Split = all windows displayed
|
||||
# Unsplit = 1 window displayed, like Max layout, but still with
|
||||
# multiple stack panes
|
||||
Key([self.mod, "shift"], "Return", lazy.layout.toggle_split()),
|
||||
|
||||
# Super-Enter to start terminal
|
||||
Key([self.mod], "Return", lazy.spawn(Config.get('app_terminal', "xterm"))),
|
||||
|
||||
# Super-R to start dmenu_run
|
||||
Key([self.mod], "r", lazy.spawn(Config.get('app_launcher', "dmenu_run"))),
|
||||
|
||||
# Super-Shift-R to start spawncmd
|
||||
Key([self.mod, "shift"], "r", lazy.spawncmd()),
|
||||
|
||||
|
||||
# Toggle between different layouts as defined below
|
||||
Key([self.mod], "Tab", lazy.next_layout()),
|
||||
Key([self.mod], "w", lazy.window.kill()),
|
||||
|
||||
Key([self.mod, "control"], "r", lazy.restart()),
|
||||
Key([self.mod, "control"], "q", lazy.shutdown()),
|
||||
Key([self.mod], "r", lazy.spawncmd()),
|
||||
# Key([self.mod, "shift"], "e", self.evaluate()),
|
||||
]
|
||||
|
||||
|
@ -84,22 +92,28 @@ class Kuro(BaseTheme):
|
|||
log.debug("Initializing layouts")
|
||||
|
||||
return [
|
||||
layout.Matrix(columns=2,
|
||||
border_focus=Config.get('colour_border_focus', "#ffffff"),
|
||||
border_normal=Config.get('colour_border_normal', "#777777"),
|
||||
border_width=Config.get('width_border', "1"),
|
||||
margin=Config.get('margin_layout', "0"),
|
||||
),
|
||||
layout.Wmii(
|
||||
border_focus=Config.get('colour_border_focus', "#ffffff"),
|
||||
border_focus_stack=Config.get('colour_border_normal', "#777777"),
|
||||
border_normal=Config.get('colour_border_normal', "#777777"),
|
||||
border_normal_stack=Config.get('colour_border_normal', "#777777"),
|
||||
border_width=Config.get('width_border', "1"),
|
||||
grow_amount=Config.get('grow_amount', "5"),
|
||||
margin=Config.get('margin_layout', "0"),
|
||||
),
|
||||
layout.Max(),
|
||||
layout.Stack(num_stacks=2)
|
||||
layout.Zoomy(
|
||||
columnwidth=Config.get('width_zoomy_column', 150),
|
||||
margin=Config.get('margin_layout', "0"),
|
||||
)
|
||||
]
|
||||
|
||||
def init_widget_defaults(self):
|
||||
log.debug("Initializing widget_defaults")
|
||||
|
||||
return {
|
||||
"font": Config.get('font_default', "Sans"),
|
||||
"fontsize": Config.get('fontsize_default', 16),
|
||||
"font": Config.get('font_topbar', "Sans"),
|
||||
"fontsize": Config.get('fontsize_topbar', 16),
|
||||
"padding": 3,
|
||||
}
|
||||
|
||||
|
@ -107,11 +121,16 @@ class Kuro(BaseTheme):
|
|||
log.debug("Initializing screens")
|
||||
|
||||
num_screens = utils.get_screen_count()
|
||||
if num_screens == 0:
|
||||
num_screens = 1
|
||||
|
||||
screens = []
|
||||
for x in range(num_screens):
|
||||
widgets = []
|
||||
widgets.extend([
|
||||
utils.AppLauncherIcon(
|
||||
filename=Config.get('applauncher_image', 'apps.png')
|
||||
),
|
||||
utils.bar_separator(Config),
|
||||
widget.GroupBox(
|
||||
active=Config.get('colour_groupbox_icon_active', '#ffffff'),
|
||||
|
@ -129,22 +148,114 @@ class Kuro(BaseTheme):
|
|||
utils.bar_separator(Config),
|
||||
widget.Prompt(**self.widget_defaults),
|
||||
|
||||
widget.WindowName(**self.widget_defaults),
|
||||
widget.TaskList(
|
||||
border=Config.get('tasklist_border', '#ffffff'),
|
||||
borderwidth=Config.get('tasklist_borderwidth', 1),
|
||||
font=Config.get('tasklist_font', 'Arial'),
|
||||
fontsize=Config.get('tasklist_fontsize', 15),
|
||||
highlight_method=Config.get('tasklist_highlight_method', 'border'),
|
||||
max_title_width=Config.get('tasklist_max_title_width', 200),
|
||||
rounded=Config.get('tasklist_rounded', True),
|
||||
urgent_alert_method=Config.get('tasklist_urgent_alert_method', 'border'),
|
||||
urgent_border=Config.get('tasklist_urgent_border', '#ff0000'),
|
||||
margin=Config.get('margin_groupbox', 0)
|
||||
),
|
||||
|
||||
utils.ThermalSensorWidget(
|
||||
font=Config.get('font_topbar', 'Arial'),
|
||||
fontsize=Config.get('fontsize_topbar', 16),
|
||||
foreground=Config.get('thermal_colour', '#ffffff'),
|
||||
foreground_alert=Config.get('thermal_colour_alert', '#ff0000'),
|
||||
tag_sensor=Config.get('thermal_sensor', 'temp1'),
|
||||
chip=Config.get('thermal_chip', None),
|
||||
threshold=Config.get('thermal_threshold', 70)
|
||||
),
|
||||
|
||||
widget.CPUGraph(
|
||||
width=25,
|
||||
border_color="#000000",
|
||||
border_width=0,
|
||||
line_width=1,
|
||||
samples=10,
|
||||
width=Config.get('cpu_width', 25),
|
||||
border_color=Config.get('cpu_border_colour', "#000000"),
|
||||
graph_color=Config.get('cpu_graph_colour', "#00ffff"),
|
||||
border_width=Config.get('cpu_graph_width', 0),
|
||||
line_width=Config.get('cpu_line_width', 1),
|
||||
samples=Config.get('cpu_samples', 10),
|
||||
),
|
||||
|
||||
widget.MemoryGraph(
|
||||
width=Config.get('mem_width', 25),
|
||||
border_color=Config.get('mem_border_colour', "#000000"),
|
||||
graph_color=Config.get('mem_graph_colour', "#00ffff"),
|
||||
border_width=Config.get('mem_graph_width', 0),
|
||||
line_width=Config.get('mem_line_width', 1),
|
||||
samples=Config.get('mem_samples', 10),
|
||||
),
|
||||
|
||||
widget.HDDBusyGraph(
|
||||
width=Config.get('hdd_width', 25),
|
||||
border_color=Config.get('hdd_border_colour', "#000000"),
|
||||
graph_color=Config.get('hdd_graph_colour', "#00ffff"),
|
||||
border_width=Config.get('hdd_border_width', 0),
|
||||
line_width=Config.get('hdd_line_width', 1),
|
||||
samples=Config.get('hdd_samples', 10),
|
||||
),
|
||||
|
||||
widget.NetGraph(
|
||||
width=Config.get('net_width', 25),
|
||||
border_color=Config.get('net_border_colour', "#000000"),
|
||||
graph_color=Config.get('net_graph_colour', "#00ffff"),
|
||||
border_width=Config.get('net_border_width', 0),
|
||||
line_width=Config.get('net_line_width', 1),
|
||||
samples=Config.get('net_samples', 10),
|
||||
),
|
||||
|
||||
widget.BatteryIcon(
|
||||
battery_name=Config.get('battery_name', 'BAT0'),
|
||||
energy_full_file=Config.get('battery_energy_full_file', 'charge_full'),
|
||||
energy_now_file=Config.get('battery_energy_now_file', 'charge_now'),
|
||||
theme_path=Config.get('battery_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile/checkouts/latest/libqtile/resources/battery-icons'),
|
||||
theme_path=Config.get('battery_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
|
||||
'/checkouts/latest/libqtile/resources/battery-icons'),
|
||||
update_delay=Config.get('battery_update_delay', 30)
|
||||
),
|
||||
|
||||
utils.WifiIconWidget(
|
||||
interface=Config.get('wifi_interface', 'wlp4s0'),
|
||||
theme_path=Config.get('wifi_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
|
||||
'/checkouts/latest/libqtile/resources/battery-icons'),
|
||||
update_interval=Config.get('wifi_update_interval', 30)
|
||||
),
|
||||
|
||||
utils.PulseVolumeWidget(
|
||||
cardid=Config.get('volume_cardid', None),
|
||||
channel=Config.get('volume_channel', 'Master'),
|
||||
device=Config.get('volume_device', None),
|
||||
font=Config.get('volume_font', 'Arial'),
|
||||
fontsize=Config.get('volume_fontsize', 15),
|
||||
foreground=Config.get('volume_foreground', '#ffffff'),
|
||||
get_volume_command=Config.get('volume_get_command', None),
|
||||
mute_command=Config.get('volume_mute_command', None),
|
||||
theme_path=Config.get('volume_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
|
||||
'/checkouts/latest/libqtile/resources/volume-icons'),
|
||||
volume_down_command=Config.get('volume_down_command', None),
|
||||
volume_up_command=Config.get('volume_up_command', None),
|
||||
is_bluetooth_icon=Config.get('volume_is_bluetooth_icon', False),
|
||||
update_interval=Config.get('volume_update_interval', 0.2)
|
||||
),
|
||||
|
||||
utils.PulseVolumeWidget(
|
||||
cardid=Config.get('bluevol_cardid', None),
|
||||
channel=Config.get('bluevol_channel', 'Master'),
|
||||
device=Config.get('bluevol_device', None),
|
||||
font=Config.get('bluevol_font', 'Arial'),
|
||||
fontsize=Config.get('bluevol_fontsize', 15),
|
||||
foreground=Config.get('bluevol_foreground', '#ffffff'),
|
||||
get_volume_command=Config.get('bluevol_get_command', None),
|
||||
mute_command=Config.get('bluevol_mute_command', None),
|
||||
theme_path=Config.get('bluevol_theme_path', '/home/docs/checkouts/readthedocs.org/user_builds/qtile'
|
||||
'/checkouts/latest/libqtile/resources/volume-icons'),
|
||||
volume_down_command=Config.get('bluevol_down_command', None),
|
||||
volume_up_command=Config.get('bluevol_up_command', None),
|
||||
is_bluetooth_icon=Config.get('bluevol_is_bluetooth_icon', False),
|
||||
update_interval=Config.get('bluevol_update_interval', 0.2)
|
||||
)
|
||||
])
|
||||
|
||||
# Systray only on first screen
|
||||
|
@ -152,7 +263,7 @@ class Kuro(BaseTheme):
|
|||
widgets.append(widget.Systray(**self.widget_defaults))
|
||||
|
||||
widgets.extend([
|
||||
utils.bar_separator(Config),
|
||||
widget.CurrentLayoutIcon(),
|
||||
widget.Clock(format="%a %d %b, %H:%M", **self.widget_defaults),
|
||||
utils.CheckUpdatesYaourt(
|
||||
colour_no_updates=Config.get('updates_colour_none', '#ffffff'),
|
||||
|
@ -168,13 +279,27 @@ class Kuro(BaseTheme):
|
|||
size=Config.get('height_groupbox', 30)
|
||||
)))
|
||||
|
||||
# Add debug bars on each window if debugging is enabled
|
||||
if Config.get('debug', False):
|
||||
for x in range(num_screens):
|
||||
widgets = []
|
||||
widgets.extend([
|
||||
widget.TextBox(" Debugging bar ", name="default", **self.widget_defaults),
|
||||
widget.Notify(),
|
||||
widget.DebugInfo()
|
||||
])
|
||||
screens[x].bottom = bar.Bar(
|
||||
widgets=widgets,
|
||||
size=Config.get('height_debugbar', 30)
|
||||
)
|
||||
|
||||
return screens
|
||||
|
||||
def init_mouse(self):
|
||||
log.debug("Initializing mouse")
|
||||
|
||||
# Drag floating layouts.
|
||||
return [
|
||||
mouse = [
|
||||
Drag([self.mod], "Button1", lazy.window.set_position_floating(),
|
||||
start=lazy.window.get_position()),
|
||||
Drag([self.mod], "Button3", lazy.window.set_size_floating(),
|
||||
|
@ -182,6 +307,8 @@ class Kuro(BaseTheme):
|
|||
Click([self.mod], "Button2", lazy.window.bring_to_front())
|
||||
]
|
||||
|
||||
return mouse
|
||||
|
||||
def update_keys(self):
|
||||
log.debug("Updating keys")
|
||||
|
||||
|
@ -196,6 +323,30 @@ class Kuro(BaseTheme):
|
|||
Key([self.mod, "shift"], str(i + 1), lazy.window.togroup(g.name))
|
||||
)
|
||||
|
||||
# Keys for the Wmii layout
|
||||
self.keys.extend([
|
||||
Key(
|
||||
[self.mod, "shift", "control"], "l",
|
||||
lazy.layout.grow_right()
|
||||
),
|
||||
Key(
|
||||
[self.mod, "shift"], "l",
|
||||
lazy.layout.shuffle_right()
|
||||
),
|
||||
Key(
|
||||
[self.mod, "shift", "control"], "h",
|
||||
lazy.layout.grow_left()
|
||||
),
|
||||
Key(
|
||||
[self.mod, "shift"], "h",
|
||||
lazy.layout.shuffle_left()
|
||||
),
|
||||
Key(
|
||||
[self.mod], "s",
|
||||
lazy.layout.toggle_split()
|
||||
)
|
||||
])
|
||||
|
||||
def callback_startup(self):
|
||||
utils.execute("sleep 3")
|
||||
utils.execute_once("nitrogen --restore")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue