diff --git a/dynamic-panel-transparency@rockon999.github.io/extension.js b/dynamic-panel-transparency@rockon999.github.io/extension.js index 7a285a8..91ef0e7 100644 --- a/dynamic-panel-transparency@rockon999.github.io/extension.js +++ b/dynamic-panel-transparency@rockon999.github.io/extension.js @@ -106,7 +106,6 @@ function modify_panel() { /* Register text color styling. */ let [text, icon, arrow] = Theming.register_text_color(Settings.get_text_color()); // eslint-disable-line no-unused-vars let [maximized_text, maximized_icon, maximized_arrow] = Theming.register_text_color(Settings.get_maximized_text_color(), 'maximized'); // eslint-disable-line no-unused-vars - if (Settings.get_enable_text_color()) { if (text !== null) { Theming.set_text_color(); @@ -114,6 +113,15 @@ function modify_panel() { log('[Dynamic Panel Transparency] Failed to enabled text coloring.'); } } + + + if (Settings.get_hide_corners()) { + if (hide_corners !== null) { + Theming.add_hide_corners(); + } else { + log('[Dynamic Panel Transparency] Failed to enable hide corners.'); + } + } } function unmodify_panel() { @@ -154,7 +162,11 @@ function initialize_settings() { name: 'hide_corners', type: 'b', handler: (function() { - Transitions.update_corner_alpha(); + if (Settings.get_hide_corners()) { + Theming.add_hide_corners(); + } else { + Theming.remove_hide_corners(); + } }.bind(this)) }); Settings.add({ @@ -206,7 +218,7 @@ function initialize_settings() { for (let i = Theming.stylesheets.length - 1; i >= 0; i--) { let stylesheet = Theming.stylesheets[i]; - if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1) { + if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1 && stylesheet.indexOf('panel-hide-corners') == -1) { theme.unload_stylesheet(Util.get_file(stylesheet)); Util.remove_file(stylesheet); Theming.stylesheets.splice(i, 1); @@ -247,7 +259,7 @@ function initialize_settings() { for (let i = Theming.stylesheets.length - 1; i >= 0; i--) { let stylesheet = Theming.stylesheets[i]; - if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1) { + if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1 && stylesheet.indexOf('panel-hide-corners') == -1) { theme.unload_stylesheet(Util.get_file(stylesheet)); Util.remove_file(stylesheet); Theming.stylesheets.splice(i, 1); @@ -285,7 +297,7 @@ function initialize_settings() { for (let i = Theming.stylesheets.length - 1; i >= 0; i--) { let stylesheet = Theming.stylesheets[i]; - if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel.dpt.css') !== -1) { + if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel.dpt.css') !== -1 && stylesheet.indexOf('panel-hide-corners') == -1) { theme.unload_stylesheet(Util.get_file(stylesheet)); Util.remove_file(stylesheet); Theming.stylesheets.splice(i, 1); @@ -568,4 +580,4 @@ function initialize_settings() { /* After we've given Settings the necessary information... let's bind it. */ Settings.bind(); -} \ No newline at end of file +} diff --git a/dynamic-panel-transparency@rockon999.github.io/stylesheet.css b/dynamic-panel-transparency@rockon999.github.io/stylesheet.css index 702169d..e80a8f4 100644 --- a/dynamic-panel-transparency@rockon999.github.io/stylesheet.css +++ b/dynamic-panel-transparency@rockon999.github.io/stylesheet.css @@ -20,3 +20,6 @@ background-image: none; } +/* Prevents overlapping of corners + top bar when using transparency */ +.dpt-panel-hide-corners { + -panel-corner-border-width: 0px;} diff --git a/dynamic-panel-transparency@rockon999.github.io/theming.js b/dynamic-panel-transparency@rockon999.github.io/theming.js index ef88d6e..b3bbb87 100644 --- a/dynamic-panel-transparency@rockon999.github.io/theming.js +++ b/dynamic-panel-transparency@rockon999.github.io/theming.js @@ -1,4 +1,4 @@ -/* exported init, cleanup, remove_maximized_background_color, remove_unmaximized_background_color, set_maximized_background_color, set_unmaximized_background_color, remove_background_color, register_text_shadow, add_text_shadow, register_icon_shadow, add_icon_shadow, has_text_shadow, has_icon_shadow, remove_text_shadow, remove_icon_shadow, register_text_color, set_text_color, remove_text_color, set_panel_color, set_corner_color, clear_corner_color, get_background_image_color, get_background_color, get_maximized_opacity, get_unmaximized_opacity, strip_panel_styling, reapply_panel_styling, strip_panel_background_image, reapply_panel_background_image, strip_panel_background, reapply_panel_background, set_background_alpha */ +/* exported init, cleanup, register_hide_corners, add_hide_corners, remove_hide_corners, remove_maximized_background_color, remove_unmaximized_background_color, set_maximized_background_color, set_unmaximized_background_color, remove_background_color, register_text_shadow, add_text_shadow, register_icon_shadow, add_icon_shadow, has_text_shadow, has_icon_shadow, remove_text_shadow, remove_icon_shadow, register_text_color, set_text_color, remove_text_color, set_panel_color, set_corner_color, clear_corner_color, get_background_image_color, get_background_color, get_maximized_opacity, get_unmaximized_opacity, strip_panel_styling, reapply_panel_styling, strip_panel_background_image, reapply_panel_background_image, strip_panel_background, reapply_panel_background, set_background_alpha */ const St = imports.gi.St; @@ -150,6 +150,31 @@ function has_icon_shadow() { function remove_text_shadow() { Panel.remove_style_class_name('dpt-panel-text-shadow'); } +/** + * Registers a hide corners stylesheet. + * + */ +function register_hide_corners() { + let stylesheet = apply_stylesheet_css('.dpt-panel-hide-corners .panel-corner { -panel-corner-radius: 0px; }', 'background/panel-hide-corners'); + + register_style('dpt-panel-hide-corners'); + + return stylesheet; +} +/** + * Adds the currently registered hide corners stylesheet to the corners of the panel. + * + */ +function add_hide_corners() { + Panel.add_style_class_name('dpt-panel-hide-corners'); +} +/** + * Unhides corners; deregistering the stylesheet and removing the css. + * + */ +function remove_hide_corners() { + Panel.remove_style_class_name('dpt-panel-hide-corners'); +} /** * Removes any icon shadowing; deregistering the stylesheet and removing the css.