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
|
@ -23,12 +23,12 @@ typedef struct
|
|||
|
||||
typedef enum
|
||||
{
|
||||
TB_AUTOHEIGHT = 1 << 0,
|
||||
TB_AUTOWIDTH = 1 << 1,
|
||||
TB_LEFT = 1 << 16,
|
||||
TB_RIGHT = 1 << 17,
|
||||
TB_CENTER = 1 << 18,
|
||||
TB_EDITABLE = 1 << 19,
|
||||
TB_AUTOHEIGHT = 1 << 0,
|
||||
TB_AUTOWIDTH = 1 << 1,
|
||||
TB_LEFT = 1 << 16,
|
||||
TB_RIGHT = 1 << 17,
|
||||
TB_CENTER = 1 << 18,
|
||||
TB_EDITABLE = 1 << 19,
|
||||
} TextboxFlags;
|
||||
|
||||
|
||||
|
@ -44,6 +44,9 @@ typedef enum
|
|||
STATE_MASK = ( NORMAL | ALT | HIGHLIGHT ),
|
||||
|
||||
BOLD = 8,
|
||||
ITALIC = 16,
|
||||
|
||||
FMOD_MASK = ( BOLD | ITALIC )
|
||||
} TextBoxFontType;
|
||||
|
||||
textbox* textbox_create ( Window parent,
|
||||
|
|
|
@ -30,19 +30,20 @@ int window_get_cardinal_prop ( Display *display, Window w, Atom atom, unsigned l
|
|||
#define ATOM_CHAR( x ) # x
|
||||
|
||||
// usable space on a monitor
|
||||
#define EWMH_ATOMS( X ) \
|
||||
X ( _NET_CLIENT_LIST_STACKING ), \
|
||||
X ( _NET_NUMBER_OF_DESKTOPS ), \
|
||||
X ( _NET_CURRENT_DESKTOP ), \
|
||||
X ( _NET_ACTIVE_WINDOW ), \
|
||||
X ( _NET_WM_NAME ), \
|
||||
X ( _NET_WM_STATE ), \
|
||||
X ( _NET_WM_STATE_SKIP_TASKBAR ), \
|
||||
X ( _NET_WM_STATE_SKIP_PAGER ), \
|
||||
X ( _NET_WM_STATE_ABOVE ), \
|
||||
X ( _NET_WM_DESKTOP ), \
|
||||
X ( CLIPBOARD ), \
|
||||
X ( UTF8_STRING ), \
|
||||
#define EWMH_ATOMS( X ) \
|
||||
X ( _NET_CLIENT_LIST_STACKING ), \
|
||||
X ( _NET_NUMBER_OF_DESKTOPS ), \
|
||||
X ( _NET_CURRENT_DESKTOP ), \
|
||||
X ( _NET_ACTIVE_WINDOW ), \
|
||||
X ( _NET_WM_NAME ), \
|
||||
X ( _NET_WM_STATE ), \
|
||||
X ( _NET_WM_STATE_SKIP_TASKBAR ), \
|
||||
X ( _NET_WM_STATE_SKIP_PAGER ), \
|
||||
X ( _NET_WM_STATE_ABOVE ), \
|
||||
X ( _NET_WM_STATE_DEMANDS_ATTENTION ), \
|
||||
X ( _NET_WM_DESKTOP ), \
|
||||
X ( CLIPBOARD ), \
|
||||
X ( UTF8_STRING ), \
|
||||
X ( _NET_WM_WINDOW_OPACITY )
|
||||
|
||||
enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS };
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#define CLIENTTITLE 100
|
||||
#define CLIENTCLASS 50
|
||||
#define CLIENTNAME 50
|
||||
#define CLIENTSTATE 10
|
||||
#define CLIENTSTATE 20
|
||||
#define CLIENTROLE 50
|
||||
|
||||
// a manageable window
|
||||
|
@ -63,6 +63,7 @@ typedef struct
|
|||
Atom state[CLIENTSTATE];
|
||||
workarea monitor;
|
||||
int active;
|
||||
int demands;
|
||||
} client;
|
||||
// TODO
|
||||
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 ) {
|
||||
continue;
|
||||
}
|
||||
if ( client_has_state ( c, netatoms[_NET_WM_STATE_DEMANDS_ATTENTION] ) ) {
|
||||
c->demands = TRUE;
|
||||
}
|
||||
|
||||
if ( c->window == curr_win_id ) {
|
||||
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 )
|
||||
{
|
||||
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 ) {
|
||||
*state = BOLD;
|
||||
*state |= BOLD;
|
||||
}
|
||||
return rmpd->cmd_list[selected_line];
|
||||
}
|
||||
|
|
|
@ -127,11 +127,14 @@ textbox* textbox_create ( Window parent,
|
|||
// set an Xft font by name
|
||||
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 );
|
||||
if ( ( tbft & BOLD ) == 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_font_description_free ( pfd );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue