The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

adding shell script to i3status.conf

asked 2014-10-21 13:32:31 +0000

nishraj gravatar image

updated 2014-10-23 08:12:11 +0000

Adaephon gravatar image
status_command i3status -c "${HOME}"/.i3/i3status.conf

here is my i3status.conf

general {
  output_format = "i3bar"
  colors = true
  interval = 2
  color_good = "#00bfd5"
  color_bad = "#cc3333"
}
order += "wireless wlan0"
  wireless wlan0 {
  format_up = "W: (%quality at %essid) %ip"
  format_down = "W:"
}

If i add another order.. say

order+="Gmail"
Gmail {
  format="Unread sh checkmail.sh"
}

It does not update my statusbar.

here is my checkmail.sh

#!/bin/bash

i3status | while:
do
    gmail=`perl gmail.pl`
    echo "GMAIL | $gmail" || exit 1
done
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-10-23 08:48:39 +0000

Adaephon gravatar image

updated 2014-10-23 08:59:05 +0000

First of all, there is no way to add a shell script to i3status, it explicitly say so in the i3status manpage: "there is no module to run arbitrary scripts or commands"


That being said, you can add i3status to a shell script.

For that you do not need to (read: must not) add a Gmail section to your i3status.conf. (The sections need to be of a specific type like wireless and sometimes require an additional argument like wlan0. They cannot be arbitrarily named (Gmail).)

Instead you have to edit your ~/.i3/config and set status_command in the bar section to call checkmail.sh instead of i3status. For example

bar {
    status_command /path/to/checkmail.sh
}

Also, your checkmail.sh will need to be closer to the example in the i3status manpage in order to work:

#!/bin/bash

i3status | while :
do
    read line
    gmail=`perl gmail.pl`
    echo "GMAIL $gmail | $line" || exit 1
done

Note the space between while and : which is really needed. The read line will read the output of i3status into the parameter line so that it can then be combined with the output of perl gmail.pl.


You may also want to have a look at py3status which is an i3status-wrapper that allows for user-made extensions.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-21 13:32:31 +0000

Seen: 983 times

Last updated: Oct 23 '14