@@ -51,6 +51,10 @@ Panel::Panel(Display* dpy, int scr, Window root, Cfg* config,
51
51
XftColorAllocName (Dpy, visual, colormap, cfg->getOption (" msg_color" ).c_str (), &msgcolor);
52
52
XftColorAllocName (Dpy, visual, colormap, cfg->getOption (" msg_shadow_color" ).c_str (), &msgshadowcolor);
53
53
XftColorAllocName (Dpy, visual, colormap, cfg->getOption (" intro_color" ).c_str (), &introcolor);
54
+ XftColorAllocName (Dpy, DefaultVisual (Dpy, Scr), colormap,
55
+ cfg->getOption (" session_color" ).c_str (), &sessioncolor);
56
+ XftColorAllocName (Dpy, DefaultVisual (Dpy, Scr), colormap,
57
+ cfg->getOption (" session_shadow_color" ).c_str (), &sessionshadowcolor);
54
58
55
59
// Load properties from config / theme
56
60
input_name_x = Cfg::string2int (cfg->getOption (" input_name_x" ).c_str ());
@@ -139,6 +143,8 @@ Panel::~Panel() {
139
143
XftColorFree (Dpy, DefaultVisual (Dpy, Scr), DefaultColormap (Dpy, Scr), &msgcolor);
140
144
XftColorFree (Dpy, DefaultVisual (Dpy, Scr), DefaultColormap (Dpy, Scr), &welcomecolor);
141
145
XftColorFree (Dpy, DefaultVisual (Dpy, Scr), DefaultColormap (Dpy, Scr), &entercolor);
146
+ XftColorFree (Dpy, DefaultVisual (Dpy, Scr), DefaultColormap (Dpy, Scr), &sessioncolor);
147
+ XftColorFree (Dpy, DefaultVisual (Dpy, Scr), DefaultColormap (Dpy, Scr), &sessionshadowcolor);
142
148
XFreeGC (Dpy, TextGC);
143
149
XftFontClose (Dpy, font);
144
150
XftFontClose (Dpy, msgfont);
@@ -566,23 +572,29 @@ void Panel::SwitchSession() {
566
572
567
573
// Display session type on the screen
568
574
void Panel::ShowSession () {
575
+ string msg_x, msg_y;
569
576
XClearWindow (Dpy, Root);
570
- string currsession = " Session: " + session;
577
+ string currsession = cfg-> getOption ( " session_msg " ) + " " + session;
571
578
XGlyphInfo extents;
572
- XftDraw *draw = XftDrawCreate (Dpy, Root,
579
+
580
+ sessionfont = XftFontOpenName (Dpy, Scr, cfg->getOption (" session_font" ).c_str ());
581
+
582
+ XftDraw *draw = XftDrawCreate (Dpy, Root,
573
583
DefaultVisual (Dpy, Scr), DefaultColormap (Dpy, Scr));
574
- XftTextExtents8 (Dpy, msgfont , reinterpret_cast <const XftChar8*>(currsession.c_str ()),
584
+ XftTextExtents8 (Dpy, sessionfont , reinterpret_cast <const XftChar8*>(currsession.c_str ()),
575
585
currsession.length (), &extents);
576
- int msg_x = Cfg::absolutepos (" 50%" , XWidthOfScreen (ScreenOfDisplay (Dpy, Scr)), extents.width );
577
- int msg_y = XHeightOfScreen (ScreenOfDisplay (Dpy, Scr)) - extents.height -100 ;
586
+ msg_x = cfg->getOption (" session_x" );
587
+ msg_y = cfg->getOption (" session_y" );
588
+ int x = Cfg::absolutepos (msg_x, XWidthOfScreen (ScreenOfDisplay (Dpy, Scr)), extents.width );
589
+ int y = Cfg::absolutepos (msg_y, XHeightOfScreen (ScreenOfDisplay (Dpy, Scr)), extents.height );
578
590
int shadowXOffset =
579
- Cfg::string2int (cfg->getOption (" msg_shadow_xoffset " ).c_str ());
591
+ Cfg::string2int (cfg->getOption (" session_shadow_xoffset " ).c_str ());
580
592
int shadowYOffset =
581
- Cfg::string2int (cfg->getOption (" msg_shadow_yoffset " ).c_str ());
593
+ Cfg::string2int (cfg->getOption (" session_shadow_yoffset " ).c_str ());
582
594
583
- SlimDrawString8 (draw, &msgcolor, msgfont, msg_x, msg_y ,
595
+ SlimDrawString8 (draw, &sessioncolor, sessionfont, x, y ,
584
596
currsession,
585
- &msgshadowcolor ,
597
+ &sessionshadowcolor ,
586
598
shadowXOffset, shadowYOffset);
587
599
XFlush (Dpy);
588
600
XftDrawDestroy (draw);
0 commit comments