Compatibility with latest qtile, fixes to widgets, etc...
This commit is contained in:
parent
a033bde573
commit
6a265ea3b6
6 changed files with 78 additions and 50 deletions
|
@ -9,7 +9,7 @@ logger.error("Importing qtile theme requirements...")
|
|||
|
||||
from libqtile.config import Key, Screen, Group, Drag, Click, Match
|
||||
from libqtile.command import lazy
|
||||
from libqtile import layout, bar, widget
|
||||
from libqtile import layout, bar, widget, qtile
|
||||
|
||||
logger.error("Importing theme util functions...")
|
||||
|
||||
|
@ -83,13 +83,14 @@ class Kuro(BaseTheme):
|
|||
Match(wm_class='ssh-askpass'), # ssh-askpass
|
||||
Match(title='branchdialog'), # gitk
|
||||
Match(title='pinentry'), # GPG key password entry
|
||||
Match(title='origin.exe', wm_class='Wine'), # Wine Origin game launcher
|
||||
])
|
||||
|
||||
def set_debug_text(self, text):
|
||||
for field in self.debug_textfields:
|
||||
field.text = text
|
||||
for bar in self.debug_bars:
|
||||
if self.qtile is not None:
|
||||
if qtile is not None:
|
||||
bar.draw()
|
||||
|
||||
def log_debug(self, text):
|
||||
|
@ -144,7 +145,7 @@ class Kuro(BaseTheme):
|
|||
Key([self.mod, "shift"], 'f', lazy.window.toggle_floating()),
|
||||
|
||||
# Pinned toggle
|
||||
Key([self.mod], 'p', lazy.function(self.toggle_pinned)),
|
||||
Key([self.mod, "shift"], 'p', lazy.function(self.toggle_pinned)),
|
||||
|
||||
# Toggle between split and unsplit sides of stack.
|
||||
# Split = all windows displayed
|
||||
|
@ -513,22 +514,22 @@ class Kuro(BaseTheme):
|
|||
else:
|
||||
utils.execute("arandr")
|
||||
|
||||
def reinitialize_visualizers(self, qtile=None):
|
||||
def reinitialize_visualizers(self):
|
||||
if Config.get("show_audio_visualizer", False):
|
||||
logger.warning("Reinitializing visualizers...")
|
||||
for screen in self.qtile.screens:
|
||||
for screen in qtile.screens:
|
||||
for widget in screen.top.widgets:
|
||||
if isinstance(widget, kuro.utils.widgets.AudioVisualizerWidget):
|
||||
if widget.client is not None:
|
||||
widget.client.kill()
|
||||
widget.client = None
|
||||
widget.screen = None
|
||||
self.update_visualizers(qtile=qtile)
|
||||
self.update_visualizers()
|
||||
|
||||
def update_visualizers(self, qtile=None):
|
||||
def update_visualizers(self):
|
||||
if Config.get("show_audio_visualizer", False):
|
||||
logger.warning("Updating visualizers..")
|
||||
for screen in self.qtile.screens:
|
||||
for screen in qtile.screens:
|
||||
for widget in screen.top.widgets:
|
||||
if isinstance(widget, kuro.utils.widgets.AudioVisualizerWidget):
|
||||
if widget.client is None:
|
||||
|
@ -577,13 +578,20 @@ class Kuro(BaseTheme):
|
|||
|
||||
# QTile base callbacks
|
||||
def callback_startup_once(self, *args, **kwargs):
|
||||
self.update_wallpaper(self.qtile)
|
||||
if not hasattr(qtile, 'theme_instance'):
|
||||
# Save theme instance in qtile
|
||||
qtile.theme_instance = self
|
||||
self.update_wallpaper(qtile)
|
||||
|
||||
# Setup audio
|
||||
# p = utils.execute_once(["qjackctl"])
|
||||
# p.wait()
|
||||
|
||||
def callback_startup(self):
|
||||
if not hasattr(qtile, 'theme_instance'):
|
||||
# Save theme instance in qtile
|
||||
qtile.theme_instance = self
|
||||
|
||||
if self.current_wallpaper:
|
||||
p = utils.execute_once(["wal", "-n", "-i", "{}".format(self.current_wallpaper)])
|
||||
p.wait()
|
||||
|
@ -596,7 +604,7 @@ class Kuro(BaseTheme):
|
|||
except KeyError:
|
||||
wallpaper = None
|
||||
if wallpaper:
|
||||
Kuro.set_wallpaper(self.qtile, wallpaper)
|
||||
Kuro.set_wallpaper(qtile, wallpaper)
|
||||
else:
|
||||
p = utils.execute_once("nitrogen --restore")
|
||||
p.wait()
|
||||
|
@ -610,6 +618,9 @@ class Kuro(BaseTheme):
|
|||
self.log_info("Starting notification daemon...")
|
||||
utils.execute_once("dunst")
|
||||
|
||||
self.log_info("Starting xiccd color profile manager...")
|
||||
utils.execute_once("xiccd")
|
||||
|
||||
# Update color scheme
|
||||
self.initialize_colorscheme()
|
||||
|
||||
|
@ -635,9 +646,13 @@ class Kuro(BaseTheme):
|
|||
initial_windows = []
|
||||
|
||||
def callback_startup_complete(self, *args, **kwargs):
|
||||
if not hasattr(qtile, 'theme_instance'):
|
||||
# Save theme instance in qtile
|
||||
qtile.theme_instance = self
|
||||
|
||||
# Only run on first startup
|
||||
if not self.qtile.no_spawn:
|
||||
dg = self.qtile.dgroups
|
||||
if not qtile.no_spawn:
|
||||
dg = qtile.dgroups
|
||||
for r in dg.rules:
|
||||
pid = -1
|
||||
# noinspection PyProtectedMember
|
||||
|
@ -651,12 +666,12 @@ class Kuro(BaseTheme):
|
|||
self.callback_client_new()
|
||||
|
||||
# After first startup is complete, start the audio apps that can only be started after boot is complete
|
||||
if not self.qtile.no_spawn:
|
||||
if not qtile.no_spawn:
|
||||
for app in Config.get("apps_audio_afterstart", []):
|
||||
utils.execute_once(app)
|
||||
|
||||
# Update color scheme
|
||||
Kuro.update_colorscheme(self.qtile)
|
||||
Kuro.update_colorscheme(qtile)
|
||||
|
||||
def callback_client_new(self, *args, **kwargs):
|
||||
client = args[0] if len(args) > 0 else None
|
||||
|
@ -664,27 +679,27 @@ class Kuro(BaseTheme):
|
|||
if len(self.initial_windows) > 0:
|
||||
init = self.initial_windows.copy()
|
||||
for pid, gname in init:
|
||||
for group in self.qtile.groups:
|
||||
for group in qtile.groups:
|
||||
if len(group.windows) > 0:
|
||||
for window in group.windows:
|
||||
w_pid = window.window.get_net_wm_pid()
|
||||
self.log_info("Comparing pid {} with window PID {}, window {}".format(pid, w_pid,
|
||||
window.name))
|
||||
if pid == w_pid:
|
||||
c = self.qtile.dgroups.rules_map.copy()
|
||||
c = qtile.dgroups.rules_map.copy()
|
||||
for rid, r in c.items():
|
||||
if r.matches(window):
|
||||
self.qtile.dgroups.remove_rule(rid)
|
||||
qtile.dgroups.remove_rule(rid)
|
||||
self.initial_windows.remove((pid, gname))
|
||||
self.log_info("Removed group rule for PID {}, window {}".format(pid,
|
||||
window.name))
|
||||
self.log_info(str(self.qtile.dgroups.rules_map))
|
||||
self.log_info(str(qtile.dgroups.rules_map))
|
||||
|
||||
# Check if it is a visualizer
|
||||
if Config.get("show_audio_visualizer", False):
|
||||
if client is not None and client.window.get_name() == "GLava":
|
||||
placed = False
|
||||
for screen in self.qtile.screens:
|
||||
for screen in qtile.screens:
|
||||
for widget in screen.top.widgets:
|
||||
if not placed and isinstance(widget, kuro.utils.widgets.AudioVisualizerWidget):
|
||||
if widget.client is None:
|
||||
|
@ -693,10 +708,10 @@ class Kuro(BaseTheme):
|
|||
pos_y = 0 + widget.margin_y
|
||||
width = viz_info['width'] - (2 * widget.margin_x)
|
||||
height = viz_info['height'] - (2 * widget.margin_y)
|
||||
screen_index = self.qtile.screens.index(screen)
|
||||
screen_index = qtile.screens.index(screen)
|
||||
logger.warning("Attaching {} {} to {} on screen {}".format(client, client.window.wid, type(widget).__name__, screen_index))
|
||||
c = KuroStatic.create(client, screen, x=pos_x, y=pos_y, width=width, height=height)
|
||||
c.set_opacity(Config.get("bar_opacity", 1.0))
|
||||
c.opacity = Config.get("bar_opacity", 1.0)
|
||||
widget.set_client(c, screen)
|
||||
placed = True
|
||||
if not placed:
|
||||
|
@ -722,11 +737,11 @@ class Kuro(BaseTheme):
|
|||
|
||||
# Detach visualizer from widget if it was a visualizer window
|
||||
if isinstance(client, KuroStatic):
|
||||
for screen in self.qtile.screens:
|
||||
for screen in qtile.screens:
|
||||
for widget in screen.top.widgets:
|
||||
if isinstance(widget, kuro.utils.widgets.AudioVisualizerWidget):
|
||||
if widget.client == client:
|
||||
screen_index = self.qtile.screens.index(screen)
|
||||
screen_index = qtile.screens.index(screen)
|
||||
logger.warning("Detaching {} {} from widget {} on screen {}".format(client, client.window.wid, type(widget).__name__, screen_index))
|
||||
widget.client = None
|
||||
widget.screen = None
|
||||
|
@ -876,7 +891,7 @@ class Kuro(BaseTheme):
|
|||
|
||||
# Update colors in visualizers and restart visualizers
|
||||
with open(Config.get("glava_color_file_path", "~/.config/glava/kurobars_color.glsl"), 'w') as f:
|
||||
f.write("#define COLOR {}\n#request setbg {}".format(colors['color15'], colors['color1'][1:]))
|
||||
f.write("#define COLOR {}\n#request setbg {}00".format(colors['color15'], colors['color1'][1:]))
|
||||
qtile.theme_instance.reinitialize_visualizers()
|
||||
|
||||
utils.notify(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue