Compare commits
7 Commits
benie/gnom
...
58b77079a4
| Author | SHA1 | Date | |
|---|---|---|---|
| 58b77079a4 | |||
| 5fbc85dade | |||
| befb02bc95 | |||
| 352ef4c8d4 | |||
| 878db362cd | |||
| 49b292126e | |||
| 67a37e0a56 |
@@ -1,3 +1,8 @@
|
||||
---
|
||||
- import_playbook: LinuxCLI.yaml
|
||||
- import_playbook: UnixGUI.yaml
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: kitty
|
||||
- role: xremap
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
- import_playbook: UnixCLI.yaml
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: gdb
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
---
|
||||
- hosts: windows
|
||||
|
||||
vars:
|
||||
install_cad_apps: false
|
||||
|
||||
roles:
|
||||
- role: python
|
||||
- role: git
|
||||
@@ -16,6 +13,7 @@
|
||||
- role: curl
|
||||
- role: fzf
|
||||
- role: gh
|
||||
- role: glab
|
||||
- role: jq
|
||||
- role: tree
|
||||
- role: yq
|
||||
@@ -29,8 +27,3 @@
|
||||
- role: obsidian
|
||||
- role: powertoys
|
||||
- role: windows-terminal
|
||||
|
||||
- role: autodesk-fusion360
|
||||
when: install_cad_apps
|
||||
- role: prusaslicer
|
||||
when: install_cad_apps
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
- assert:
|
||||
that: ansible_os_family == "Windows"
|
||||
|
||||
- name: install chocolatey package
|
||||
win_chocolatey:
|
||||
name: autodesk-fusion360
|
||||
state: latest
|
||||
6
roles/kitty/tasks/Debian.yaml
Normal file
6
roles/kitty/tasks/Debian.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: install apt package
|
||||
become: true
|
||||
apt:
|
||||
name: kitty
|
||||
state: latest
|
||||
6
roles/kitty/tasks/RedHat.yaml
Normal file
6
roles/kitty/tasks/RedHat.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: install dnf package
|
||||
become: true
|
||||
dnf:
|
||||
name: kitty
|
||||
state: latest
|
||||
7
roles/kitty/tasks/main.yaml
Normal file
7
roles/kitty/tasks/main.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- include_tasks: '{{ansible_os_family}}.yaml'
|
||||
|
||||
- name: clone config repo
|
||||
git:
|
||||
repo: git@code.infektor.net:config/kitty.git
|
||||
dest: ~/.config/kitty
|
||||
@@ -25,13 +25,34 @@
|
||||
dest: '{{filepath}}'
|
||||
mode: '0755'
|
||||
|
||||
- name: create directories
|
||||
file:
|
||||
path: '{{item}}'
|
||||
state: directory
|
||||
with_items:
|
||||
- '{{ansible_env.HOME}}/.local/bin'
|
||||
- '{{ansible_env.HOME}}/.local/share/icon/hicolor/512x512/apps'
|
||||
|
||||
- name: create symlink
|
||||
file:
|
||||
src: '{{filepath}}'
|
||||
dest: '{{ansible_env.HOME}}/.local/bin/Obsidian'
|
||||
state: link
|
||||
|
||||
# TODO: icon for desktop file
|
||||
- name: extract squashfs-root for app icon
|
||||
command:
|
||||
cmd: '{{ansible_env.HOME}}/.local/bin/Obsidian --appimage-extract'
|
||||
chdir: '/tmp'
|
||||
|
||||
- name: copy icon file
|
||||
copy:
|
||||
src: '/tmp/squashfs-root/usr/share/icons/hicolor/512x512/apps/obsidian.png'
|
||||
dest: '{{ansible_env.HOME}}/.local/share/icon/hicolor/512x512/apps/'
|
||||
|
||||
- name: remove squashfs-root directory
|
||||
file:
|
||||
path: '/tmp/squashfs-root'
|
||||
state: absent
|
||||
|
||||
- name: create desktop file
|
||||
template:
|
||||
@@ -1,2 +1,5 @@
|
||||
---
|
||||
- include_tasks: '{{ansible_os_family}}.yaml'
|
||||
when: ansible_os_family == "Darwin" or ansible_os_family == "Windows"
|
||||
- include_tasks: 'Linux.yaml'
|
||||
when: ansible_os_family != "Darwin" and ansible_os_family != "Windows"
|
||||
|
||||
@@ -3,7 +3,7 @@ Name=Obsidian
|
||||
Exec={{ansible_env.HOME}}/.local/bin/Obsidian
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=obsidian
|
||||
Icon={{ansible_env.HOME}}/.local/share/icon/hicolor/512x512/apps/obsidian.png
|
||||
StartupWMClass=Obsidian
|
||||
X-AppImage-Version={{latest.json.name}}
|
||||
Comment=Private and flexible note‑taking app that adapts to the way you think.
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
- assert:
|
||||
that: ansible_os_family == "Windows"
|
||||
|
||||
- name: install chocolatey package
|
||||
win_chocolatey:
|
||||
name: prusaslicer
|
||||
state: latest
|
||||
|
||||
- name: create start menu shortcut
|
||||
win_shortcut:
|
||||
src: '{{ansible_env.ProgramData}}/chocolatey/bin/prusa-slicer.exe'
|
||||
dest: '{{ansible_env.ProgramData}}/Microsoft/Windows/Start Menu/Programs/PrusaSlicer.lnk'
|
||||
icon: '{{ansible_env.ProgramData}}/chocolatey/bin/prusa-slicer.exe,0'
|
||||
@@ -40,15 +40,18 @@
|
||||
dest: external/ansible-win_git
|
||||
version: master
|
||||
|
||||
- set_fact:
|
||||
modules_dir: ~/.config/local/modules
|
||||
|
||||
- name: create ansible modules directory
|
||||
file:
|
||||
dest: ~/.ansible/plugins/modules
|
||||
dest: '{{modules_dir}}'
|
||||
state: directory
|
||||
|
||||
- name: copy win_git files to ansible modules directory
|
||||
copy:
|
||||
src: '~/.config/local/external/ansible-win_git/{{item}}'
|
||||
dest: '~/.config/local/modules/{{item}}'
|
||||
dest: '{{modules_dir}}/{{item}}'
|
||||
with_items:
|
||||
- win_git.ps1
|
||||
- win_git.py
|
||||
|
||||
7
roles/xremap/handlers/main.yaml
Normal file
7
roles/xremap/handlers/main.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: restart xremap
|
||||
systemd:
|
||||
name: xremap
|
||||
scope: user
|
||||
daemon_reload: true
|
||||
state: restarted
|
||||
123
roles/xremap/tasks/main.yaml
Normal file
123
roles/xremap/tasks/main.yaml
Normal file
@@ -0,0 +1,123 @@
|
||||
---
|
||||
- assert:
|
||||
that: ansible_env.XDG_CURRENT_DESKTOP == "GNOME" and
|
||||
ansible_env.XDG_SESSION_TYPE == "wayland"
|
||||
|
||||
- set_fact:
|
||||
install_dir: '{{ansible_env.HOME}}/.local/bin'
|
||||
config_dir: '{{ansible_env.HOME}}/.config/xremap'
|
||||
- set_fact:
|
||||
executable_path: '{{install_dir}}/xremap'
|
||||
|
||||
- name: stat executable
|
||||
stat:
|
||||
path: '{{executable_path}}'
|
||||
register: executable
|
||||
|
||||
- name: get installed version
|
||||
when: executable.stat.exists
|
||||
command: '{{executable_path}} --version'
|
||||
register: version_command
|
||||
changed_when: false
|
||||
|
||||
- name: extract version from command output
|
||||
when: executable.stat.exists
|
||||
set_fact:
|
||||
installed_version:
|
||||
'v{{version_command.stdout.strip() | regex_replace("^.*(\d+\.\d+\.\d+).*$", "\1")}}'
|
||||
|
||||
- name: get latest release
|
||||
uri:
|
||||
url: https://api.github.com/repos/k0kubun/xremap/releases/latest
|
||||
register: latest
|
||||
|
||||
- name: determine if install needed
|
||||
set_fact:
|
||||
needs_installed:
|
||||
'{{not executable.stat.exists or installed_version != latest.json.name}}'
|
||||
|
||||
- name: construct asset query
|
||||
set_fact:
|
||||
asset_query: >
|
||||
[?contains(name, `xremap-linux-{{ansible_architecture}}-{{
|
||||
ansible_env.XDG_CURRENT_DESKTOP | lower}}.zip`)] | [0]
|
||||
- name: get release asset
|
||||
set_fact:
|
||||
asset: '{{latest.json.assets | to_json | from_json | json_query(asset_query)}}'
|
||||
|
||||
- name: create directories
|
||||
file:
|
||||
path: '{{item}}'
|
||||
state: directory
|
||||
with_items:
|
||||
- '{{install_dir}}'
|
||||
- '{{config_dir}}'
|
||||
|
||||
- name: download release archive
|
||||
when: needs_installed
|
||||
become: true
|
||||
get_url:
|
||||
url: '{{asset.browser_download_url}}'
|
||||
dest: '{{install_dir}}/xremap.zip'
|
||||
|
||||
- name: extract release archive
|
||||
when: needs_installed
|
||||
become: true
|
||||
unarchive:
|
||||
src: '{{install_dir}}/xremap.zip'
|
||||
dest: '{{install_dir}}'
|
||||
|
||||
- name: remove release archive
|
||||
when: needs_installed
|
||||
become: true
|
||||
file:
|
||||
path: '{{install_dir}}/xremap.zip'
|
||||
state: absent
|
||||
|
||||
- name: add user to input group
|
||||
become: true
|
||||
user:
|
||||
name: '{{ansible_user_id}}'
|
||||
append: true
|
||||
groups: input
|
||||
|
||||
# TODO: This works for on Fedora, author uses it on Ubuntu so I assume Debian
|
||||
# will work too. Arch and other distros are potentially different see the docs
|
||||
# https://github.com/k0kubun/xremap
|
||||
- name: add udev rule for input access
|
||||
become: true
|
||||
copy:
|
||||
content: |
|
||||
KERNEL=="uinput", GROUP="input", TAG+="uaccess"
|
||||
dest: /etc/udev/rules.d/input.rules
|
||||
|
||||
- name: clone config repo
|
||||
git:
|
||||
repo: git@code.infektor.net:config/xremap.git
|
||||
dest: '{{config_dir}}'
|
||||
notify: restart xremap
|
||||
|
||||
- name: install xremap systemd unit
|
||||
template:
|
||||
src: xremap.service.j2
|
||||
dest: ~/.config/systemd/user/xremap.service
|
||||
notify: restart xremap
|
||||
|
||||
- name: enable xremap service
|
||||
systemd:
|
||||
name: xremap
|
||||
scope: user
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: check if extension is installed
|
||||
command: gnome-extensions show xremap@k0kubun.com
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: extension
|
||||
|
||||
- when: extension.rc != 0
|
||||
debug:
|
||||
msg: 'install gnome extension then reboot:
|
||||
https://extensions.gnome.org/extension/5060/xremap'
|
||||
changed_when: true
|
||||
10
roles/xremap/templates/xremap.service.j2
Normal file
10
roles/xremap/templates/xremap.service.j2
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=macOS Key Remapping
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart={{executable_path}} {{config_dir}}/macOS.yaml
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
Reference in New Issue
Block a user