HOWTO: NC10 scripts

Discussions about Linux installation and configuration on Samsung laptops
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

HOWTO: NC10 scripts

Post by voria »

Due to the many changes in my scripts done these days, a brief summary is a good thing to do. :)
You can always download the latest scripts from here.

Scripts have been completely reorganized and standardized, thanks to the work done by Stuart Herbert.

The main script is samsung-scripts and it has to be installed in /usr/bin/.
All the others scripts must be installed in /usr/lib/samsung-scripts/.

If you are a K/Ubuntu user, install the samsung-scripts package from my repository and everything will be set and ready to be used.

You can have a good summary of how the scripts work by launching the command 'samsung-scripts' from a terminal. This is the output:

Code: Select all

samsung-scripts - Utilities for your Samsung netbook

samsung-scripts status - show status for all devices
samsung-scripts bluetooth on|off|status - no params will toggle
samsung-scripts cpuperf auto|status - no params will switch to next perf option
samsung-scripts lcd on|off - no params will toggle
samsung-scripts webcam on|off|status - no params will toggle
samsung-scripts wifi on|off|status - no params will toggle
Examples of use:
To check the current status of bluetooth:

Code: Select all

samsung-scripts bluetooth status
To switch to next CPU governor:

Code: Select all

samsung-scripts cpuperf
To toggle the wifi device:

Code: Select all

samsung-scripts wifi
Note:
when the script is launched in an interactive session (ie, from a terminal), it prints its output on the standard output (ie, the terminal). When it's launched in a not-interactive session (for instance, from an hotkey), it shows its output in a notification bubble.

If you use the samsung-scripts package from my repository, a new rule is automatically added to sudo in order to run the 'samsung-scripts' script with admin rights with no need to insert the user password.
Also, the following hotkeys are automatically created:
- Fn-F4: launch the command 'switchscreenlayout.sh' - (switch to next screen layout, more informations here).
- Fn-F5: launch the command 'sudo samsung-scripts lcd' - (toggle the lcd brightness).
- Fn-F7: launch the command 'sudo samsung-scripts bluetooth' - (toggle the bluetooth)
- Fn-F8: launch the command 'sudo samsung-scripts cpuperf auto' - (show/switch CPU governors).
- Fn-F9: launch the command 'sudo samsung-scripts wifi' - (toggle the wifi device)
- <Ctrl><Alt><Shift>w: launch the command 'sudo samsung-scripts webcam' - (toggle the webcam)
- <Ctrl><Alt><Shift>m: launch the script 'wmswitcher.sh' - (toggle compiz, only available on Ubuntu)

There is a configuration file, /etc/default/samsung-scripts, for users with a netbook different from NC10, where various options can be configured. Open the file in a text editor and follow the instructions to customize it.
Last edited by voria on 26 Jun 2009, 19:54, edited 1 time in total.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
Cezary
Newbie
Newbie
Posts: 12
Joined: 13 Mar 2009, 17:01
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by Cezary »

Polish translation:

Code: Select all

diff -Nuar orig/btonoff.sh pl_PL/btonoff.sh
--- orig/btonoff.sh	2009-03-15 14:30:59.000000000 +0100
+++ pl_PL/btonoff.sh	2009-03-15 14:25:13.000000000 +0100
@@ -17,6 +17,11 @@
 		BT_ON="Bluetooth attivato"
 		BT_OFF="Bluetooth disattivato"
 		;;
+	pl_PL*)
+		POPUP_TITLE="Bluetooth"
+		BT_ON="Bluetooth włączony"
+		BT_OFF="Bluetooth wyłączony"
+		;;
 	*)
 		POPUP_TITLE="Bluetooth"
 		BT_ON="Bluetooth enabled"
diff -Nuar orig/cpuscaling.sh pl_PL/cpuscaling.sh
--- orig/cpuscaling.sh	2009-03-15 14:31:03.000000000 +0100
+++ pl_PL/cpuscaling.sh	2009-03-15 14:46:13.000000000 +0100
@@ -22,6 +22,11 @@
 		GOVERNOR_CHANGED="CPU Governor cambiato in:"
 		GOVERNOR_INUSE="CPU Governor in uso:"
 		;;
+	pl_PL*)
+		POPUP_TITLE="Regulator CPU"
+		GOVERNOR_CHANGED="Regulator CPU został zmieniony na:"
+		GOVERNOR_INUSE="Bieżący regulator CPU:"
+		;;
 	*)
 		POPUP_TITLE="CPU Governor"
 		GOVERNOR_CHANGED="CPU Governor changed to:"
diff -Nuar orig/cputemp.sh pl_PL/cputemp.sh
--- orig/cputemp.sh	2009-03-15 14:31:39.000000000 +0100
+++ pl_PL/cputemp.sh	2009-03-15 14:25:47.000000000 +0100
@@ -15,6 +15,10 @@
 		POPUP_TITLE="Temperatura CPU"
 		CPU_TEMP="Temperatura CPU:"
 		;;
