l

by Sunny from QAD1 min read30th Dec 20198 comments

3

Personal Blog

TLDR: I wrote myself a script that significantly reduced the friction associated with adding a new note to a notes file. This has made me happier.

Sometimes I need to brainstorm lists of things. Here are some examples:

  • A professor at the college I attend challenged me to solve a puzzle that boils down to "produce a complete list of physical attributes that satisfy property X", where X isn't relevant here.
  • I'm part of a community that's working to develop a conlang called Toaq which is still in its infancy. I'm currently working on several aspects of the language, including:
    • A vocabulary for talking about mathematics, for which I need to brainstorm a list of mathematical concepts (integer, complex number, infinity, triangle, and so on).
    • A system for talking about temporal features more complex than "in the past", for which I need to get my hands on a list of examples of English sentences that will need translations (containing phrases such as "twenty years ago", "every five seconds", and so on).
  • I'm working on a secret personal project with a lot of potential for disaster, for which I need to brainstorm possible failure modes.

The thing is, I'm not very good at just sitting down and coming up with these things. Or, to be more precise, even when I sit down and just come up with ideas for a while, I still find more ideas coming to me at random times.

I use Linux, and I spend a lot of time at my computer. But even when I'm already at my computer, it's kind of a hassle to add something to a notes file: I have to open the file browser, remember where the file is located or spend time searching for it, double click the file, add my note, close the text editor, then close the file browser.

So I wrote myself a script, called l (a lowercase letter L). It's a command line script that takes one argument, and all it does is open a text file with that name located in the directory ~/Documents/Lists. (If no such file exists, it first creates one.)

Now, to add a note to such a file, all I have to do is click inside the command-prompt I have in the top corner of my screen, type "l " plus the name of the list, add my note, then close the text editor. This a lot smoother of a process than the old way of doing it, and I find it a lot more pleasant.

But then don't I spend some time remembering the name of the notes file? Sometimes. But it turns out that my brain and this task are collectively such that when I first create a new notes file, I can usually succeed in choosing a name that I don't subsequently forget.

Personal Blog

3

8 comments, sorted by Highlighting new comments since Today at 11:51 PM
New Comment

FYI I found the title of this post pretty confusing

I was wondering what people would think of that. I chose this name because it "seemed cool", which I put in quotes because it refers to a specific kind of feeling that I can't really articulate. Short titles often give me this feeling.

If you think it's too short (eg, it seems spammy or you think it might annoy other users to see it) then let me know and I'll be happy to come up with something that gives a better idea of what the post is about.

I get the "short title" aesthetic, but in this case I wasn't sure it wasn't just a weird bug or typo.

I have recently found this nice note-taking software: cherrytree. You probably have different needs and preferences, so it may not be the best choice for you, but it works in Linux, and allows to save notes in XML format (which would allow e.g. search using command-line tools).

Thanks for the link. Your guess is right: from a cursory glance it looks like this software would be a bit too heavyweight for my purposes. But, I bet somebody will benefit from seeing this.

It is really nice to have someone reporting on those little things that make a good (unseen) impact on their workflow and that we usually don't even consider the possibility of having them. I have something like that implemented and I also noticed that reducing those small frictions result in much more notes and less disruption of the current task, you think of something, a note is added in a few seconds and you can continue working on.

They are also surprisingly easy to implement, and I got surprised how fast it took me to have something functional. I think the effort put into writing the script was paid back pretty fast, since some of them took just some minutes to write and test. But, I think the biggest obstacle to do something like that is having the idea and some basic knowledge of programming to do it, and I'm not sure how to transfer it to other people. Maybe giving them the code with very detailed comments and providing some step-by-step tutorial of how to do it. Would you mind sharing your code?

Now, to add a note to such a file, all I have to do is click inside the command-prompt I have in the top corner of my screen, type "l " plus the name of the list,

I found that using some keybindings to rely solely on the keyboard also made a good improvement. There are several available keys that can be used to call the scripts directly, and if it depends on a parameter as in your case, I use the system tool that ask for a command then run it, on LXDE it is A-F2 or W-r (the same from windows).

I recommend also implementing some scripts to search on the web what is selected by the cursor or open a text file to get a query to be searched. While I'm reading I just open new tabs in the browser to find things I want to look for more details. I doesn't interrupt the reading flow and I also don't forget to search for them later (and I don't have more the thought that there was something I wanted to search by I don't remember what).

reducing those small frictions result in much more notes and less disruption of the current task, you think of something, a note is added in a few seconds and you can continue working on.

I upvoted for this snippet because it's an important aspect of the situation that I forgot to call out in the main post.

Would you mind sharing your code?

Sure! This one is actually a one-liner: it's simply "gedit ~/Documents/lists/$1", which you put in a file called "l" in your ~/bin/ directory. If you prefer a different editor, you can swap out "gedit" for "emacs" or the command used to launch whatever editor you like. (This advice is directed at others reading this comment chain, you probably already know how to do that.)

I found that using some keybindings to rely solely on the keyboard also made a good improvement.

That's a good idea. I currently have a piece of software that I use to type diacritics (for Toaq) but I'm not super happy with it — it kind of bugs out on occasion and can be slow to insert the characters I want. The software I'm using is AutoKey. What do you use? Are you happy with it?

I recommend also implementing some scripts to search on the web [...]

This is also a good idea. I'm pretty fast at typing and pretty slow with the mouse, so I'd probably instead make a macro for "prompt me for a search key, open a new tab, search that thing, then take me back to the tab I was in before".


The software I'm using is AutoKey. What do you use? Are you happy with it?

I'm using LXDE as a desktop environment and it allows you to set the shortcuts in its config file. If I'm not mistaken, other flavors, like GNOME and KDE, had a GUI to bind a certain key sequence to a script.

It seems that it catches the keybindings instantaneously and any lag is due starting a program called by the script, but it is usually around 1 second, which is similar to launch the program independently.

Autokey sounded very promising, but it is too slow. I wanted to port my emacs keybindings to use system wide, but it was impossible to use due to its lags.

This is also a good idea. I'm pretty fast at typing and pretty slow with the mouse, so I'd probably instead make a macro for "prompt me for a search key, open a new tab, search that thing, then take me back to the tab I was in before".

My (shell) scripts are pretty simple, the one that prompt me for a search query is:

xclip -o -selection p > query.temp
leafpad query.temp
query=$(<query.temp)
key=${query%%[ .:]*}  # get only the first word or 'www' or 'http*'
case $key in
    "wiki") # search on wikipedia
	term=${query#* } # get from second word to end
	url="https://www.wikipedia.org/search-redirect.php?family=wikipedia&language=en&go=Go&search="
    ;;
    ## Other cases omitted
    *) # didn't matched anything -> search on web
	# there is a command --search, but it opens a new window
	url="https://duckduckgo.com/?q="
	term=$query
    ;;
esac
/opt/firefox/firefox --new-tab "$url$term"
rm query.temp # remove the temp fifo

And a fast search of the current selected text:

query=$(xclip -o -selection p)
if [[ $query =~ ^(http|www).*$ ]]; then
    url=$query
elif [[ $query =~ ^.*\..{2,3}(/[^ ]*)?$ ]]; then
    url=$query
else
    url="https://duckduckgo.com/?q="$query
fi
/opt/firefox/firefox --new-tab "$url"

I started with the first one, which offers more flexibility, but most of time I use the fast one and I edit the query if it doesn't return the desired results.