summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-10 18:49:44 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-10 18:49:44 +0200
commit2760491ebf49ead138b877ae5de691292dca0f40 (patch)
tree5800e4d12f8efa3510c32ae35f410b6b689ac60c
parent448b78eaeb6ea80d44686f62419dd2b5892a6da9 (diff)
Replace hyprland monitors with kanshi profiles
-rw-r--r--host_vars/desktop.local.ymlbin818 -> 892 bytes
-rw-r--r--host_vars/desktop.local.yml.example10
-rw-r--r--host_vars/laptop.local.ymlbin881 -> 937 bytes
-rw-r--r--host_vars/laptop.local.yml.example7
-rw-r--r--host_vars/macbook.local.ymlbin885 -> 1258 bytes
-rw-r--r--host_vars/macbook.local.yml.example15
-rw-r--r--roles/hyprland/defaults/main.yml1
-rw-r--r--roles/hyprland/meta/argument_specs.yml9
-rw-r--r--roles/hyprland/tasks/main.yml16
-rw-r--r--roles/hyprland/templates/hypr/autostart.conf.j21
-rw-r--r--roles/hyprland/templates/hypr/kanshi.conf.j27
-rw-r--r--roles/hyprland/templates/hypr/monitors.conf.j217
-rw-r--r--roles/hyprland/templates/uwsm/env.j21
13 files changed, 63 insertions, 21 deletions
diff --git a/host_vars/desktop.local.yml b/host_vars/desktop.local.yml
index 9abcecf7..53939d8a 100644
--- a/host_vars/desktop.local.yml
+++ b/host_vars/desktop.local.yml
Binary files differ
diff --git a/host_vars/desktop.local.yml.example b/host_vars/desktop.local.yml.example
index 7017c6de..d24dcff2 100644
--- a/host_vars/desktop.local.yml.example
+++ b/host_vars/desktop.local.yml.example
@@ -41,10 +41,12 @@ fonts_extra:
- "noto-fonts"
hyprland_nvidia: true
-hyprland_monitors: |
- env = GDK_SCALE,2
- monitor=HDMI-A-1,3840x2160@60,auto-left,1.6
- monitor=DP-1,3840x2160@60,auto-right,1.6
+hyprland_gdk_scale: 2
+hyprland_kanshi_profiles: |
+ profile home {
+ output "Left Monitor" mode 3840x2160@60Hz position 0,0 scale 1.6
+ output "Right Monitor" mode 3840x2160@60Hz position 2400,0 scale 1.6
+ }
zen_browser_install_browserpass: true
zen_browser_install_passff: false
diff --git a/host_vars/laptop.local.yml b/host_vars/laptop.local.yml
index 8674e040..21e21e28 100644
--- a/host_vars/laptop.local.yml
+++ b/host_vars/laptop.local.yml
Binary files differ
diff --git a/host_vars/laptop.local.yml.example b/host_vars/laptop.local.yml.example
index c3f4ff18..ba9536da 100644
--- a/host_vars/laptop.local.yml.example
+++ b/host_vars/laptop.local.yml.example
@@ -39,4 +39,11 @@ fonts_extra:
- "fonts-font-awesome"
- "fonts-google-fira"
+hyprland_nvidia: false
+hyprland_gdk_scale: 2
+hyprland_kanshi_profiles: |
+ profile default {
+ output * mode preferred position 0,0 scale 1.6
+ }
+
logind_lid_ac_action: "ignore"
diff --git a/host_vars/macbook.local.yml b/host_vars/macbook.local.yml
index 9bdb3650..b9a4e517 100644
--- a/host_vars/macbook.local.yml
+++ b/host_vars/macbook.local.yml
Binary files differ
diff --git a/host_vars/macbook.local.yml.example b/host_vars/macbook.local.yml.example
index cb8aae6d..c20ce1da 100644
--- a/host_vars/macbook.local.yml.example
+++ b/host_vars/macbook.local.yml.example
@@ -53,4 +53,19 @@ firefox_extra_extensions:
installation_mode: "force_installed"
install_url: "https://addons.mozilla.org/firefox/downloads/latest/tabby-window-tab-manager/latest.xpi"
+hyprland_nvidia: false
+# Output criteria must be the full "make model serial" string reported by
+# `hyprctl monitors` (use "Unknown" for any missing field), not just the
+# model name — otherwise the profile silently never matches and kanshi
+# does nothing.
+hyprland_kanshi_profiles: |
+ profile docked {
+ output "Apple Computer Inc Built-in Display Unknown" disable
+ output "Some Company LEFT-MODEL 1234ABCD" mode [email protected] position 0,0 scale 1.0
+ output "Some Company RIGHT-MODEL 5678EFGH" mode [email protected] position 2560,0 scale 1.0
+ }
+ profile standalone {
+ output "Apple Computer Inc Built-in Display Unknown" mode 2880x1800@60Hz position 0,0 scale 2.0
+ }
+
logind_lid_ac_action: "ignore"
diff --git a/roles/hyprland/defaults/main.yml b/roles/hyprland/defaults/main.yml
index b385f701..3781ee44 100644
--- a/roles/hyprland/defaults/main.yml
+++ b/roles/hyprland/defaults/main.yml
@@ -1,2 +1,3 @@
---
hyprland_nvidia: false
+hyprland_gdk_scale: 1
diff --git a/roles/hyprland/meta/argument_specs.yml b/roles/hyprland/meta/argument_specs.yml
index 917b9ff9..d5da1e36 100644
--- a/roles/hyprland/meta/argument_specs.yml
+++ b/roles/hyprland/meta/argument_specs.yml
@@ -6,3 +6,12 @@ argument_specs:
type: "bool"
default: false
description: "Enable NVIDIA-specific environment variables for Wayland"
+ hyprland_gdk_scale:
+ type: "int"
+ default: 1
+ description: "GDK_SCALE value exported via uwsm env; use 2 for HiDPI/4K displays with fractional scaling"
+ hyprland_kanshi_profiles:
+ type: "str"
+ description: >-
+ Raw kanshi profile config deployed to ~/.config/kanshi/config;
+ falls back to a generic single-monitor profile when unset
diff --git a/roles/hyprland/tasks/main.yml b/roles/hyprland/tasks/main.yml
index 7a25e7c2..d14b556c 100644
--- a/roles/hyprland/tasks/main.yml
+++ b/roles/hyprland/tasks/main.yml
@@ -11,6 +11,7 @@
- "hyprshot"
- "satty"
- "hyprland"
+ - "kanshi"
state: "present"
- name: "Ensure hyprland AUR packages are installed"
@@ -50,7 +51,9 @@
- "/etc/hypr/scripts"
- "/etc/xdg/uwsm"
- "/etc/xdg/xdg-desktop-portal"
+ - "/etc/xdg/kanshi"
- "{{ ansible_facts['env']['HOME'] }}/.config/hypr"
+ - "{{ ansible_facts['env']['HOME'] }}/.config/kanshi"
- name: "Configure system defaults"
become: true
@@ -77,6 +80,8 @@
dest: "/etc/hypr/hypridle.conf"
- src: "hypr/hyprland.conf.j2"
dest: "/etc/hypr/hyprland.conf"
+ - src: "hypr/kanshi.conf.j2"
+ dest: "/etc/xdg/kanshi/config"
- src: "uwsm/env.j2"
dest: "/etc/xdg/uwsm/env"
- src: "uwsm/env-hyprland.j2"
@@ -108,6 +113,17 @@
# System defaults
source = /etc/hypr/hypridle.conf
+ - name: "Configure user kanshi configuration"
+ ansible.builtin.blockinfile:
+ path: "{{ ansible_facts['env']['HOME'] }}/.config/kanshi/config"
+ state: "present"
+ prepend_newline: true
+ append_newline: true
+ marker: "# ==== {mark} ANSIBLE KANSHI CONFIG"
+ block: |
+ # System defaults
+ include /etc/xdg/kanshi/config
+
- name: "Copy hyprland scripts"
become: true
ansible.builtin.copy:
diff --git a/roles/hyprland/templates/hypr/autostart.conf.j2 b/roles/hyprland/templates/hypr/autostart.conf.j2
index ec06c627..852e86ec 100644
--- a/roles/hyprland/templates/hypr/autostart.conf.j2
+++ b/roles/hyprland/templates/hypr/autostart.conf.j2
@@ -6,3 +6,4 @@ exec-once = uwsm-app -- waybar
exec-once = uwsm-app -- swaybg -i ~/.config/hyprtheme/current/wallpaper -m fill
exec-once = uwsm-app -- clipse -listen
exec-once = uwsm app -- hyprsunset
+exec-once = uwsm-app -- kanshi
diff --git a/roles/hyprland/templates/hypr/kanshi.conf.j2 b/roles/hyprland/templates/hypr/kanshi.conf.j2
new file mode 100644
index 00000000..18161771
--- /dev/null
+++ b/roles/hyprland/templates/hypr/kanshi.conf.j2
@@ -0,0 +1,7 @@
+{% if hyprland_kanshi_profiles is defined %}
+{{ hyprland_kanshi_profiles }}
+{% else %}
+profile default {
+ output * mode preferred position 0,0 scale 1
+}
+{% endif %}
diff --git a/roles/hyprland/templates/hypr/monitors.conf.j2 b/roles/hyprland/templates/hypr/monitors.conf.j2
index 266cb0af..bfd5da29 100644
--- a/roles/hyprland/templates/hypr/monitors.conf.j2
+++ b/roles/hyprland/templates/hypr/monitors.conf.j2
@@ -1,20 +1,3 @@
# vim: set filetype=hyprlang.ansible :
-# Configure Hyprland Monitors
-# See https://wiki.hypr.land/Configuring/Monitors/
-
-{% if hyprland_monitors is defined %}
-{{ hyprland_monitors }}
-{% 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 %}
diff --git a/roles/hyprland/templates/uwsm/env.j2 b/roles/hyprland/templates/uwsm/env.j2
index 9a360ce6..f0a03b64 100644
--- a/roles/hyprland/templates/uwsm/env.j2
+++ b/roles/hyprland/templates/uwsm/env.j2
@@ -4,6 +4,7 @@
# See https://wiki.hypr.land/Configuring/Environment-variables/
export XCURSOR_SIZE=24
+export GDK_SCALE={{ hyprland_gdk_scale }}
# Fix steam scaling
export STEAM_FORCE_DESKTOPUI_SCALING=1.6