LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices



Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Pseudo-template noob hack that may apply for several situations

Posted 04-12-2012 at 05:10 PM by the dsc
Updated 04-12-2012 at 05:14 PM by the dsc

There's a painting software, "mypaint", which is very nice, but it does not support templates, at least not yet.

I've created a template (just a "blank" file with the correct resolution and whatnot) on GIMP, saved it as "ora", but instead of opening this file manually every time, and remembering to save it with a new name in order to not overwrite the template, I came up with a script that will create a new name automatically, with no risk of overwriting the template.

Code:
template=$1

export DISPLAY=:0 # I'm not really sure it's needed or why it's there anymore

filename="$(date '+%y%b%d-%H%M').ext" # creates a filename based on the time and day you run the script

cp "/path/to/your/$template" "/dev/shm/$filename" && # just in case you don't end up saving the new work from the template, it copies it first to the memory

whatever-program "/dev/shm/$filename" &

while true ; do inotifywait /dev/shm/$filename && cp /dev/shm/$filename /path/to/destination/folder/ # if the file on /dev/sh (memory) is changed (when you save it), it's copied to a given destination folder on the hard drive.
  done

Then you can add some application menu entry pointing to this script, or even a submenu with several template options, given as parameters to the script ($1).
Posted in Uncategorized
Views 6457 Comments 2
« Prev     Main     Next »
Total Comments 2

Comments

  1. Old Comment
    okay here's where you must finally learn to not use such predictable names.
    Posted 04-13-2012 at 12:48 AM by Web31337 Web31337 is offline
  2. Old Comment
    Uh?
    Posted 04-13-2012 at 06:36 PM by the dsc the dsc is offline
 

  



All times are GMT -5. The time now is 03:23 PM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration