aboutsummaryrefslogtreecommitdiffstats
path: root/slack/init.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-12 22:10:40 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit7574554b09eacb7aaaa8610d73fef6bd9d8a363f (patch)
tree3ce9140f61c77502b8a9ec765bc346eea9543960 /slack/init.py
parentf2fc8b771c5f7c93f6bbfd44ad42494eaed107a6 (diff)
downloadwee-slack-7574554b09eacb7aaaa8610d73fef6bd9d8a363f.tar.gz
Show disconnected status in input field
Diffstat (limited to 'slack/init.py')
-rw-r--r--slack/init.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/slack/init.py b/slack/init.py
index a4c97be..68da138 100644
--- a/slack/init.py
+++ b/slack/init.py
@@ -28,18 +28,27 @@ def signal_buffer_switch_cb(data: str, signal: str, buffer_pointer: str) -> int:
def modifier_input_text_display_with_cursor_cb(
data: str, modifier: str, buffer_pointer: str, string: str
) -> str:
+ prefix = ""
conversation = get_conversation_from_buffer_pointer(buffer_pointer)
- if conversation and conversation.is_loading:
+ if conversation:
input_delim_color = weechat.config_string(
weechat.config_get("weechat.bar.input.color_delim")
)
- return (
- f"{with_color(input_delim_color, '[')}"
- f"{with_color(shared.config.color.loading.value, 'loading')}"
- f"{with_color(input_delim_color, ']')}"
- f" {string}"
- )
- return string
+ input_delim_start = with_color(input_delim_color, "[")
+ input_delim_end = with_color(input_delim_color, "]")
+ if not conversation.workspace.is_connected:
+ prefix += (
+ f"{input_delim_start}"
+ f"{with_color(shared.config.color.disconnected.value, 'disconnected')}"
+ f"{input_delim_end} "
+ )
+ if conversation.is_loading:
+ prefix += (
+ f"{input_delim_start}"
+ f"{with_color(shared.config.color.loading.value, 'loading')}"
+ f"{input_delim_end} "
+ )
+ return prefix + string
async def init():