diff --git a/config_debug.py b/config_debug.py index 8dbfaff..3aa6617 100644 --- a/config_debug.py +++ b/config_debug.py @@ -25,7 +25,7 @@ # SOFTWARE. from libqtile.config import Key, Screen, Group, Drag, Click -from libqtile.command import lazy +from libqtile.lazy import lazy from libqtile import layout, bar, widget diff --git a/kuro/base.py b/kuro/base.py index 370c02f..221d1fd 100644 --- a/kuro/base.py +++ b/kuro/base.py @@ -1,5 +1,5 @@ from libqtile import layout as libqtile_layout, layout, bar, widget -from libqtile.command import lazy +from libqtile.lazy import lazy from libqtile.config import Key, Group, Screen, Drag, Click, Match diff --git a/kuro/config.py b/kuro/config.py index 6761564..5bc2ce7 100644 --- a/kuro/config.py +++ b/kuro/config.py @@ -15,12 +15,13 @@ class Config(BaseConfig): inactive_dark = "#333333" # Default Applications - app_terminal = "terminator" + app_terminal = "ghostty" + app_terminal_init = "ghostty --gtk-single-instance=true --quit-after-last-window-close=false --initial-window=true" app_launcher = "/home/kevin/bin/dmenu_wal.sh" web_browser = "firefox" file_manager = "thunar" app_chat = "/usr/bin/rambox" - app_irc = "quasselclient" + app_irc = "" app_mail = "thunderbird" app_music = "spotify" cmd_brightness_up = "sudo /usr/bin/xbacklight -inc 10" @@ -49,7 +50,8 @@ class Config(BaseConfig): # Images desktop_bg = "/home/kevin/Pictures/wallpapers/desktop.png" - desktop_bg_folder = "/home/kevin/Pictures/wallpapers/desktop_rotation" + desktop_bg_folder = "/home/kevin/Pictures/wallpapers/desktop_rotation/day" + desktop_bg_night_folder = "/home/kevin/Pictures/wallpapers/desktop_rotation/night" # desktop_bg_override = "/home/kevin/Pictures/safe_wallpaper.jpg" applauncher_image = "/home/kevin/.config/qtile/kuro/resources/arch.png" custom_layout_icon_paths = ['/home/kevin/.config/qtile/kuro/resources/layout_icons/'] diff --git a/kuro/theme.py b/kuro/theme.py index f85eb9e..b83e0d6 100644 --- a/kuro/theme.py +++ b/kuro/theme.py @@ -1,6 +1,7 @@ import json import os import random +import datetime # Initialize logging from libqtile.log_utils import logger @@ -8,7 +9,8 @@ from libqtile.log_utils import logger logger.error("Importing qtile theme requirements...") from libqtile.config import Key, Screen, Group, Drag, Click, Match -from libqtile.command import lazy +from libqtile.command.base import expose_command +from libqtile.lazy import lazy from libqtile import layout, bar, widget, qtile logger.error("Importing theme util functions...") @@ -248,7 +250,7 @@ class Kuro(BaseTheme): # http://fontawesome.io/cheatsheet groups.append(Group("", spawn=Config.get('web_browser', "true"))) - groups.append(Group("", spawn=Config.get('app_terminal', "true"))) + groups.append(Group("", spawn=Config.get('app_terminal_init', "true"))) groups.append(Group("")) groups.append(Group("", spawn=Config.get('app_chat', "true"))) groups.append(Group("", spawn=Config.get('app_irc', "true"))) @@ -612,7 +614,8 @@ class Kuro(BaseTheme): qtile.theme_instance = self if self.current_wallpaper: - p = utils.execute_once(["wal", "-n", "-i", "{}".format(self.current_wallpaper)]) + #p = utils.execute_once(["wal", "-n", "-i", "{}".format(self.current_wallpaper)]) + p = utils.execute_once(["wallust", "run", "{}".format(self.current_wallpaper)]) p.wait() else: wallpaper = None @@ -640,8 +643,8 @@ class Kuro(BaseTheme): self.log_info("Starting xiccd color profile manager...") utils.execute_once("xiccd") - self.log_info("Starting KDE connect daemon...") - utils.execute_once("/usr/lib/kdeconnectd") + #self.log_info("Starting KDE connect daemon...") + #utils.execute_once("/usr/lib/kdeconnectd") self.log_info("Starting KDE connect indicator...") utils.execute_once("/usr/bin/kdeconnect-indicator") @@ -784,16 +787,26 @@ class Kuro(BaseTheme): def update_wallpaper(qtile): wallpapers = [] wallpaper_dir = Config.get("desktop_bg_folder", "") + + # Use a wallpaper from the night folder after 9PM and before 6AM + wallpaper_night_dir = Config.get("desktop_bg_night_folder", "") + if wallpaper_night_dir and os.path.isdir(wallpaper_night_dir): + cur_time = datetime.datetime.now() + if cur_time.hour > 21 or cur_time.hour < 6: + wallpaper_dir = wallpaper_night_dir + try: wallpapers = [x for x in os.listdir(wallpaper_dir) if ".vertical." not in x] except os.error as e: logger.warning("Could not load wallpapers from directory: {}".format(e)) + if wallpapers: if Config.get("desktop_bg_override", False): qtile.theme_instance.current_wallpaper = Config.get("desktop_bg_override", "") else: qtile.theme_instance.current_wallpaper = os.path.join(wallpaper_dir, random.choice(wallpapers)) + logger.warning("Selected new wallpaper: {}".format(qtile.theme_instance.current_wallpaper)) Kuro.set_wallpaper(qtile, qtile.theme_instance.current_wallpaper) else: utils.execute_once("nitrogen --restore") @@ -838,7 +851,8 @@ class Kuro(BaseTheme): :type qtile: libqtile.manager.Qtile """ if qtile.theme_instance.current_wallpaper: - p = utils.execute(["wal", "-n", "-i", "{}".format(qtile.theme_instance.current_wallpaper)]) + #p = utils.execute(["wal", "-n", "-i", "{}".format(qtile.theme_instance.current_wallpaper)]) + p = utils.execute(["wallust", "run", "{}".format(qtile.theme_instance.current_wallpaper)]) p.wait() colors = None diff --git a/kuro/utils/widgets.py b/kuro/utils/widgets.py index d03c0da..442595c 100644 --- a/kuro/utils/widgets.py +++ b/kuro/utils/widgets.py @@ -11,6 +11,7 @@ import six import unicodedata from libqtile import bar, pangocffi from libqtile.log_utils import logger +from libqtile.command.base import expose_command from libqtile.widget import base from libqtile.widget.base import ORIENTATION_HORIZONTAL from libqtile.widget.battery import default_icon_path, load_battery, BatteryState @@ -242,18 +243,19 @@ class DualPaneTextboxBase(base._Widget): self.bar.draw() self.changed = False - def cmd_set_font(self, font=base.UNSPECIFIED, fontsize_left=base.UNSPECIFIED, fontsize_right=base.UNSPECIFIED, fontshadow=base.UNSPECIFIED): + @expose_command() + def set_font(self, font=None, fontsize_left=None, fontsize_right=None, fontshadow=None): """ Change the font used by this widget. If font is None, the current font is used. """ - if font is not base.UNSPECIFIED: + if font is not None: self.font = font - if fontsize_left is not base.UNSPECIFIED: + if fontsize_left is not None: self.fontsize_left = fontsize_left - if fontsize_right is not base.UNSPECIFIED: + if fontsize_right is not None: self.fontsize_right = fontsize_right - if fontshadow is not base.UNSPECIFIED: + if fontshadow is not None: self.fontshadow = fontshadow self.bar.draw() @@ -354,7 +356,8 @@ class MediaWidget(base.InLoopPollText): # logger.warning("{}") pass - def cmd_update_custom_player(self, player_name, data): + @expose_command() + def update_custom_player(self, player_name, data): # Update firefox player if player_name.startswith("firefox"): if data['playing'] and data['muted']: @@ -538,7 +541,7 @@ class AudioVisualizerWidget(_Graph): class KuroCurrentLayoutIcon(CurrentLayoutIcon): def _get_layout_names(self): - names = super(KuroCurrentLayoutIcon, self)._get_layout_names() + names = list(super(KuroCurrentLayoutIcon, self)._get_layout_names()) from kuro.utils import layouts as kuro_layouts from libqtile.layout.base import Layout @@ -550,7 +553,7 @@ class KuroCurrentLayoutIcon(CurrentLayoutIcon): ] names.extend(klayouts) - return list(set(names)) + return set(names) class KuroTaskList(TaskList): @@ -1321,18 +1324,22 @@ class VolumeInfoWidget(DualPaneTextboxBase): self.update() - def cmd_increase_vol(self): + @expose_command() + def increase_vol(self): # Emulate button press. self.button_press(0, 0, BUTTON_UP) - def cmd_decrease_vol(self): + @expose_command() + def decrease_vol(self): # Emulate button press. self.button_press(0, 0, BUTTON_DOWN) - def cmd_mute(self): + @expose_command() + def mute(self): # Emulate button press. self.button_press(0, 0, BUTTON_MUTE) - def cmd_run_app(self): + @expose_command() + def run_app(self): # Emulate button press. self.button_press(0, 0, BUTTON_RIGHT)