From db4a6d953ec56aeb4fa5aa04f3d7c08857a7fe7d Mon Sep 17 00:00:00 2001 From: Satoxyan Date: Tue, 4 Mar 2025 11:58:18 +0700 Subject: [PATCH 01/14] fix the sideright wifi module (#1127) --- .config/ags/modules/sideright/centermodules/wifinetworks.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index ca0e7da0c..237b421c9 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -142,8 +142,10 @@ const CurrentNetwork = () => { onAccept: (self) => { authLock = false; networkAuth.revealChild = false; - execAsync(`nmcli device wifi connect '${connectAttempt}' password '${self.text}'`) - .catch(print); + execAsync(['nmcli', 'connection', 'delete', connectAttempt]) + .catch(print) + .then(() => execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text]) + .catch(print)); } }) ] From ad63420198e75550d96ceec525e6ee912414d032 Mon Sep 17 00:00:00 2001 From: Satoxyan Date: Tue, 11 Mar 2025 14:03:59 +0700 Subject: [PATCH 02/14] adjusting timeout for wifinetwork --- .../sideright/centermodules/wifinetworks.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 237b421c9..f597a84e3 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -81,7 +81,8 @@ const NetResource = (icon, command) => { const CurrentNetwork = () => { let authLock = false; - // console.log(Network.wifi); + let timeoutId = null; + const bottomSeparator = Box({ className: 'separator-line', }); @@ -138,7 +139,7 @@ const CurrentNetwork = () => { }), Entry({ className: 'sidebar-wifinetworks-auth-entry', - visibility: false, // Password dots + visibility: false, onAccept: (self) => { authLock = false; networkAuth.revealChild = false; @@ -155,6 +156,14 @@ const CurrentNetwork = () => { authLock = true; connectAttempt = Network.wifi.ssid; self.revealChild = true; + if (timeoutId) { + clearTimeout(timeoutId); + } + timeoutId = setTimeout(() => { + authLock = false; + self.revealChild = false; + Network.wifi.state = 'activated'; + }, 20000); // 20 seconds timeout } }), }); @@ -249,4 +258,4 @@ export default (props) => { bottomBar, ] }); -} +} \ No newline at end of file From 968534c99a43fc5e24a4778d764f38483ee47023 Mon Sep 17 00:00:00 2001 From: Satoxyan Date: Thu, 20 Mar 2025 09:37:21 +0700 Subject: [PATCH 03/14] fix:wifinetwork keep asking for pass --- .../sideright/centermodules/wifinetworks.js | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index f597a84e3..b39a28c16 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -143,28 +143,32 @@ const CurrentNetwork = () => { onAccept: (self) => { authLock = false; networkAuth.revealChild = false; - execAsync(['nmcli', 'connection', 'delete', connectAttempt]) - .catch(print) - .then(() => execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text]) - .catch(print)); + execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text]) + .catch(print); } - }) + }) ] }), setup: (self) => self.hook(Network, (self) => { - if (Network.wifi.state == 'failed' || Network.wifi.state == 'need_auth') { - authLock = true; - connectAttempt = Network.wifi.ssid; - self.revealChild = true; - if (timeoutId) { - clearTimeout(timeoutId); + execAsync(['nmcli', '-g', 'NAME', 'connection', 'show']) + .then((savedConnections) => { + const savedSSIDs = savedConnections.split('\n'); + if (Network.wifi.state == 'failed' || + (Network.wifi.state == 'need_auth' && !savedSSIDs.includes(Network.wifi.ssid))) { + authLock = true; + connectAttempt = Network.wifi.ssid; + self.revealChild = true; + if (timeoutId) { + clearTimeout(timeoutId); + } + timeoutId = setTimeout(() => { + authLock = false; + self.revealChild = false; + Network.wifi.state = 'activated'; + }, 20000); // 20 seconds timeout + } } - timeoutId = setTimeout(() => { - authLock = false; - self.revealChild = false; - Network.wifi.state = 'activated'; - }, 20000); // 20 seconds timeout - } + ).catch(print); }), }); const actualContent = Box({ From 5d86c7e6a25c53b4374e8bc552bee296bb768f55 Mon Sep 17 00:00:00 2001 From: Satoxyan Date: Fri, 28 Mar 2025 20:34:09 +0700 Subject: [PATCH 04/14] wifinetworks:big improvement, and more bugfix --- .../sideright/centermodules/wifinetworks.js | 140 +++++++++++++++--- .config/ags/scss/_sidebars.scss | 14 ++ .config/hypr/hyprland/rules.conf | 6 + 3 files changed, 141 insertions(+), 19 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index b39a28c16..71cb1cd5f 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -17,6 +17,8 @@ const MATERIAL_SYMBOL_SIGNAL_STRENGTH = { } let connectAttempt = ''; +let networkAuth = null; +let networkAuthSSID = null; const WifiNetwork = (accessPoint) => { const networkStrength = MaterialIcon(MATERIAL_SYMBOL_SIGNAL_STRENGTH[accessPoint.iconName], 'hugerass') @@ -35,15 +37,34 @@ const WifiNetwork = (accessPoint) => { ] }); return Button({ - onClicked: accessPoint.active ? () => { } : () => execAsync(`nmcli device wifi connect ${accessPoint.bssid}`) - // .catch(e => { - // Utils.notify({ - // summary: "Network", - // body: e, - // actions: { "Open network manager": () => execAsync("nm-connection-editor").catch(print) } - // }); - // }) - .catch(print), + onClicked: accessPoint.active ? () => {} : () => { + connectAttempt = accessPoint.ssid; + networkAuthSSID.label = `Connecting to: ${connectAttempt}`; + + // Cek apakah SSID sudah tersimpan + execAsync(['nmcli', '-g', 'NAME', 'connection', 'show']) + .then((savedConnections) => { + const savedSSIDs = savedConnections.split('\n'); + + if (!savedSSIDs.includes(connectAttempt)) { + // Jika SSID belum tersimpan, tampilkan input password + if (networkAuth) { + networkAuth.revealChild = true; + } + } else { + // Jika SSID sudah tersimpan, sembunyikan input password + if (networkAuth) { + networkAuth.revealChild = false; + } + + // Langsung konek tanpa input password + execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt]) + .catch(print); + } + }) + .catch(print); + + }, child: Box({ className: 'sidebar-wifinetworks-network spacing-h-10', children: [ @@ -124,28 +145,108 @@ const CurrentNetwork = () => { self.label = Network.wifi.state; }), })] - }) - const networkAuth = Revealer({ + }); + networkAuthSSID = Label({ + className: 'margin-left-5', + hpack: 'start', + hexpand: true, + label: '', + }); + const cancelAuthButton = Button({ + className: 'txt sidebar-centermodules-rightbar-button', + label: 'Cancel', + hpack: 'end', + onClicked: () => { + networkAuth.revealChild = false; + networkAuthSSID.label = ''; + networkName.children[1].label = Network.wifi?.ssid; + } + }); + const authHeader = Box({ + vertical: false, + hpack: 'fill', + spacing: 10, + children: [ + networkAuthSSID, + cancelAuthButton + ] + }); + const forgetButton = Button({ + label: 'Forget Network', + hexpand: true, + className: 'txt sidebar-centermodules-rightbar-button', + onClicked: () => { + execAsync(['nmcli', '-t', '-f', 'ACTIVE,NAME', 'connection', 'show']) + .then(output => { + const activeSSID = output + .split('\n') + .find(line => line.startsWith('yes:')) + ?.split(':')[1]; + + if (activeSSID) { + execAsync(['nmcli', 'connection', 'delete', activeSSID]) + .then(() => notify(`Forgot network: ${activeSSID}`)) + .catch(err => notify(`Failed to forget network: ${err}`)); + } else { + notify('No active network to forget'); + } + }) + .catch(err => notify(`Error: ${err}`)); + } + }); + const settingsButton = Button({ + label: 'Network Properties', + className: 'txt sidebar-centermodules-rightbar-button', + hexpand: true, + onClicked: () => { + Utils.execAsync('nmcli -t -f uuid connection show --active').then(uuid => { + if (uuid.trim()) { + Utils.execAsync(`nm-connection-editor --edit ${uuid.trim()}`); + } + }).catch(error => { + Utils.notify('Failed to get connection UUID'); + }); + } + }); + const networkProp = Box({ + vertical: false, + hpack: 'fill', + homogeneous: true, + spacing: 10, + children: [ + settingsButton, + forgetButton, + ] + }); + networkAuth = Revealer({ transition: 'slide_down', transitionDuration: userOptions.animations.durationLarge, child: Box({ className: 'margin-top-10 spacing-v-5', vertical: true, children: [ - Label({ - className: 'margin-left-5', - hpack: 'start', - label: getString("Authentication"), - }), + authHeader, Entry({ className: 'sidebar-wifinetworks-auth-entry', visibility: false, onAccept: (self) => { authLock = false; - networkAuth.revealChild = false; + // Hapus koneksi SSID sebelum mencoba menyambung ulang + execAsync(['nmcli', 'connection', 'delete', connectAttempt]) + .catch(() => {}); // Abaikan error jika SSID tidak ditemukan + execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text]) - .catch(print); - } + .then(() => { + connectAttempt = ''; // Reset SSID setelah koneksi berhasil + networkAuth.revealChild = false; // Sembunyikan input jika berhasil + }) + .catch(() => { + // Jika koneksi gagal, tampilkan kembali input password + networkAuth.revealChild = true; + networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`; + self.text = ''; // Kosongkan input untuk coba lagi + }); + } }) ] }), @@ -192,6 +293,7 @@ const CurrentNetwork = () => { networkAuth, ] }), + networkProp, bottomSeparator, ] }); diff --git a/.config/ags/scss/_sidebars.scss b/.config/ags/scss/_sidebars.scss index d9206f9d5..2c79379fa 100644 --- a/.config/ags/scss/_sidebars.scss +++ b/.config/ags/scss/_sidebars.scss @@ -1039,3 +1039,17 @@ $waifu_image_overlay_transparency: 0.7; .sidebar-centermodules-scrollgradient-bottom { background: linear-gradient(to top, $layer1 0%, transparentize($layer1, 1) 1.023rem); } + +.sidebar-centermodules-rightbar-button { + @include full-rounding; + @include element_decel; + min-width: 6.818rem; + min-height: 2.25rem; + background-color: $layer2Hover; + color: $onLayer2; +} + +.sidebar-centermodules-rightbar-button:hover, +.sidebar-centermodules-rightbar-button:focus { + background-color: $layer2Active; +} \ No newline at end of file diff --git a/.config/hypr/hyprland/rules.conf b/.config/hypr/hyprland/rules.conf index 3387ec4a7..5693b4e34 100644 --- a/.config/hypr/hyprland/rules.conf +++ b/.config/hypr/hyprland/rules.conf @@ -10,6 +10,7 @@ windowrulev2 = noblur, class:.* # Specific floating windows. windowrulev2 = float, class:^(blueberry\.py)$ windowrulev2 = float, class:^(steam)$ +windowrulev2 = float, class:^(nm-connection-editor)$ windowrulev2 = float, class:^(guifetch)$ # FlafyDev/guifetch # Tiling rule for a specific app. @@ -40,6 +41,11 @@ windowrulev2 = move 73% 72%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ windowrulev2 = size 25%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ windowrulev2 = pin, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = size 45%, class:^(pavucontrol)$ +windowrulev2 = center, class:^(pavucontrol)$ +windowrulev2 = size 45%, class:^(nm-connection-editor)$ +windowrulev2 = center, class:^(nm-connection-editor)$ + # --- Tearing --- windowrulev2 = immediate, title:.*\.exe From c34744d650f4fdf92880496b05fedd64dd6036da Mon Sep 17 00:00:00 2001 From: Satoxyan Date: Fri, 28 Mar 2025 20:36:44 +0700 Subject: [PATCH 05/14] wifinetworks:change label --- .config/ags/modules/sideright/centermodules/wifinetworks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 71cb1cd5f..00c30659c 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -172,7 +172,7 @@ const CurrentNetwork = () => { ] }); const forgetButton = Button({ - label: 'Forget Network', + label: 'Forget', hexpand: true, className: 'txt sidebar-centermodules-rightbar-button', onClicked: () => { @@ -195,7 +195,7 @@ const CurrentNetwork = () => { } }); const settingsButton = Button({ - label: 'Network Properties', + label: 'Properties', className: 'txt sidebar-centermodules-rightbar-button', hexpand: true, onClicked: () => { From c1ab074de594dabe4c66ac7c2309b33ffe3d79ef Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 17:26:25 +0100 Subject: [PATCH 06/14] dependencies: add nm-connection-editor --- arch-packages/illogical-impulse-widgets/PKGBUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/arch-packages/illogical-impulse-widgets/PKGBUILD b/arch-packages/illogical-impulse-widgets/PKGBUILD index 37a018c71..447c4b5aa 100644 --- a/arch-packages/illogical-impulse-widgets/PKGBUILD +++ b/arch-packages/illogical-impulse-widgets/PKGBUILD @@ -13,4 +13,5 @@ depends=( wl-clipboard hyprpicker anyrun-git + nm-connection-editor ) From d9a1793bfc463e7a6d6045b277cf6a647180605b Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 17:30:21 +0100 Subject: [PATCH 07/14] wifi networks: styles: rename + fix light theme caret color --- .../sideright/centermodules/wifinetworks.js | 15 +++++++++------ .config/ags/scss/_sidebars.scss | 7 ++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 00c30659c..3ad7bd53a 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -153,14 +153,15 @@ const CurrentNetwork = () => { label: '', }); const cancelAuthButton = Button({ - className: 'txt sidebar-centermodules-rightbar-button', + className: 'txt sidebar-wifinetworks-network-button', label: 'Cancel', hpack: 'end', onClicked: () => { networkAuth.revealChild = false; networkAuthSSID.label = ''; networkName.children[1].label = Network.wifi?.ssid; - } + }, + setup: setupCursorHover, }); const authHeader = Box({ vertical: false, @@ -174,7 +175,7 @@ const CurrentNetwork = () => { const forgetButton = Button({ label: 'Forget', hexpand: true, - className: 'txt sidebar-centermodules-rightbar-button', + className: 'txt sidebar-wifinetworks-network-button', onClicked: () => { execAsync(['nmcli', '-t', '-f', 'ACTIVE,NAME', 'connection', 'show']) .then(output => { @@ -196,7 +197,7 @@ const CurrentNetwork = () => { }); const settingsButton = Button({ label: 'Properties', - className: 'txt sidebar-centermodules-rightbar-button', + className: 'txt sidebar-wifinetworks-network-button', hexpand: true, onClicked: () => { Utils.execAsync('nmcli -t -f uuid connection show --active').then(uuid => { @@ -206,7 +207,8 @@ const CurrentNetwork = () => { }).catch(error => { Utils.notify('Failed to get connection UUID'); }); - } + }, + setup: setupCursorHover, }); const networkProp = Box({ vertical: false, @@ -216,7 +218,8 @@ const CurrentNetwork = () => { children: [ settingsButton, forgetButton, - ] + ], + setup: setupCursorHover, }); networkAuth = Revealer({ transition: 'slide_down', diff --git a/.config/ags/scss/_sidebars.scss b/.config/ags/scss/_sidebars.scss index 2c79379fa..b02b88152 100644 --- a/.config/ags/scss/_sidebars.scss +++ b/.config/ags/scss/_sidebars.scss @@ -1011,6 +1011,7 @@ $waifu_image_overlay_transparency: 0.7; background-color: $layer1; color: $onLayer1; padding: 0.682rem; + caret-color: $onLayer2; } .sidebar-wifinetworks-bandwidth { @@ -1040,7 +1041,7 @@ $waifu_image_overlay_transparency: 0.7; background: linear-gradient(to top, $layer1 0%, transparentize($layer1, 1) 1.023rem); } -.sidebar-centermodules-rightbar-button { +.sidebar-wifinetworks-network-button { @include full-rounding; @include element_decel; min-width: 6.818rem; @@ -1049,7 +1050,7 @@ $waifu_image_overlay_transparency: 0.7; color: $onLayer2; } -.sidebar-centermodules-rightbar-button:hover, -.sidebar-centermodules-rightbar-button:focus { +.sidebar-wifinetworks-network-button:hover, +.sidebar-wifinetworks-network-button:focus { background-color: $layer2Active; } \ No newline at end of file From 22bd00f67e5430d6d07e7f96ef8b37e796de26cb Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 17:35:20 +0100 Subject: [PATCH 08/14] translate comments to english --- .../sideright/centermodules/wifinetworks.js | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 3ad7bd53a..5f2c972bf 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -41,23 +41,20 @@ const WifiNetwork = (accessPoint) => { connectAttempt = accessPoint.ssid; networkAuthSSID.label = `Connecting to: ${connectAttempt}`; - // Cek apakah SSID sudah tersimpan + // Check if the SSID is stored execAsync(['nmcli', '-g', 'NAME', 'connection', 'show']) .then((savedConnections) => { const savedSSIDs = savedConnections.split('\n'); - if (!savedSSIDs.includes(connectAttempt)) { - // Jika SSID belum tersimpan, tampilkan input password + if (!savedSSIDs.includes(connectAttempt)) { // SSID not saved: show password input if (networkAuth) { networkAuth.revealChild = true; } - } else { - // Jika SSID sudah tersimpan, sembunyikan input password + } else { // If SSID is saved, hide password input if (networkAuth) { networkAuth.revealChild = false; } - - // Langsung konek tanpa input password + // Connect execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt]) .catch(print); } @@ -234,20 +231,20 @@ const CurrentNetwork = () => { visibility: false, onAccept: (self) => { authLock = false; - // Hapus koneksi SSID sebelum mencoba menyambung ulang + // Delete SSID connection before attempting to reconnect execAsync(['nmcli', 'connection', 'delete', connectAttempt]) - .catch(() => {}); // Abaikan error jika SSID tidak ditemukan + .catch(() => {}); // Ignore error if SSID not found execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text]) .then(() => { - connectAttempt = ''; // Reset SSID setelah koneksi berhasil - networkAuth.revealChild = false; // Sembunyikan input jika berhasil + connectAttempt = ''; // Reset SSID after successful connection + networkAuth.revealChild = false; // Hide input if successful }) .catch(() => { - // Jika koneksi gagal, tampilkan kembali input password + // Connection failed, show password input again networkAuth.revealChild = true; networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`; - self.text = ''; // Kosongkan input untuk coba lagi + self.text = ''; // Empty input for retry }); } }) From fbb159c576ef106a4906b9848d61f520a2939b8c Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 17:50:51 +0100 Subject: [PATCH 09/14] wifi networks: layout adjustment --- .../sideright/centermodules/wifinetworks.js | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 5f2c972bf..0dc7a0852 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -169,6 +169,28 @@ const CurrentNetwork = () => { 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({ label: 'Forget', hexpand: true, @@ -190,7 +212,8 @@ const CurrentNetwork = () => { } }) .catch(err => notify(`Error: ${err}`)); - } + }, + setup: setupCursorHover, }); const settingsButton = Button({ label: 'Properties', @@ -208,10 +231,8 @@ const CurrentNetwork = () => { setup: setupCursorHover, }); const networkProp = Box({ - vertical: false, - hpack: 'fill', + className: 'spacing-h-10', homogeneous: true, - spacing: 10, children: [ settingsButton, forgetButton, @@ -226,28 +247,7 @@ const CurrentNetwork = () => { vertical: true, children: [ authHeader, - 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 - }); - } - }) + authEntry, ] }), setup: (self) => self.hook(Network, (self) => { @@ -281,7 +281,7 @@ const CurrentNetwork = () => { vertical: true, children: [ Box({ - className: 'spacing-h-10', + className: 'spacing-h-10 margin-bottom-10', children: [ MaterialIcon('language', 'hugerass'), networkName, @@ -290,10 +290,10 @@ const CurrentNetwork = () => { ] }), - networkAuth, + networkProp, + networkAuth ] }), - networkProp, bottomSeparator, ] }); @@ -334,7 +334,7 @@ export default (props) => { vertical: true, className: 'spacing-v-5 margin-bottom-15', setup: (self) => self.hook(Network, self.attribute.updateNetworks), - }) + }), }), overlays: [Box({ className: 'sidebar-centermodules-scrollgradient-bottom' From dd35d8d02a6d69d2b4c9346b3e503f3e98c7425e Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 17:53:30 +0100 Subject: [PATCH 10/14] wifi networks: properties button: close sidebar --- .config/ags/modules/sideright/centermodules/wifinetworks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 0dc7a0852..3194b9e56 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -224,6 +224,7 @@ const CurrentNetwork = () => { if (uuid.trim()) { Utils.execAsync(`nm-connection-editor --edit ${uuid.trim()}`); } + closeEverything(); }).catch(error => { Utils.notify('Failed to get connection UUID'); }); From a4811814b1c3f084a88828008f4340419b5bc2a6 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 17:59:44 +0100 Subject: [PATCH 11/14] fix windowrule for pavucontrol --- .config/hypr/hyprland/rules.conf | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.config/hypr/hyprland/rules.conf b/.config/hypr/hyprland/rules.conf index 5693b4e34..5a107eb33 100644 --- a/.config/hypr/hyprland/rules.conf +++ b/.config/hypr/hyprland/rules.conf @@ -7,17 +7,30 @@ windowrulev2 = noblur, class:.* # Uncomment to apply global transparency to all windows: # windowrulev2 = opacity 0.89 override 0.89 override, class:.* -# Specific floating windows. +# Floating windowrulev2 = float, class:^(blueberry\.py)$ windowrulev2 = float, class:^(steam)$ -windowrulev2 = float, class:^(nm-connection-editor)$ windowrulev2 = float, class:^(guifetch)$ # FlafyDev/guifetch +windowrulev2 = float, class:^(pavucontrol)$ +windowrulev2 = size 45%, class:^(pavucontrol)$ +windowrulev2 = center, class:^(pavucontrol)$ +windowrulev2 = float, class:^(org.pulseaudio.pavucontrol)$ +windowrulev2 = size 45%, class:^(org.pulseaudio.pavucontrol)$ +windowrulev2 = center, class:^(org.pulseaudio.pavucontrol)$ +windowrulev2 = float, class:^(nm-connection-editor)$ +windowrulev2 = size 45%, class:^(nm-connection-editor)$ +windowrulev2 = center, class:^(nm-connection-editor)$ -# Tiling rule for a specific app. +# Tiling windowrulev2 = tile, class:^dev\.warp\.Warp$ -# Picture-in-Picture window (matched by title). +# Picture-in-Picture windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = keepaspectratio, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = move 73% 72%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = size 25%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = pin, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ # Dialog windows – float+center these windows. windowrulev2 = center, title:^(Open File)(.*)$ @@ -35,17 +48,6 @@ windowrulev2 = float, title:^(Save As)(.*)$ windowrulev2 = float, title:^(Library)(.*)$ windowrulev2 = float, title:^(File Upload)(.*)$ -# --- Picture-in-Picture enhancements --- -windowrulev2 = keepaspectratio, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ -windowrulev2 = move 73% 72%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ -windowrulev2 = size 25%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ -windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ -windowrulev2 = pin, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ -windowrulev2 = size 45%, class:^(pavucontrol)$ -windowrulev2 = center, class:^(pavucontrol)$ -windowrulev2 = size 45%, class:^(nm-connection-editor)$ -windowrulev2 = center, class:^(nm-connection-editor)$ - # --- Tearing --- windowrulev2 = immediate, title:.*\.exe From 04bee91d43bdbcea407017a0fb9a33f1bb625b90 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 18:34:05 +0100 Subject: [PATCH 12/14] wifi networks: layout adjustments --- .../sideright/centermodules/wifinetworks.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 3194b9e56..4aa0b3b20 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -126,7 +126,7 @@ const CurrentNetwork = () => { const networkBandwidth = Box({ vertical: true, hexpand: true, - hpack: 'center', + hpack: 'end', className: 'sidebar-wifinetworks-bandwidth', children: [ NetResource('arrow_warm_up', `${App.configDir}/scripts/network_scripts/network_bandwidth.py sent`), @@ -155,8 +155,10 @@ const CurrentNetwork = () => { hpack: 'end', onClicked: () => { networkAuth.revealChild = false; + authFailed.revealChild = false; networkAuthSSID.label = ''; networkName.children[1].label = Network.wifi?.ssid; + authEntry.text = ''; }, setup: setupCursorHover, }); @@ -169,6 +171,13 @@ const CurrentNetwork = () => { cancelAuthButton ] }); + const authFailed = Revealer({ + revealChild: false, + child: Label({ + className: 'txt txt-italic txt-subtext', + label: 'Authentication failed', + }), + }) const authEntry = Entry({ className: 'sidebar-wifinetworks-auth-entry', visibility: false, @@ -182,14 +191,16 @@ const CurrentNetwork = () => { .then(() => { connectAttempt = ''; // Reset SSID after successful connection networkAuth.revealChild = false; // Hide input if successful + authFailed.revealChild = false; // Hide failed message if successful + self.text = ''; // Empty input for retry }) .catch(() => { // Connection failed, show password input again networkAuth.revealChild = true; - networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`; - self.text = ''; // Empty input for retry + authFailed.revealChild = true; }); - } + }, + placeholderText: 'Enter network password', }); const forgetButton = Button({ label: 'Forget', @@ -249,6 +260,7 @@ const CurrentNetwork = () => { children: [ authHeader, authEntry, + authFailed, ] }), setup: (self) => self.hook(Network, (self) => { @@ -266,6 +278,7 @@ const CurrentNetwork = () => { timeoutId = setTimeout(() => { authLock = false; self.revealChild = false; + authFailed.revealChild = false; Network.wifi.state = 'activated'; }, 20000); // 20 seconds timeout } @@ -287,8 +300,7 @@ const CurrentNetwork = () => { MaterialIcon('language', 'hugerass'), networkName, networkBandwidth, - networkStatus, - + // networkStatus, ] }), networkProp, From f2ad19f14b08528695371c7c674d1444e83c0bba Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 18:45:30 +0100 Subject: [PATCH 13/14] wifi networks: hide network actions when not connected --- .../sideright/centermodules/wifinetworks.js | 91 ++++++++++--------- 1 file changed, 48 insertions(+), 43 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 4aa0b3b20..8e54255c9 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -37,31 +37,31 @@ const WifiNetwork = (accessPoint) => { ] }); return Button({ - onClicked: accessPoint.active ? () => {} : () => { + onClicked: accessPoint.active ? () => { } : () => { connectAttempt = accessPoint.ssid; networkAuthSSID.label = `Connecting to: ${connectAttempt}`; - + // Check if the SSID is stored execAsync(['nmcli', '-g', 'NAME', 'connection', 'show']) - .then((savedConnections) => { - const savedSSIDs = savedConnections.split('\n'); - - if (!savedSSIDs.includes(connectAttempt)) { // SSID not saved: show password input - if (networkAuth) { - networkAuth.revealChild = true; + .then((savedConnections) => { + const savedSSIDs = savedConnections.split('\n'); + + if (!savedSSIDs.includes(connectAttempt)) { // SSID not saved: show password input + if (networkAuth) { + networkAuth.revealChild = true; + } + } else { // If SSID is saved, hide password input + if (networkAuth) { + networkAuth.revealChild = false; + } + // Connect + execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt]) + .catch(print); } - } else { // If SSID is saved, hide password input - if (networkAuth) { - networkAuth.revealChild = false; - } - // Connect - execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt]) - .catch(print); - } - }) - .catch(print); - - }, + }) + .catch(print); + + }, child: Box({ className: 'sidebar-wifinetworks-network spacing-h-10', children: [ @@ -185,10 +185,10 @@ const CurrentNetwork = () => { authLock = false; // Delete SSID connection before attempting to reconnect execAsync(['nmcli', 'connection', 'delete', connectAttempt]) - .catch(() => {}); // Ignore error if SSID not found - + .catch(() => { }); // Ignore error if SSID not found + execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text]) - .then(() => { + .then(() => { connectAttempt = ''; // Reset SSID after successful connection networkAuth.revealChild = false; // Hide input if successful authFailed.revealChild = false; // Hide failed message if successful @@ -213,20 +213,17 @@ const CurrentNetwork = () => { .split('\n') .find(line => line.startsWith('yes:')) ?.split(':')[1]; - + if (activeSSID) { execAsync(['nmcli', 'connection', 'delete', activeSSID]) - .then(() => notify(`Forgot network: ${activeSSID}`)) - .catch(err => notify(`Failed to forget network: ${err}`)); - } else { - notify('No active network to forget'); + .catch(err => Utils.notify(`Failed to forget network: ${err}`)); } }) - .catch(err => notify(`Error: ${err}`)); + .catch(print); }, setup: setupCursorHover, }); - const settingsButton = Button({ + const propertiesButton = Button({ label: 'Properties', className: 'txt sidebar-wifinetworks-network-button', hexpand: true, @@ -242,14 +239,22 @@ const CurrentNetwork = () => { }, setup: setupCursorHover, }); - const networkProp = Box({ - className: 'spacing-h-10', - homogeneous: true, - children: [ - settingsButton, - forgetButton, - ], - setup: setupCursorHover, + const networkProp = Revealer({ + transition: 'slide_down', + transitionDuration: userOptions.animations.durationLarge, + child: Box({ + className: 'spacing-h-10', + homogeneous: true, + children: [ + propertiesButton, + forgetButton, + ], + setup: setupCursorHover, + }), + setup: (self) => self.hook(Network, (self) => { + if (Network.wifi?.ssid === '') self.revealChild = false; + else self.revealChild = true; + }), }); networkAuth = Revealer({ transition: 'slide_down', @@ -266,9 +271,9 @@ const CurrentNetwork = () => { setup: (self) => self.hook(Network, (self) => { execAsync(['nmcli', '-g', 'NAME', 'connection', 'show']) .then((savedConnections) => { - const savedSSIDs = savedConnections.split('\n'); - if (Network.wifi.state == 'failed' || - (Network.wifi.state == 'need_auth' && !savedSSIDs.includes(Network.wifi.ssid))) { + const savedSSIDs = savedConnections.split('\n'); + if (Network.wifi.state == 'failed' || + (Network.wifi.state == 'need_auth' && !savedSSIDs.includes(Network.wifi.ssid))) { authLock = true; connectAttempt = Network.wifi.ssid; self.revealChild = true; @@ -279,11 +284,11 @@ const CurrentNetwork = () => { authLock = false; self.revealChild = false; authFailed.revealChild = false; - Network.wifi.state = 'activated'; + Network.wifi.state = 'activated'; }, 20000); // 20 seconds timeout } } - ).catch(print); + ).catch(print); }), }); const actualContent = Box({ From e99321c5f2004f86662505db16f79b0513b3387a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 28 Mar 2025 19:01:41 +0100 Subject: [PATCH 14/14] wifi networks: improve notifications --- .../sideright/centermodules/wifinetworks.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.config/ags/modules/sideright/centermodules/wifinetworks.js b/.config/ags/modules/sideright/centermodules/wifinetworks.js index 8e54255c9..90be10b9f 100644 --- a/.config/ags/modules/sideright/centermodules/wifinetworks.js +++ b/.config/ags/modules/sideright/centermodules/wifinetworks.js @@ -216,10 +216,14 @@ const CurrentNetwork = () => { if (activeSSID) { execAsync(['nmcli', 'connection', 'delete', activeSSID]) - .catch(err => Utils.notify(`Failed to forget network: ${err}`)); + .catch(err => Utils.execAsync(['notify-send', + "Network", + `Failed to forget network - Hold to copy\n${err}`, + '-a', 'ags', + ]).catch(print)); } }) - .catch(print); + .catch(); }, setup: setupCursorHover, }); @@ -233,9 +237,11 @@ const CurrentNetwork = () => { Utils.execAsync(`nm-connection-editor --edit ${uuid.trim()}`); } closeEverything(); - }).catch(error => { - Utils.notify('Failed to get connection UUID'); - }); + }).catch(err => Utils.execAsync(['notify-send', + "Network", + `Failed to get connection UUID - Hold to copy\n${err}`, + '-a', 'ags', + ]).catch(print)); }, setup: setupCursorHover, });