You are not logged in.

#1 2013-01-11 15:09:20

delta_4d
Member
Registered: 2011-07-26
Posts: 16

how to add icons on dwm statusbar?

att
Lately I ran into dwm, and seeing some very cool screenshot in arch forum, I want to show icons on statusbar to make mine looks better.
Then I found this post, but it didn't work out.

I used dwm-6.0, and only apply xft-patch.
config.h

/* See LICENSE file for copyright and license details. */

/* appearance */
//static const char font[]            = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
//static const char font[]            = "-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*" "," "ohsnap:size=9:antialias=true:hinting=true"; 
static const char font[]            = "ohsnap:size=9:antialias=true:hinting=true" "," "-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#444444";
static const char normbgcolor[]     = "#222222";
static const char normfgcolor[]     = "#bbbbbb";
static const char selbordercolor[]  = "#005577";
static const char selbgcolor[]      = "#005577";
static const char selfgcolor[]      = "#eeeeee";
static const unsigned int borderpx  = 1;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const Bool showbar           = True;     /* False means no bar */
static const Bool topbar            = True;     /* False means bottom bar */

/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };

.xinitrc

#!/bin/sh

xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55 &
feh --bg-scale /home/delta/pictures/bg.jpg

_test() {
#	echo -e '\uE015'
	echo "$(date)"
}

xset +fp /usr/share/fonts/local
xset +fp /usr/share/fonts/gao
xset +fp /usr/share/fonts/terminus
xset fp rehash

while true; do
	xsetroot -name "$(_test)"
	sleep 1
done &
exec dwm

echo -e result:
taDE2MA

Am I missing something or doing something wrong ? Thx.


take it easy

Offline

#2 2013-01-11 15:40:01

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,471
Website

Re: how to add icons on dwm statusbar?

I think XFT is the culprit. Why do you patch DWM with XFT, if you use bitmap fonts anyway? Try without the XFT patch.

Also, this is the wrong subforum for such a post. Could a moderator move it?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#3 2013-01-11 15:56:18

delta_4d
Member
Registered: 2011-07-26
Posts: 16

Re: how to add icons on dwm statusbar?

Thx Unia. I tried it without XFT, still without icons.
And I am new to linux and arch forum, really sorry for the inconvenience.


take it easy

Offline

#4 2013-01-11 16:46:30

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,497
Website

Re: how to add icons on dwm statusbar?

So using xsetroot to set the date string works.

When I suggested (in other thread) to do the echo command from a terminal within dwm I wasn't very clear.  You'd still need to pass that to xsetroot:

$ xsetroot -name "$(echo -e '\uE015')"

That will definitely change what is in the status area (for a second), but whether it shows what you want will help determine the next troubleshooting steps.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#5 2013-01-11 19:50:38

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,315
Website

Re: how to add icons on dwm statusbar?

Image doesn't really qualify as Artwork and Screenshots: moving to Newbie Corner...


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#6 2013-01-11 22:23:05

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,250

Re: how to add icons on dwm statusbar?

Are you using xterm or urxvt? In urxvt, it should print a box which you can paste into your .xinitrc and it should show the glyph in dwm. In xterm, it just prints an empty line here, but I can still grab the first character of the empty line and paste it. Maybe give that a try. You'll probably need to use stlarch first in the font string and ohsnap last too.

Offline

#7 2013-01-12 05:15:20

delta_4d
Member
Registered: 2011-07-26
Posts: 16

Re: how to add icons on dwm statusbar?

thx
@stlarch I use urxvt, it shows a blank line when I type echo -e '\uE015'. I change the font order in config.h, it remains the same.
@Trilby I type the xsetroot command in urxvt, result is:
taDFpbw
taDFpcA


take it easy

Offline

#8 2013-01-12 05:31:45

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: how to add icons on dwm statusbar?

Did you run

fc-cache -f -v

?


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#9 2013-01-12 05:32:51

delta_4d
Member
Registered: 2011-07-26
Posts: 16

Re: how to add icons on dwm statusbar?

bohoomil wrote:

Did you run

fc-cache -f -v

?

yes


take it easy

Offline

#10 2013-01-12 07:07:45

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,250

Re: how to add icons on dwm statusbar?

Did you try what I said about grabbing the first character of the empty line and the pasting it into your script. There is something there if it's printing an empty line, I don't why it's not showing a box. Maybe check your locale settings? It's all I can think of.

Offline

#11 2013-01-12 07:41:58

delta_4d
Member
Registered: 2011-07-26
Posts: 16

Re: how to add icons on dwm statusbar?

thx stlarch!
It's the locale thing.
It's now like this. It's a box now! But still.. I think I miss something.
taDFqbw


take it easy

Offline

#12 2013-01-12 08:55:31

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,250

Re: how to add icons on dwm statusbar?

In my config.h, I have

static const char font[]            =
"-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*"",""-*-ohsnap-medium-r-*-*-11-*-*-*-*-*-*-*";

and in my .xinitrc

while true; do
        xsetroot -name " $(date +"%I:%M")"
        sleep 30
done &

Offline

#13 2013-01-12 09:56:26

delta_4d
Member
Registered: 2011-07-26
Posts: 16

Re: how to add icons on dwm statusbar?

stlarch, I now use ur settings.
It's wierd that when I type space, it show '0020' in gedit, and now It's like this.
taDFrbg

Last edited by delta_4d (2013-01-12 09:58:00)


take it easy

Offline

#14 2013-02-03 19:42:54

azb
Member
Registered: 2013-02-03
Posts: 14

Re: how to add icons on dwm statusbar?

Hi. Sorry for bumping, don't want to make a new thread either.

I'm also having trouble getting icons on the bar. I assume it has something to do with defining font in config.h.
Whenever I try to use newly installed font, it seems to default on some other font; symbols, size changes etc won't work.
Also, some (well, most actually) fonts I download won't get recognised by fontforge. For instance terminus2 from https://github.com/w0ng/dwm, sm4tik from https://github.com/sunaku/sm4tik-font. So far only stlarch.bdf has been recognised. But neither of those seem to work.

Any recommendation where to start?

Offline

#15 2013-02-04 13:56:39

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,250

Re: how to add icons on dwm statusbar?

Make sure you have something like this in your .xinitrc :

xrdb -merge ~/.Xresources
xset +fp /usr/share/fonts/local
xset fp rehash

If you're installing the fonts manually, run :

#fc-cache -fs
#mkfontscale /usr/share/fonts/local
#mkfontdir /usr/share/fonts/local

Replace local with the actual location if it is different.
And try using the example I gave above in this thread for defining your fonts in config.h.

Offline

#16 2013-02-17 08:20:29

azb
Member
Registered: 2013-02-03
Posts: 14

Re: how to add icons on dwm statusbar?

Thanks stlarch. I believe the fonts installed successfully, but the correct icons still cannot be used. If I opened the .pcf file in fontforge, clicked on the symbol, read it's value and typed it in terminal, the icon above it would be printed instead. Your example of clock icon with echo -e '\uE015' would give the smaller clock above the one listed within fontforge.

Edit: added screenshot explaining what I mean by the top row icon getting printed (note the icon is copied from the terminal into chromium address bar)

Last edited by azb (2013-02-20 20:11:08)

Offline

#17 2013-02-22 08:24:22

azb
Member
Registered: 2013-02-03
Posts: 14

Re: how to add icons on dwm statusbar?

Selfish bump.

Offline

#18 2013-07-03 03:40:39

kyzys
Member
Registered: 2013-06-14
Posts: 9

Re: how to add icons on dwm statusbar?

Hey sorry I also did not want to start a new thread. I am able to see the icons in my config.h but when I reload dwm it is just a blank space. Any help would be great. Thanks.

Edit: Fixed locales, everything works now. Sorry for reviving an old thread.

Last edited by kyzys (2013-07-08 20:24:20)

Offline

Board footer

Powered by FluxBB