diff --git a/ansible/roles/greetd/templates/config.toml.j2 b/ansible/roles/greetd/templates/config.toml.j2 index 2090145..a1b2bb6 100644 --- a/ansible/roles/greetd/templates/config.toml.j2 +++ b/ansible/roles/greetd/templates/config.toml.j2 @@ -2,7 +2,7 @@ # The VT to run the greeter on vt = 1 -# Default session: tuigreet greeter +# Default session: tuigreet greeter with uwsm-managed Hyprland as fallback [default_session] -command = "tuigreet --time --remember --asterisks --cmd {{ hyprland_cmd | default('start-hyprland') }}" +command = "tuigreet --time --remember --asterisks --cmd 'uwsm start -e -D Hyprland hyprland.desktop'" user = "greeter" diff --git a/ansible/roles/hyprland/tasks/main.yml b/ansible/roles/hyprland/tasks/main.yml index 6b69cea..1cb5ce0 100644 --- a/ansible/roles/hyprland/tasks/main.yml +++ b/ansible/roles/hyprland/tasks/main.yml @@ -16,10 +16,19 @@ loop: - hypr - waybar - - wofi + - hyprlauncher - dunst tags: [hyprland, config] +- name: Hyprland - ensure Waybar scripts directory exists + file: + path: "/home/{{ system_user }}/.config/waybar/scripts" + state: directory + owner: "{{ system_user }}" + group: "{{ system_user }}" + mode: '0755' + tags: [hyprland, config] + - name: Hyprland - configure NVIDIA DRM KMS (modeset=1) lineinfile: path: /etc/modprobe.d/nvidia.conf @@ -70,5 +79,15 @@ - { src: 'hyprpaper.conf.j2', dest: 'hypr/hyprpaper.conf' } - { src: 'waybar_config.j2', dest: 'waybar/config' } - { src: 'waybar_style.css.j2', dest: 'waybar/style.css' } + - { src: 'hyprlauncher.conf.j2', dest: 'hypr/hyprlauncher.conf' } - { src: 'dunstrc.j2', dest: 'dunst/dunstrc' } tags: [hyprland, config] + +- name: Hyprland - deploy Waybar GPU monitoring script + template: + src: 'waybar_gpu_script.sh.j2' + dest: "/home/{{ system_user }}/.config/waybar/scripts/gpu.sh" + owner: "{{ system_user }}" + group: "{{ system_user }}" + mode: '0755' + tags: [hyprland, config] diff --git a/ansible/roles/hyprland/templates/hyprland.conf.j2 b/ansible/roles/hyprland/templates/hyprland.conf.j2 index d393f35..0991bcb 100644 --- a/ansible/roles/hyprland/templates/hyprland.conf.j2 +++ b/ansible/roles/hyprland/templates/hyprland.conf.j2 @@ -67,7 +67,7 @@ $mainMod = SUPER bind = $mainMod, Q, exec, kitty bind = $mainMod, C, killactive, bind = $mainMod, M, exit, -bind = $mainMod, E, exec, dolphin +bind = $mainMod, E, exec, kitty -e yazi bind = $mainMod, V, togglefloating, bind = $mainMod, D, exec, hyprlauncher bind = $mainMod, P, pseudo @@ -75,6 +75,7 @@ bind = $mainMod, J, layoutmsg, togglesplit # Worktime safers bind = $mainMod, F, fullscreen, 0 # Toggle fullscreen +bind = $mainMod, R, exec, hyprctl reload # Reload Hyprland config bind = $mainMod, SPACE, togglefloating # Toggle float (popup window) bind = $mainMod, TAB, cyclenext # Cycle through windows bind = $mainMod SHIFT, TAB, cyclenext, prev # Cycle backwards @@ -101,6 +102,12 @@ bind = $mainMod ALT, J, resizeactive, 0 40 # Lock screen bind = $mainMod CTRL, L, exec, hyprlock +# Screenshots +bind = , Print, exec, grimblast copysave area +bind = $mainMod, Print, exec, grimblast copysave active +bind = $mainMod SHIFT, Print, exec, grimblast copysave output +bind = $mainMod ALT, Print, exec, grim -g "$(slurp)" - | satty -f - + # Focus bind = $mainMod, left, movefocus, l @@ -120,7 +127,7 @@ bind = $mainMod SHIFT, up, movewindow, u bind = $mainMod SHIFT, down, movewindow, d # Apps -bind = $mainMod, B, exec, chromium +bind = $mainMod, B, exec, google-chrome-stable # Workspaces bind = $mainMod, 1, workspace, 1 diff --git a/ansible/roles/hyprland/templates/hyprlauncher.conf.j2 b/ansible/roles/hyprland/templates/hyprlauncher.conf.j2 new file mode 100644 index 0000000..855af54 --- /dev/null +++ b/ansible/roles/hyprland/templates/hyprlauncher.conf.j2 @@ -0,0 +1,16 @@ +[general] +grab_focus = true + +[cache] +enabled = true + +[finders] +default_finder = desktop +unicode_prefix = . +math_prefix = = +font_prefix = ' +desktop_launch_prefix = uwsm app -- +desktop_icons = true + +[ui] +window_size = 500 300 diff --git a/ansible/roles/hyprland/templates/waybar_config.j2 b/ansible/roles/hyprland/templates/waybar_config.j2 index a2953cd..17beae4 100644 --- a/ansible/roles/hyprland/templates/waybar_config.j2 +++ b/ansible/roles/hyprland/templates/waybar_config.j2 @@ -4,7 +4,7 @@ "height": 30, "modules-left": ["hyprland/workspaces", "hyprland/mode"], "modules-center": ["hyprland/window"], - "modules-right": ["network", "cpu", "memory", "clock", "tray"], + "modules-right": ["network", "cpu", "memory", "custom/gpu", "pulseaudio", "clock", "tray"], "hyprland/workspaces": { "disable-scroll": true, "all-outputs": true, @@ -25,5 +25,21 @@ "format-wifi": " {essid} ({signalStrength}%)", "format-ethernet": "󰈀 {ifname}", "format-disconnected": "⚠ Disconnected" + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-muted": "󰝟 Muted", + "format-icons": { + "default": ["", "", ""] + }, + "on-click": "pavucontrol", + "on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", + "on-scroll-up": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+", + "on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + }, + "custom/gpu": { + "exec": "~/.config/waybar/scripts/gpu.sh", + "interval": 5, + "return-type": "json" } } diff --git a/ansible/roles/hyprland/templates/waybar_gpu_script.sh.j2 b/ansible/roles/hyprland/templates/waybar_gpu_script.sh.j2 new file mode 100644 index 0000000..0eb5537 --- /dev/null +++ b/ansible/roles/hyprland/templates/waybar_gpu_script.sh.j2 @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Waybar GPU usage module - NVIDIA +set -euo pipefail + +GPU=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits 2>/dev/null | head -1 | tr -d ' ') +TEMP=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits 2>/dev/null | head -1 | tr -d ' ') + +if [ -z "$GPU" ]; then + echo '{"text": "GPU N/A", "percentage": 0}' + exit 0 +fi + +if [ "$GPU" -ge 80 ]; then + ICON="" +elif [ "$GPU" -ge 50 ]; then + ICON="" +else + ICON="󰢮" +fi + +echo "{\"text\": \"${ICON} ${GPU}%\", \"tooltip\": \"GPU Usage: ${GPU}% | Temp: ${TEMP}°C\", \"percentage\": ${GPU}}" diff --git a/ansible/roles/hyprland/templates/waybar_style.css.j2 b/ansible/roles/hyprland/templates/waybar_style.css.j2 index bce369d..b170ff5 100644 --- a/ansible/roles/hyprland/templates/waybar_style.css.j2 +++ b/ansible/roles/hyprland/templates/waybar_style.css.j2 @@ -21,6 +21,10 @@ window#waybar { border-bottom: 3px solid #ffffff; } -#clock, #cpu, #memory, #network, #tray { +#clock, #cpu, #memory, #network, #tray, #pulseaudio, #custom-gpu { padding: 0 10px; } + +#pulseaudio:hover { + background: #555; +} diff --git a/ansible/vars/main.yml b/ansible/vars/main.yml index df1b2a0..bc361ff 100644 --- a/ansible/vars/main.yml +++ b/ansible/vars/main.yml @@ -49,13 +49,18 @@ hyprland_packages: - hypridle - hyprshot - hyprcursor + - grim + - slurp + - wl-clipboard + - satty + - yazi - xdg-desktop-portal-hyprland - waybar - - wofi + - hyprlauncher - dunst - kitty - cliphist - - wl-clipboard + - uwsm - brightnessctl - pipewire - pipewire-pulse