Skip to content

Commit 40260da

Browse files
Merge pull request #167 from luisbocanegra/konsole-auto-theme-profile
2 parents eb1bbee + 2350c8c commit 40260da

File tree

6 files changed

+217
-129
lines changed

6 files changed

+217
-129
lines changed

src/kde_material_you_colors/apply_themes.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,14 @@ def apply(config: Configs, wallpaper: WallpaperReader, dark_light):
5151
if config.read("titlebar_opacity"):
5252
titlebar_utils.titlebar_opacity(config.read("titlebar_opacity"))
5353
needs_kwin_reload = True
54-
if config.read("konsole_profile"):
55-
konsole_utils.make_mirror_profile(config.read("konsole_profile"))
56-
konsole_utils.apply_color_scheme(
57-
dark_light,
58-
config.read("pywal_light"),
59-
schemes,
60-
config.read("konsole_profile"),
61-
konsole_opacity=config.read("konsole_opacity"),
62-
)
54+
konsole_utils.export_scheme(
55+
light=config.read("light"),
56+
pywal_light=config.read("pywal_light"),
57+
schemes=schemes,
58+
konsole_opacity=config.read("konsole_opacity"),
59+
)
60+
if config.read("disable_konsole") is not True:
61+
konsole_utils.apply_color_scheme()
6362
if config.read("darker_window_list"):
6463
titlebar_utils.kwin_rule_darker_titlebar(
6564
dark_light

src/kde_material_you_colors/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def __init__(self, args):
9393
"dark_blend_multiplier": [args.dbmultiplier, 1, 2],
9494
"on_change_hook": [args.on_change_hook, None, 3],
9595
"sierra_breeze_buttons_color": [args.sierra_breeze_buttons_color, None, 0],
96-
"konsole_profile": [args.konsole_profile, None, 3],
96+
"disable_konsole": [args.disable_konsole, False, 0],
9797
"titlebar_opacity": [args.titlebar_opacity, None, 1],
9898
"toolbar_opacity": [args.toolbar_opacity, None, 1],
9999
"konsole_opacity": [args.konsole_opacity, None, 1],

src/kde_material_you_colors/data/sample_config.conf

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ncolor = 0
5454
# Accepted values are True or False comment out to dark/light scheme
5555
# Commented by default (Follows light option above)
5656
# NOTE:
57-
# Theming konsole only doesn't require pywal, just setting konsole_profile below
57+
# Theming Konsole doesn't require pywal to be installed
5858
#pywal_light = False
5959

6060
# The amount of perceptible color for backgrounds in dark mode
@@ -78,15 +78,11 @@ ncolor = 0
7878
# This WILL OVERWRITE any set colors and reload KWin (screen will blink on x11)
7979
#sierra_breeze_buttons_color = True
8080

81-
# Dynamically updated Konsole color scheme
82-
# Accepted value is the name of your current Konsole profile, except TempMyou and Default profile as is read only
83-
# Default is commented (disabled)
81+
# Disable automatic Konsole theming
82+
# Default is False
8483
# NOTE:
85-
# This makes a temp profile named TempMyou.profile and MaterialYou/MaterialYouAlt color schemes to switch between them automatically in all open Konsole instances
86-
# You can make direct changes to your profile, but for the color scheme edit MaterialYou one
87-
# WARNING:
88-
# I recommend you to backup the ~/.local/share/konsole/ folder before trying this because it will edit your profiles
89-
#konsole_profile = Profile 1
84+
# When enabled, Konsole color scheme files are still generated, but not enforced
85+
#disable_konsole = False
9086

9187
# Konsole background opacity
9288
# An integer between 0 and 100

src/kde_material_you_colors/main.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,11 @@ def main():
175175
)
176176

177177
parser.add_argument(
178-
"--konsole-profile",
179-
"-kp",
180-
type=str,
181-
help="The name of your (existing) Konsole profile that is going to be themed, you can check your current profiles with konsole --list-profiles",
178+
"--disable-konsole",
179+
"-dk",
180+
action="store_true",
181+
help="Disable Konsole automatic theming (color schemes are still generated)",
182182
default=None,
183-
metavar="<profile>",
184183
)
185184

186185
parser.add_argument(
@@ -316,12 +315,15 @@ def main():
316315

317316
counter = 0
318317

318+
logging.debug(config.options)
319+
319320
while True:
320321
config_modified.set_value(file_utils.get_file_sha1(config_file))
321322

322323
# Get config from file and compare it with passed args
323324
if config_modified.changed:
324325
config = Configs(args)
326+
logging.debug(config.options)
325327

326328
# Get current options, pass to watcher
327329
config_watcher.set_value(config.options)

src/kde_material_you_colors/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
KONSOLE_COLOR_SCHEME_PATH = KONSOLE_DIR + "MaterialYou.colorscheme"
4343
KONSOLE_COLOR_SCHEME_ALT_PATH = KONSOLE_DIR + "MaterialYouAlt.colorscheme"
4444
KONSOLE_TEMP_PROFILE = KONSOLE_DIR + "TempMyou.profile"
45+
KONSOLE_DEFAULT_THEMED_PROFILE = "Profile 1"
46+
KONSOLE_RC = HOME + "/.config/konsolerc"
4547
KSYNTAX_THEMES_DIR = HOME + "/.local/share/org.kde.syntax-highlighting/themes/"
4648
LOG_FILE_PATH = HOME + "/.local/share/kde-material-you-colors/"
4749
LOG_FILE_NAME = "kde-material-you-colors.log"

0 commit comments

Comments
 (0)