From 1ff3f6e17b99da620f07d846ade8277ae9bcc399 Mon Sep 17 00:00:00 2001 From: Vladyslav Hroshev Date: Wed, 16 Apr 2025 13:29:57 +0300 Subject: [PATCH] Added group panel buttons tweak --- colors.json | 15 +++++++ tweaks/panel/grouped-buttons.css | 77 ++++++++++++++++++++++++++++++++ tweaks/panel/tweak.py | 5 +++ 3 files changed, 97 insertions(+) create mode 100644 tweaks/panel/grouped-buttons.css diff --git a/colors.json b/colors.json index 06bba6d..c6f3832 100644 --- a/colors.json +++ b/colors.json @@ -486,6 +486,21 @@ "a" : 0.07 } }, + "PANEL-BUTTON-BORDER": { + "_comment" : "Used as border in panel buttons", + + "light" : { + "s" : 0, + "l" : 0, + "a" : 0.07 + }, + + "dark" : { + "s" : 0, + "l" : 100, + "a" : 0.04 + } + }, "SEPARATOR-COLOR" : { "_comment" : "Color for separators", diff --git a/tweaks/panel/grouped-buttons.css b/tweaks/panel/grouped-buttons.css new file mode 100644 index 0000000..ce6c152 --- /dev/null +++ b/tweaks/panel/grouped-buttons.css @@ -0,0 +1,77 @@ +.panel-button { + border-radius: 0; + margin-left: 0; + margin-right: 0; + box-shadow: none; + border: 1px solid PANEL-BUTTON-BORDER !important; + border-left-width: 0 !important; +} + +#panelCenter .panel-button { + border-radius: 9px; + margin-left: 3px; + margin-right: 3px; + box-shadow: none; + border: 1px solid PANEL-BUTTON-BORDER !important; +} + +#panelLeft > StBin:first-child > .panel-button, +#panelRight > StBin:first-child > .panel-button { + border-radius: 9px 0 0 9px; + border: 1px solid PANEL-BUTTON-BORDER !important; + margin-left: 3px; +} + +#panelLeft > StBin:last-child > .panel-button, +#panelRight > StBin:last-child > .panel-button { + border-radius: 0 9px 9px 0; + margin-right: 3px; +} + +#panelLeft > StBin:first-child:last-child > .panel-button, +#panelRight > StBin:first-child:last-child > .panel-button { + border-radius: 9px; + border: 1px solid PANEL-BUTTON-BORDER !important; + margin-left: 3px; + margin-right: 3px; +} + +#panelCenter .clock-display { + border: none !important; +} + +/* in dash to panel leftPanel, centerPanel, rightPanel doesn't work as intended */ +.dashtopanelMainPanel StBin:last-child > .panel-button { + border-radius: 0 !important; + margin-right: 0 !important; +} + +.dashtopanelMainPanel StBin:first-child:last-child > .panel-button { + border-radius: 9px !important; + margin-left: 3px !important; + margin-right: 3px !important; +} + +.dashtopanelMainPanel Gjs_ui_panel_QuickSettings.panel-button { + margin-right: 4px; + border-radius: 0 9px 9px 0; +} + +/* use entire button area for clock */ +.dashtopanelMainPanel .clock-display { + background-color: ACCENT-DISABLED-COLOR !important; + margin-left: 0; + margin-right: 0; + border: 1px solid PANEL-BUTTON-BORDER !important; + border-left-width: 0 !important; +} + +.dashtopanelMainPanel .clock-display .clock { + background-color: transparent; + border: none !important; + box-shadow: none; +} + +.dashtopanelMainPanel .clock-display:hover { + background-color: ACCENT-DISABLED_HOVER !important; +} \ No newline at end of file diff --git a/tweaks/panel/tweak.py b/tweaks/panel/tweak.py index e58e89f..048399b 100755 --- a/tweaks/panel/tweak.py +++ b/tweaks/panel/tweak.py @@ -10,6 +10,7 @@ def define_arguments(parser): panel_args.add_argument('-Pnp', '--panel-no-pill', action='store_true', help='remove panel button background') panel_args.add_argument('-Ptc', '--panel-text-color', type=str, nargs='?', help='custom panel HEX(A) text color') panel_args.add_argument('--wider-panel', action='store_true', help='make the panel wider') + panel_args.add_argument('--panel-grouped-buttons', action='store_true', help='group panel buttons together') def apply_tweak(args, theme, colors): @@ -31,3 +32,7 @@ def apply_tweak(args, theme, colors): .clock-display StIcon {\ color: rgba(" + ', '.join(map(str, ColorConverterImpl.hex_to_rgba(args.panel_text_color))) + ");\ }" + + if args.panel_grouped_buttons: + with open(f"{panel_folder}/grouped-buttons.css", "r") as f: + theme += f.read() \ No newline at end of file