sway-launcher-desktop icon indicating copy to clipboard operation
sway-launcher-desktop copied to clipboard

Using brotab as a provider

Open tijptjik opened this issue 2 years ago • 1 comments
trafficstars

In an attempt to use brotab as a provider, I've added the following to providers.conf

[brotab]
list_cmd=/usr/local/bin/bt list | awk -v FS="\t" -v OFS="\034" '{print $1,"brotab",$2,$3}'
preview_cmd=echo -e '{2}'
launch_cmd=/usr/local/bin/bt activate '{1}'
purge_cmd=test -f '{1}' || exit 43

however, it results it the following error message upon launching sway-launcher-desktop

image

while directly running the list_cmd in the shell seems to produce desirable results

c.1153042208.1153042209brotabNew Issue · Biont/sway-launcher-desktophttps://github.com/Biont/sway-launcher-desktop/issues/new
c.1153042208.1153042211brotabbalta2ar/brotab: Control your browser's tabs from the command linehttps://github.com/balta2ar/brotab

What could be wrong with the list input, or would you have further suggestions on how to troubleshoot this issue?

tijptjik avatar May 17 '23 16:05 tijptjik

I'm willing to bet it's tripping over the double quotes in your list_cmd. The string handling isn't that sophisticated in these areas, sorry.

One idea would be to place the actual code in a separate shell script and reference that in your provider.

Biont avatar Jun 17 '23 00:06 Biont

Thank you! That did the trick. For reference, providers.conf

[brotab]
list_cmd=/home/io/.config/sway-launcher-desktop/brotab.sh
preview_cmd=/usr/local/bin/bt list | grep '{1}' | awk -F'\t' '{print $NF}'
launch_cmd=/usr/local/bin/bt activate '{1}'
purge_cmd=/usr/local/bin/bt list | grep '{1}' || exit 43

and brotab.sh

#!/usr/bin/env bash
/usr/local/bin/bt list | awk -v FS='\t' -v OFS='\34' '{print $1,"brotab","🦊 " $2,$3}'

tijptjik avatar Apr 16 '24 18:04 tijptjik

Though the launched items end up in the cache / history file, so to keep the tab listing current the history either needs to be disabled, or ./sway-launcher-desktop.sh purge needs to be called before each invocation.

tijptjik avatar Apr 16 '24 19:04 tijptjik