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

Add user name to status bar

asked 2013-04-12 13:09:10 +0000

I use more than one user accounts (5, to be precise) on my laptop, and I want to see who I am in the i3 status bar. For now, and I am sorry for the ugliness of that, I have put the user name somewhere in the .i3status.conf "time" string, since that produces at least some output. I have been trying almost everything imaginable with (what I assumed to work) "order += "user" but with no result whatsoever. I also tried just to put the name hard coded in the .i3/config file with, again, no show. All I need is just a user name in the status bar. How do I do that?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
4

answered 2013-04-12 17:20:25 +0000

updated 2013-04-12 17:21:10 +0000

As in my answer here: https://faq.i3wm.org/question/1537/sh... (sorry, not enough karma for links) you could try an external script. In your case you should create a script like this:

#!/bin/bash
i3status | while :
do
    read line
    user=`whoami`
    echo "whoami: $user | $line" || exit 1
done

Make the script executable and run it instead of i3status in your i3 config file.

edit flag offensive delete link more

Comments

Thank you very much mschaefer, that works. But now it appears at the left of the status bar, where it is covered by the workspace tabs, and the colors are gone! For now I am happy with the result, but I will certainly try to find out how I can get it on the other side and recover the colors. Thx

Maestraccio gravatar imageMaestraccio ( 2013-04-12 18:44:25 +0000 )edit

+1 for karma!

joepd gravatar imagejoepd ( 2013-04-12 21:19:38 +0000 )edit

Moving to the other side was as easy as 1-2-3; just changing the order of "$user | $line" to "$line | $user" (I took out the "whoami:" tag for space's sake). I guess that the colors issue is due to the fact that the line is wrapped in a script. Well, there are worse things in life...

Maestraccio gravatar imageMaestraccio ( 2013-04-12 21:38:34 +0000 )edit

To keep the colors, you could also replace i3status with [py3status](http://i3wm.org/docs/user-contributed/py3status.html) or [conky](http://i3wm.org/docs/user-contributed/conky-i3bar.html).

joepd gravatar imagejoepd ( 2013-04-13 08:36:39 +0000 )edit

@joepd: thanks for karma :-) Indeed, py3status would be a good alternative, I am using that myself, too.

mschaefer gravatar imagemschaefer ( 2013-04-13 10:09:25 +0000 )edit
1

answered 2013-12-12 11:41:21 +0000

Ultrabug gravatar image

Hi,

As @joepd and @mschaefer suggested, you can do it easily using py3status while keeping the colors and having the possibility to order your modules' output on your i3bar.

I've created a module named whoami.py in the examples directory of py3status sources which does the work :)

I hope this helps !

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-04-12 13:09:10 +0000

Seen: 865 times

Last updated: Dec 12 '13