From e1456dd0c3d2da1d64014a5062b3a1a1272e1154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Fri, 29 Nov 2019 22:57:39 +0100 Subject: Document usage of custom providers --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 94ffe1f..4af6352 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,22 @@ bindsym $mod+d exec $menu ### Setup a Terminal command Some of your desktop entries will probably be TUI programs that expect to be launched in a new terminal window. Those entries have the `Terminal=true` flag set and you need to tell the launcher which terminal emulator to use. Pass the `TERMINAL_COMMAND` environment variable with your terminal startup command to the script to use your preferred terminal emulator. The script will default to `urxvt -e` + +## Extending the launcher + +In addition to desktop application entries and binaries, you can extend `sway-launcher-desktop` with custom item providers. +If will read the configuration of custom item providers from `$HOME/.config/sway-launcher-desktop/providers.conf` +The structure looks like this: + +``` +[my-provider] +list_cmd=echo 'my-custom-entry\034 \034My custom provider' +preview_cmd=echo 'This is the preview of {1}' +launch_cmd=notify-send 'I am not launching {1}' +``` + +The `list_cmd` generated the list of entries. For each entry, it has to print the following columns, separated by the `\034` field separator character: +1. The item to launch. This will get passed to `preview_cmd` and `launch_cmd` as `{1}` +2. A glyph or any kind of prefix to differentiate your provider from others. Feel free to use ANSI escape codes for coloring it +3. The text that appears in the `fzf` window +4. (optional) Metadata that you can pass to `preview_cmd` and `launch_cmd` as `{2}`. For example, this is used to specify a specific Desktop Action inside a .desktop file \ No newline at end of file -- cgit v1.2.3 From d3a3657a0f21e87acce072deaf1d30095b447b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Fri, 29 Nov 2019 23:13:30 +0100 Subject: typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 4af6352..8f2ae8e 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The structure looks like this: [my-provider] list_cmd=echo 'my-custom-entry\034 \034My custom provider' preview_cmd=echo 'This is the preview of {1}' -launch_cmd=notify-send 'I am not launching {1}' +launch_cmd=notify-send 'I am now launching {1}' ``` The `list_cmd` generated the list of entries. For each entry, it has to print the following columns, separated by the `\034` field separator character: -- cgit v1.2.3 From 4e58f614e28cd23106101b303dccc526febf16b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Fri, 29 Nov 2019 23:58:24 +0100 Subject: Implement template variable substitution in provider commands --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8f2ae8e..d3a07af 100644 --- a/README.md +++ b/README.md @@ -41,13 +41,13 @@ The structure looks like this: ``` [my-provider] -list_cmd=echo 'my-custom-entry\034 \034My custom provider' +list_cmd=echo 'my-custom-entry\034my-provider\034 \034My custom provider' preview_cmd=echo 'This is the preview of {1}' launch_cmd=notify-send 'I am now launching {1}' ``` The `list_cmd` generated the list of entries. For each entry, it has to print the following columns, separated by the `\034` field separator character: 1. The item to launch. This will get passed to `preview_cmd` and `launch_cmd` as `{1}` -2. A glyph or any kind of prefix to differentiate your provider from others. Feel free to use ANSI escape codes for coloring it -3. The text that appears in the `fzf` window +2. The name of your provider (the same as what what you put inside the brackets, so `my-provider` in this example) +3. The text that appears in the `fzf` window. You might want to prepend it with a glyph and add some color via ANSI escape codes 4. (optional) Metadata that you can pass to `preview_cmd` and `launch_cmd` as `{2}`. For example, this is used to specify a specific Desktop Action inside a .desktop file \ No newline at end of file -- cgit v1.2.3 From 9827852e967849714b9497c74543eb14a17606d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Fri, 29 Nov 2019 23:59:53 +0100 Subject: Fix example provider --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index d3a07af..70fbac9 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ The structure looks like this: ``` [my-provider] -list_cmd=echo 'my-custom-entry\034my-provider\034 \034My custom provider' -preview_cmd=echo 'This is the preview of {1}' +list_cmd=echo -e 'my-custom-entry\034my-provider\034 My custom provider' +preview_cmd=echo -e 'This is the preview of {1}' launch_cmd=notify-send 'I am now launching {1}' ``` -- cgit v1.2.3 From 3429a175db5eb6a9ca9ab93c808b6ed102ab7393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Sat, 30 Nov 2019 00:38:56 +0100 Subject: Fix and improve usage of launch_cmd in providers --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 70fbac9..e92a677 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Some of your desktop entries will probably be TUI programs that expect to be lau ## Extending the launcher In addition to desktop application entries and binaries, you can extend `sway-launcher-desktop` with custom item providers. -If will read the configuration of custom item providers from `$HOME/.config/sway-launcher-desktop/providers.conf` +If will read the configuration of custom item providers from `$HOME/.config/sway-launcher-desktop/providers.conf`. The structure looks like this: ``` @@ -50,4 +50,8 @@ The `list_cmd` generated the list of entries. For each entry, it has to print th 1. The item to launch. This will get passed to `preview_cmd` and `launch_cmd` as `{1}` 2. The name of your provider (the same as what what you put inside the brackets, so `my-provider` in this example) 3. The text that appears in the `fzf` window. You might want to prepend it with a glyph and add some color via ANSI escape codes -4. (optional) Metadata that you can pass to `preview_cmd` and `launch_cmd` as `{2}`. For example, this is used to specify a specific Desktop Action inside a .desktop file \ No newline at end of file +4. (optional) Metadata that you can pass to `preview_cmd` and `launch_cmd` as `{2}`. For example, this is used to specify a specific Desktop Action inside a .desktop file + +The `preview_cmd` renders the contents of the `fzf` preview panel. You can use the template variable `{1}` in your command, which will be substituted with the value of the selected item. + +The `launch_cmd` is fired when the user has selected one of the provider's entries. \ No newline at end of file -- cgit v1.2.3 From bd5bfc49309a49c09d97be8530b166507342ba07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Tue, 3 Dec 2019 20:06:21 +0100 Subject: Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index e92a677..5e0de3e 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Some of your desktop entries will probably be TUI programs that expect to be lau ## Extending the launcher In addition to desktop application entries and binaries, you can extend `sway-launcher-desktop` with custom item providers. -If will read the configuration of custom item providers from `$HOME/.config/sway-launcher-desktop/providers.conf`. +It will read the configuration of custom item providers from `$HOME/.config/sway-launcher-desktop/providers.conf`. The structure looks like this: ``` -- cgit v1.2.3