bar_items: Return sane defaults if we're not on our own buffer.
This commit is contained in:
parent
2ab1885b5f
commit
12bf9c85c4
1 changed files with 28 additions and 1 deletions
|
@ -32,7 +32,10 @@ def matrix_bar_item_plugin(data, item, window, buffer, extra_info):
|
||||||
name=server.name,
|
name=server.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
return ""
|
ptr_plugin = W.buffer_get_pointer(buffer, "plugin")
|
||||||
|
name = W.plugin_get_name(ptr_plugin)
|
||||||
|
|
||||||
|
return name
|
||||||
|
|
||||||
|
|
||||||
@utf8_decode
|
@utf8_decode
|
||||||
|
@ -66,6 +69,24 @@ def matrix_bar_item_name(data, item, window, buffer, extra_info):
|
||||||
name=server.name,
|
name=server.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name = W.buffer_get_string(buffer, "name")
|
||||||
|
|
||||||
|
if name:
|
||||||
|
localvar_type = W.buffer_get_string(buffer, "localvar_type")
|
||||||
|
is_channel = localvar_type == "channel"
|
||||||
|
|
||||||
|
if is_channel:
|
||||||
|
name = W.buffer_get_string(buffer, "localvar_channel")
|
||||||
|
|
||||||
|
return "{}{}{}{}{}{}".format(
|
||||||
|
W.color("bar_delim") if is_channel else "",
|
||||||
|
"(" if is_channel else "",
|
||||||
|
W.color("status_name"),
|
||||||
|
name,
|
||||||
|
W.color("bar_delim") if is_channel else "",
|
||||||
|
")" if is_channel else "",
|
||||||
|
)
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,6 +148,12 @@ def matrix_bar_nicklist_count(data, item, window, buffer, extra_info):
|
||||||
room = room_buffer.room
|
room = room_buffer.room
|
||||||
return str(room.member_count)
|
return str(room.member_count)
|
||||||
|
|
||||||
|
nick_count = W.buffer_get_integer(buffer, "nicklist_nicks_count")
|
||||||
|
nicklist_enabled = bool(W.buffer_get_integer(buffer, "nicklist"))
|
||||||
|
|
||||||
|
if nicklist_enabled:
|
||||||
|
return str(nick_count)
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue