'border' as panel button border, add_from_file method

- Use 'border' as panel button border, not 'box-shadow';
- Added add_from_file method to ThemePreparation.
This commit is contained in:
Vladyslav Hroshev
2025-04-16 15:53:36 +03:00
parent 1ff3f6e17b
commit 408fe473ee
8 changed files with 43 additions and 29 deletions

View File

@@ -68,6 +68,14 @@ class Theme(ThemeBase):
self._preparation.add_to_start(content) self._preparation.add_to_start(content)
return self return self
def add_from_file(self, content) -> "Theme":
"""
Adds content from a file to the main styles file.
:param content: The path of the file to add.
"""
self._preparation.add_from_file(content)
return self
def prepare(self): def prepare(self):
"""Extract theme from source folder and prepare it for installation.""" """Extract theme from source folder and prepare it for installation."""
self._preparation.prepare() self._preparation.prepare()

View File

@@ -40,6 +40,15 @@ class ThemePreparation:
self.style_manager.prepend_content(content) self.style_manager.prepend_content(content)
return self return self
def add_from_file(self, content) -> "ThemePreparation":
"""
Adds content from a file to the main styles file.
:param content: The path of the file to add.
"""
with open(content, "r") as f:
self.style_manager.append_content(f.read())
return self
def prepare(self): def prepare(self):
""" """
Extract theme from source folder and prepare it for installation. Extract theme from source folder and prepare it for installation.

View File

@@ -31,9 +31,9 @@
.panel-button .clock { /* DND / new messages icon */ .panel-button .clock { /* DND / new messages icon */
color: TEXT-PRIMARY-COLOR; color: TEXT-PRIMARY-COLOR;
border-radius: 9px; border-radius: 9px;
border-width: 0 !important; border: 1px solid PANEL-BUTTON-BORDER !important;
background-color: ACCENT-DISABLED-COLOR; background-color: ACCENT-DISABLED-COLOR;
box-shadow: inset 0 0 0 1px BORDER-SHADOW; box-shadow: none;
} }
.panel-button:hover, .panel-button:hover,
@@ -87,7 +87,8 @@
/* panel clock fix. remove additional background */ /* panel clock fix. remove additional background */
.clock-display { .clock-display {
background-color: transparent !important; background-color: transparent !important;
box-shadow: none !important; box-shadow: none;
border: none !important;
} }
/* additional background for DND / new messages icon */ /* additional background for DND / new messages icon */

View File

@@ -1,4 +1,6 @@
from scripts import config from scripts import config
from scripts.utils.theme.theme import Theme
overview_folder = f"{config.tweaks_folder}/overview" overview_folder = f"{config.tweaks_folder}/overview"
@@ -7,9 +9,7 @@ def define_arguments(parser):
overview_args.add_argument('--launchpad', action='store_true', help='change Show Apps icon to macOS Launchpad icon') overview_args.add_argument('--launchpad', action='store_true', help='change Show Apps icon to macOS Launchpad icon')
def apply_tweak(args, theme, colors): def apply_tweak(args, theme: Theme, colors):
if args.launchpad: if args.launchpad:
with open(f"{overview_folder}/launchpad/launchpad.css", "r") as f: theme.add_from_file(f"{overview_folder}/launchpad/launchpad.css")
theme += f.read()
theme *= f"{overview_folder}/launchpad/launchpad.png" theme *= f"{overview_folder}/launchpad/launchpad.png"

View File

@@ -2,13 +2,16 @@
#panel { #panel {
height: 2.2em; height: 2.2em;
font-size: 15px; font-size: 1em;
}
.panel-button {
margin: 3px 2px;
} }
.panel-button, .panel-button,
.panel-button .clock { .panel-button .clock {
border-radius: 12px; border-radius: 8px;
border: 3px solid transparent !important;
} }
.panel-button { -natural-hpadding: 10px !important; } .panel-button { -natural-hpadding: 10px !important; }

View File

@@ -2,8 +2,6 @@
border-radius: 0; border-radius: 0;
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
box-shadow: none;
border: 1px solid PANEL-BUTTON-BORDER !important;
border-left-width: 0 !important; border-left-width: 0 !important;
} }
@@ -11,14 +9,12 @@
border-radius: 9px; border-radius: 9px;
margin-left: 3px; margin-left: 3px;
margin-right: 3px; margin-right: 3px;
box-shadow: none;
border: 1px solid PANEL-BUTTON-BORDER !important;
} }
#panelLeft > StBin:first-child > .panel-button, #panelLeft > StBin:first-child > .panel-button,
#panelRight > StBin:first-child > .panel-button { #panelRight > StBin:first-child > .panel-button {
border-radius: 9px 0 0 9px; border-radius: 9px 0 0 9px;
border: 1px solid PANEL-BUTTON-BORDER !important; border-left-width: 1px !important;
margin-left: 3px; margin-left: 3px;
} }
@@ -31,7 +27,7 @@
#panelLeft > StBin:first-child:last-child > .panel-button, #panelLeft > StBin:first-child:last-child > .panel-button,
#panelRight > StBin:first-child:last-child > .panel-button { #panelRight > StBin:first-child:last-child > .panel-button {
border-radius: 9px; border-radius: 9px;
border: 1px solid PANEL-BUTTON-BORDER !important; border-left-width: 1px !important;
margin-left: 3px; margin-left: 3px;
margin-right: 3px; margin-right: 3px;
} }

View File

@@ -5,8 +5,8 @@
background-color: transparent; background-color: transparent;
box-shadow: none; box-shadow: none;
margin: 0; margin: 0;
border: 4px solid transparent !important; border: 3px solid transparent !important;
border-radius: 12px; border-radius: 10px;
} }
.panel-button:hover, .panel-button:hover,

View File

@@ -1,5 +1,6 @@
from scripts import config from scripts import config
from scripts.utils.color_converter.color_converter_impl import ColorConverterImpl from scripts.utils.color_converter.color_converter_impl import ColorConverterImpl
from scripts.utils.theme.theme import Theme
panel_folder = f"{config.tweaks_folder}/panel" panel_folder = f"{config.tweaks_folder}/panel"
@@ -13,18 +14,15 @@ def define_arguments(parser):
panel_args.add_argument('--panel-grouped-buttons', action='store_true', help='group panel buttons together') panel_args.add_argument('--panel-grouped-buttons', action='store_true', help='group panel buttons together')
def apply_tweak(args, theme, colors): def apply_tweak(args, theme: Theme, colors):
if args.panel_no_pill:
with open(f"{panel_folder}/no-pill.css", "r") as f:
theme += f.read()
if args.panel_default_size: if args.panel_default_size:
with open(f"{panel_folder}/def-size.css", "r") as f: theme.add_from_file(f"{panel_folder}/def-size.css")
theme += f.read()
if args.panel_no_pill:
theme.add_from_file(f"{panel_folder}/no-pill.css")
if args.wider_panel: if args.wider_panel:
with open(f"{panel_folder}/wider-panel.css", "r") as f: theme.add_from_file(f"{panel_folder}/wider-panel.css")
theme += f.read()
if args.panel_text_color: if args.panel_text_color:
theme += ".panel-button,\ theme += ".panel-button,\
@@ -34,5 +32,4 @@ def apply_tweak(args, theme, colors):
}" }"
if args.panel_grouped_buttons: if args.panel_grouped_buttons:
with open(f"{panel_folder}/grouped-buttons.css", "r") as f: theme.add_from_file(f"{panel_folder}/grouped-buttons.css")
theme += f.read()