mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-23 03:43:02 +00:00
make popup topmost setting configurable (#309)
This commit is contained in:
parent
1648fa867c
commit
51eb1c1730
2 changed files with 19 additions and 3 deletions
21
src/popup.c
21
src/popup.c
|
@ -15,6 +15,7 @@ void popup_init(struct popup* popup, struct bar_item* host) {
|
||||||
popup->adid = 0;
|
popup->adid = 0;
|
||||||
popup->align = POSITION_LEFT;
|
popup->align = POSITION_LEFT;
|
||||||
popup->blur_radius = 0;
|
popup->blur_radius = 0;
|
||||||
|
popup->topmost = true;
|
||||||
|
|
||||||
popup->num_items = 0;
|
popup->num_items = 0;
|
||||||
popup->cell_size = 30;
|
popup->cell_size = 30;
|
||||||
|
@ -40,7 +41,10 @@ static bool popup_set_blur_radius(struct popup* popup, uint32_t radius) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void popup_order_windows(struct popup* popup) {
|
static void popup_order_windows(struct popup* popup) {
|
||||||
window_set_level(&popup->window, kCGScreenSaverWindowLevel);
|
int level = popup->topmost
|
||||||
|
? kCGScreenSaverWindowLevel
|
||||||
|
: kCGNormalWindowLevel;
|
||||||
|
window_set_level(&popup->window, level);
|
||||||
window_order(&popup->window, NULL, W_ABOVE);
|
window_order(&popup->window, NULL, W_ABOVE);
|
||||||
|
|
||||||
struct window* previous_window = NULL;
|
struct window* previous_window = NULL;
|
||||||
|
@ -49,7 +53,7 @@ static void popup_order_windows(struct popup* popup) {
|
||||||
struct bar_item* bar_item = popup->items[i];
|
struct bar_item* bar_item = popup->items[i];
|
||||||
|
|
||||||
struct window* window = bar_item_get_window(bar_item, popup->adid);
|
struct window* window = bar_item_get_window(bar_item, popup->adid);
|
||||||
window_set_level(window, kCGScreenSaverWindowLevel);
|
window_set_level(window, level);
|
||||||
if (!first_window) first_window = window;
|
if (!first_window) first_window = window;
|
||||||
|
|
||||||
if (bar_item->type == BAR_COMPONENT_GROUP) {
|
if (bar_item->type == BAR_COMPONENT_GROUP) {
|
||||||
|
@ -408,6 +412,13 @@ static bool popup_set_cell_size(struct popup* popup, int size) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool popup_set_topmost(struct popup* popup, bool topmost) {
|
||||||
|
if (topmost == popup->topmost) return false;
|
||||||
|
popup->topmost = topmost;
|
||||||
|
popup->needs_ordering = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool popup_parse_sub_domain(struct popup* popup, FILE* rsp, struct token property, char* message) {
|
bool popup_parse_sub_domain(struct popup* popup, FILE* rsp, struct token property, char* message) {
|
||||||
bool needs_refresh = false;
|
bool needs_refresh = false;
|
||||||
if (token_equals(property, PROPERTY_YOFFSET)) {
|
if (token_equals(property, PROPERTY_YOFFSET)) {
|
||||||
|
@ -434,7 +445,11 @@ bool popup_parse_sub_domain(struct popup* popup, FILE* rsp, struct token propert
|
||||||
popup->blur_radius,
|
popup->blur_radius,
|
||||||
token_to_int(get_token(&message)));
|
token_to_int(get_token(&message)));
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (token_equals(property, PROPERTY_TOPMOST)) {
|
||||||
|
return popup_set_topmost(popup,
|
||||||
|
evaluate_boolean_state(get_token(&message),
|
||||||
|
popup->topmost ));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
struct key_value_pair key_value_pair = get_key_value_pair(property.text,
|
struct key_value_pair key_value_pair = get_key_value_pair(property.text,
|
||||||
'.' );
|
'.' );
|
||||||
|
|
|
@ -12,6 +12,7 @@ struct popup {
|
||||||
bool overrides_cell_size;
|
bool overrides_cell_size;
|
||||||
bool mouse_over;
|
bool mouse_over;
|
||||||
bool needs_ordering;
|
bool needs_ordering;
|
||||||
|
bool topmost;
|
||||||
|
|
||||||
char align;
|
char align;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue