Notes
Simple script to keep pieces of text
Details
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | #! /bin/bash
# -*- mode: sh -*-
#
# Simple notes
# Author: Victor Ananjevsky <ananasik@gmail.com>, 2010
#
function show_note () {
[[ -e /tmp/notes.lock ]] && return
touch /tmp/notes.lock
yad --text-info --show-uri --geometry=400x200-0-0 --name="notes" --window-icon="text-editor" \
--title=$"Notes" --button="gtk-save:0" --button="gtk-close:1" \
--editable --filename=${XDG_CACHE_HOME:-$HOME/.cache}/notes > /tmp/.notes
[[ $? -eq 0 ]] && mv /tmp/.notes ${XDG_CACHE_HOME:-$HOME/.cache}/notes
rm -f /tmp/notes.lock
}
export -f show_note
mkdir -p ${XDG_CACHE_HOME:-$HOME/.cache}
touch ${XDG_CACHE_HOME:-$HOME/.cache}/notes
exec yad --notification --text=$"Text notes" --image="text-editor" --command "sh -c show_note"
|
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: alzingr...@gmail.com
Victor, First of all, thank you !
It is so great to work with such a nice tool. In the code above, I wonder what is the usual contents of the $XDG_CACHE_HOME. On my Ubuntu ( 10.10 ), it is void.
Can I use another location instead of that value ?
Thanks and greetings from France
Jean-michel, Nemours, France
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: ananasik
yes, of course. fill free to change this example as you wish. this script just demonstrate how to use functions as a supply commands for yad.
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: alzingr...@gmail.com
Hi Victor,
I have added the line "export XDG_CACHE_HOME=/tmp" just before the show_note function description. But I still have a problem at launch: "sh: show_note: not found"
Where is the "--command" parameter described on the internet ?
Thanks for your help
Jean-michel, Nemours, France
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: ananasik
are 'sh' is a symlink to 'bash'? if not, use --command "bash -c show_note" parameter instead
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: alzingr...@gmail.com
OK. I'll try tomorrow. Thanks Jean-michel
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: alzingr...@gmail.com
Hi Victor, Fine. The "bash" works. I had to suppress the "--show-uri" parameter because of the following error : "Unable parse command line: Unknown option --show-uri" It now works but the data are not saved when clicking on the "Save" button. The notes are void when I click on the top icon. Do I have to break to carry on working with my terminal and thus lose the benefit of the show_notes ?
Thanks Jean-michel, Nemours, FRANCE
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: ananasik
check that the main filename for notes ($XDG_CACHE_HOME/notes) and temporary (/tmp/.notes) are not the same name
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: alzingr...@gmail.com
My XDG value contains "home/g2a/.cache" so they are different. I give up for the moment
Thanks
Jean-michel
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: geoffrey...@gmail.com
Works well, I like this, only needs this small change to stop it being stuck to the one location. Change code so that it follows the mouse if the tray is anywhere other than the bottom right corner of the screen.
Geoffrey