Siga exatamente estas etapas:
-
Abra o terminal através de Ctrl - Alt - T
-
Crie uma pasta para o script
mkdir -p ~/bin
-
Abra o arquivo
~/bin/setup.sh
emgedit
.gedit ~/bin/setup.sh
-
Copie o código abaixo salve o arquivo, feche o editor.
#!/bin/sh # Author: Serg Kolo # Date: Mon Aug 24 , 2015 # Description: setup script for creating # launcher and setting up the Dimmer script DESKFILE="$HOME/bin/Dimmer.desktop" SCHEMA="com.canonical.Unity.Launcher" KEY="favorites" SCRIPTFILE="$HOME/bin/Dimmer.sh" createBinFolder() { if [ ! -e "$HOME/bin" ]; then mkdir "$HOME/bin" fi echo "created bin folder" } createLauncher() { OUTPUT="$(gsettings get $SCHEMA $KEY | awk -v file="$DESKFILE" -v sq="'" '{ sub(/\]/,""); print $0","sq"application://"file sq "]" }')" ; gsettings set $SCHEMA $KEY "$OUTPUT" ; echo "Launcher for Dimmer created" } createScriptFile() { touch "$SCRIPTFILE" chmod 755 "$SCRIPTFILE" echo "Created script file. Please copy over the code to \"$SCRIPTFILE\"" } createDeskFile() { printf "[Desktop Entry]\nName=Dimmer\nExec=%s\nType=Application\nTerminal=false" "$SCRIPTFILE" > "$DESKFILE" } createBinFolder createScriptFile createDeskFile createLauncher
-
Torne o arquivo executável e inicie o script de configuração
chmod 755 ~/bin/setup.sh && ~/bin/setup.sh
Esse script criará a pasta
bin
e o arquivoDimmer.sh
em branco. -
Edite o arquivo
Dimmer.sh
gedit ~/bin/Dimmer.sh
-
Copie o código abaixo, salve e feche o editor
#!/bin/sh # Name: backlightscript # Author: Serg Kolo # Date: March 2 , 2015 # Description: Simple script to change screen brightness using xrandr # uncomment this for debugging as needed # set -x NEWVAL=$( zenity --scale --min-value=0 --max-value=7 --text="Enter number between 0 and 7" ) && brightness=$(($NEWVAL+2)) if [ "$NEWVAL" != "" ]; then xrandr --output "$( xrandr | awk '$2=="connected" {print $1}')" --brightness 0.$brightness fi
Agora, você deve conseguir clicar duas vezes no iniciador e fazer com que o aplicativo dimmer funcione.