diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-12-12 18:47:09 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-12-12 21:05:58 +0100 |
| commit | 923ff1e6021e2746829fe0bc459f32179155f95f (patch) | |
| tree | 2361cf2e7c5553746dbee7760cb44d915050a446 /roles | |
| parent | 0dc03632c7eb24227cdecbe460ab8d42669430a7 (diff) | |
Add initial (basic) hyprland role configurations
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/hyprland/handlers/main.yml | 6 | ||||
| -rw-r--r-- | roles/hyprland/meta/argument_specs.yml | 6 | ||||
| -rw-r--r-- | roles/hyprland/meta/main.yml | 16 | ||||
| -rw-r--r-- | roles/hyprland/tasks/main.yml | 60 | ||||
| -rw-r--r-- | roles/hyprland/templates/hyprland-custom.desktop.j2 | 6 | ||||
| -rw-r--r-- | roles/hyprland/templates/hyprland/bindings.conf.j2 | 67 | ||||
| -rw-r--r-- | roles/hyprland/templates/hyprland/envs.conf.j2 | 5 | ||||
| -rw-r--r-- | roles/hyprland/templates/hyprland/hyprland.conf.j2 | 12 | ||||
| -rw-r--r-- | roles/hyprland/templates/hyprland/input.conf.j2 | 41 | ||||
| -rw-r--r-- | roles/hyprland/templates/hyprland/looknfeel.conf.j2 | 147 | ||||
| -rw-r--r-- | roles/hyprland/templates/hyprland/monitors.conf.j2 | 18 |
11 files changed, 384 insertions, 0 deletions
diff --git a/roles/hyprland/handlers/main.yml b/roles/hyprland/handlers/main.yml new file mode 100644 index 00000000..c6576510 --- /dev/null +++ b/roles/hyprland/handlers/main.yml @@ -0,0 +1,6 @@ +--- +- name: "Restart greetd" + become: true + ansible.builtin.systemd_service: + name: "greetd" + state: "restarted" diff --git a/roles/hyprland/meta/argument_specs.yml b/roles/hyprland/meta/argument_specs.yml new file mode 100644 index 00000000..9845602d --- /dev/null +++ b/roles/hyprland/meta/argument_specs.yml @@ -0,0 +1,6 @@ +--- +argument_specs: + main: + short_description: "Install hyprland on ArchLinux" + description: "Install hyprland on Linux distribution" + options: {} diff --git a/roles/hyprland/meta/main.yml b/roles/hyprland/meta/main.yml new file mode 100644 index 00000000..3791f453 --- /dev/null +++ b/roles/hyprland/meta/main.yml @@ -0,0 +1,16 @@ +--- +dependencies: + - role: "uwsm" + - role: "cage" + - role: "greetd" + - role: "nautilus" +galaxy_info: + author: "a14m" + description: "Install hyprland" + company: "kartoffeln.work GmbH." + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "ArchLinux" + versions: + - "all" diff --git a/roles/hyprland/tasks/main.yml b/roles/hyprland/tasks/main.yml new file mode 100644 index 00000000..c7bb98b2 --- /dev/null +++ b/roles/hyprland/tasks/main.yml @@ -0,0 +1,60 @@ +--- +- name: "Ensure hyprland packages are installed" + become: true + ansible.builtin.package: + name: "{{ item }}" + state: "present" + 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: + dest: "/etc/greetd/config.toml" + owner: "greeter" + group: "greeter" + mode: "0644" + content: | + [terminal] + vt = 1 + [default_session] + command = "cage -s -- gtkgreet -c 'uwsm start hyprland-custom.desktop'" + user = "greeter" + notify: + - "Restart greetd" + +- name: "Create hyprland config directory" + become: true + ansible.builtin.file: + path: "/etc/hypr" + state: "directory" + mode: "0755" + +- name: "Configure hyprland 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/monitors.conf.j2" + dest: "/etc/hypr/monitors.conf" + - src: "hyprland/input.conf.j2" + dest: "/etc/hypr/input.conf" + - src: "hyprland/bindings.conf.j2" + dest: "/etc/hypr/bindings.conf" + - src: "hyprland/envs.conf.j2" + dest: "/etc/hypr/envs.conf" + - src: "hyprland/looknfeel.conf.j2" + dest: "/etc/hypr/looknfeel.conf" diff --git a/roles/hyprland/templates/hyprland-custom.desktop.j2 b/roles/hyprland/templates/hyprland-custom.desktop.j2 new file mode 100644 index 00000000..57975bf0 --- /dev/null +++ b/roles/hyprland/templates/hyprland-custom.desktop.j2 @@ -0,0 +1,6 @@ +[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/bindings.conf.j2 b/roles/hyprland/templates/hyprland/bindings.conf.j2 new file mode 100644 index 00000000..c607f393 --- /dev/null +++ b/roles/hyprland/templates/hyprland/bindings.conf.j2 @@ -0,0 +1,67 @@ +# Configure Hyprland Bindings +# +# See https://wiki.hypr.land/Configuring/Keywords/ +# See https://wiki.hypr.land/Configuring/Binds/ + +bindd = SUPER, Q, Quit, killactive, +bindd = SUPER CONTROL, Q, Logout, exit, + +# Switch workspaces with ctrl + [0-9] (MacOS-like) +bind = CONTROL, 1, workspace, 1 +bind = CONTROL, 2, workspace, 2 +bind = CONTROL, 3, workspace, 3 +bind = CONTROL, 4, workspace, 4 +bind = CONTROL, 5, workspace, 5 +bind = CONTROL, 6, workspace, 6 +bind = CONTROL, 7, workspace, 7 +bind = CONTROL, 8, workspace, 8 +bind = CONTROL, 9, workspace, 9 +bind = CONTROL, 0, workspace, 10 + +# Move active window to a workspace with ctrl + SHIFT + [0-9] +bind = CONTROL SHIFT, 1, movetoworkspace, 1 +bind = CONTROL SHIFT, 2, movetoworkspace, 2 +bind = CONTROL SHIFT, 3, movetoworkspace, 3 +bind = CONTROL SHIFT, 4, movetoworkspace, 4 +bind = CONTROL SHIFT, 5, movetoworkspace, 5 +bind = CONTROL SHIFT, 6, movetoworkspace, 6 +bind = CONTROL SHIFT, 7, movetoworkspace, 7 +bind = CONTROL SHIFT, 8, movetoworkspace, 8 +bind = CONTROL SHIFT, 9, movetoworkspace, 9 +bind = CONTROL SHIFT, 0, movetoworkspace, 10 + +# Move/resize windows with mouse (SUPER + SHIFT + left/right click) +bindm = SUPER SHIFT, mouse:272, movewindow +bindm = SUPER SHIFT, mouse:273, resizewindow + +# Move focus with (SUPER + h/j/k/l) +binde = SUPER, h, movefocus, l +binde = SUPER, j, movefocus, d +binde = SUPER, k, movefocus, u +binde = SUPER, l, movefocus, r + +# Swap windows with (SUPER + SHIFT + h/j/k/l) +binde = SUPER SHIFT, h, swapwindow, l +binde = SUPER SHIFT, j, swapwindow, d +binde = SUPER SHIFT, k, swapwindow, u +binde = SUPER SHIFT, l, swapwindow, r + +# Resize windows with (SUPER + CONTROL + h/j/k/l) +binde = SUPER CONTROL, h, resizeactive, -20 0 +binde = SUPER CONTROL, j, resizeactive, 0 20 +binde = SUPER CONTROL, k, resizeactive, 0 -20 +binde = SUPER CONTROL, l, resizeactive, 20 0 + +# Laptop multimedia keys for volume and LCD brightness +bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ +bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle +bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle +bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+ +bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%- + +# Requires playerctl +bindl = , XF86AudioNext, exec, playerctl next +bindl = , XF86AudioPause, exec, playerctl play-pause +bindl = , XF86AudioPlay, exec, playerctl play-pause +bindl = , XF86AudioPrev, exec, playerctl previous diff --git a/roles/hyprland/templates/hyprland/envs.conf.j2 b/roles/hyprland/templates/hyprland/envs.conf.j2 new file mode 100644 index 00000000..51f7bc08 --- /dev/null +++ b/roles/hyprland/templates/hyprland/envs.conf.j2 @@ -0,0 +1,5 @@ +# Configure Hyprland Environment Variables +# See https://wiki.hypr.land/Configuring/Environment-variables/ + +env = XCURSOR_SIZE,24 +env = HYPRCURSOR_SIZE,24 diff --git a/roles/hyprland/templates/hyprland/hyprland.conf.j2 b/roles/hyprland/templates/hyprland/hyprland.conf.j2 new file mode 100644 index 00000000..790e496d --- /dev/null +++ b/roles/hyprland/templates/hyprland/hyprland.conf.j2 @@ -0,0 +1,12 @@ +# Hyprland main configuration file +# Inspired by omarchy setup + +# Use default configuration files +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/hyprland/templates/hyprland/input.conf.j2 b/roles/hyprland/templates/hyprland/input.conf.j2 new file mode 100644 index 00000000..01f50b02 --- /dev/null +++ b/roles/hyprland/templates/hyprland/input.conf.j2 @@ -0,0 +1,41 @@ +# Control your input devices +# See https://wiki.hypr.land/Configuring/Variables/#input +input { + kb_layout = us + + # Change speed of keyboard repeat + repeat_rate = 40 + repeat_delay = 600 + + # Don't start with numlock on by default + numlock_by_default = false + + # Increase sensitivity for mouse/trackpad (default: 0) + # sensitivity = 0.35 + + # focus follows mouse pointer + # follow_mouse = 1 + + touchpad { + natural_scroll = false + + # Use two-finger clicks for right-click instead of lower-right corner + clickfinger_behavior = true + + # Control the speed of your scrolling + scroll_factor = 0.4 + } +} + +# Scroll nicely in the terminal +windowrule = scrolltouchpad 1.5, class:(Alacritty|kitty) +windowrule = scrolltouchpad 0.2, class:com.mitchellh.ghostty + +# Enable touchpad gestures for changing workspaces +# See https://wiki.hyprland.org/Configuring/Gestures/ +# gesture = 3, horizontal, workspace + +misc { + # key_press_enables_dpms = true # key press will trigger wake + # mouse_move_enables_dpms = true # mouse move will trigger wake +} diff --git a/roles/hyprland/templates/hyprland/looknfeel.conf.j2 b/roles/hyprland/templates/hyprland/looknfeel.conf.j2 new file mode 100644 index 00000000..5f386139 --- /dev/null +++ b/roles/hyprland/templates/hyprland/looknfeel.conf.j2 @@ -0,0 +1,147 @@ +# Look'n'feel configurations +# Inspired by Omarchy Hyprland setup +# Source: https://github.com/basecamp/omarchy/tree/8a37f3dce71b0764e3758cb86478c503a4a8746e/config/hypr/looknfeel.conf +# Defaults: https://github.com/basecamp/omarchy/blob/8a37f3dce71b0764e3758cb86478c503a4a8746e/default/hypr/looknfeel.conf + +# Refer to https://wiki.hyprland.org/Configuring/Variables/ +# Variables +$activeBorderColor = rgba(33ccffee) rgba(00ff99ee) 45deg +$inactiveBorderColor = rgba(595959aa) + +# https://wiki.hyprland.org/Configuring/Variables/#general +general { + gaps_in = 5 + gaps_out = 10 + + border_size = 2 + + # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors + col.active_border = $activeBorderColor + col.inactive_border = $inactiveBorderColor + + # Set to true enable resizing windows by clicking and dragging on borders and gaps + resize_on_border = false + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false + + layout = dwindle +} + +# https://wiki.hyprland.org/Configuring/Variables/#decoration +decoration { + rounding = 5 + + shadow { + enabled = true + range = 2 + render_power = 3 + color = rgba(1a1a1aee) + } + + # Change transparency of focused and unfocused windows + active_opacity = 1.0 + inactive_opacity = 0.75 + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur { + enabled = true + size = 2 + passes = 2 + special = true + brightness = 0.60 + contrast = 0.75 + } +} + +# https://wiki.hypr.land/Configuring/Variables/#group +group { + col.border_active = $activeBorderColor + col.border_inactive = $inactiveBorderColor + col.border_locked_active = -1 + col.border_locked_inactive = -1 + + groupbar { + font_size = 12 + font_family = monospace + font_weight_active = ultraheavy + font_weight_inactive = normal + + indicator_height = 0 + indicator_gap = 5 + height = 22 + gaps_in = 5 + gaps_out = 0 + + text_color = rgb(ffffff) + text_color_inactive = rgba(ffffff90) + col.active = rgba(00000040) + col.inactive = rgba(00000020) + + gradients = true + gradient_rounding = 0 + gradient_round_only_edges = false + } +} + + +# https://wiki.hyprland.org/Configuring/Variables/#animations +animations { + enabled = yes, please :) + + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = easeOutQuint,0.23,1,0.32,1 + bezier = easeInOutCubic,0.65,0.05,0.36,1 + bezier = linear,0,0,1,1 + bezier = almostLinear,0.5,0.5,0.75,1.0 + bezier = quick,0.15,0,0.1,1 + + animation = global, 1, 10, default + animation = border, 1, 5.39, easeOutQuint + animation = windows, 1, 4.79, easeOutQuint + animation = windowsIn, 1, 4.1, easeOutQuint, popin 87% + animation = windowsOut, 1, 1.49, linear, popin 87% + animation = fadeIn, 1, 1.73, almostLinear + animation = fadeOut, 1, 1.46, almostLinear + animation = fade, 1, 3.03, quick + animation = layers, 1, 3.81, easeOutQuint + animation = layersIn, 1, 4, easeOutQuint, fade + animation = layersOut, 1, 1.5, linear, fade + animation = fadeLayersIn, 1, 1.79, almostLinear + animation = fadeLayersOut, 1, 1.39, almostLinear + animation = workspaces, 0, 0, ease +} + +# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more +dwindle { + pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true # You probably want this + force_split = 2 # Always split on the right +} + +# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more +master { + new_status = master +} + +# https://wiki.hyprland.org/Configuring/Variables/#misc +misc { + disable_hyprland_logo = true + disable_splash_rendering = true + focus_on_activate = true + anr_missed_pings = 3 + new_window_takes_over_fullscreen = 1 +} + +# https://wiki.hypr.land/Configuring/Variables/#cursor +cursor { + hide_on_key_press = true +} + +# Style Gum confirm to match terminal theme +env = GUM_CONFIRM_PROMPT_FOREGROUND,6 # Cyan +env = GUM_CONFIRM_SELECTED_FOREGROUND,0 # Black +env = GUM_CONFIRM_SELECTED_BACKGROUND,2 # Green +env = GUM_CONFIRM_UNSELECTED_FOREGROUND,0 # Black +env = GUM_CONFIRM_UNSELECTED_BACKGROUND,8 # Dark grey diff --git a/roles/hyprland/templates/hyprland/monitors.conf.j2 b/roles/hyprland/templates/hyprland/monitors.conf.j2 new file mode 100644 index 00000000..2c649b5a --- /dev/null +++ b/roles/hyprland/templates/hyprland/monitors.conf.j2 @@ -0,0 +1,18 @@ +# Configure Hyprland Monitors +# See https://wiki.hypr.land/Configuring/Monitors/ + +{% if hyper_monitor_config is defined %} +{{ hyper_monitor_config }} +{% else %} +# Optimized for retina-class 2x displays, like 13" 2.8K, 27" 5K, 32" 6K. +# env = GDK_SCALE,2 +# monitor=,preferred,auto,auto + +# Good compromise for 27" or 32" 4K monitors (but fractional!) +# env = GDK_SCALE,1.75 +# monitor=,preferred,auto,1.6 + +# Straight 1x setup for low-resolution displays like 1080p or 1440p +env = GDK_SCALE,1 +monitor=,preferred,auto,1 +{% endif %} |
