Minggu, 14 Agustus 2011

110814 memunculkan PupShutdown saat tombol power ditekan



caranya cukup mudah.
buat file script dengan nama "mati" di /usr/bin
(buka direktori /usr/bin dengan rox, klik kanan di tempat yang kosong, pilih new, Script. muncul kotak dialog, ganti tulisan "Script" dengan "mati", ok.)
klik kanan file "mati", open as text, lalu masukkan perintah ini:

#!/bin/sh
cat /proc/acpi/event |
while read line; do
 aplay /usr/share/audio/bark.au & #yang ini bisa diganti dengan suara lain
 PupShutdown
done

kemudian buat sebuah file "PupShutdown" di /usr/bin.
open as text, masukkan perintah ini:
#!/bin/sh
# simple shutdown dialog for puplite, sc0ttman
# edited by recobayu

# get distro details, if possible
[ -f /etc/DISTRO_SPECS ] && . /etc/DISTRO_SPECS
DISTRO_NAME="$DISTRO_NAME "

# make GUI
export SHTDWNGUI='
<window title="'${DISTRO_NAME}'Shutdown Menu">
<vbox>
<frame>
 <pixmap>
  <input file>/usr/share/doc/puppylogo48.png</input>
 </pixmap>
 <text><label>'${DISTRO_NAME}'Shutdown</label></text>
</frame>
<frame>
 <vbox>
 <button relief="1" tooltip-text="Shutdown and power off your PC, your session can be saved before your PC powers off">
  <label>Shutdown PC</label>
  <input file icon="gtk-stop"></input>
  <action>wmpoweroff</action>
 </button>
 </vbox>
 <hbox>
 <vbox>
  <button relief="1" tooltip-text="Exit the the command prompt, no X windows or desktop">
   <label>Exit to Prompt</label>
   <input file icon="gtk-no"></input>
   <action>killall X</action>
  </button>
  <button relief="1" tooltip-text="Reboot your PC, your session can be saved before reboot starts">
   <label>Reboot PC</label>
   <input file icon="gtk-refresh"></input>
   <action>exec /usr/X11R7/bin/wmreboot</action>
  </button>
 </vbox>
 <vbox>
  <button relief="1" tooltip-text="Restart the JWM window manager, useful if you updated any JWM settings">
   <label>Restart JWM</label>
   <input file icon="gtk-leave-fullscreen"></input>
   <action>jwm -restart</action>
  </button>
  <button relief="1" tooltip-text="Restart the entire X server, useful if you have any freezes or display problems">
   <label>Restart X Server</label>
   <input file icon="gtk-execute"></input>
   <action>restartwm</action>
  </button>
 </vbox>
 </hbox> 
</frame>
<frame>
 <hbox>
 <vbox>
  <button relief="1" tooltip-text="Return to the desktop and continue your session">
   <label>Back to Desktop</label>
   <input file icon="gtk-home"></input>
   <action type="exit">EXIT_NOW</action>
  </button>
 </vbox>
 </hbox>
</frame>
</vbox>
</window>'

gtkdialog3 -p SHTDWNGUI -c
exit

sekarang agar program jalan dari pertama, begini caranya.
buka file /usr/bin dengan rox, kemudian buka lagi direktori /root/Startup dengan rox juga. drag file "mati" dari /usr/bin ke rox yang satunya (/root/Startup), muncul kotak pilihan, pilih link (absolute).

cara ini lebih aman daripada langsung membuat script "mati" pada /root/Startup karena ketika program tidak jalan, sewaktu-waktu dapat dipanggil dengan mengetik perintah "mati" pada console. nah, setelah program jalan, tombol power dapat berfungsi lagi dengan baik.


sekarang saatnya mencoba.
restart x server
pencet tombol power pada laptop.
speaker anda mengeluarkan bunyi sesuatu dan layar monitor anda muncul jendela PupShutdown.

selamat menikmati.
pakai puppy linux yuk..
:)

Tidak ada komentar:

Posting Komentar