feat: add wifi toggle slider (#348)

* feat: add wifi toggle slider

* Added styling options for the network switch

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
Rubin Bhandari
2024-10-21 14:15:53 +05:45
committed by GitHub
parent 3cae0e1fae
commit 2126cf0657
4 changed files with 181 additions and 117 deletions

View File

@@ -31,6 +31,15 @@ const Wifi = (): BoxWidget => {
hpack: 'start', hpack: 'start',
label: 'Wi-Fi', label: 'Wi-Fi',
}), }),
Widget.Switch({
class_name: 'menu-switch network',
vpack: 'center',
tooltip_text: 'Toggle Wifi',
active: network.wifi.enabled,
on_activate: () => {
network.toggleWifi();
},
}),
Widget.Button({ Widget.Button({
vpack: 'center', vpack: 'center',
hpack: 'end', hpack: 'end',

View File

@@ -528,6 +528,11 @@ const options = mkOptions(OPTIONS, {
passive: opt(colors.text), passive: opt(colors.text),
active: opt(colors.mauve), active: opt(colors.mauve),
}, },
switch: {
enabled: opt(colors.mauve),
disabled: opt(tertiary_colors.surface0),
puck: opt(secondary_colors.surface1),
},
}, },
bluetooth: { bluetooth: {
scaling: opt(100), scaling: opt(100),

View File

@@ -2,7 +2,7 @@
font-size: $font-size * $bar-menus-menu-network-scaling * 0.01; font-size: $font-size * $bar-menus-menu-network-scaling * 0.01;
} }
@import "./menu.scss"; @import './menu.scss';
.menu-items.network { .menu-items.network {
background: if($bar-menus-monochrome, $bar-menus-background, $bar-menus-menu-network-background-color); background: if($bar-menus-monochrome, $bar-menus-background, $bar-menus-menu-network-background-color);
@@ -72,7 +72,11 @@
} }
.active-connection { .active-connection {
color: if($bar-menus-monochrome, $bar-menus-iconbuttons-active, $bar-menus-menu-network-iconbuttons-active); color: if(
$bar-menus-monochrome,
$bar-menus-iconbuttons-active,
$bar-menus-menu-network-iconbuttons-active
);
} }
} }
@@ -140,8 +144,41 @@
background: if($bar-menus-monochrome, $bar-menus-cards, $bar-menus-menu-network-card-color); background: if($bar-menus-monochrome, $bar-menus-cards, $bar-menus-menu-network-card-color);
} }
.menu-items-section { .menu-items-section {
background: if($bar-menus-monochrome, $bar-menus-cards, $bar-menus-menu-network-card-color); background: if($bar-menus-monochrome, $bar-menus-cards, $bar-menus-menu-network-card-color);
} }
.menu-switch.network {
background-color: if(
$bar-menus-monochrome,
$bar-menus-switch-disabled,
$bar-menus-menu-network-switch-disabled
);
&:checked {
background: if($bar-menus-monochrome, $bar-menus-switch-enabled, $bar-menus-menu-network-switch-enabled);
}
slider {
background-color: if($bar-menus-monochrome, $bar-menus-switch-puck, $bar-menus-menu-network-switch-puck);
}
&:hover {
trough {
background: if(
$bar-menus-monochrome,
$bar-menus-switch-disabled,
$bar-menus-menu-network-switch-disabled
);
}
slider {
background: if($bar-menus-monochrome, $bar-menus-switch-puck, $bar-menus-menu-network-switch-puck);
}
}
&:active {
background: if($bar-menus-monochrome, $bar-menus-switch-enabled, $bar-menus-menu-network-switch-enabled);
}
}
} }

View File

@@ -40,6 +40,19 @@ export const NetworkMenuTheme = (): Scrollable<Child, Attribute> => {
type: 'color', type: 'color',
}), }),
Header('Switch'),
Option({
opt: options.theme.bar.menus.menu.network.switch.enabled,
title: 'Enabled',
type: 'color',
}),
Option({
opt: options.theme.bar.menus.menu.network.switch.disabled,
title: 'Disabled',
type: 'color',
}),
Option({ opt: options.theme.bar.menus.menu.network.switch.puck, title: 'Puck', type: 'color' }),
Header('List Items'), Header('List Items'),
Option({ Option({
opt: options.theme.bar.menus.menu.network.listitems.active, opt: options.theme.bar.menus.menu.network.listitems.active,