From cca34af31eda6538c657b6d6687aac39d08ea10c Mon Sep 17 00:00:00 2001 From: Alice Mikhaylenko Date: Tue, 18 Jun 2024 21:39:06 +0400 Subject: [PATCH] switch: Add hover styles Same as checkboxes. Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6455 Part-of: --- data/theme/gnome-shell-sass/widgets/_switches.scss | 13 +++++++++++++ js/ui/popupMenu.js | 1 + 2 files changed, 14 insertions(+) diff --git a/data/theme/gnome-shell-sass/widgets/_switches.scss b/data/theme/gnome-shell-sass/widgets/_switches.scss index 31e4de05a..28416b5c8 100644 --- a/data/theme/gnome-shell-sass/widgets/_switches.scss +++ b/data/theme/gnome-shell-sass/widgets/_switches.scss @@ -11,8 +11,16 @@ $switch_handle_size: 20px; @if $contrast == 'high' { background: transparentize(if($variant == 'light', black, white), .7); + + &:hover { + background: transparentize(if($variant == 'light', black, white), .6); + } } @else { background: transparentize(if($variant == 'light', black, white), .85); + + &:hover { + background: transparentize(if($variant == 'light', black, white), .8); + } } StIcon { @@ -33,6 +41,11 @@ $switch_handle_size: 20px; background: $selected_bg_color; color: $selected_fg_color; + &:hover { + background-color: lighten($selected_bg_color, 5%); + color: lighten($selected_fg_color, 5%); + } + .handle { background: white; } diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index a37484bbd..bc98be2fc 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -343,6 +343,7 @@ export const Switch = GObject.registerClass({ super._init({ style_class: 'toggle-switch', accessible_role: Atk.Role.CHECK_BOX, + track_hover: true, }); const box = new St.BoxLayout({