Friday, 12 July 2013

toggle wifi status using network manager nmcli

fujitsu siemens amilo pro V3405 special keys:

wifi (or FN+F10)

dmesg:
[] atkbd serio0: Unknown key pressed (translated set 2, code 0xd5 on isa0060/serio0).
[] atkbd serio0: Use 'setkeycodes e055 <keycode>' to make it known.
[] atkbd serio0: Unknown key released (translated set 2, code 0xd5 on isa0060/serio0).
[] atkbd serio0: Use 'setkeycodes e055 <keycode>' to make it known.

xmodmap for ubuntu 13.04 have keycodes for wifi:

keycode 246 = XF86WLAN NoSymbol XF86WLAN

but thay start from 8 so, it should by 246-8:

setkeycodes e055 238

after verify by xev utility, I made script using nmcli utility to toggle status of wifi:

/usr/local/bin/toggle_wifi.sh

#!/bin/bash
if nmcli nm wifi|grep -q enabled;then nmcli nm wifi off;else nmcli nm wifi on;fi

about help key:

[] atkbd serio0: Unknown key pressed (translated set 2, code 0xa5 on isa0060/serio0).
[] atkbd serio0: Use 'setkeycodes e025 <keycode>' to make it known.
[] atkbd serio0: Unknown key released (translated set 2, code 0xa5 on isa0060/serio0).
[] atkbd serio0: Use 'setkeycodes e025 <keycode>' to make it known.

xmodmap:

keycode 146 = Help NoSymbol Help

146-8=138

setkeycodes e025 138

verify by xev

permanent setup for keys, I use init script as here.

know just need to asign new keys:
settings-> keyboard-> shortcus