Geektool

s e 7 e n

Power Member
geektool_gros.png

Site

GeekTool is a PrefPane (System Preferences module) for Panther or Tiger to show system logs, unix commands output, or images (i.e. from the internet) on your desktop (or even in front of all windows).


Alguns códigos:

Clock:
Código:
All using the 'Shell' selection:
Date: date +%d
Month: date +%B
Day: date +%A
Time: date +"%I:%M"
AM/PM: date +"%p"
Font: Helvetica Neue (Regular, Bold, Light)


Weather (need Lynx) [Shell]:
Código:
Temperature: lynx -dump [url]http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=YOURZIPCODE|awk[/url] '/Temp/{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'
Conditions: lynx -dump [url]http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=YOURZIPCODE|awk[/url] '/Cond/ && !/Fore/ {for (i=2; i<=10; i++) printf $i " " }'


Process Monitor:
Código:
#!/bin/bash

### Curby's GeekTool process listing script (ps+top version)
### by Michael 'Curby' Lee
### v1.00.00, 2007-02-17

###   Description
#
#  Outputs a list of processes using the most CPU time recently,
#  processes having used the most CPU time since they started, and
#  processes using the most memory (largest resident memory size).
#
#  Compared to geektool-ps and geektool-top, this runs the slowest
#  but displays the heftiest programs sorted in three ways and has
#  the slimmest output (horizonally).
#

###   Suggested use
#
#  This script can be executed from the OS X commandline without
#  administrative priveleges, but is intended for use with GeekTool
#  with a refresh time of 10 seconds.  The number of processes 
#  displayed can be customized below.  This script was tested on
#  OS X v10.4.8 with GeekTool v2.1.2(112).  The script may fail with
#  other versions of ps and top.
#

###   License
#
#  Copyright (C) 2007  Michael Lee 
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#



#-------------------------------------------------------------------------------
#  Configuration
#-------------------------------------------------------------------------------
cpu_rows=15
time_rows=15
mem_rows=15



#-------------------------------------------------------------------------------
#  Output
#-------------------------------------------------------------------------------
echo "COMMAND      PID %CPU"
ps -c -r -ax -o command,pid,pcpu | sed 's/^\(.\{10\}\).\{6\}\(.\{6\}\)..\(.\{4\}\)$/\1\2 \3/' | head -n $(($cpu_rows+1)) | tail -n $cpu_rows
echo
top -l1 -otime -n $time_rows -F -R | tail -n $(($time_rows+1)) | sed 's/\(.\{5\}\) \(.\{10\}\).\{8\}\(.\{8\}\).*/\2 \1 \3/'
echo
ps -c -m -ax -o command,pid,pmem | sed 's/^\(.\{10\}\).\{6\}\(.\{6\}\).\(.\{4\}\)$/\1\2 \3/' | head -n $(($mem_rows+1))
Guardar num ficheiro de texto com o nome: processinfo.bash
Depois no Terminal fazer chmod 755 ao ficheiro
Depois no GeekTool meter: (substituir o path)
Código:
bash /Users/jvl_iMac/bin/processinfo.bash


Monthly calendar:
Código:
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed 's/./#/g') /"


Displaying the System Log:
Código:
syslog -k Time ge -600


Displaying iTunes Info:
Código:
tell application "System Events"
	set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
	if powerCheck = 0 then
		return ""
	end if
end tell
tell application "iTunes"
	try
		set playerstate to (get player state)
	end try
	if playerstate = paused then
		set trackPaused to " (paused)"
	else
		set trackPaused to ""
	end if
	if playerstate = stopped then
		return "Stopped"
	end if
	set trackID to the current track
	set trackName to the name of trackID
	set theStream to the current stream title as text
	if theStream is not "missing value" then
		set totalData to "Stream : " & trackName & trackPaused & "
Title  : " & theStream
	else
		set artistName to the artist of trackID
		set albumName to the album of trackID
		set totalData to "Track  : " & trackName & trackPaused & "
Artist : " & artistName & "
Album  : " & albumName
	end if
	return totalData
end tell
Guardar no Script Editor com o nome iTunesInfo.scpt
Depois no GeekTool: (alterar o path)
Código:
osascript /Users/jvl_iMac/bin/iTunesInfo.scpt


Display Your Computer’s Uptime And Total CPU/Memory Usage:

Código:
uptime | awk '{print "UPTIME : " $3 " " $4 " " $5 }' | sed -e 's/.$//g'; top -l 1 | awk '/PhysMem/ {print "RAM : " $8 " "}' ; top -l 2 | awk '/CPU usage/ && NR > 5 {print $6, $7=":", $8, $9="user ", $10, $11="sys ", $12, $13}'


Display Drive Info

Código:
df -H -l


Display IP Address and Network Info

