workstation/roles/home-gui/tasks/emacs.yml

51 lines
1.8 KiB
YAML
Raw Normal View History

---
2020-07-11 16:11:19 +00:00
- name: Detect Emacs binary
2020-07-11 16:04:46 +00:00
stat:
path: "{{ prefix }}/bin/emacs"
vars:
prefix: "{{ '/usr' if ansible_system == 'Linux' else '/usr/pkg' if ansible_system == 'NetBSD' else '/usr/local' }}"
register: emacs_binary
2020-07-11 18:58:15 +00:00
- name: Remove ~/.emacs file
file:
path: "{{ ansible_env.HOME }}/.emacs"
state: absent
2019-10-03 14:24:33 +00:00
- name: Clone Emacs settings
git:
2020-01-10 15:39:47 +00:00
repo: https://code.acperkins.com/acp/emacs.d.git
dest: "{{ ansible_env.HOME }}/.emacs.d"
2020-07-11 18:56:11 +00:00
- name: Install NotoSansMono-Regular font
copy:
src: NotoSansMono-Regular.ttf
dest: "{{ ansible_env.HOME }}/.local/share/fonts/NotoSansMono-Regular.ttf"
- name: Install NotoSansMono-Bold font
copy:
src: NotoSansMono-Bold.ttf
dest: "{{ ansible_env.HOME }}/.local/share/fonts/NotoSansMono-Bold.ttf"
- name: Create Emacs user service (Linux)
2020-07-11 16:22:27 +00:00
template:
2020-03-08 22:09:14 +00:00
src: emacs.service
dest: "{{ ansible_env.HOME }}/.config/systemd/user/emacs.service"
2020-07-11 16:22:27 +00:00
vars:
prefix: "{{ '/usr' if ansible_system == 'Linux' else '/usr/pkg' if ansible_system == 'NetBSD' else '/usr/local' }}"
2020-07-11 16:11:19 +00:00
when: ansible_system == 'Linux' and emacs_binary.stat.exists == True
- name: Add Emacs server to autostart (FreeBSD)
copy:
src: '{{ ansible_env.HOME }}/.emacs.d/emacs-server.desktop'
dest: '{{ ansible_env.HOME }}/.config/autostart'
remote_src: yes
2020-07-11 16:11:19 +00:00
when: ansible_system == 'FreeBSD' and emacs_binary.stat.exists == True
- name: Start Emacs user service
systemd:
name: emacs.service
scope: user
daemon_reload: yes
enabled: yes
state: started
2020-07-11 16:11:19 +00:00
when: ansible_system == 'Linux' and emacs_binary.stat.exists == True
- name: Create Emacs client launcher
copy:
src: "{{ ansible_env.HOME }}/.emacs.d/emacs-client.desktop"
dest: "{{ ansible_env.HOME }}/.local/share/applications/emacs.desktop"
remote_src: yes
2020-07-11 16:11:19 +00:00
when: emacs_binary.stat.exists == True