I've cooked a bash script to get a new empty TW right-clicking in a
nautilus folder. It then opens in firefox

It follows nautilus-scripts style and is based in the File Processing
new-text-document script.

Unfortunately I haven't succeded to integrate it in Nautilus actions,
nor in gdm menus - nor opens with file:/// instead of firefox, dont
know why. I even see a simple deb package - or any other distro pack -
to integrate in repositories.

Installation: just copy it in your $HOME/Scripts folder, and
(optionally) edit it to set your prefered behavior.
=========

It sounds to me a natural way of creating new templates.

Here it is:

#!/bin/sh
#
# Add a new text file in the current directory.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Copyright (C) 2003 Dexter Ang [[email protected]
# based on work by Jeffrey Philips and Johnathan Bailes
# and a script I found on themedepot.org

# KNOWN BUGS:
#       - Never tested with an invalid directory. Don't know how.
#       - When you enter a blank filename, it generates a .txt hidden file.
#       - There's probably more.
# 2003-12-08 Dexter Ang [[email protected]]
# Modified for Nautilus 2.4
# -- now detects if executed on desktop "x-nautilus-desktop:///"
#    so that it creates the file in /home/{user}/Desktop

# Remove comment to set Debug Mode. Displays crucial variable values
#DEBUG_MODE=1

# Remove comment to automatically generate filename. Set to 1 to ask
for filename
#ASK_MODE=1

# Set the default extension of your preference here
EXTENSION="txt"

# Function for displaying variable values and anything else I want
debug() {
        [ -n "$DEBUG_MODE" ] && gdialog --title "Debug Mode" --msgbox "$*"
200 100
}

# This gets the current directory. It is "space-space" as it replaces
%20 with spaces
Current_Dir="`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed -e 's/^file:\/
\///' -e 's/%20/\ /g'`"

# Added 2003-12-08 Dexter Ang
if [ $Current_Dir == "x-nautilus-desktop:///" ]; then
        Current_Dir=$HOME"/Desktop"
fi

debug "Current_Dir = $Current_Dir"

if [ $ASK_MODE == "1" ]; then
        debug "In Ask Mode"
        New_Document="`gdialog --title "New Filename" --inputbox "Enter a new
filename" 200 100 2>&1`"
        if [ $? -ne "0" ]; then
                debug "Canceled"
                exit 1
        fi
else
        debug "In Non-Ask Mode"
        New_Document="New Text Document"
fi
debug "New_Document = $New_Document"

COUNT=1

# If file doens't exist, touch it
if ! [ -a "$Current_Dir/$New_Document.txt" ] ; then
  touch "$Current_Dir/$New_Document.txt"
# else, go loop until you get a number that works!
else
  while ! [ "$retry" ] ; do
    let $((COUNT++))
    if ! [ -a "$Current_Dir/$New_Document($COUNT).txt" ] ; then
        touch "$Current_Dir/$New_Document($COUNT).txt"
        retry=1
    fi
  done
fi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWikiDev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to