From e3ffc2bb7c897529d91f0cd8d1a371cc6b7f893c Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Mon, 10 Jul 2017 15:01:18 +0200 Subject: [PATCH] Updated documentation. Made configuration file more readable. --- doc/index.html | 155 ++++++++++++++++-- doc/index.org | 92 ++++++++++- instantlauncher.iml | 3 +- .../configuration/ConfigurationManager.java | 2 + 4 files changed, 227 insertions(+), 25 deletions(-) diff --git a/doc/index.html b/doc/index.html index febe9c0..4088d6e 100644 --- a/doc/index.html +++ b/doc/index.html @@ -2,7 +2,7 @@ Instantlauncher - navigate to your files and programs quickly! - + @@ -225,9 +225,9 @@ published by the Free Software Foundation.

1 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 predefined directory. Sub directories can be chosen +by simply moving mouse pointer over corresponding directory.

@@ -245,8 +245,14 @@ Files types are color-coded.

2 Usage

+

+Simply hovering mouse pointer over directory expands its contents in +the next right column. +

+ +
    -
  • Executable file: +
  • Executable file (red):
    • Left mouse click:
        @@ -263,7 +269,7 @@ Files types are color-coded.
    • -
    • Non-executable file: +
    • Non-executable file (green):
      • Left mouse click:
          @@ -280,7 +286,7 @@ Files types are color-coded.
      • -
      • Directory/symlink: +
      • Directory/symlink (blue):
        • Left mouse click:
            @@ -304,17 +310,130 @@ Files types are color-coded.

            3 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:

            +
            +!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/
            +
            +
            + +
            +

            3.1 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}
            +
            +
            +

            3.2 directoryTerminalOpenCommand

            +
            +

            +Command to use when opening directory in text terminal based console. +

            -
            -

            4 TODO

            -

            -TODO: +By default instantlauncher assumes that Gnome desktop environment is +installed and uses Gnome Terminal:

            + +
            +directoryTerminalOpenCommand: gnome-terminal --working-directory={file}
            +
            +
            +
            +
            +

            3.3 fileAssociations

            +
            +

            +Allows to map file name/extension using regular expression pattern +matching to corresponding application. +

            + +

            +Example: +

            +
            + +
            -  command: vlc {file}
            +   fileRegex: .*\.mkv$
            +
            +
            + +

            +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. +
            +
            +
            +
            +
            +

            3.4 navigationRootPath

            +
            +

            +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. +

            + +
            +navigationRootPath: /home/svjatoslav/
            +
            +
diff --git a/doc/index.org b/doc/index.org index 0dd67f2..22e7758 100644 --- a/doc/index.org +++ b/doc/index.org @@ -25,35 +25,109 @@ #+HTML_HEAD: * 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/ diff --git a/instantlauncher.iml b/instantlauncher.iml index 29f95d9..b09b360 100644 --- a/instantlauncher.iml +++ b/instantlauncher.iml @@ -1,10 +1,11 @@ - + + diff --git a/src/main/java/eu/svjatoslav/instantlauncher/configuration/ConfigurationManager.java b/src/main/java/eu/svjatoslav/instantlauncher/configuration/ConfigurationManager.java index 3d2988b..aef82f2 100755 --- a/src/main/java/eu/svjatoslav/instantlauncher/configuration/ConfigurationManager.java +++ b/src/main/java/eu/svjatoslav/instantlauncher/configuration/ConfigurationManager.java @@ -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(); } -- 2.20.1