+	pl_PL*)
+		POPUP_TITLE="Temperatura CPU"
+		CPU_TEMP="Temperatura CPU:"
+		;;
 	*)
 		POPUP_TITLE="CPU Temperature"
 		CPU_TEMP="CPU Temperature:"
diff -Nuar orig/wconoff.sh pl_PL/wconoff.sh
--- orig/wconoff.sh	2009-03-15 14:31:01.000000000 +0100
+++ pl_PL/wconoff.sh	2009-03-15 14:47:25.000000000 +0100
@@ -19,6 +19,13 @@
 		WC_INUSE="Webcam in uso.
 Al momento non puo' essere disattivata."
 		;;
+	pl_PL*)
+		POPUP_TITLE="Webcam"
+		WC_ON="Webcam włączony"
+		WC_OFF="Webcam wyłączony"
+		WC_INUSE="Webcam w użyciu.
+Nie można wyłączyć kamery w tym momencie."
+		;;
 	*)
 		POPUP_TITLE="Webcam"
 		WC_ON="Webcam enabled"
diff -Nuar orig/wlonoff.sh pl_PL/wlonoff.sh
--- orig/wlonoff.sh	2009-03-15 14:29:30.000000000 +0100
+++ pl_PL/wlonoff.sh	2009-03-15 14:27:59.000000000 +0100
@@ -17,6 +17,11 @@
 		WIFI_ON="Wireless attivato"
 		WIFI_OFF="Wireless disattivato"
 		;;
+	pl_PL*)
+		POPUP_TITLE="Sieć bezprzewodowa"
+		WIFI_ON="Sieć bezprzewodowa włączona"
+		WIFI_OFF="Sieć bezprzewodowa wyłączona"
+		;;
 	*)
 		POPUP_TITLE="Wireless"
 		WIFI_ON="Wireless enabled"
voRia: maybe you should create new packages with custom scripts?
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by voria »

Thanks for the polish translation. :)

I'm considering to create a new package on my repository containing all these scripts, mapping them to some keys combinations... but I don't know what keys combinations to use (others might not like my preferences, so I don't want to force anyone to use them).

I like to use the FN-F3, FN-F7 and FN-F8 keys for launching the applications I mostly use, so I use a 4-keys combination for every script (in order to avoid keybinding conflicts with the software I use... damn eclipse, it already uses all the best key combinations! :P):

t -> CPU Temperature
g -> CPU Governors
b -> Bluetooth
w -> Webcam

What do you think about them? Are they good to be the defaults for everyone?
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
Cezary
Newbie
Newbie
Posts: 12
Joined: 13 Mar 2009, 17:01
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by Cezary »

I use fn+f7 for CPU Temperature, fn+f8 for CPU Governors.

b for Bluetooth and w for Webcam looks ok. And e for disable/enable ethernet :)
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by voria »

IMHO it's a pity to use the best hotkeys (FN) for things that are not used so often... mmm I don't know what to do. :P
Last edited by voria on 15 Mar 2009, 16:15, edited 1 time in total.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
kadrach
Newbie
Newbie
Posts: 30
Joined: 14 Mar 2009, 21:59

RE: [NC10] New scripts, updated scripts and a general summary

Post by kadrach »

I prefer the gnome applet for cpu governors. This way I have a visual indicator for the current governor.
Just do dpgk-reconfigure gnome-applets and allow the cpu frequency scaling applet to run with root privileges.
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by voria »

Well, I'm adding a new package to my repository, nc10-scripts, containing the 'cpuscaling.sh', 'cputemp.sh', 'btonoff.sh' and 'wconoff.sh' scripts. They are mapped globally to the following keybindings:
t -> CPU Temperature
g -> CPU Governors
b -> Bluetooth
w -> Webcam
Furthermore, new rules are automatically added to /etc/sudoers in order to run the scripts that need admin rights.

This package is optional (this is the reason why it's already on the repository), so if you want to use it you have to manually install it with the command

Code: Select all

sudo apt-get install nc10-scripts
Let me know what you think about it! ;)

PS:
Scripts are globally mapped in metacity as command_3, command_4, command_5, command_6.
If you already have a local configuration in your user home for hotkeys, this has the precedence over the global one.
These are the files where local configuration for hotkeys is stored

Code: Select all

<your home>/.gconf/apps/metacity/keybinding_commands/%gconf.xml
<your home>/.gconf/apps/metacity/global_keybindings/%gconf.xml
You have two options: you can delete both files (this will delete all other custom hotkeys too, so you have to reconfigure them), or you can edit both files and delete the sections referring to all the above command_* numbers.
Last edited by voria on 15 Mar 2009, 18:27, edited 1 time in total.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
Cezary
Newbie
Newbie
Posts: 12
Joined: 13 Mar 2009, 17:01
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by Cezary »

