From 3d5b8caa4d4880c5308807baaf4ae04456403d13 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Mon, 22 Dec 2025 22:50:35 +0100 Subject: Refactor hyprland/mako This follows a more clean setup (inspired by omarchy) with the difference that the user files are delegated to the user dotfile (and are calling the system defaults first). This is to insure clarity and don't depend on hidden behaviour in the default system configurations --- roles/hyprland/meta/main.yml | 1 + roles/hyprland/tasks/main.yml | 23 ++++++-------- .../hyprland/templates/hyprland-custom.desktop.j2 | 6 ---- .../hyprland/templates/hyprland/autostart.conf.j2 | 1 + roles/hyprland/templates/hyprland/hyprland.conf.j2 | 4 +-- roles/mako/meta/argument_specs.yml | 6 ++++ roles/mako/meta/main.yml | 11 +++++++ roles/mako/tasks/main.yml | 22 +++++++++++++ roles/mako/templates/mako/config.j2 | 36 ++++++++++++++++++++++ 9 files changed, 87 insertions(+), 23 deletions(-) delete mode 100644 roles/hyprland/templates/hyprland-custom.desktop.j2 create mode 100644 roles/hyprland/templates/hyprland/autostart.conf.j2 create mode 100644 roles/mako/meta/argument_specs.yml create mode 100644 roles/mako/meta/main.yml create mode 100644 roles/mako/tasks/main.yml create mode 100644 roles/mako/templates/mako/config.j2 diff --git a/roles/hyprland/meta/main.yml b/roles/hyprland/meta/main.yml index 7cb0020f..3c8902a0 100644 --- a/roles/hyprland/meta/main.yml +++ b/roles/hyprland/meta/main.yml @@ -4,6 +4,7 @@ dependencies: - role: "cage" - role: "greetd" - role: "nautilus" + - role: "mako" galaxy_info: author: "a14m" description: "Install hyprland" diff --git a/roles/hyprland/tasks/main.yml b/roles/hyprland/tasks/main.yml index c7bb98b2..855b1f67 100644 --- a/roles/hyprland/tasks/main.yml +++ b/roles/hyprland/tasks/main.yml @@ -7,15 +7,6 @@ loop: - "hyprland" -- name: "Deploy custom hyprland desktop entry" - become: true - ansible.builtin.template: - src: "hyprland-custom.desktop.j2" - dest: "/usr/share/wayland-sessions/hyprland-custom.desktop" - mode: "0644" - owner: "root" - group: "root" - - name: "Configure greetd" become: true ansible.builtin.copy: @@ -27,27 +18,29 @@ [terminal] vt = 1 [default_session] - command = "cage -s -- gtkgreet -c 'uwsm start hyprland-custom.desktop'" + command = "cage -s -- gtkgreet -c 'uwsm start hyprland.desktop'" user = "greeter" notify: - "Restart greetd" -- name: "Create hyprland config directory" +- name: "Create system config directory" become: true ansible.builtin.file: path: "/etc/hypr" state: "directory" mode: "0755" + loop: + - "{{ ansible_env.HOME }}/.config/hypr" -- name: "Configure hyprland defaults" +- name: "Configure system defaults" become: true ansible.builtin.template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" loop: - - src: "hyprland/hyprland.conf.j2" - dest: "/etc/hypr/hyprland.conf" + - src: "hyprland/autostart.conf.j2" + dest: "/etc/hypr/autostart.conf" - src: "hyprland/monitors.conf.j2" dest: "/etc/hypr/monitors.conf" - src: "hyprland/input.conf.j2" @@ -58,3 +51,5 @@ dest: "/etc/hypr/envs.conf" - src: "hyprland/looknfeel.conf.j2" dest: "/etc/hypr/looknfeel.conf" + - src: "hyprland/hyprland.conf.j2" + dest: "/etc/hypr/hyprland.conf" diff --git a/roles/hyprland/templates/hyprland-custom.desktop.j2 b/roles/hyprland/templates/hyprland-custom.desktop.j2 deleted file mode 100644 index 57975bf0..00000000 --- a/roles/hyprland/templates/hyprland-custom.desktop.j2 +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Name=Hyprland (Custom Config) -Comment=An intelligent dynamic tiling Wayland compositor with system config -Exec=env HYPRLAND_CONFIG=/etc/hypr/hyprland.conf Hyprland -Type=Application -DesktopNames=Hyprland diff --git a/roles/hyprland/templates/hyprland/autostart.conf.j2 b/roles/hyprland/templates/hyprland/autostart.conf.j2 new file mode 100644 index 00000000..f0cd7213 --- /dev/null +++ b/roles/hyprland/templates/hyprland/autostart.conf.j2 @@ -0,0 +1 @@ +exec-once = uwsm-app -- mako diff --git a/roles/hyprland/templates/hyprland/hyprland.conf.j2 b/roles/hyprland/templates/hyprland/hyprland.conf.j2 index 790e496d..3e2c08a3 100644 --- a/roles/hyprland/templates/hyprland/hyprland.conf.j2 +++ b/roles/hyprland/templates/hyprland/hyprland.conf.j2 @@ -2,11 +2,9 @@ # Inspired by omarchy setup # Use default configuration files +source = /etc/hypr/autostart.conf source = /etc/hypr/monitors.conf source = /etc/hypr/input.conf source = /etc/hypr/bindings.conf source = /etc/hypr/envs.conf source = /etc/hypr/looknfeel.conf - -# Load user configuration -source = ~/.config/hypr/hyprland.conf diff --git a/roles/mako/meta/argument_specs.yml b/roles/mako/meta/argument_specs.yml new file mode 100644 index 00000000..b6b69a07 --- /dev/null +++ b/roles/mako/meta/argument_specs.yml @@ -0,0 +1,6 @@ +--- +argument_specs: + main: + short_description: "Install mako on Arch Linux" + description: "Install mako on Arch Linux" + options: {} diff --git a/roles/mako/meta/main.yml b/roles/mako/meta/main.yml new file mode 100644 index 00000000..bb71080a --- /dev/null +++ b/roles/mako/meta/main.yml @@ -0,0 +1,11 @@ +--- +dependencies: [] +galaxy_info: + author: "a14m" + description: "Install mako on Arch Linux" + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "ArchLinux" + versions: + - "all" diff --git a/roles/mako/tasks/main.yml b/roles/mako/tasks/main.yml new file mode 100644 index 00000000..3303969f --- /dev/null +++ b/roles/mako/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: "Ensure mako is installed" + become: true + ansible.builtin.package: + name: + - "libnotify" + - "mako" + state: "present" + +- name: "Create system config directory" + become: true + ansible.builtin.file: + path: "/etc/xdg/mako" + state: "directory" + mode: "0755" + +- name: "Configure system defaults" + become: true + ansible.builtin.template: + src: "mako/config.j2" + dest: "/etc/xdg/mako/config" + mode: "0644" diff --git a/roles/mako/templates/mako/config.j2 b/roles/mako/templates/mako/config.j2 new file mode 100644 index 00000000..83be3e1a --- /dev/null +++ b/roles/mako/templates/mako/config.j2 @@ -0,0 +1,36 @@ +sort=-time +layer=overlay +background-color=#2e3440 +width=300 +height=110 +border-size=2 +border-color=#f1c40f +border-radius=5 +icons=1 +max-icon-size=32 +default-timeout=5000 +ignore-timeout=1 +history=1 +actions=1 +font=sans-serif 14px + +[mode=do-not-disturb] +invisible=true + +[mode=do-not-disturb app-name=notify-send] +invisible=false + +# [urgency=low] +# border-color=#41cfff + +# [urgency=normal] +# border-color=#41cfff + +[urgency=critical] +border-color=#e74c3c +default-timeout=0 +layer=overlay + +[category=mpd] +default-timeout=2000 +group-by=category -- cgit v1.2.3