Use Hyprland instead of sway #1

Merged
Bluemedia merged 15 commits from hyprland into master 2024-06-01 01:39:10 +02:00
10 changed files with 238 additions and 30 deletions
Showing only changes of commit d8113f6228 - Show all commits

View file

@ -1,3 +0,0 @@
isNotebook: true
isDesktop: false
isVm: false

47
host_vars/kronos Normal file
View file

@ -0,0 +1,47 @@
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

26
host_vars/zeus Normal file
View file

@ -0,0 +1,26 @@
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

View file

@ -30,6 +30,8 @@
loop: loop:
- src: "{{ role_path }}/files/.config" - src: "{{ role_path }}/files/.config"
dest: "{{ ansible_env.HOME }}/" dest: "{{ ansible_env.HOME }}/"
- src: "{{ role_path }}/files/.local"
dest: "{{ ansible_env.HOME }}/"
- name: Ensure presence of required directories - name: Ensure presence of required directories
file: file:
@ -39,6 +41,7 @@
loop: loop:
- "{{ ansible_env.HOME }}/.config/hypr" - "{{ ansible_env.HOME }}/.config/hypr"
- "{{ ansible_env.HOME }}/.config/waybar" - "{{ ansible_env.HOME }}/.config/waybar"
- "{{ ansible_env.HOME }}/.local/bin"
- name: Render config files - name: Render config files
ansible.builtin.template: ansible.builtin.template:
@ -51,3 +54,10 @@
dest: "{{ ansible_env.HOME }}/.config/hypr/hyprland.conf" dest: "{{ ansible_env.HOME }}/.config/hypr/hyprland.conf"
- src: ".config/waybar/config.j2" - src: ".config/waybar/config.j2"
dest: "{{ ansible_env.HOME }}/.config/waybar/config" 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"

View file

@ -15,6 +15,8 @@
- build-essential - build-essential
- cmake - cmake
- meson - meson
# hyprland-scanner
- libpugixml-dev
# hyprcursor # hyprcursor
- libzip-dev - libzip-dev
- librsvg2-dev - librsvg2-dev
@ -22,8 +24,10 @@
# Hyprland # Hyprland
- libpango1.0-dev - libpango1.0-dev
- libtomlplusplus-dev - libtomlplusplus-dev
- uuid-dev
# xdg-desktop-portal-hyprland # xdg-desktop-portal-hyprland
- qtbase5-dev #- qtbase5-dev
- qt6-base-dev
- libspa-0.2-dev - libspa-0.2-dev
- libpipewire-0.3-dev - libpipewire-0.3-dev
@ -35,16 +39,25 @@
owner: "{{ ansible_user_id }}" owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_id }}" group: "{{ ansible_user_id }}"
loop: loop:
- "hyprwayland-scanner"
- "Hyprland" - "Hyprland"
- "hyprlang" - "hyprlang"
- "hyprcursor" - "hyprcursor"
- "xdg-desktop-portal-hyprland" - "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 - name: Checkout Hyprland repo
ansible.builtin.git: ansible.builtin.git:
repo: 'https://github.com/hyprwm/Hyprland.git' repo: 'https://github.com/hyprwm/Hyprland.git'
dest: /usr/local/src/Hyprland dest: /usr/local/src/Hyprland
version: v0.39.1 version: v0.40.0
force: true force: true
recursive: true recursive: true
@ -68,10 +81,24 @@
ansible.builtin.git: ansible.builtin.git:
repo: 'https://github.com/hyprwm/xdg-desktop-portal-hyprland.git' repo: 'https://github.com/hyprwm/xdg-desktop-portal-hyprland.git'
dest: /usr/local/src/xdg-desktop-portal-hyprland dest: /usr/local/src/xdg-desktop-portal-hyprland
version: v1.3.1 version: master
force: true force: true
recursive: 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 - name: Build hyprlang
ansible.builtin.command: ansible.builtin.command:
cmd: "{{ item }}" cmd: "{{ item }}"

View file

@ -6,7 +6,9 @@
name: name:
- swaylock - swaylock
- swaybg - swaybg
- swayidle
- waybar - waybar
- wofi
- xdg-desktop-portal-wlr - xdg-desktop-portal-wlr
- xdg-desktop-portal-gtk - xdg-desktop-portal-gtk
- xfce4-appfinder - xfce4-appfinder