Código:
#! /bin/bash 
myvar1=`system_profiler SPAirPortDataType | grep -e "Current Wireless Network:" | awk '{print $4}'`
myvar2=`system_profiler SPAirPortDataType | grep -e "Wireless Channel:" | awk '{print $3}'`

echo "External :" `curl -s http://checkip.dyndns.org/ | awk '{print $6}' | cut -f 1 -d "<"`
myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'| grep -v inet`

if [ "$myen0" != "" ]
then
echo "Ethernet : $myen0"
else
echo "Ethernet : INACTIVE"
fi

myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'| grep -v inet`

if [ "myen1" != "" ]
then
echo "AirPort  : $myen1 [$myvar1 : CH.$myvar2]"
else
echo "Airport  : INACTIVE"
fi
Guardar num editor de texto com o nome: ipadd.bash
No Terminal fazer: chmod 755 ipadd.bash
Depois no GeekTool: (alterar o path)
Código:
bash /Users/jvl_iMac/bin/ipadd.bash


Mais aqui e aqui...
A maior parte já são repetidos ou são outra maneira de fazer o mesmo.
Alguns Desktops
 
Eu uso o Geektool há já uns tempinhos e agora só tenho uma coisa: um calendário no canto inferior direito. Mais nada... pode ser q desta vez consiga pôr a info da música q está a tocar no iTunes lol
 
Eu uso o Geektool há já uns tempinhos e agora só tenho uma coisa: um calendário no canto inferior direito. Mais nada... pode ser q desta vez consiga pôr a info da música q está a tocar no iTunes lol
Exactamente como eu :joker:
Entretanto também vou substituir o aborrecido relógio da menu bar e metê-lo com o geek tools por baixo do calendário.
 
estas coisas ficam "coladas" ao desktop? Não "vão para canto" quando vamos ao Desktop pelo Exposé?

eu praticamente só vou ao desktop pelo Exposé.. já não posso usar o bowtie, provavelmente este também não poderei.. alguém que me verifique aí isso sff :P
 
estas coisas ficam "coladas" ao desktop? Não "vão para canto" quando vamos ao Desktop pelo Exposé?

eu praticamente só vou ao desktop pelo Exposé.. já não posso usar o bowtie, provavelmente este também não poderei.. alguém que me verifique aí isso sff :P

Nope.
 
Epah vou ter que começar a mecher nisto outra vez eheh Agora q vi os teus screens oh se7en... Vai dar muito trabalhinho pôr a data e calendário como o teu, mas eu quero um igual! :D

EDIT: Alguém que tenha conseguido pôr a dar o script da info do iTunes? Aqui parece não funcionar no Geektools... Funciona normalmente no script editor, mas no GeekTools o script simplesmente apresenta linhas de código...

EDIT2: Já consegui pôr a dar. Quem quiser:

Código:
osascript -e '''tell application "iTunes" to set currentLyrics to the lyrics of the current track'''

Encontrei-o nu tuaw.com e funciona mas só tem uma desvantagem: tem que se activar a shell no GeekTools sempre que se precisar disto, caso contrário o iTunes nunca se vai fechar...
 
Última edição:
Fiz umas pequenas alterações na do iTunes, se alguém quiser experimentar :P

Código:
tell application "System Events"
	set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
	if powerCheck = 0 then
		return ""
	end if
end tell
tell application "iTunes"
	try
		set playerstate to (get player state)
	end try
	if playerstate = paused then
		set trackPaused to " (paused)"
	else
		set trackPaused to ""
	end if
	if playerstate = stopped then
		return "NO TRACK PLAYING"
	end if
	set trackID to the current track
	set trackName to the name of trackID
	set artistName to the artist of trackID
	set trackTime to the time of trackID
	set totalData to "(" & trackTime & ")" & " " & artistName & " - " & trackName & trackPaused
	return totalData
end tell

Marquei o refresh desta entrada para 1sg para ser quase instantâneo, enquanto o do calendário que escusa fazer refresh de 10 em 10sg, meti 1800sg (30minutos), no entanto ainda não verifiquei a fiabilidade...
 
Última edição:
Já andei à procura a ver se conseguia fazer, mas nope...
Queria tirar algumas cenas da menubar e precisava de ter no geektool maneira de ver a percentagem de memória/cpu a ser usada e a temperatura do cpu.
Alguém sabe como?

EDIT: e percentagem da bateria que resta, é possível?
 
Última edição:
Por acaso o se7en tem pouco explícito.
Para as horas (por exemplo) vão ao Geektool pelas preferências do sistema e seguem estes passos:

1-New Entry
2-Por default aparece seleccionado em cima a opção "File". Escolham "Shell".
3-Na caixa de texto "Command" escrevam
Código:
date +"%H:%M %p"
4-Façam ENTER
5-Vão a "Color and Fonts" e alteram a côr para algo mais desejável.
 
Back
Topo