diff --git a/group_vars/all.yml b/group_vars/all.yml new file mode 100644 index 0000000..a0d2313 --- /dev/null +++ b/group_vars/all.yml @@ -0,0 +1,3 @@ +isNotebook: true +isDesktop: false +isVm: false \ No newline at end of file diff --git a/host_vars/kronos b/host_vars/kronos deleted file mode 100644 index a09bb13..0000000 --- a/host_vars/kronos +++ /dev/null @@ -1,47 +0,0 @@ -mobile_platform: false - -monitors: - - desc: "LG Electronics LG ULTRAGEAR 311NTZN8J917" - output: "DP-1" - resolution: "2560x1440@120" - position: "1440x1440" - background: - file: "bg1.png" - mode: "fill" - - - desc: "LG Electronics LG ULTRAGEAR 311NTVS8J911" - output: "DP-2" - resolution: "2560x1440@120" - position: "1440x0" - background: - file: "bg0.png" - mode: "fill" - - - desc: "Acer Technologies KG271U TATEE0048524" - output: "HDMI-A-4" - resolution: "2560x1440@120" - position: "0x320" - transform: 3 - background: - file: "bgv0.png" - mode: "fill" - -workspaces: - - id: 1 - monitor: "LG Electronics LG ULTRAGEAR 311NTZN8J917" - default: true - - id: 2 - monitor: "LG Electronics LG ULTRAGEAR 311NTVS8J911" - default: true - - id: 3 - monitor: "Acer Technologies KG271U TATEE0048524" - default: true - layoutopt_orientation: "top" - on_created_empty: "flatpak run com.discordapp.Discord & keepassxc" - - id: 9 - monitor: "LG Electronics LG ULTRAGEAR 311NTVS8J911" - -autostart: - - command: "spotify --enable-features=UseOzonePlatform --ozone-platform=wayland" - workspace: 9 - silent: true \ No newline at end of file diff --git a/host_vars/zeus b/host_vars/zeus deleted file mode 100644 index 348e08a..0000000 --- a/host_vars/zeus +++ /dev/null @@ -1,26 +0,0 @@ -mobile_platform: true - -monitors: - - desc: "BOE 0x07C9" - output: "eDP-1" - resolution: "1920x1080@60" - background: - file: "bg0.png" - mode: "fill" - -workspaces: - - id: 1 - monitor: "BOE 0x07C9" - default: true - - id: 8 - monitor: "BOE 0x07C9" - - id: 9 - monitor: "BOE 0x07C9" - -autostart: - - command: "keepassxc" - workspace: 8 - silent: true - - command: "spotify --enable-features=UseOzonePlatform --ozone-platform=wayland" - workspace: 9 - silent: true \ No newline at end of file diff --git a/roles/desktop-environment/files/.config/background/background.png b/roles/desktop-environment/files/.config/background/background.png new file mode 100644 index 0000000..3d0c67e Binary files /dev/null and b/roles/desktop-environment/files/.config/background/background.png differ diff --git a/roles/desktop-environment/files/.config/background/bg0.png b/roles/desktop-environment/files/.config/background/bg0.png deleted file mode 100644 index d407675..0000000 Binary files a/roles/desktop-environment/files/.config/background/bg0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/bg1.png b/roles/desktop-environment/files/.config/background/bg1.png deleted file mode 100644 index 263e236..0000000 Binary files a/roles/desktop-environment/files/.config/background/bg1.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/bgv0.png b/roles/desktop-environment/files/.config/background/bgv0.png deleted file mode 100644 index 2b6a553..0000000 Binary files a/roles/desktop-environment/files/.config/background/bgv0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/lock-bg0.png b/roles/desktop-environment/files/.config/background/lock-bg0.png deleted file mode 100644 index b1977da..0000000 Binary files a/roles/desktop-environment/files/.config/background/lock-bg0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/lock-bg1.png b/roles/desktop-environment/files/.config/background/lock-bg1.png deleted file mode 100644 index ffaba68..0000000 Binary files a/roles/desktop-environment/files/.config/background/lock-bg1.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/lock-bgv0.png b/roles/desktop-environment/files/.config/background/lock-bgv0.png deleted file mode 100644 index e241fab..0000000 Binary files a/roles/desktop-environment/files/.config/background/lock-bgv0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/lockscreen.jpg b/roles/desktop-environment/files/.config/background/lockscreen.jpg new file mode 100644 index 0000000..99a4b70 Binary files /dev/null and b/roles/desktop-environment/files/.config/background/lockscreen.jpg differ diff --git a/roles/desktop-environment/tasks/config.yml b/roles/desktop-environment/tasks/config.yml index 073a97d..4f98e33 100644 --- a/roles/desktop-environment/tasks/config.yml +++ b/roles/desktop-environment/tasks/config.yml @@ -30,8 +30,6 @@ loop: - src: "{{ role_path }}/files/.config" dest: "{{ ansible_env.HOME }}/" - - src: "{{ role_path }}/files/.local" - dest: "{{ ansible_env.HOME }}/" - name: Ensure presence of required directories file: @@ -41,7 +39,6 @@ loop: - "{{ ansible_env.HOME }}/.config/hypr" - "{{ ansible_env.HOME }}/.config/waybar" - - "{{ ansible_env.HOME }}/.local/bin" - name: Render config files ansible.builtin.template: @@ -53,11 +50,4 @@ - src: ".config/hypr/hyprland.conf.j2" dest: "{{ ansible_env.HOME }}/.config/hypr/hyprland.conf" - src: ".config/waybar/config.j2" - dest: "{{ ansible_env.HOME }}/.config/waybar/config" - - src: ".local/bin/hyprhelpr.j2" - dest: "{{ ansible_env.HOME }}/.local/bin/hyprhelpr" - -- name: Make "~/.local/bin/hyprhelpr" executable - ansible.builtin.file: - dest: "{{ ansible_env.HOME }}/.local/bin/hyprhelpr" - mode: "og+x" \ No newline at end of file + dest: "{{ ansible_env.HOME }}/.config/waybar/config" \ No newline at end of file diff --git a/roles/desktop-environment/tasks/hyprland.yml b/roles/desktop-environment/tasks/hyprland.yml index 108f6b3..ee544d0 100644 --- a/roles/desktop-environment/tasks/hyprland.yml +++ b/roles/desktop-environment/tasks/hyprland.yml @@ -15,19 +15,14 @@ - build-essential - cmake - meson - # hyprland-scanner - - libpugixml-dev # hyprcursor - libzip-dev - librsvg2-dev - - libxcb-util-dev # Hyprland - libpango1.0-dev - libtomlplusplus-dev - - uuid-dev # xdg-desktop-portal-hyprland - #- qtbase5-dev - - qt6-base-dev + - qtbase5-dev - libspa-0.2-dev - libpipewire-0.3-dev @@ -39,25 +34,16 @@ owner: "{{ ansible_user_id }}" group: "{{ ansible_user_id }}" loop: - - "hyprwayland-scanner" - "Hyprland" - "hyprlang" - "hyprcursor" - "xdg-desktop-portal-hyprland" -- name: Checkout hyprwayland-scanner repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprwayland-scanner.git' - dest: /usr/local/src/hyprwayland-scanner - version: v0.3.4 - force: true - recursive: true - - name: Checkout Hyprland repo ansible.builtin.git: repo: 'https://github.com/hyprwm/Hyprland.git' dest: /usr/local/src/Hyprland - version: v0.40.0 + version: v0.37.1 force: true recursive: true @@ -65,7 +51,7 @@ ansible.builtin.git: repo: 'https://github.com/hyprwm/hyprlang.git' dest: /usr/local/src/hyprlang - version: v0.5.1 + version: v0.5.0 force: true recursive: true @@ -73,7 +59,7 @@ ansible.builtin.git: repo: 'https://github.com/hyprwm/hyprcursor.git' dest: /usr/local/src/hyprcursor - version: v0.1.8 + version: v0.1.4 force: true recursive: true @@ -81,24 +67,10 @@ ansible.builtin.git: repo: 'https://github.com/hyprwm/xdg-desktop-portal-hyprland.git' dest: /usr/local/src/xdg-desktop-portal-hyprland - version: master + version: v1.3.1 force: true recursive: true -- name: Build hyprwayland-scanner - ansible.builtin.command: - cmd: "{{ item }}" - chdir: /usr/local/src/hyprwayland-scanner - loop: - - "cmake -DCMAKE_INSTALL_PREFIX=/usr -B build" - - "cmake --build build" - -- name: Install hyprwayland-scanner - become: yes - ansible.builtin.command: - cmd: "cmake --install build" - chdir: /usr/local/src/hyprwayland-scanner - - name: Build hyprlang ansible.builtin.command: cmd: "{{ item }}" @@ -161,4 +133,4 @@ - name: Reload systemd ansible.builtin.systemd_service: daemon_reload: true - scope: user + scope: user \ No newline at end of file diff --git a/roles/desktop-environment/tasks/utils.yml b/roles/desktop-environment/tasks/utils.yml index 45c7dbd..0d8a16e 100644 --- a/roles/desktop-environment/tasks/utils.yml +++ b/roles/desktop-environment/tasks/utils.yml @@ -6,9 +6,7 @@ name: - swaylock - swaybg - - swayidle - waybar - - wofi - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - xfce4-appfinder diff --git a/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 b/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 index 610673b..5f0b496 100644 --- a/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 +++ b/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 @@ -1,26 +1,23 @@ # Monitor configuration (see https://wiki.hyprland.org/Configuring/Monitors/) -{% for monitor in hostvars[ansible_hostname]['monitors'] -%} -monitor=desc:{{ monitor['desc'] }}, {{ monitor['resolution'] }}, {{ monitor['position'] }}, 1 -{% endfor %} +monitor=,preferred,auto,auto # Programs to use -$terminal = flatpak run --nosocket=wayland org.wezfurlong.wezterm +$terminal = flatpak run org.wezfurlong.wezterm $menu = xfce4-appfinder --disable-server # Default env vars env = XCURSOR_SIZE,24 -env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that +env = QT_QPA_PLATFORMTHEME,qt5ct # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ input { kb_layout = de kb_variant = nodeadkeys - numlock_by_default = 1 - follow_mouse = 2 + follow_mouse = 1 touchpad { - natural_scroll = 1 + natural_scroll = enabled } sensitivity = 0 # -1.0 - 1.0, 0 means no modification. @@ -37,7 +34,6 @@ general { layout = master - # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on allow_tearing = false } @@ -90,41 +86,36 @@ misc { force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers } -# Example windowrule v2 # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more -windowrulev2 = suppressevent maximize, class:.* -windowrulev2 = idleinhibit fullscreen, class:.* +windowrulev2 = nomaximizerequest, class:.* windowrulev2 = float,title:^(Application Finder)$ windowrulev2 = size 500 500,title:^(Application Finder)$ -# Workspace rules -{% for workspace in hostvars[ansible_hostname]['workspaces'] -%} -workspace = {{ workspace['id'] }}{% if 'monitor' in workspace %}, monitor:desc:{{ workspace['monitor'] }}{% endif %}{% if 'default' in workspace %}, default:{{ workspace['default'] }}{% endif %}{% if 'layoutopt_orientation' in workspace %}, layoutopt:orientation:{{ workspace['layoutopt_orientation'] }}{% endif %}{% if 'on_created_empty' in workspace %}, on-created-empty:{{ workspace['on_created_empty'] }}{% endif %} -{% endfor %} - # Execute apps at launch exec-once = systemctl --user import-environment DISPLAY WAYLAND_DISPLAY && hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK -exec-once = waybar & ~/.local/bin/hyprhelpr background & ~/.local/bin/hyprhelpr idle +exec-once = waybar +exec-once = swaybg -i ~/.config/background/background.png -m fill +{% if 'spotify' in role_names %} +exec-once = [workspace 9 silent] spotify --enable-features=UseOzonePlatform --ozone-platform=wayland +{% endif %} {% if 'nextcloud' in role_names %} exec-once = nextcloud --background {% endif %} -{% for autostart in hostvars[ansible_hostname]['autostart'] -%} -exec-once = {% if 'workspace' in autostart %}[workspace {{ autostart['workspace'] }}] {% endif %}{{ autostart['command'] }} -{% endfor %} # See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER -# Key binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +# Keybinds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, Return, exec, $terminal bind = $mainMod, D, exec, $menu bind = $mainMod SHIFT, Q, killactive, bind = $mainMod SHIFT, E, exit, bind = $mainMod, F, fullscreen, 0 bind = $mainMod, V, togglefloating, -bind = $mainMod, L, exec, ~/.local/bin/hyprhelpr lock -bind = $mainMod, P, exec, ~/.local/bin/hyprhelpr powermenu +bind = $mainMod, L, exec, pa-loopback +#bind = $mainMod, P, pseudo, # dwindle +#bind = $mainMod, J, togglesplit, # dwindle # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l diff --git a/roles/desktop-environment/templates/.config/waybar/config.j2 b/roles/desktop-environment/templates/.config/waybar/config.j2 index a1ac65f..3a2a298 100644 --- a/roles/desktop-environment/templates/.config/waybar/config.j2 +++ b/roles/desktop-environment/templates/.config/waybar/config.j2 @@ -28,11 +28,15 @@ "reverse-scrolling": true, "on-click": "swaymsg exec amixer -q set Master toggle" }, - {% if hostvars[ansible_hostname]['mobile_platform'] | bool %} + {% if isNotebook | bool %} "battery": { "format": "{icon} {capacity}%", "format-charging": " {capacity}%", "format-icons": ["", "", "", "", ""] - } + }, {% endif %} + "custom/power":{ + "format":"  ", + "on-click":"swaynag -t warning -m 'Power Menu Options' -b 'Logout' 'swaymsg exit' -b 'Lock' 'swaymsg exec swaylock -f' -b 'Suspend' 'swaymsg exec sudo systemctl suspend && swaylock -f' -b 'Reboot' 'swaymsg exec sudo systemctl reboot' -b 'Shutdown' 'swaymsg exec sudo systemctl poweroff'" + } } diff --git a/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 b/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 deleted file mode 100644 index a9242f6..0000000 --- a/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -set -eu - -background() { - swaybg \ - {% for monitor in hostvars[ansible_hostname]['monitors'] -%} - -o "{{ monitor['desc'] }}" -i ~/.config/background/{{ monitor['background']['file'] }} -m {{ monitor['background']['mode'] }} {%- if not loop.last %}\{% endif %} - {% endfor %} -} - -idle() { - swayidle -w \ - timeout 180 '~/.local/bin/hyprhelpr lock' \ - timeout 240 'hyprctl dispatch dpms off' \ - resume 'hyprctl dispatch dpms on' -} - -lock() { - if pgrep -x "swaylock" >/dev/null - then - echo "A instance of swaylock is already running." - exit 1 - else - swaylock -f -e -s fill --indicator-radius 150 \ - {% for monitor in hostvars[ansible_hostname]['monitors'] -%} - -i {{ monitor['output'] }}:~/.config/background/lock-{{ monitor['background']['file'] }} {%- if not loop.last %}\{% endif %} - {% endfor %} - fi -} - -shutdown() { - sudo systemctl poweroff -} - -reboot() { - sudo systemctl reboot -} - -powermenu() { - PM_ACTION=$(printf "Shutdown\nReboot\nLock\nLogoff" | wofi --show=dmenu -i --width 200 --height 150) - if [ -n "$PM_ACTION" ]; then - case $PM_ACTION in - Shutdown) - shutdown - ;; - Reboot) - reboot - ;; - Lock) - lock - ;; - Logoff) - hyprctl dispatch exit - ;; - esac - fi -} - -ACTION=$1 -case $ACTION in - background) - background - ;; - idle) - idle - ;; - lock) - lock - ;; - shutdown) - shutdown - ;; - reboot) - reboot - ;; - powermenu) - powermenu - ;; - help | -h | --help) - echo "Usage: hyprhelpr [parameters]" - echo "Available actions:" - echo " background Start swaybg with the configured backgrounds." - echo " idle Start swayidle with the configured actions." - echo " lock Lock the current session using swaylock." - echo " shutdown Shut down the system." - echo " reboot Reboot the system." - echo " powermenu Show wofi in dmenu mode with different power options" - echo " help Show this help text." - ;; - *) - echo "Invalid action \"$ACTION\"."' Use "hyprhelpr help" to get help.' - exit 1 -esac diff --git a/roles/desktop-environment/templates/bash_profile.j2 b/roles/desktop-environment/templates/bash_profile.j2 index 19f4cec..0841f70 100644 --- a/roles/desktop-environment/templates/bash_profile.j2 +++ b/roles/desktop-environment/templates/bash_profile.j2 @@ -15,7 +15,7 @@ export GPG_TTY=$(tty) # Autostart Hyprland at login if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then - {% if hostvars[ansible_hostname]['virtual_machine'] | bool %} + {% if isVm | bool %} export WLR_NO_HARDWARE_CURSORS=1 {% endif %} exec Hyprland