forked from Shinonome/dots-hyprland
wifi networks: layout adjustments
This commit is contained in:
@@ -126,7 +126,7 @@ const CurrentNetwork = () => {
|
|||||||
const networkBandwidth = Box({
|
const networkBandwidth = Box({
|
||||||
vertical: true,
|
vertical: true,
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
hpack: 'center',
|
hpack: 'end',
|
||||||
className: 'sidebar-wifinetworks-bandwidth',
|
className: 'sidebar-wifinetworks-bandwidth',
|
||||||
children: [
|
children: [
|
||||||
NetResource('arrow_warm_up', `${App.configDir}/scripts/network_scripts/network_bandwidth.py sent`),
|
NetResource('arrow_warm_up', `${App.configDir}/scripts/network_scripts/network_bandwidth.py sent`),
|
||||||
@@ -155,8 +155,10 @@ const CurrentNetwork = () => {
|
|||||||
hpack: 'end',
|
hpack: 'end',
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
networkAuth.revealChild = false;
|
networkAuth.revealChild = false;
|
||||||
|
authFailed.revealChild = false;
|
||||||
networkAuthSSID.label = '';
|
networkAuthSSID.label = '';
|
||||||
networkName.children[1].label = Network.wifi?.ssid;
|
networkName.children[1].label = Network.wifi?.ssid;
|
||||||
|
authEntry.text = '';
|
||||||
},
|
},
|
||||||
setup: setupCursorHover,
|
setup: setupCursorHover,
|
||||||
});
|
});
|
||||||
@@ -169,6 +171,13 @@ const CurrentNetwork = () => {
|
|||||||
cancelAuthButton
|
cancelAuthButton
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
const authFailed = Revealer({
|
||||||
|
revealChild: false,
|
||||||
|
child: Label({
|
||||||
|
className: 'txt txt-italic txt-subtext',
|
||||||
|
label: 'Authentication failed',
|
||||||
|
}),
|
||||||
|
})
|
||||||
const authEntry = Entry({
|
const authEntry = Entry({
|
||||||
className: 'sidebar-wifinetworks-auth-entry',
|
className: 'sidebar-wifinetworks-auth-entry',
|
||||||
visibility: false,
|
visibility: false,
|
||||||
@@ -182,14 +191,16 @@ const CurrentNetwork = () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
connectAttempt = ''; // Reset SSID after successful connection
|
connectAttempt = ''; // Reset SSID after successful connection
|
||||||
networkAuth.revealChild = false; // Hide input if successful
|
networkAuth.revealChild = false; // Hide input if successful
|
||||||
|
authFailed.revealChild = false; // Hide failed message if successful
|
||||||
|
self.text = ''; // Empty input for retry
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// Connection failed, show password input again
|
// Connection failed, show password input again
|
||||||
networkAuth.revealChild = true;
|
networkAuth.revealChild = true;
|
||||||
networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`;
|
authFailed.revealChild = true;
|
||||||
self.text = ''; // Empty input for retry
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
placeholderText: 'Enter network password',
|
||||||
});
|
});
|
||||||
const forgetButton = Button({
|
const forgetButton = Button({
|
||||||
label: 'Forget',
|
label: 'Forget',
|
||||||
@@ -249,6 +260,7 @@ const CurrentNetwork = () => {
|
|||||||
children: [
|
children: [
|
||||||
authHeader,
|
authHeader,
|
||||||
authEntry,
|
authEntry,
|
||||||
|
authFailed,
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
setup: (self) => self.hook(Network, (self) => {
|
setup: (self) => self.hook(Network, (self) => {
|
||||||
@@ -266,6 +278,7 @@ const CurrentNetwork = () => {
|
|||||||
timeoutId = setTimeout(() => {
|
timeoutId = setTimeout(() => {
|
||||||
authLock = false;
|
authLock = false;
|
||||||
self.revealChild = false;
|
self.revealChild = false;
|
||||||
|
authFailed.revealChild = false;
|
||||||
Network.wifi.state = 'activated';
|
Network.wifi.state = 'activated';
|
||||||
}, 20000); // 20 seconds timeout
|
}, 20000); // 20 seconds timeout
|
||||||
}
|
}
|
||||||
@@ -287,8 +300,7 @@ const CurrentNetwork = () => {
|
|||||||
MaterialIcon('language', 'hugerass'),
|
MaterialIcon('language', 'hugerass'),
|
||||||
networkName,
|
networkName,
|
||||||
networkBandwidth,
|
networkBandwidth,
|
||||||
networkStatus,
|
// networkStatus,
|
||||||
|
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
networkProp,
|
networkProp,
|
||||||
|
|||||||
Reference in New Issue
Block a user