๐Ÿ Home๐Ÿ“šBlogs
๐Ÿ“Post

Share WiFi password with QR Code using Linux CLI

โŒ› a year ago | ๐Ÿ“– 1 min read


What are we trying to do?

We want to display current password and QR code of currently connected WiFi. We want to do this using Linux terminal and eventually bind this to a shortcut key and display it like a popup.The popup will be dismissed on any key press.

Requirements

Getting password and QR

nmcli device wifi show-password

This should output the password and QR code to connect for currently connected WiFi.

Showing this information in a popup-like window

alacritty --class Notice --title Wifi-info -o "window.dimensions.lines=20" -o "window.dimensions.columns=35" -o "window.position.x=5" -o "window.position.y=20" -e sh -c 'nmcli device wifi show-password && read -n 1'

Main part here is after -e flag where it runs the nmcli command to show the qr and then waits for a keyboard input before dismissing the window. Before that flags and values set position, window name, window class, and dimension for alacritty terminal.

If you are using a tiling window manager then you may want to set the window rule to floating for given class.

Now, you can bind this to your favorite hot-key.


Share this on

Related Blogs;