[TxMt] tmTheme: Slate
Allan Odgaard
throw-away-1 at macromates.com
Thu Nov 10 12:24:59 UTC 2005
On 10/11/2005, at 12.03, Andreas Wahlin wrote:
> Could one expand the list in some way and just increment that final
> digit there?
Like a cycle? You would need to store the value somewhere, e.g. in a
file. It could be made… meanwhile I had some fun creating this script:
IFS=$(echo -e "\n\r")
themes=($(find /Applications/TextMate.app/Contents/SharedSupport/
Themes -name "*.tmTheme"))
rand=$(dd </dev/random bs=1 count=1 2>/dev/null|hexdump -e '/1 "%u"')
total=${#themes[@]}
open "${themes[$((rand % total))]}"
It picks a random theme from what's included by default.
Unfortunately I see that a lot of the default themes have a plist
extension, for which it doesn't work. So currently will only pick
random from 4 themes, but I'll have that corrected in next build.
Also be aware, if the default theme has an equivalent in ~/Library,
TM will ask if it should overwrite (instead of switching), since it
thinks you're opening a new version of the theme -- for users with a
lot of custom themes, it'd probably be better to just let it randomly
pick from what's in ~/Library.
More information about the textmate
mailing list