Skip to main content

Flauncher

Universal CLI file launcher

Launch any file in terminal with one unique command. flauncher works as a command router and launches the input files with the according application/program regarding your settings preferences. Can also be imported in your own python codes.

Then, flauncher can deal with any file type such as audio, image, libreoffice-writer (odt), libreoffice-calc (ods), pdf, rar, tar, tar.gz, tar.xz, tar.bz2, text, tgz, zip, video, etc. files.

Installation

With pip:
sudo pip3 install flauncher

With yay:
yay -a flauncher

With yaourt:
yaourt -a flauncher

Compatibility

python >= 3

Usage

flauncher [FILE_PATH_01 FILE_PATH_02 ...]
options:
         -h, --help        show this help message and exit
         -m [mode]         select another mode than the default open one to open another conf file than open.json

Configuration

The settings defining the command to be run for any extension type are located in the ~/.config/flauncher/open.json json file.

If this file doesn't exist, copy the default one located in usr/lib/flauncher/open.json and configure it as you wish.

{
        "files":
        {
                "audio": {
                  "mode": "playlist",
                  "exts": ["mp3", "wav", "m4a", "aac", "mp1", "mp2", "flac", "aa", "aax", "act", "aiff", "amr", "ape", "au", "awb", "dct", "dss", "dvf", "gsm", "iklax", "ivs", "m4b", "m4p", "mmf", "mpc", "msv", "nmf", "nsf", "oga", "mogg", "opus", "ra", "raw", "sin", "tta", "vox", "wma", "wv", "8svx"],
                  "app": "mpv",
                  "args": "--fs-screen=all -fs --loop-playplaylist --script-opts=osc-hidetimeout=6000 --player-operation-mode=pseudo-gui"
                },
                "graphical": {
                  "mode": "individual",
                  "exts": ["xcf"],
                  "app": "gimp",
                  "args": null
                },
                "image_bitmap": {
                  "mode": "playlist",
                  "exts": ["jpg", "jpeg", "png", "tif", "gif", "bmp", "pjpeg", "jfif", "exif", "tiff", "png", "ppm", "pgm", "pbm", "pnm", "webp", "hdr", "heif", "bat", "bpg"],
                  "app": "sxiv",
                  "args": "-bf"
                },
                "libreoffice_writer": {
                  "mode": "individual",
                  "exts": ["odt", "doc", "docx", "docs"],
                  "app": "libreoffice --writer",
                  "args": null
                },
                "markup": {
                  "mode": "individual",
                  "exts": ["ad", "md", "adoc"],
                  "app": "brave",
                  "args": "-a"
                },
                "python": {
                  "mode": "individual",
                  "exts": ["py"],
                  "app": "pycharm",
                  "args": null
                },
                "pdf": {
                  "mode": "individual",
                  "exts": ["pdf"],
                  "app": "brave",
                  "args": "-a"
                },
                "rar": {
                  "mode": "archive_a",
                  "exts": ["rar"],
                  "app": "unrar",
                  "args": "x"
                },
                "tar": {
                  "mode": "archive_a",
                  "exts": ["tar"],
                  "app": "tar",
                  "args": "-xvf"
                },
                "tar_gz": {
                  "mode": "archive_a",
                  "exts": ["tar.gz"],
                  "app": "tar",
                  "args": "-zxvf"
                },
                "tar_xz": {
                  "mode": "archive_b",
                  "exts": ["tar.xz", "txz"],
                  "app": "tar",
                  "args": "--directory FOLDER_PATH -xJf ARCHIVE_PATH"
                }
        ...
        ...
        ...
        },
        "folders": {}
}

By default any audio and video files are launched with mpv, any image with sxiv, any pdf with the brave browser, any text with the atom editor, etc. But feel free to set your preferred application.

Examples

For help:

flauncher -h
or
flauncher --help

Launch a pdf, a zip, a tar.gz and a mp3:

flauncher titi.pdf toto/tutu.zip toto/tutu.tar.gz toto/tata/tutu.mp3

Custom mode

Define others modes corresponding to others conf files with the -m parameter. When specifying the -m parameter, you have to precise the mode name just after it corresponding to the ~/.config/flauncher/mode.json conf file. -m edit will use the ~/.config/flauncher/edit.json conf file rather than the default launch.json one.

Then, you can have different launch mode corresponding to any kind of file.

Suggestions

Use the o command to open any file:

alias o='flauncher'

And the e command to edit any file:

alias e='flauncher -m edit'

Python import

You can import the flauncher package in your own codes and then call the get_cmds method with the file paths and the mode you want to use.

from flauncher import get_cmds
cmds = get_cmds(paths, mode)

It will return a list of clean commands, every command being a dictionary with the "app", the "args" and the "su" attributes.

Release files for flauncher 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flauncher 1.5.0
File Size Uploaded
flauncher-1.5.0.tar.gz 17.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flauncher 1.5.0
File Interpreter ABI Platform
flauncher-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.5 kB

Release files / flauncher-1.5.0.tar.gz

Download URL flauncher-1.5.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d9bb2e26e01b221a2a530e2c2b42985dbf7c285b9b0c3367260e1f09b712e40f
BLAKE2b-256 checksum
How to use checksums
1b9a3bf5e8c4b53fb0326124b45d47efcb2dfedb217500ec228ccc1b383a5b1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.5

Release files / flauncher-1.5.0-py3-none-any.whl

Download URL flauncher-1.5.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a68a1cf88e5047c1b18b8441d45bb81999c8c9a975a86f8efb1153c704c4df1
BLAKE2b-256 checksum
How to use checksums
4c99a6852bb6825762818a0193239c364e10a56685f6efc6e22fb7e97e27ea15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.5

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.1.8

1 release file

1.1.7

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page