View file

@ -1,23 +1,26 @@
# Monitor configuration (see https://wiki.hyprland.org/Configuring/Monitors/) # Monitor configuration (see https://wiki.hyprland.org/Configuring/Monitors/)
monitor=,preferred,auto,auto {% for monitor in hostvars[ansible_hostname]['monitors'] -%}
monitor=desc:{{ monitor['desc'] }}, {{ monitor['resolution'] }}, {{ monitor['position'] }}, 1
{% endfor %}
# Programs to use # Programs to use
$terminal = flatpak run org.wezfurlong.wezterm $terminal = flatpak run --nosocket=wayland org.wezfurlong.wezterm
$menu = xfce4-appfinder --disable-server $menu = xfce4-appfinder --disable-server
# Default env vars # Default env vars
env = XCURSOR_SIZE,24 env = XCURSOR_SIZE,24
env = QT_QPA_PLATFORMTHEME,qt5ct env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ # For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input { input {
kb_layout = de kb_layout = de
kb_variant = nodeadkeys kb_variant = nodeadkeys
numlock_by_default = 1
follow_mouse = 1 follow_mouse = 2
touchpad { touchpad {
natural_scroll = enabled natural_scroll = 1
} }
sensitivity = 0 # -1.0 - 1.0, 0 means no modification. sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
@ -34,6 +37,7 @@ general {
layout = master layout = master
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false allow_tearing = false
} }
@ -86,22 +90,28 @@ misc {
force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers
} }
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrulev2 = nomaximizerequest, class:.* windowrulev2 = suppressevent maximize, class:.*
windowrulev2 = idleinhibit fullscreen, class:.*
windowrulev2 = float,title:^(Application Finder)$ windowrulev2 = float,title:^(Application Finder)$
windowrulev2 = size 500 500,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 # 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 = 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 exec-once = waybar & ~/.local/bin/hyprhelpr background & ~/.local/bin/hyprhelpr idle
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 %} {% if 'nextcloud' in role_names %}
exec-once = nextcloud --background exec-once = nextcloud --background
{% endif %} {% 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 # See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER $mainMod = SUPER
@ -113,9 +123,8 @@ bind = $mainMod SHIFT, Q, killactive,
bind = $mainMod SHIFT, E, exit, bind = $mainMod SHIFT, E, exit,
bind = $mainMod, F, fullscreen, 0 bind = $mainMod, F, fullscreen, 0
bind = $mainMod, V, togglefloating, bind = $mainMod, V, togglefloating,
bind = $mainMod, L, exec, pa-loopback bind = $mainMod, L, exec, ~/.local/bin/hyprhelpr lock
#bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, P, exec, ~/.local/bin/hyprhelpr powermenu
#bind = $mainMod, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys # Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l bind = $mainMod, left, movefocus, l

View file

@ -28,15 +28,11 @@
"reverse-scrolling": true, "reverse-scrolling": true,
"on-click": "swaymsg exec amixer -q set Master toggle" "on-click": "swaymsg exec amixer -q set Master toggle"
}, },
{% if isNotebook | bool %} {% if hostvars[ansible_hostname]['mobile_platform'] | bool %}
"battery": { "battery": {
"format": "{icon} {capacity}%", "format": "{icon} {capacity}%",
"format-charging": " {capacity}%", "format-charging": " {capacity}%",
"format-icons": ["", "", "", "", ""] "format-icons": ["", "", "", "", ""]
}, }
{% endif %} {% 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'"
}
} }

View file

@ -0,0 +1,94 @@
#!/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 <action> [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

View file

@ -15,7 +15,7 @@ export GPG_TTY=$(tty)
# Autostart Hyprland at login # Autostart Hyprland at login
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
{% if isVm | bool %} {% if hostvars[ansible_hostname]['virtual_machine'] | bool %}
export WLR_NO_HARDWARE_CURSORS=1 export WLR_NO_HARDWARE_CURSORS=1
{% endif %} {% endif %}
exec Hyprland exec Hyprland