firecat53/networkmanager-dmenu

Control NetworkManager via dmenu

Python

1,000

273 commits

updated Oct 12, 2026

See the code

README

Networkmanager-dmenu

Manage NetworkManager connections with supported launchers instead of nm-applet.

Features

  • Connect to existing NetworkManager WiFi or wired connections
  • Connect to new WiFi connections. Requests passphrase if required
  • Connect to existing VPN, Wireguard, GSM/WWAN and Bluetooth connections
  • Enable/Disable WiFi, WWAN, bluetooth and networking
  • Launch nm-connection-editor GUI
  • Support for multiple WiFi adapters
  • Optional Pinentry support for secure passphrase entry
  • Delete existing connections
  • Rescan WiFi networks
  • Uses notify-send for notifications if available
  • Start/stop/delete existing NetworkManager Hotspots
  • Show password/QR code for current WiFi network

Screencast

Installation

Requirements

  1. Python 3.11+
  2. NetworkManager
  3. Dmenu (X), Rofi (X or XWayland), Wofi (Wayland), Yofi (Wayland) or Bemenu (X or Wayland)
  4. Python gobject (PyGObject, python-gobject, etc.)
  5. (Debian/Ubuntu based distros) libnm0 (libnm-util-dev on older distributions) and gir1.2-nm-1.0 (you have to explicitly install the latter on Debian Sid)
  6. (optional) The network-manager-applet or nm-connection-editor package, depending on distro (in order to launch the GUI connection editor, if desired. The applet does not need to be started.)
  7. (optional) Pinentry. Make sure to set which flavor of pinentry command to use in the config file.
  8. (optional) ModemManager for WWAN support.
  9. (optional) notify-send (libnotify) for notifications (connected, disconnected, etc.)
  10. (optional) bluez package for bluetooth control

Configuration

Initial Setup

  • Run ./networkmanager_dmenu in your terminal to generate the config file. Checks for installed launchers and terminals and prompts for selection. The generated config file will be created at: ~/.config/networkmanager-dmenu/config.ini

Custom Configuration

  • To customize behavior further, edit the generated configuration file
  • You can also manually copy config.ini.example to ~/.config/networkmanager-dmenu/config.ini and edit it directly
  • Alternatively, specify a custom config file location using:
    • Command line: --config /path/to/config.ini
    • Environment variable: NM_DMENU_CONFIG=/path/to/config.ini networkmanager_dmenu
    • The command line flag takes precedence over the environment variable
  • All theming is done through the respective menu programs. Set dmenu_command with the desired options, including things like -i for case insensitivity. See config.ini.example for examples.
    • Note: if a literal % is used in the config, it must be entered as %%. See config.ini.example.
  • If using dmenu for passphrase entry (pinentry not set), dmenu options in the [dmenu_passphrase] section of config.ini will set the normal foreground and background colors to be the same to obscure the passphrase. The Suckless password patch -P option is supported if that patch is installed. Rofi, Wofi and Bemenu will use their respective flags for passphrase entry.
  • Set default terminal (xterm, urxvtc, etc.) command in config.ini.
  • Configure show_pass to run nmcli dev wifi show-password in a terminal. This may take some experimentation to determine what will work for your terminal.
  • Saved connections can be listed if desired. Set list_saved = True under [dmenu] in config.ini. If set to False, saved connections are still accessible under a "Saved connections" sub-menu.
  • If desired, copy the networkmanager_dmenu.desktop to /usr/share/applications or ~/.local/share/applications.
  • If you want to run the script as $USER instead of ROOT
    1. Set PolicyKit permissions. The script is usable for connecting to pre-existing connections without setting these, but you won't be able to enable/disable networking or add new connections.
  • For bluetooth control, there are two options:
    1. If bluez is installed and the bluetooth service is running, no further action is needed.

    2. If not, the user needs to have access to /dev/rfkill. On some distros (e.g. Archlinux), /dev/rfkill belongs to a group such as rfkill. In this case, ensure $USER belongs to that group. For other distros (e.g. Fedora), you can use udev to ensure /dev/rfkill belongs to a group. For example, create /etc/udev/rules.d/10-rfkill.rules:

          KERNEL=="rfkill", GROUP="wheel", MODE="0664"
      

      and then ensure $USER belongs to the wheel group.

Config.ini values

