diff --git a/host_vars/kronos b/host_vars/kronos index a09bb13..a0f89fe 100644 --- a/host_vars/kronos +++ b/host_vars/kronos @@ -37,7 +37,7 @@ workspaces: monitor: "Acer Technologies KG271U TATEE0048524" default: true layoutopt_orientation: "top" - on_created_empty: "flatpak run com.discordapp.Discord & keepassxc" + on_created_empty: "~/.local/bin/update-discord && discord-canary & keepassxc" - id: 9 monitor: "LG Electronics LG ULTRAGEAR 311NTVS8J911" diff --git a/main.yml b/main.yml index 8fa7835..45c00b8 100644 --- a/main.yml +++ b/main.yml @@ -10,4 +10,4 @@ #- vs-code #- qemu-kvm #- docker - #- discord + #- discord-canary diff --git a/roles/desktop-environment/tasks/hyprland.yml b/roles/desktop-environment/tasks/hyprland.yml index 173e154..e93ae2b 100644 --- a/roles/desktop-environment/tasks/hyprland.yml +++ b/roles/desktop-environment/tasks/hyprland.yml @@ -79,67 +79,38 @@ - "Aquamarine" - "hyprgraphics" -- name: Checkout hyprutils repo +- name: Checkout required source repositories ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprutils.git' - dest: /usr/local/src/hyprutils - version: v0.2.6 - force: true - recursive: true - -- name: Checkout hyprwayland-scanner repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprwayland-scanner.git' - dest: /usr/local/src/hyprwayland-scanner - version: v0.4.2 - force: true - recursive: true - -- name: Checkout hyprlang repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprlang.git' - dest: /usr/local/src/hyprlang - version: v0.6.0 - force: true - recursive: true - -- name: Checkout hyprcursor repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprcursor.git' - dest: /usr/local/src/hyprcursor - version: v0.1.10 - force: true - recursive: true - -- name: Checkout xdg-desktop-portal-hyprland repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/xdg-desktop-portal-hyprland.git' - dest: /usr/local/src/xdg-desktop-portal-hyprland - version: v1.3.9 - force: true - -- name: Checkout Aquamarine repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/aquamarine.git' - dest: /usr/local/src/Aquamarine - version: v0.5.1 - force: true - recursive: true - -- name: Checkout hyprgraphics repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprgraphics.git' - dest: /usr/local/src/hyprgraphics - version: v0.1.1 - force: true - -- name: Checkout Hyprland repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/Hyprland.git' - dest: /usr/local/src/Hyprland - version: v0.46.2 + repo: "{{ item.repo }}" + dest: "{{ item.dest }}" + version: "{{ item.version }}" force: true recursive: true + loop: + - repo: "https://github.com/hyprwm/hyprutils.git" + version: "v0.5.0" + dest: "/usr/local/src/hyprutils" + - repo: "https://github.com/hyprwm/hyprwayland-scanner.git" + version: "v0.4.4" + dest: "/usr/local/src/hyprwayland-scanner" + - repo: "https://github.com/hyprwm/hyprlang.git" + version: "v0.6.0" + dest: "/usr/local/src/hyprlang" + - repo: "https://github.com/hyprwm/hyprcursor.git" + version: "v0.1.11" + dest: "/usr/local/src/hyprcursor" + - repo: "https://github.com/hyprwm/xdg-desktop-portal-hyprland.git" + version: "v1.3.9" + dest: "/usr/local/src/xdg-desktop-portal-hyprland" + - repo: "https://github.com/hyprwm/aquamarine.git" + version: "v0.7.2" + dest: "/usr/local/src/Aquamarine" + - repo: "https://github.com/hyprwm/hyprgraphics.git" + version: "v0.1.1" + dest: "/usr/local/src/hyprgraphics" + - repo: "https://github.com/hyprwm/Hyprland.git" + version: "v0.47.1" + dest: "/usr/local/src/Hyprland" - name: Build hyprutils ansible.builtin.command: diff --git a/roles/discord-canary/files/update-discord b/roles/discord-canary/files/update-discord new file mode 100755 index 0000000..3f8b858 --- /dev/null +++ b/roles/discord-canary/files/update-discord @@ -0,0 +1,23 @@ +#!/bin/bash + +set -eu + +SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}") +CACHE_FILE_PATH="$SCRIPT_PATH/.discord_version_cache" + +CURRENT_VERSION=$(curl -s "https://discord.com/api/updates/canary?platform=linux" | jq -r .name) +INSTALLED_VERSION="" + +if test -f "$CACHE_FILE_PATH"; then + INSTALLED_VERSION=$(head -n 1 "$CACHE_FILE_PATH") +fi + +if [ "$CURRENT_VERSION" != "$INSTALLED_VERSION" ]; then + echo "New version $CURRENT_VERSION found. Downloading..." + curl -Ls -o /tmp/discord-canary.deb "https://discord.com/api/download/canary?platform=linux&format=deb" + if [ $1 != "--download-only" ]; then + pkexec apt install -y /tmp/discord-canary.deb + rm /tmp/discord-canary.deb + fi + echo $CURRENT_VERSION > $CACHE_FILE_PATH +fi diff --git a/roles/discord-canary/tasks/main.yml b/roles/discord-canary/tasks/main.yml new file mode 100644 index 0000000..04c40ff --- /dev/null +++ b/roles/discord-canary/tasks/main.yml @@ -0,0 +1,32 @@ +- name: Install pkexec + become: yes + apt: + state: latest + install_recommends: false + name: pkexec + +- name: Copy update helper + copy: + src: "{{ role_path }}/files/update-discord" + dest: "{{ ansible_env.HOME }}/.local/bin/" + +- name: Make update helper executable + ansible.builtin.file: + dest: "{{ ansible_env.HOME }}/.local/bin/update-discord" + mode: "ug+x" + +- name: Download Discord canary using helper + ansible.builtin.command: + cmd: "update-discord --download-only" + chdir: "{{ ansible_env.HOME }}/.local/bin" + +- name: Install Discord canary + become: yes + apt: + deb: /tmp/discord-canary.deb + install_recommends: false + +- name: Remove installation package + ansible.builtin.file: + state: absent + path: /tmp/discord-canary.deb diff --git a/roles/discord/tasks/main.yml b/roles/discord/tasks/main.yml deleted file mode 100644 index 3aa94db..0000000 --- a/roles/discord/tasks/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Install Discord - community.general.flatpak: - name: "com.discordapp.Discord" - state: present - method: user diff --git a/roles/spotify/tasks/main.yml b/roles/spotify/tasks/main.yml index b944acb..0b807a4 100644 --- a/roles/spotify/tasks/main.yml +++ b/roles/spotify/tasks/main.yml @@ -6,7 +6,7 @@ uris: http://repository.spotify.com suites: stable components: non-free - signed_by: https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg + signed_by: https://download.spotify.com/debian/pubkey_C85668DF69375001.gpg state: present enabled: yes @@ -28,4 +28,4 @@ - name: Create Spotify desktop entry copy: src: "{{ role_path }}/files/spotify.desktop" - dest: "{{ ansible_env.HOME }}/.local/share/applications/spotify.desktop" \ No newline at end of file + dest: "{{ ansible_env.HOME }}/.local/share/applications/spotify.desktop"