Compare commits
8 Commits
benie/gnom
...
65f44a8454
| Author | SHA1 | Date | |
|---|---|---|---|
| 65f44a8454 | |||
| 960f853d1f | |||
| 5fbc85dade | |||
| befb02bc95 | |||
| 352ef4c8d4 | |||
| 878db362cd | |||
| 49b292126e | |||
| 67a37e0a56 |
@@ -1,3 +1,8 @@
|
|||||||
---
|
---
|
||||||
- import_playbook: LinuxCLI.yaml
|
- import_playbook: LinuxCLI.yaml
|
||||||
- import_playbook: UnixGUI.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
|
- hosts: localhost
|
||||||
roles:
|
roles:
|
||||||
- role: gdb
|
- role: gdb
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
---
|
---
|
||||||
- hosts: windows
|
- hosts: windows
|
||||||
|
|
||||||
vars:
|
|
||||||
install_cad_apps: false
|
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: python
|
- role: python
|
||||||
- role: git
|
- role: git
|
||||||
@@ -16,6 +13,7 @@
|
|||||||
- role: curl
|
- role: curl
|
||||||
- role: fzf
|
- role: fzf
|
||||||
- role: gh
|
- role: gh
|
||||||
|
- role: glab
|
||||||
- role: jq
|
- role: jq
|
||||||
- role: tree
|
- role: tree
|
||||||
- role: yq
|
- role: yq
|
||||||
@@ -29,8 +27,3 @@
|
|||||||
- role: obsidian
|
- role: obsidian
|
||||||
- role: powertoys
|
- role: powertoys
|
||||||
- role: windows-terminal
|
- 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
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
appimage: 'Obsidian-{{latest.json.name}}.AppImage'
|
appimage: 'Obsidian-{{latest.json.name}}.AppImage'
|
||||||
- set_fact:
|
- set_fact:
|
||||||
filepath: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
|
filepath: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
|
||||||
|
iconpath: 'share/icons/hicolor/512x512/apps/obsidian.png'
|
||||||
asset_query: '[?contains(name, `{{appimage}}`)] | [0]'
|
asset_query: '[?contains(name, `{{appimage}}`)] | [0]'
|
||||||
- set_fact:
|
- set_fact:
|
||||||
needs_installed:
|
needs_installed:
|
||||||
@@ -25,13 +26,37 @@
|
|||||||
dest: '{{filepath}}'
|
dest: '{{filepath}}'
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: create directories
|
||||||
|
file:
|
||||||
|
path: '{{item}}'
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- '{{ansible_env.HOME}}/.local/bin'
|
||||||
|
- '{{ansible_env.HOME}}/.local/share/icons/hicolor/512x512/apps'
|
||||||
|
|
||||||
- name: create symlink
|
- name: create symlink
|
||||||
file:
|
file:
|
||||||
src: '{{filepath}}'
|
src: '{{filepath}}'
|
||||||
dest: '{{ansible_env.HOME}}/.local/bin/Obsidian'
|
dest: '{{ansible_env.HOME}}/.local/bin/Obsidian'
|
||||||
state: link
|
state: link
|
||||||
|
|
||||||
# TODO: icon for desktop file
|
- name: extract squashfs-root for app icon
|
||||||
|
when: needs_installed
|
||||||
|
command:
|
||||||
|
cmd: '{{ansible_env.HOME}}/.local/bin/Obsidian --appimage-extract'
|
||||||
|
chdir: '/tmp'
|
||||||
|
|
||||||
|
- name: copy icon file
|
||||||
|
when: needs_installed
|
||||||
|
copy:
|
||||||
|
src: '/tmp/squashfs-root/usr/{{iconpath}}'
|
||||||
|
dest: '{{ansible_env.HOME}}/.local/{{iconpath}}'
|
||||||
|
|
||||||
|
- name: remove squashfs-root directory
|
||||||
|
when: needs_installed
|
||||||
|
file:
|
||||||
|
path: '/tmp/squashfs-root'
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: create desktop file
|
- name: create desktop file
|
||||||
template:
|
template:
|
||||||
@@ -1,2 +1,5 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: '{{ansible_os_family}}.yaml'
|
- 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"
|
||||||
|
|||||||
@@ -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'
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
appimage: 'WebCatalog-{{releases[0].version}}.AppImage'
|
appimage: 'WebCatalog-{{releases[0].version}}.AppImage'
|
||||||
- set_fact:
|
- set_fact:
|
||||||
filepath: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
|
filepath: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
|
||||||
|
iconpath: 'share/icons/hicolor/512x512/apps/webcatalog.png'
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
needs_installed:
|
needs_installed:
|
||||||
@@ -28,13 +29,37 @@
|
|||||||
dest: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
|
dest: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: create directories
|
||||||
|
file:
|
||||||
|
path: '{{item}}'
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- '{{ansible_env.HOME}}/.local/bin'
|
||||||
|
- '{{ansible_env.HOME}}/.local/share/icons/hicolor/512x512/apps'
|
||||||
|
|
||||||
- name: create symlink
|
- name: create symlink
|
||||||
file:
|
file:
|
||||||
src: '{{filepath}}'
|
src: '{{filepath}}'
|
||||||
dest: '{{ansible_env.HOME}}/.local/bin/WebCatalog'
|
dest: '{{ansible_env.HOME}}/.local/bin/WebCatalog'
|
||||||
state: link
|
state: link
|
||||||
|
|
||||||
# TODO: icon for desktop file
|
- name: extract squashfs-root for app icon
|
||||||
|
when: needs_installed
|
||||||
|
command:
|
||||||
|
cmd: '{{ansible_env.HOME}}/.local/bin/WebCatalog --appimage-extract'
|
||||||
|
chdir: '/tmp'
|
||||||
|
|
||||||
|
- name: copy icon file
|
||||||
|
when: needs_installed
|
||||||
|
copy:
|
||||||
|
src: '/tmp/squashfs-root/usr/{{iconpath}}'
|
||||||
|
dest: '{{ansible_env.HOME}}/.local/{{iconpath}}'
|
||||||
|
|
||||||
|
- name: remove squashfs-root directory
|
||||||
|
when: needs_installed
|
||||||
|
file:
|
||||||
|
path: '/tmp/squashfs-root'
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: create desktop file
|
- name: create desktop file
|
||||||
template:
|
template:
|
||||||
|
|||||||
@@ -40,15 +40,18 @@
|
|||||||
dest: external/ansible-win_git
|
dest: external/ansible-win_git
|
||||||
version: master
|
version: master
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
modules_dir: ~/.config/local/modules
|
||||||
|
|
||||||
- name: create ansible modules directory
|
- name: create ansible modules directory
|
||||||
file:
|
file:
|
||||||
dest: ~/.ansible/plugins/modules
|
dest: '{{modules_dir}}'
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: copy win_git files to ansible modules directory
|
- name: copy win_git files to ansible modules directory
|
||||||
copy:
|
copy:
|
||||||
src: '~/.config/local/external/ansible-win_git/{{item}}'
|
src: '~/.config/local/external/ansible-win_git/{{item}}'
|
||||||
dest: '~/.config/local/modules/{{item}}'
|
dest: '{{modules_dir}}/{{item}}'
|
||||||
with_items:
|
with_items:
|
||||||
- win_git.ps1
|
- win_git.ps1
|
||||||
- win_git.py
|
- 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