Looks ok. :)
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by voria »

While updating packages for kernel 2.6.27-14, I was thinking that it would be better to have all scripts in the same package (well, at least for me, for mantaining them :P), so I removed 'wlonoff.sh' and 'lcdonoff.sh' scripts respectively from 'linux-backports-modules' and 'gnome-power-manager' packages and putted them into 'nc10-scripts' package.
Last edited by voria on 17 Mar 2009, 21:20, edited 1 time in total.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
moijbt
Newbie
Newbie
Posts: 2
Joined: 08 Apr 2009, 11:53

RE: [NC10] New scripts, updated scripts and a general summary

Post by moijbt »

Hi everyone !
First of all, thanks Voria for all your work !
I just completed an install of Jaunty beta on my NC10, but the scripts don't work.
I added your repository to the sources.list and installed the nc10-scripts package.
All your scripts are in /usr/bin, they do work when I call them with the Terminal but the mapping doesn't seem to work.
I checked in Gconf if the mapping was Ok (it is), I checked the visudo file to see if I had the permissions to run these scripts and it's OK too.

The kernel is 2.6.28-11-generic.

Thank you very much !
moijbt
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by voria »

Hi and Welcome :)

In Jaunty you have to enable the 'Commands' plugin in the 'compiz configuration settings manager' in order to activate and use the metacity bindings.
You can install the compiz configuration settings manager with the command

Code: Select all

sudo apt-get install compizconfig-settings-manager
and start it through the 'System'-->'Preferences' menu.
Last edited by voria on 08 Apr 2009, 12:59, edited 1 time in total.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
moijbt
Newbie
Newbie
Posts: 2
Joined: 08 Apr 2009, 11:53

RE: [NC10] New scripts, updated scripts and a general summary

Post by moijbt »

Indeed, it works now !
Thanks a lot for the quick answer and thanks again for your work on the nc10 !

moijbt
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by voria »

Just added a new script to the package, 'wmswitcher.sh'.
It switches compiz/metacity window managers. It's mapped to m.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
mbt28
Newbie
Newbie
Posts: 31
Joined: 23 Apr 2009, 11:18

RE: [NC10] New scripts, updated scripts and a general summary

Post by mbt28 »

I have added Turkish translation of wlonoff.sh script.

Code: Select all

#!/bin/sh
# script by Fortunato Ventre (voRia) - http://www.voria.org - vorione@gmail.com
#
# "Toggle wireless on/off on Samsung NC10"
#

if [ $USER != "root" ]; then
    echo "You need admin rights to run this script. Try with sudo."
    exit 1
fi

LOCALE=`export | grep -w LANG | cut -d\' -f2`
case $LOCALE in
    it_IT*)
        POPUP_TITLE="Wireless"
        WIFI_ON="Wireless attivato"
        WIFI_OFF="Wireless disattivato"
        ;;
    pl_PL*)
        POPUP_TITLE="Sieć bezprzewodowa"
        WIFI_ON="Sieć bezprzewodowa włączona"
        WIFI_OFF="Sieć bezprzewodowa wyłączona"
        ;;
    tr_TR*)
        POPUP_TITLE="Kablosuz Bağlantı"
        WIFI_ON="Kablosuz bağlantı etkin"
        WIFI_OFF="Kablosuz bağlantı devre dışı"
        ;;
    *)
        POPUP_TITLE="Wireless"
        WIFI_ON="Wireless enabled"
        WIFI_OFF="Wireless disabled"
        ;;
esac

ICON_CONNECTED=notification-network-wireless-none
ICON_DISCONNECTED=notification-network-wireless-disconnected

if which notify-send > /dev/null; then
    USE_POPUP=1
else
    USE_POPUP=0
fi

# If $SUDO_USER is not specified, defaults to root.
if [ -z $SUDO_USER ]; then
    SUDO_USER="root"
fi

if lsmod | grep ath5k > /dev/null; then
    modprobe -r ath5k
    if [ $USE_POPUP = 1 ]; then
        sudo -u $SUDO_USER -- notify-send -u normal -i $ICON_DISCONNECTED -t 2000 "$POPUP_TITLE" "$WIFI_OFF"
    fi
else
    modprobe ath5k
    if [ $USE_POPUP = 1 ]; then
        sudo -u $SUDO_USER -- notify-send -u normal -i $ICON_CONNECTED -t 2000 "$POPUP_TITLE" "$WIFI_ON"
    fi
fi
exit 0
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] New scripts, updated scripts and a general summary

Post by voria »

Thanks, I'll update the script into 'nc10-scripts' package.
It would be nice if you can add turkish translation to other scripts too. ;)
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
Post Reply