SectionKeyDefaultNotes
[dmenu]compactFalse
dmenu_commanddmenuCommand can include arguments
list_savedFalse
pinentryNone
active_chars==Prefix of active connection
highlightFalseOnly applicable to rofi / wofi
highlight_fgNoneOnly applicable to wofi
highlight_bgNoneOnly applicable to wofi
highlight_boldTrueOnly applicable to wofi
promptNetworks
wifi_charsNoneString of 4 unicode characters
wifi_iconsNoneString of icon characters
format(depends on compact)Python-style format string
[pinentry]descriptionGet network password
promptPassword:
[dmenu_passphrase]obscureFalse
obscure_color#222222Only applicable to dmenu
show_passSee config.ini.exampleCLI to run nmcli d wifi show-password
[editor]gui_if_availableTrue
guinm-connection-editor
terminalxtermCan include terminal arguments
[nmdm]rescan_delay5Adjust delay in re-opening nmdm following rescan
show_notificationsTrueSet to False to disable notify-send messages
notification_timeout5Seconds a notify-send message stays on screen

Usage

networkmanager_dmenu [-h] [-V] [--config CONFIG_PATH] <menu args>

  • Run script or bind to keystroke combination
  • If desired, menu options can be passed on the command line instead of or in addition to the config file. These will override options in the config file.
  • Networkmanager_dmenu cannot create hotspots, but can manage existing ones. To create a new NetworkManager hotspot and show a QR Code with the password:
nmcli device wifi hotspot ifname wlp0s20f3 ssid testing password pass123456 band a
nmcli connection up hotspot (or use networkmanager_dmenu to enable)
nmcli device wifi show-password

This may not work for your setup. Linux-wifi-hotspot is an option if straight NetworkManager WiFi sharing doesn't work for you. Unfortunately, these hotspots cannot be managed with networkmanager_dmenu.

  • NOTE Running under UWSM requires some extra configuration.
    • Assigning to keyboard shortcut: uwsm app -- networkmanager_dmenu
    • If launching by, for example, clicking a Waybar icon, Waybar must be the version that works with UWSM and be started as a systemd --user service.

Development

The version is documented as __version__ in the script.

nix develop provides a shell with the needed dependencies on Nix or NixOS.

make release VERSION=x.y.z opens $EDITOR prefilled with one bullet per commit since the last tag, creates an annotated tag, then prints the push command. Github action in place to create a release for each tag push.

MIT License

dmenu
networkmanager
rofi

firecat53/networkmanager-dmenu

Control NetworkManager via dmenu

Python

1,000

273 commits

updated Oct 12, 2026

See the code

README

Networkmanager-dmenu

Manage NetworkManager connections with supported launchers instead of nm-applet.

Features

  • Connect to existing NetworkManager WiFi or wired connections
  • Connect to new WiFi connections. Requests passphrase if required
  • Connect to existing VPN, Wireguard, GSM/WWAN and Bluetooth connections
  • Enable/Disable WiFi, WWAN, bluetooth and networking
  • Launch nm-connection-editor GUI
  • Support for multiple WiFi adapters
  • Optional Pinentry support for secure passphrase entry
  • Delete existing connections
  • Rescan WiFi networks
  • Uses notify-send for notifications if available
  • Start/stop/delete existing NetworkManager Hotspots
  • Show password/QR code for current WiFi network

Screencast

Installation

Requirements

  1. Python 3.11+
  2. NetworkManager
  3. Dmenu (X), Rofi (X or XWayland), Wofi (Wayland), Yofi (Wayland) or Bemenu (X or Wayland)
  4. Python gobject (PyGObject, python-gobject, etc.)
  5. (Debian/Ubuntu based distros) libnm0 (libnm-util-dev on older distributions) and gir1.2-nm-1.0 (you have to explicitly install the latter on Debian Sid)
  6. (optional) The network-manager-applet or nm-connection-editor package, depending on distro (in order to launch the GUI connection editor, if desired. The applet does not need to be started.)
  7. (optional) Pinentry. Make sure to set which flavor of pinentry command to use in the config file.
  8. (optional) ModemManager for WWAN support.
  9. (optional) notify-send (libnotify) for notifications (connected, disconnected, etc.)
  10. (optional) bluez package for bluetooth control

Configuration

Initial Setup

  • Run ./networkmanager_dmenu in your terminal to generate the config file. Checks for installed launchers and terminals and prompts for selection. The generated config file will be created at: ~/.config/networkmanager-dmenu/config.ini

Custom Configuration

  • To customize behavior further, edit the generated configuration file
  • You can also manually copy config.ini.example to ~/.config/networkmanager-dmenu/config.ini and edit it directly
  • Alternatively, specify a custom config file location using:
    • Command line: --config /path/to/config.ini
    • Environment variable: NM_DMENU_CONFIG=/path/to/config.ini networkmanager_dmenu
    • The command line flag takes precedence over the environment variable
  • All theming is done through the respective menu programs. Set dmenu_command with the desired options, including things like -i for case insensitivity. See config.ini.example for examples.
    • Note: if a literal % is used in the config, it must be entered as %%. See config.ini.example.
  • If using dmenu for passphrase entry (pinentry not set), dmenu options in the [dmenu_passphrase] section of config.ini will set the normal foreground and background colors to be the same to obscure the passphrase. The Suckless password patch -P option is supported if that patch is installed. Rofi, Wofi and Bemenu will use their respective flags for passphrase entry.
  • Set default terminal (xterm, urxvtc, etc.) command in config.ini.
  • Configure show_pass to run nmcli dev wifi show-password in a terminal. This may take some experimentation to determine what will work for your terminal.
  • Saved connections can be listed if desired. Set list_saved = True under [dmenu] in config.ini. If set to False, saved connections are still accessible under a "Saved connections" sub-menu.
  • If desired, copy the networkmanager_dmenu.desktop to /usr/share/applications or ~/.local/share/applications.
  • If you want to run the script as $USER instead of ROOT
    1. Set PolicyKit permissions. The script is usable for connecting to pre-existing connections without setting these, but you won't be able to enable/disable networking or add new connections.
  • For bluetooth control, there are two options:
    1. If bluez is installed and the bluetooth service is running, no further action is needed.

    2. If not, the user needs to have access to /dev/rfkill. On some distros (e.g. Archlinux), /dev/rfkill belongs to a group such as rfkill. In this case, ensure $USER belongs to that group. For other distros (e.g. Fedora), you can use udev to ensure /dev/rfkill belongs to a group. For example, create /etc/udev/rules.d/10-rfkill.rules:

          KERNEL=="rfkill", GROUP="wheel", MODE="0664"
      

      and then ensure $USER belongs to the wheel group.

Config.ini values

SectionKeyDefaultNotes
[dmenu]compactFalse
dmenu_commanddmenuCommand can include arguments
list_savedFalse
pinentryNone
active_chars==Prefix of active connection
highlightFalseOnly applicable to rofi / wofi
highlight_fgNoneOnly applicable to wofi
highlight_bgNoneOnly applicable to wofi
highlight_boldTrueOnly applicable to wofi
promptNetworks
wifi_charsNoneString of 4 unicode characters
wifi_iconsNoneString of icon characters
format(depends on compact)Python-style format string
[pinentry]descriptionGet network password
promptPassword:
[dmenu_passphrase]obscureFalse
obscure_color#222222Only applicable to dmenu
show_passSee config.ini.exampleCLI to run nmcli d wifi show-password
[editor]gui_if_availableTrue
guinm-connection-editor
terminalxtermCan include terminal arguments
[nmdm]rescan_delay5Adjust delay in re-opening nmdm following rescan
show_notificationsTrueSet to False to disable notify-send messages
notification_timeout5Seconds a notify-send message stays on screen

Usage

networkmanager_dmenu [-h] [-V] [--config CONFIG_PATH] <menu args>

  • Run script or bind to keystroke combination
  • If desired, menu options can be passed on the command line instead of or in addition to the config file. These will override options in the config file.
  • Networkmanager_dmenu cannot create hotspots, but can manage existing ones. To create a new NetworkManager hotspot and show a QR Code with the password:
nmcli device wifi hotspot ifname wlp0s20f3 ssid testing password pass123456 band a
nmcli connection up hotspot (or use networkmanager_dmenu to enable)
nmcli device wifi show-password

This may not work for your setup. Linux-wifi-hotspot is an option if straight NetworkManager WiFi sharing doesn't work for you. Unfortunately, these hotspots cannot be managed with networkmanager_dmenu.

  • NOTE Running under UWSM requires some extra configuration.
    • Assigning to keyboard shortcut: uwsm app -- networkmanager_dmenu
    • If launching by, for example, clicking a Waybar icon, Waybar must be the version that works with UWSM and be started as a systemd --user service.

Development

The version is documented as __version__ in the script.

nix develop provides a shell with the needed dependencies on Nix or NixOS.

make release VERSION=x.y.z opens $EDITOR prefilled with one bullet per commit since the last tag, creates an annotated tag, then prints the push command. Github action in place to create a release for each tag push.

MIT License

dmenu
networkmanager
rofi

Project health

Overall

3.8/10

Maintained

10/10

Code review

0/10
OpenSSF Scorecard

Significant stargazers

Patrick Schratz

342 followers · starred Jul 2019

Ivan Malison

148 followers · starred Jun 2018

Paweł Gronowski

78 followers · starred Oct 2018

Danijar Hafner

2,400 followers · starred Mar 2017