5 Commits

Author SHA1 Message Date
2215ee589a temp! 2023-06-10 11:21:08 +01:00
352ef4c8d4 Remove CAD apps because of Autodesk
Autodesk change distribution of Fusion360 to require a login breaking
the Chocolatey package, easier to manage this manually anyway since they
won't be installed on all Windows systems.
2023-06-10 11:18:30 +01:00
878db362cd Add xremap role for macOS bindings on Linux 2023-06-08 23:41:06 +01:00
49b292126e Add kitty role for Linux 2023-06-06 19:39:58 +01:00
67a37e0a56 Actually make LinuxCLI import UnixCLI 2023-06-04 21:39:06 +01:00
17 changed files with 1386 additions and 62 deletions

1194
git.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,7 @@
---
- import_playbook: LinuxCLI.yaml
- import_playbook: UnixGUI.yaml
- hosts: localhost
roles:
- role: kitty
- role: xremap

View File

@@ -1,4 +1,5 @@
---
- import_playbook: UnixCLI.yaml
- hosts: localhost
roles:
- role: gdb

View File

@@ -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

View File

@@ -1,3 +1,2 @@
---
- include_tasks: '{{ansible_os_family}}.yaml'
# TODO: If gnome-shell on wayland set global key binding in custom keyboard settings

View File

@@ -1,8 +0,0 @@
---
- assert:
that: ansible_os_family == "Windows"
- name: install chocolatey package
win_chocolatey:
name: autodesk-fusion360
state: latest

View File

@@ -31,17 +31,17 @@
- include_tasks: Windows-installer.yaml
when: git_run_installer
- name: clone config repos
win_git:
repo: '{{item.repo}}'
dest: '{{ansible_env.USERPROFILE}}/.config/{{item.name}}'
version: master
with_items: '{{git_config_repos}}'
- win_owner:
path: '{{ansible_env.USERPROFILE}}/.config/{{item.name}}'
user: Benie
recurse: true
with_items: '{{git_config_repos}}'
# - name: clone config repos
# win_git:
# repo: '{{item.repo}}'
# dest: '{{ansible_env.USERPROFILE}}\.config\{{item.name}}'
# version: master
# with_items: '{{git_config_repos}}'
# - win_owner:
# path: '{{ansible_env.USERPROFILE}}\.config\{{item.name}}'
# user: Benie
# recurse: true
# with_items: '{{git_config_repos}}'
# - TODO: install pip packages
# win_pip:

View File

@@ -0,0 +1,6 @@
---
- name: install apt package
become: true
apt:
name: kitty
state: latest

View File

@@ -0,0 +1,6 @@
---
- name: install dnf package
become: true
dnf:
name: kitty
state: latest

View 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

View File

@@ -8,20 +8,17 @@
- set_fact:
vim_config_dir: '{{ansible_env.LOCALAPPDATA}}\nvim'
- name: clone config repo
win_git:
repo: git@code.infektor.net:config/vim.git
dest: '{{vim_config_dir}}'
branch: master
# clone: false
update: true
- win_owner:
path: '{{vim_config_dir}}'
user: Benie
recurse: true
- assert:
that: False
# - name: clone config repo
# win_git:
# repo: git@code.infektor.net:config/vim.git
# dest: '{{vim_config_dir}}'
# branch: master
# # clone: false
# update: true
# - win_owner:
# path: '{{vim_config_dir}}'
# user: Benie
# recurse: true
# - TODO: neovim set repo email
# win_git_config:

View File

@@ -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'

View File

@@ -1,4 +0,0 @@
---
# TODO: Install ulauncher - or find a better alternative
# TODO: If gnome-shell on wayland set global key binding in custom keyboard settings
# TODO: Clone https://github.com/shepda/ulauncher-adwaita-darkish into ~/.config/ulauncher/user-themes

View File

@@ -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

View File

@@ -0,0 +1,7 @@
---
- name: restart xremap
systemd:
name: xremap
scope: user
daemon_reload: true
state: restarted

View 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

View 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