Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lemonbuddy crashed on click of a custom script. #131

Closed
g-suraj opened this issue Oct 27, 2016 · 14 comments
Closed

Lemonbuddy crashed on click of a custom script. #131

g-suraj opened this issue Oct 27, 2016 · 14 comments

Comments

@g-suraj
Copy link

g-suraj commented Oct 27, 2016

I have a custom scrip as follows

[module/dropbox]
type = custom/script
exec = echo "%{A1:command}script%{A}"
format-underline = #458588
interval=10

Clicking on this crashes lemonbuddy, after which killing it is the only option.

@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

Can you post your full config

@g-suraj
Copy link
Author

g-suraj commented Oct 28, 2016

Sure thing. This is a tiny script I wrote to indicate the status of dropbox

#!/bin/bash
#Dropbox Status outputs
#Dropbox isn't enabled : "Dropbox"
#Dropbox is startin: "Starting..."
#Dropbox is Syncing: "Syncing ..."
#Dropbox is running: "Up to date..."
STATUS="$(echo `dropbox status` | awk '{print $1;}')"
C_status=#fbf1c7
DROPBOX_ICON=""
if [[ $STATUS == *"Dropbox"* ]]; then
  C_status=#fb4934
elif [[ $STATUS == *"Starting"* ]]; then
  #statements
  ICON=
elif [[ $STATUS == *"Syncing"* ]]; then
  DROPBOX_ICON=
else
  I=1
fi
echo "%{F$C_status}$DROPBOX_ICON%{F}$ICON"
#echo "%{A:dropbox start}$DROPBOX_ICON $ICON%{A}"

The commented echo is what crashes the bar, and I intended on making the click action on the icon one that triggers dropbox

The module in my lemonbuddy config is as follows.

[module/dropbox]
type = custom/script
exec = ~/github/Scripts/dropboxStatus.sh
format-underline = #458588
interval=5

As a side note, I think the wiki should have something about clickable buttons, I am completely new to this so I am horrendously lost.

@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

You are missing the closing colon of the %{A} tag. The correct syntax is:

%{A:command:}....%{A}

And also the foreground color reset should be:

%{F-}

You are right about the wiki. Input like this is really helpful since it's hard for me to know how it is for new users.

@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

Of course the invalid tags should not crash the bar so that will need to be fixed.

@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

I also want to add a hint about the button handlers available for the custom/script module. Info on the wiki.

@g-suraj
Copy link
Author

g-suraj commented Oct 28, 2016

Now I've gone ahead and replaced the %{A} tags to the button handlers instead. Here is the code for it

#!/bin/bash
#Dropbox Status outputs
#Dropbox isn't enabled : "Dropbox"
#Dropbox is startin: "Starting..."
#Dropbox is Syncing: "Syncing ..."
#Dropbox is running: "Up to date..."
STATUS="$(echo `dropbox status` | awk '{print $1;}')"
C_status=#fbf1c7
DROPBOX_ICON=""
if [[ $STATUS == *"Dropbox"* ]]; then
  C_status=#ec644b
elif [[ $STATUS == *"Starting"* ]]; then
  #statements
  ICON=
elif [[ $STATUS == *"Syncing"* ]]; then
  DROPBOX_ICON=
else
  I=1
fi
echo "%{F$C_status}$DROPBOX_ICON%{-F} $ICON"

The module in lemonbar's config file looks as follows


[module/dropbox]
type = custom/script
exec = ~/github/Scripts/dropboxStatus.sh
format-underline = #458588
click-left = dropbox start
interval=2
format-padding = 2

The bar still crashes on a click.

@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

I will test the script and get back to you

@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

Try to replace I=1 in the else with exit 0. Fixes it for me.

I don't know why the bar hangs, but I'll look into it.

@g-suraj
Copy link
Author

g-suraj commented Oct 28, 2016

The whole script works fine as it is, dropbox launches accordingly, but the bar crashes and does not update any further. Thanks for looking into this

@jaagr jaagr closed this as completed in fa7e3d4 Oct 28, 2016
@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

I found a bug that caused the execution to be blocked while the sub process was running. Please verify.

@g-suraj
Copy link
Author

g-suraj commented Oct 28, 2016

Whew! Works like a charm now!

@jaagr
Copy link
Member

jaagr commented Oct 28, 2016

Great! Please report any other issues you encounter.

@blackbart420
Copy link

Any chance you integrate this module ?

@jaagr
Copy link
Member

jaagr commented Oct 25, 2017

@blackbart420 it's a custom/script so you can use whatever @g-suraj posted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants