Updated documentation. Made configuration file more readable.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 10 Jul 2017 13:01:18 +0000 (15:01 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 10 Jul 2017 13:01:18 +0000 (15:01 +0200)
doc/index.html
doc/index.org
instantlauncher.iml
src/main/java/eu/svjatoslav/instantlauncher/configuration/ConfigurationManager.java

index febe9c0..4088d6e 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="en">
 <head>
 <title>Instantlauncher - navigate to your files and programs quickly!</title>
-<!-- 2017-07-07 Fri 13:17 -->
+<!-- 2017-07-10 Mon 14:59 -->
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta name="generator" content="Org-mode">
@@ -225,9 +225,9 @@ published by the Free Software Foundation.
 <h2 id="sec-1"><span class="section-number-2">1</span> General description</h2>
 <div class="outline-text-2" id="text-1">
 <p>
-Quick filesystem based document/application launcher. It starts by showing
-content of predefined directory. Sub directories can be chosen by simply moving
-mouse pointer over corresponding directory.
+Quick filesystem based document/application launcher. It starts by
+showing content of <a href="#sec-3-4">predefined directory</a>. Sub directories can be chosen
+by simply moving mouse pointer over corresponding directory.
 </p>
 
 
@@ -245,8 +245,14 @@ Files types are color-coded.
 <div id="outline-container-sec-2" class="outline-2">
 <h2 id="sec-2"><span class="section-number-2">2</span> Usage</h2>
 <div class="outline-text-2" id="text-2">
+<p>
+Simply hovering mouse pointer over directory expands its contents in
+the next right column.
+</p>
+
+
 <ul class="org-ul">
-<li>Executable file:
+<li>Executable file (red):
 <ul class="org-ul">
 <li>Left mouse click:
 <ul class="org-ul">
@@ -263,7 +269,7 @@ Files types are color-coded.
 </ul>
 </li>
 
-<li>Non-executable file:
+<li>Non-executable file (green):
 <ul class="org-ul">
 <li>Left mouse click:
 <ul class="org-ul">
@@ -280,7 +286,7 @@ Files types are color-coded.
 </ul>
 </li>
 
-<li>Directory/symlink:
+<li>Directory/symlink (blue):
 <ul class="org-ul">
 <li>Left mouse click:
 <ul class="org-ul">
@@ -304,17 +310,130 @@ Files types are color-coded.
 <h2 id="sec-3"><span class="section-number-2">3</span> Configuration</h2>
 <div class="outline-text-2" id="text-3">
 <p>
-TODO:
+When instantlauncher starts, it looks for configuration file under
+</p>
+<pre class="example">
+~/.instantlauncher
+</pre>
+
+<p>
+If file is not found, it creates new default configuration file in
+YAML format:
 </p>
+<pre class="example">
+!configuration
+directoryOpenCommand: nautilus -w {file}
+directoryTerminalOpenCommand: gnome-terminal --working-directory={file}
+fileAssociations:
+-  command: vlc {file}
+   fileRegex: .*\.mkv$
+-  command: emacs {file}
+   fileRegex: .*\.txt$
+-  command: eog {file}
+   fileRegex: .*\.jpeg$
+-  command: eog {file}
+   fileRegex: .*\.png$
+-  command: vlc {file}
+   fileRegex: .*\.avi$
+-  command: vlc {file}
+   fileRegex: .*\.mp4$
+-  command: eog {file}
+   fileRegex: .*\.jpg$
+-  command: emacs {file}
+   fileRegex: .*\.org$
+navigationRootPath: /home/svjatoslav/
+</pre>
+</div>
+
+<div id="outline-container-sec-3-1" class="outline-3">
+<h3 id="sec-3-1"><span class="section-number-3">3.1</span> directoryOpenCommand</h3>
+<div class="outline-text-3" id="text-3-1">
+<p>
+Command to use when opening directory.
+</p>
+
+<p>
+By default instantlauncher assumes that Gnome desktop environment is
+installed and uses Nautilus file manager:
+</p>
+<pre class="example">
+directoryOpenCommand: nautilus -w {file}
+</pre>
 </div>
 </div>
+<div id="outline-container-sec-3-2" class="outline-3">
+<h3 id="sec-3-2"><span class="section-number-3">3.2</span> directoryTerminalOpenCommand</h3>
+<div class="outline-text-3" id="text-3-2">
+<p>
+Command to use when opening directory in text terminal based console.
+</p>
 
-<div id="outline-container-sec-4" class="outline-2">
-<h2 id="sec-4"><span class="section-number-2">4</span> <span class="label label-primary TODO">TODO</span> </h2>
-<div class="outline-text-2" id="text-4">
 <p>
-TODO:
+By default instantlauncher assumes that Gnome desktop environment is
+installed and uses Gnome Terminal:
 </p>
+
+<pre class="example">
+directoryTerminalOpenCommand: gnome-terminal --working-directory={file}
+</pre>
+</div>
+</div>
+<div id="outline-container-sec-3-3" class="outline-3">
+<h3 id="sec-3-3"><span class="section-number-3">3.3</span> fileAssociations</h3>
+<div class="outline-text-3" id="text-3-3">
+<p>
+Allows to map file name/extension using regular expression pattern
+matching to corresponding application.
+</p>
+
+<p>
+Example:
+</p>
+<div class="org-src-container">
+
+<pre class="src src-conf">-  command: vlc {file}
+   fileRegex: .*\.mkv$
+</pre>
+</div>
+
+<p>
+Where:
+</p>
+<dl class="org-dl">
+<dt> command </dt><dd>Command to execute to open given file. Special variable
+{file} will point to user chosen file using absolute file
+path.
+</dd>
+
+<dt> fileRegex </dt><dd>Regular expression that must match the file.
+</dd>
+</dl>
+</div>
+</div>
+<div id="outline-container-sec-3-4" class="outline-3">
+<h3 id="sec-3-4"><a id="ID-5ced6bf5-165a-49a0-8de4-3755d810d987" name="ID-5ced6bf5-165a-49a0-8de4-3755d810d987"></a><span class="section-number-3">3.4</span> navigationRootPath</h3>
+<div class="outline-text-3" id="text-3-4">
+<p>
+Root directory from where to start navigation.
+</p>
+
+<p>
+This parameter is user specific! In my case instantlauncher by default
+pointed this to my home directory. But it can be any directory user
+chooses.
+</p>
+
+<p>
+I think good use-case is to create special directory to be used for
+instantlauncher root. This special root directory can in turn contain
+symlinks to various places user wants to visit often. Instantlauncher
+will follow symlinks as if they were directories.
+</p>
+
+<pre class="example">
+navigationRootPath: /home/svjatoslav/
+</pre>
+</div>
 </div>
 </div>
 </div><div class="col-md-3"><nav id="table-of-contents">
@@ -322,15 +441,21 @@ TODO:
 <ul class="nav">
 <li><a href="#sec-1">1. General description</a></li>
 <li><a href="#sec-2">2. Usage</a></li>
-<li><a href="#sec-3">3. Configuration</a></li>
-<li><a href="#sec-4">4. </a></li>
+<li><a href="#sec-3">3. Configuration</a>
+<ul class="nav">
+<li><a href="#sec-3-1">3.1. directoryOpenCommand</a></li>
+<li><a href="#sec-3-2">3.2. directoryTerminalOpenCommand</a></li>
+<li><a href="#sec-3-3">3.3. fileAssociations</a></li>
+<li><a href="#sec-3-4">3.4. navigationRootPath</a></li>
+</ul>
+</li>
 </ul>
 </div>
 </nav>
 </div></div></div>
 <footer id="postamble" class="">
 <div><p class="author">Author: Svjatoslav Agejenko</p>
-<p class="date">Created: 2017-07-07 Fri 13:17</p>
+<p class="date">Created: 2017-07-10 Mon 14:59</p>
 <p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.1.1 (<a href="http://orgmode.org">Org-mode</a> 8.2.10)</p>
 </div>
 </footer>
index 0dd67f2..22e7758 100644 (file)
 #+HTML_HEAD: </style>
 
 * General description
-Quick filesystem based document/application launcher. It starts by showing
-content of predefined directory. Sub directories can be chosen by simply moving
-mouse pointer over corresponding directory.
+Quick filesystem based document/application launcher. It starts by
+showing content of [[id:5ced6bf5-165a-49a0-8de4-3755d810d987][predefined directory]]. Sub directories can be chosen
+by simply moving mouse pointer over corresponding directory.
 
 [[file:screenshot.png]]
 
 Files types are color-coded.
 
 * Usage
-+ Executable file:
+Simply hovering mouse pointer over directory expands its contents in
+the next right column.
+
+
++ Executable file (red):
   + Left mouse click:
     + Run executable file.
   + Right mouse click:
     + Toggle executable state.
 
-+ Non-executable file:
++ Non-executable file (green):
   + Left mouse click:
     + Open file using corresponding application.
   + Right mouse click:
     + Toggle executable state.
 
-+ Directory/symlink:
++ Directory/symlink (blue):
   + Left mouse click:
     + Open directory using configured filesystem browser.
   + Right mouse click:
     + Open directory using configured text based terminal emulator.
 
 * Configuration
-TODO:
+When instantlauncher starts, it looks for configuration file under
+: ~/.instantlauncher
+
+If file is not found, it creates new default configuration file in
+YAML format:
+#+BEGIN_SRC
+!configuration
+directoryOpenCommand: nautilus -w {file}
+directoryTerminalOpenCommand: gnome-terminal --working-directory={file}
+fileAssociations:
+-  command: vlc {file}
+   fileRegex: .*\.mkv$
+-  command: emacs {file}
+   fileRegex: .*\.txt$
+-  command: eog {file}
+   fileRegex: .*\.jpeg$
+-  command: eog {file}
+   fileRegex: .*\.png$
+-  command: vlc {file}
+   fileRegex: .*\.avi$
+-  command: vlc {file}
+   fileRegex: .*\.mp4$
+-  command: eog {file}
+   fileRegex: .*\.jpg$
+-  command: emacs {file}
+   fileRegex: .*\.org$
+navigationRootPath: /home/svjatoslav/
+#+END_SRC
+
+** directoryOpenCommand
+Command to use when opening directory.
+
+By default instantlauncher assumes that Gnome desktop environment is
+installed and uses Nautilus file manager:
+: directoryOpenCommand: nautilus -w {file}
+** directoryTerminalOpenCommand
+Command to use when opening directory in text terminal based console.
+
+By default instantlauncher assumes that Gnome desktop environment is
+installed and uses Gnome Terminal:
+
+: directoryTerminalOpenCommand: gnome-terminal --working-directory={file}
+** fileAssociations
+Allows to map file name/extension using regular expression pattern
+matching to corresponding application.
+
+Example:
+#+BEGIN_SRC conf
+-  command: vlc {file}
+   fileRegex: .*\.mkv$
+#+END_SRC
+
+Where:
+- command :: Command to execute to open given file. Special variable
+             {file} will point to user chosen file using absolute file
+             path.
+
+- fileRegex :: Regular expression that must match the file.
+** navigationRootPath
+    :PROPERTIES:
+    :ID:       5ced6bf5-165a-49a0-8de4-3755d810d987
+    :END:
+Root directory from where to start navigation.
+
+This parameter is user specific! In my case instantlauncher by default
+pointed this to my home directory. But it can be any directory user
+chooses.
+
+I think good use-case is to create special directory to be used for
+instantlauncher root. This special root directory can in turn contain
+symlinks to various places user wants to visit often. Instantlauncher
+will follow symlinks as if they were directories.
 
-* TODO
-TODO:
+: navigationRootPath: /home/svjatoslav/
index 29f95d9..b09b360 100644 (file)
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
     <output url="file://$MODULE_DIR$/target/classes" />
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
       <excludeFolder url="file://$MODULE_DIR$/target" />
     </content>
     <orderEntry type="inheritedJdk" />
index 3d2988b..aef82f2 100755 (executable)
@@ -41,6 +41,8 @@ public class ConfigurationManager {
 
     private void saveConfigFile() throws IOException {
         YamlWriter writer = new YamlWriter(new FileWriter(getPropertiesFile()));
+        writer.getConfig().setClassTag("configuration",  Configuration.class);
+        writer.getConfig().setPropertyElementType(Configuration.class, "fileAssociations", FileAssociation.class);
         writer.write(configuration);
         writer.close();
     }