forked from Shinonome/dots-hyprland
wifi networks: layout adjustment
This commit is contained in:
@@ -169,6 +169,28 @@ const CurrentNetwork = () => {
|
|||||||
cancelAuthButton
|
cancelAuthButton
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
const authEntry = Entry({
|
||||||
|
className: 'sidebar-wifinetworks-auth-entry',
|
||||||
|
visibility: false,
|
||||||
|
onAccept: (self) => {
|
||||||
|
authLock = false;
|
||||||
|
// Delete SSID connection before attempting to reconnect
|
||||||
|
execAsync(['nmcli', 'connection', 'delete', connectAttempt])
|
||||||
|
.catch(() => {}); // Ignore error if SSID not found
|
||||||
|
|
||||||
|
execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text])
|
||||||
|
.then(() => {
|
||||||
|
connectAttempt = ''; // Reset SSID after successful connection
|
||||||
|
networkAuth.revealChild = false; // Hide input if successful
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// Connection failed, show password input again
|
||||||
|
networkAuth.revealChild = true;
|
||||||
|
networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`;
|
||||||
|
self.text = ''; // Empty input for retry
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
const forgetButton = Button({
|
const forgetButton = Button({
|
||||||
label: 'Forget',
|
label: 'Forget',
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
@@ -190,7 +212,8 @@ const CurrentNetwork = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => notify(`Error: ${err}`));
|
.catch(err => notify(`Error: ${err}`));
|
||||||
}
|
},
|
||||||
|
setup: setupCursorHover,
|
||||||
});
|
});
|
||||||
const settingsButton = Button({
|
const settingsButton = Button({
|
||||||
label: 'Properties',
|
label: 'Properties',
|
||||||
@@ -208,10 +231,8 @@ const CurrentNetwork = () => {
|
|||||||
setup: setupCursorHover,
|
setup: setupCursorHover,
|
||||||
});
|
});
|
||||||
const networkProp = Box({
|
const networkProp = Box({
|
||||||
vertical: false,
|
className: 'spacing-h-10',
|
||||||
hpack: 'fill',
|
|
||||||
homogeneous: true,
|
homogeneous: true,
|
||||||
spacing: 10,
|
|
||||||
children: [
|
children: [
|
||||||
settingsButton,
|
settingsButton,
|
||||||
forgetButton,
|
forgetButton,
|
||||||
@@ -226,28 +247,7 @@ const CurrentNetwork = () => {
|
|||||||
vertical: true,
|
vertical: true,
|
||||||
children: [
|
children: [
|
||||||
authHeader,
|
authHeader,
|
||||||
Entry({
|
authEntry,
|
||||||
className: 'sidebar-wifinetworks-auth-entry',
|
|
||||||
visibility: false,
|
|
||||||
onAccept: (self) => {
|
|
||||||
authLock = false;
|
|
||||||
// Delete SSID connection before attempting to reconnect
|
|
||||||
execAsync(['nmcli', 'connection', 'delete', connectAttempt])
|
|
||||||
.catch(() => {}); // Ignore error if SSID not found
|
|
||||||
|
|
||||||
execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text])
|
|
||||||
.then(() => {
|
|
||||||
connectAttempt = ''; // Reset SSID after successful connection
|
|
||||||
networkAuth.revealChild = false; // Hide input if successful
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
// Connection failed, show password input again
|
|
||||||
networkAuth.revealChild = true;
|
|
||||||
networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`;
|
|
||||||
self.text = ''; // Empty input for retry
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
setup: (self) => self.hook(Network, (self) => {
|
setup: (self) => self.hook(Network, (self) => {
|
||||||
@@ -281,7 +281,7 @@ const CurrentNetwork = () => {
|
|||||||
vertical: true,
|
vertical: true,
|
||||||
children: [
|
children: [
|
||||||
Box({
|
Box({
|
||||||
className: 'spacing-h-10',
|
className: 'spacing-h-10 margin-bottom-10',
|
||||||
children: [
|
children: [
|
||||||
MaterialIcon('language', 'hugerass'),
|
MaterialIcon('language', 'hugerass'),
|
||||||
networkName,
|
networkName,
|
||||||
@@ -290,10 +290,10 @@ const CurrentNetwork = () => {
|
|||||||
|
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
networkAuth,
|
networkProp,
|
||||||
|
networkAuth
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
networkProp,
|
|
||||||
bottomSeparator,
|
bottomSeparator,
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -334,7 +334,7 @@ export default (props) => {
|
|||||||
vertical: true,
|
vertical: true,
|
||||||
className: 'spacing-v-5 margin-bottom-15',
|
className: 'spacing-v-5 margin-bottom-15',
|
||||||
setup: (self) => self.hook(Network, self.attribute.updateNetworks),
|
setup: (self) => self.hook(Network, self.attribute.updateNetworks),
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
overlays: [Box({
|
overlays: [Box({
|
||||||
className: 'sidebar-centermodules-scrollgradient-bottom'
|
className: 'sidebar-centermodules-scrollgradient-bottom'
|
||||||
|
|||||||
Reference in New Issue
Block a user