qs: wifi pwd
This commit is contained in:
parent
dc2712c66b
commit
b3e9b4e6be
5 changed files with 56 additions and 10 deletions
|
|
@ -32,6 +32,7 @@
|
||||||
networkmanager = {
|
networkmanager = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dns = lib.mkForce "systemd-resolved";
|
dns = lib.mkForce "systemd-resolved";
|
||||||
|
settings.connectivity.uri = "http://nmcheck.gnome.org/check_network_status.txt";
|
||||||
};
|
};
|
||||||
|
|
||||||
nameservers = [ "9.9.9.9" ];
|
nameservers = [ "9.9.9.9" ];
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ in {
|
||||||
users.users.${username} = {
|
users.users.${username} = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
extraGroups = [ "wheel" ];
|
extraGroups = [ "wheel" "networkmanager" ];
|
||||||
initialPassword = "test";
|
initialPassword = "test";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ PanelWindow {
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
WlrLayershell.namespace: "shell:bar"
|
WlrLayershell.namespace: "shell:bar"
|
||||||
|
focusable: tooltip.activeItem != null
|
||||||
|
|
||||||
readonly property Tooltip tooltip: tooltip;
|
readonly property Tooltip tooltip: tooltip;
|
||||||
Tooltip {
|
Tooltip {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import qs.bar
|
||||||
ClickableIcon {
|
ClickableIcon {
|
||||||
id: root
|
id: root
|
||||||
required property var bar;
|
required property var bar;
|
||||||
readonly property NetworkDevice adapter: Networking.devices.values[0]
|
readonly property WifiDevice adapter: Networking.devices.values[0] ?? null
|
||||||
readonly property bool connected: adapter.connected
|
readonly property bool connected: adapter.connected
|
||||||
readonly property WifiNetwork activeNetwork: adapter.networks.values.find(network => network.connected)
|
readonly property WifiNetwork activeNetwork: adapter.networks.values.find(network => network.connected)
|
||||||
|
|
||||||
|
|
@ -124,6 +124,7 @@ ClickableIcon {
|
||||||
device: root.adapter
|
device: root.adapter
|
||||||
network: modelData
|
network: modelData
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
onConnectionAttempted: root.adapter.scannerEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,45 @@ WrapperMouseArea {
|
||||||
required property NetworkDevice device
|
required property NetworkDevice device
|
||||||
required property WifiNetwork network
|
required property WifiNetwork network
|
||||||
property bool menuOpen: false
|
property bool menuOpen: false
|
||||||
readonly property bool showBg: false
|
property bool passwordRequired: false
|
||||||
|
readonly property bool showBg: root.passwordRequired
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
|
signal connectionAttempted();
|
||||||
|
|
||||||
|
function tryConnect() {
|
||||||
|
const connecting = root.network.connected || root.network.state == ConnectionState.Connecting;
|
||||||
|
if (connecting) root.device.disconnect();
|
||||||
|
else {
|
||||||
|
root.connectionAttempted();
|
||||||
|
if (pwField.text != "") root.network.connectWithPsk(pwField.text);
|
||||||
|
else root.network.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: menuOpen = !menuOpen
|
onClicked: menuOpen = !menuOpen
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.network
|
||||||
|
function onConnectionFailed(reason) {
|
||||||
|
console.log(reason, reason == ConnectionFailReason.NoSecrets);
|
||||||
|
pwField.text = "";
|
||||||
|
root.passwordRequired = reason == ConnectionFailReason.NoSecrets;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onStateChanged() {
|
||||||
|
if (root.network.state == ConnectionState.Connected) {
|
||||||
|
root.passwordRequired = false;
|
||||||
|
pwField.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WrapperRectangle {
|
WrapperRectangle {
|
||||||
color: root.showBg ? ShellGlobals.colors.widget : "transparent"
|
color: root.showBg ? ShellGlobals.colors.widget : "transparent"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: root.showBg ? ShellGlobals.colors.widgetOutline : "transparent"
|
border.color: root.showBg ? ShellGlobals.colors.widgetOutline : "transparent"
|
||||||
radius: 4
|
radius: 4
|
||||||
rightMargin: 2
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
@ -43,11 +71,7 @@ WrapperMouseArea {
|
||||||
implicitHeight: 24
|
implicitHeight: 24
|
||||||
implicitWidth: height
|
implicitWidth: height
|
||||||
showAction: root.network.stateChanging
|
showAction: root.network.stateChanging
|
||||||
onClicked: {
|
onClicked: tryConnect()
|
||||||
if (showAction) return;
|
|
||||||
else if (root.network.connected) root.device.disconnect();
|
|
||||||
else root.network.connect();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClickableIcon {
|
ClickableIcon {
|
||||||
|
|
@ -56,6 +80,25 @@ WrapperMouseArea {
|
||||||
implicitWidth: height
|
implicitWidth: height
|
||||||
visible: root.network.known
|
visible: root.network.known
|
||||||
onClicked: root.network.forget()
|
onClicked: root.network.forget()
|
||||||
|
Layout.rightMargin: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: pwField
|
||||||
|
visible: root.passwordRequired
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.margins: 4
|
||||||
|
placeholderText: "Password"
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
enabled: !(root.network.stateChanging || root.network.connected)
|
||||||
|
onAccepted: tryConnect()
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
//color: "transparent" // ShellGlobals.colors.widget
|
||||||
|
color: pwField.enabled ? "transparent" : ShellGlobals.colors.widgetActive
|
||||||
|
border.color: ShellGlobals.colors.widgetOutline
|
||||||
|
radius: 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue