Nm-applet

From awesome
Jump to: navigation, search

nm-applet is a system tray application to help connect to both wired and wireless networks.

Running as a non-root user: easy way[edit]

Add yourself to netdev group:

adduser username netdev

I guess some similar policy exist on almost any system. If this fails, follow the non easy way below.

Running as a non-root user[edit]

If one tries to run nm-applet as a non-root user then it will often show no networks, this is because of its security policies. It is possible to run it using "sudo nm-applet", however this will not allow you to autostart it.

To allow the user to run nm-applet on without root privileges the following files need to be edited:

/etc/dbus-1/system.d/NetworkManager.conf

/etc/dbus-1/system.d/NetworkManagerInfo.conf

/etc/dbus-1/system.d/nm-applet.conf

/etc/dbus-1/system.d/nm-avahi-autoipd.conf

/etc/dbus-1/system.d/nm-dhcp-client.conf

In each file, copy the section of text which starts with <policy user="root"> and ends with </policy>. Paste it immediately below the </policy> line, and change the <policy user="root"> line to your username, i.e. <policy user="fred">, where "fred" is your username.

For example:

<policy user="root">
  <allow own="org.freedesktop.nm_dhcp_client"/>
  <allow send_interface="org.freedesktop.nm_dhcp_client"/>
</policy>

Becomes:

<policy user="root">
  <allow own="org.freedesktop.nm_dhcp_client"/>
  <allow send_interface="org.freedesktop.nm_dhcp_client"/>
</policy>
<policy user="fred">
  <allow own="org.freedesktop.nm_dhcp_client"/>
  <allow send_interface="org.freedesktop.nm_dhcp_client"/>
</policy>

After this, nm-applet should work when started normally.

Fix error creating/editing new networks due to insufficient provileges[edit]

If you cannot create new networks or edit existing ones because of the error "Failed to add new connection: (32) Insufficient privileges", then check this solution.

Autostarting[edit]

To autostart nm-applet first add the above changes to the configuration, then add:

os.execute("nm-applet &")

To the end of your rc.lua file.

nm-applet >= 0.9.4.1-1[edit]

The new version of nm-applet requires polkit to be running in background in order to correctly work. add your username to the netdev group

Create a small run_once script as described in the Autostart page (eg: /usr/local/bin/run_once)

#!/bin/bash
#Alternative
pgrep $@ > /dev/null || ($@ &)

at the end of the rc.lua add start the gnome polkit daemon and the applet

awful.util.spawn_with_shell("/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1")
awful.util.spawn_with_shell("run_once nm-applet")
Note
The run_once script avoid nm-applet to start twice in case of multi-screen configuration.

Known issue[edit]

The network icon is a bit too large to fit in the status bar if it uses the default 8pt font size. Changing the font size to 10pt for example fixes this issue. This is a bug in network-manager, see https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1143&project=1&pagenum=3 for more information.

Alternative to nm-applet[edit]

wicd (wicd.sourceforge.net) is an alternative to the gnome network manager and it only gtk dependent. wicd as 3 client front-ends:

  1. wicd-cli: a scriptable console client
  2. wicd-curses: a Curse client
  3. wicd-gtk: a gtk client interface and systray applet.