complete-computing-environment/weechat_for_matrix.org

5.3 KiB

Weechat for Matrix

,#+ARCOLOGY_KEY: cce/weechat ,#+CCE_ANSIBLE: weechat

,#+ARROYO_EMACS_MODULE: weechat ,#+ARROYO_MODULE_WANTS: cce/configure_packaging.org

(provide 'cce/weechat)

I am a big proponent of the Matrix.org Ecosystem, but their primary desktop client is a React web application, and the implementation of other clients is not so trivial when you consider the full surface area of features they've built over the last few years of creating a serviceable high-gloss Slack competitor, Riot.im. I'm happy for the work that they're doing, and I think ultimately it helps the ecosystem and the project as a whole.

But, I have different desires for a client. It would deeply integrate with Emacs, of course, and that carries with it a lot of implementational baggage. This was the initial reasoning towards the Emacs Matrix Client, and is a reason to revisit it. But in the mean time, I am not so satisfied with the glossy web-app, especially when it's crammed in to an Electron container. I could in theory create an overlay like exwm-evil-firefox, but I still pay for Unexplored Surface Area

- name: weechat installed
  dnf:
    name:
    - weechat
    state: installed
  tags:
  - weechat

- name: libolm installed
  dnf:
    name:
    - libolm
    - libolm-devel
    state: installed
  tags:
  - weechat

- name: weechat-matrix checked out
  become: yes
  become_user: "{{local_account}}"
  git:
    repo: https://github.com/poljar/weechat-matrix.git
    dest: /home/{{local_account}}/Checkouts/weechat-matrix
  tags:
  - weechat

- name: weechat-matrix requirements installed
  become: yes
  become_user: "{{local_account}}"
  pip:
    extra_args: --user
    requirements: /home/{{local_account}}/Checkouts/weechat-matrix/requirements.txt
  tags:
  - weechat

# - name: weechat-matrix installed
#   become: yes
#   become_user: "{{local_account}}"
#   shell:
#     cmd: make install
#     chdir: /home/{{local_account}}/Checkouts/weechat-matrix/
#   tags:
#   - weechat

- name: weechat-matrix will be auto-loaded by weechat
  become: yes
  become_user: "{{local_account}}"
  file:
    state: link
    dest: /home/{{local_account}}/.weechat/python/autoload/matrix.py
    src: /home/{{local_account}}/.weechat/python/matrix.py
  tags:
  - weechat

# https://github.com/de-vri-es/weechat-autosort
- name: autosort.py installed
  become: yes
  become_user: "{{local_account}}"
  get_url:
    url:  https://raw.githubusercontent.com/de-vri-es/weechat-autosort/3.8/autosort.py
    dest:  "/home/{{local_account}}/.weechat/python/autosort.py"
  tags:
  - weechat

- name: weechat.conf changes are made
  become: yes
  become_user: "{{local_account}}"
  lineinfile:
    regexp:  "{{item['r']}}"
    line: "{{item['l']}}"
    path: "/home/{{local_account}}/.weechat/{{item['f']}}"
  tags:
  - weechat
  with_items: []
  # - {'f':'weechat.conf', 'r':'nicklist-conditions', 'l':'nicklist.conditions = "0"'}
  # - {'f':'weechat.conf', 'r':'status.items', 'l':'status.items = "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[chanact],completion"'}
  # - {'f':'weechat.conf', 'r':'meta-q', 'l':'meta-q = "/buffer The Commons"'}
  # - {'f':'weechat.conf', 'r':'meta-w', 'l':'meta-w = "/buffer MORE"'}
  # - {'f':'weechat.conf', 'r':'meta-e', 'l':'meta-e = "/buffer 625756"'}
  # - {'f':'weechat.conf', 'r':'meta-r', 'l':'meta-r = "/buffer #racing - GTHub"'}
  # - {'f':'weechat.conf', 'r':'meta-t', 'l':'meta-t = "/buffer #livestreaming"'}
  # - {'f':'weechat.conf', 'r':'meta-y', 'l':'meta-y = "/buffer Never"'}
  # - {'f':'weechat.conf', 'r':'meta-u', 'l':'meta-u = "/buffer Value"'}
  # - {'f':'weechat.conf', 'r':'meta-i', 'l':'meta-i = "/buffer #general - dungeon"'}
  # - {'f':'weechat.conf', 'r':'meta-o', 'l':'meta-o = "/buffer ##computer"'}
  # alias.conf - b = "%%buffer"
  # alias.conf - ['/buffer$', 'b = "/buffer"']
  # buflist.conf - display_conditions = "${buffer.hidden}==0 && ${buffer.hotlist.priority}!=0"
  # plugins.conf - python.chanact.lowest_priority = "1"

weechat.el is an Emacs interface for weechat, but it doesn't work great with weechat-matrix, the channel names and nicknames are all out of whack and I don't understand the plumbing enough to deal with that. let's see how I can fix that.

I have to make the following changes for this to work:

  • /relay add weechat 9000
  • /set matrix.look.human_buffer_names 1
  • /set relay.network.password REDACTED
  • /set matrix.network.print_unconfirmed_messages 1
  • /set matrix.network.print_unconfirmed_messages 0
(require 'rx)
(use-package weechat)

With this, weechat-connect will open my buffers which I have asked for by customising weechat-auto-monitor-buffers">weechat-auto-monitor-buffers. I can monitor others