mirror of https://github.com/davatorium/rofi.git
Add italic support and use it for windows that demand attention (working?)
This commit is contained in:
parent
2b340a4762
commit
0ab7aa4bba
|
@ -44,6 +44,9 @@ typedef enum
|
||||||
STATE_MASK = ( NORMAL | ALT | HIGHLIGHT ),
|
STATE_MASK = ( NORMAL | ALT | HIGHLIGHT ),
|
||||||
|
|
||||||
BOLD = 8,
|
BOLD = 8,
|
||||||
|
ITALIC = 16,
|
||||||
|
|
||||||
|
FMOD_MASK = ( BOLD | ITALIC )
|
||||||
} TextBoxFontType;
|
} TextBoxFontType;
|
||||||
|
|
||||||
textbox* textbox_create ( Window parent,
|
textbox* textbox_create ( Window parent,
|
||||||
|
|
|
@ -40,6 +40,7 @@ int window_get_cardinal_prop ( Display *display, Window w, Atom atom, unsigned l
|
||||||
X ( _NET_WM_STATE_SKIP_TASKBAR ), \
|
X ( _NET_WM_STATE_SKIP_TASKBAR ), \
|
||||||
X ( _NET_WM_STATE_SKIP_PAGER ), \
|
X ( _NET_WM_STATE_SKIP_PAGER ), \
|
||||||
X ( _NET_WM_STATE_ABOVE ), \
|
X ( _NET_WM_STATE_ABOVE ), \
|
||||||
|
X ( _NET_WM_STATE_DEMANDS_ATTENTION ), \
|
||||||
X ( _NET_WM_DESKTOP ), \
|
X ( _NET_WM_DESKTOP ), \
|
||||||
X ( CLIPBOARD ), \
|
X ( CLIPBOARD ), \
|
||||||
X ( UTF8_STRING ), \
|
X ( UTF8_STRING ), \
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#define CLIENTTITLE 100
|
#define CLIENTTITLE 100
|
||||||
#define CLIENTCLASS 50
|
#define CLIENTCLASS 50
|
||||||
#define CLIENTNAME 50
|
#define CLIENTNAME 50
|
||||||
#define CLIENTSTATE 10
|
#define CLIENTSTATE 20
|
||||||
#define CLIENTROLE 50
|
#define CLIENTROLE 50
|
||||||
|
|
||||||
// a manageable window
|
// a manageable window
|
||||||
|
@ -63,6 +63,7 @@ typedef struct
|
||||||
Atom state[CLIENTSTATE];
|
Atom state[CLIENTSTATE];
|
||||||
workarea monitor;
|
workarea monitor;
|
||||||
int active;
|
int active;
|
||||||
|
int demands;
|
||||||
} client;
|
} client;
|
||||||
// TODO
|
// TODO
|
||||||
extern Display *display;
|
extern Display *display;
|
||||||
|
@ -397,6 +398,9 @@ static char ** window_mode_get_data ( unsigned int *length, Switcher *sw )
|
||||||
if ( pd->config_i3_mode && strstr ( c->class, "i3bar" ) != NULL ) {
|
if ( pd->config_i3_mode && strstr ( c->class, "i3bar" ) != NULL ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ( client_has_state ( c, netatoms[_NET_WM_STATE_DEMANDS_ATTENTION] ) ) {
|
||||||
|
c->demands = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if ( c->window == curr_win_id ) {
|
if ( c->window == curr_win_id ) {
|
||||||
c->active = TRUE;
|
c->active = TRUE;
|
||||||
|
@ -508,8 +512,11 @@ static void window_mode_destroy ( Switcher *sw )
|
||||||
static const char *mgrv ( unsigned int selected_line, void *sw, G_GNUC_UNUSED int *state )
|
static const char *mgrv ( unsigned int selected_line, void *sw, G_GNUC_UNUSED int *state )
|
||||||
{
|
{
|
||||||
SwitcherModePrivateData *rmpd = ( (Switcher *) sw )->private_data;
|
SwitcherModePrivateData *rmpd = ( (Switcher *) sw )->private_data;
|
||||||
|
if ( window_client ( display, rmpd->ids->array[selected_line] )->demands ) {
|
||||||
|
*state |= ITALIC;
|
||||||
|
}
|
||||||
if ( window_client ( display, rmpd->ids->array[selected_line] )->active ) {
|
if ( window_client ( display, rmpd->ids->array[selected_line] )->active ) {
|
||||||
*state = BOLD;
|
*state |= BOLD;
|
||||||
}
|
}
|
||||||
return rmpd->cmd_list[selected_line];
|
return rmpd->cmd_list[selected_line];
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,11 +127,14 @@ textbox* textbox_create ( Window parent,
|
||||||
// set an Xft font by name
|
// set an Xft font by name
|
||||||
void textbox_font ( textbox *tb, TextBoxFontType tbft )
|
void textbox_font ( textbox *tb, TextBoxFontType tbft )
|
||||||
{
|
{
|
||||||
if ( ( tbft & BOLD ) != ( tb->tbft & BOLD ) ) {
|
if ( ( tbft & FMOD_MASK ) != ( tb->tbft & FMOD_MASK ) ) {
|
||||||
PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font );
|
PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font );
|
||||||
if ( ( tbft & BOLD ) == BOLD ) {
|
if ( ( tbft & BOLD ) == BOLD ) {
|
||||||
pango_font_description_set_weight ( pfd, PANGO_WEIGHT_BOLD );
|
pango_font_description_set_weight ( pfd, PANGO_WEIGHT_BOLD );
|
||||||
}
|
}
|
||||||
|
if ( ( tbft & ITALIC ) == ITALIC ) {
|
||||||
|
pango_font_description_set_style ( pfd, PANGO_STYLE_ITALIC );
|
||||||
|
}
|
||||||
pango_layout_set_font_description ( tb->layout, pfd );
|
pango_layout_set_font_description ( tb->layout, pfd );
|
||||||
pango_font_description_free ( pfd );
|
pango_font_description_free ( pfd );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue