1 parent
80ec3dfdd3
commit
079cceb554
57 files changed
+4092
-538
No files matched your search
@@ -12,8 +12,11 @@ local ipc = "noctalia msg "
|
||||
---- APPLICATIONS ----
|
||||
----------------------
|
||||
|
||||
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(nix.terminal))
|
||||
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(nix.fileManager))
|
||||
-- Started through uwsm-app (nix.appLauncher), so each app is a scope of the
|
||||
-- session and is stopped before the compositor at logout. The short-lived
|
||||
-- commands further down (noctalia msg, screenshots) are started directly.
|
||||
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(nix.appLauncher .. " " .. nix.terminal))
|
||||
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(nix.appLauncher .. " " .. nix.fileManager))
|
||||
|
||||
---------------
|
||||
---- WINDOWS ----
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# Hyprland desktop, both halves of one feature:
|
||||
# NixOS UWSM-managed compositor, SDDM with autologin of the owner,
|
||||
# portals, keyring and the small services a desktop needs.
|
||||
# NixOS UWSM-managed compositor, portals, keyring and the small
|
||||
# services a desktop needs.
|
||||
# home-manager the user configuration. Hyprland reads Lua: the real config
|
||||
# is in the .lua files next to this file; Nix only passes in the
|
||||
# values that come from elsewhere (`require("nixvars")`).
|
||||
# The NixOS half adds the home-manager half to the owner, so a host imports
|
||||
# `nixos.hyprland` once. Noctalia, audio and fonts are separate aspects.
|
||||
# `nixos.hyprland` once. The display manager (sddm), Noctalia, audio and fonts
|
||||
# are separate aspects.
|
||||
{ config, ... }:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
@@ -24,15 +25,6 @@ in
|
||||
xwayland.enable = true;
|
||||
};
|
||||
|
||||
services.displayManager.sddm = {
|
||||
enable = true;
|
||||
wayland.enable = true;
|
||||
settings.Autologin = {
|
||||
Session = "hyprland.desktop";
|
||||
User = owner.name;
|
||||
};
|
||||
};
|
||||
|
||||
xdg.portal.extraPortals = [
|
||||
pkgs.xdg-desktop-portal-gtk
|
||||
pkgs.xdg-desktop-portal-hyprland
|
||||
@@ -44,9 +36,6 @@ in
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
||||
# Electron/Chromium apps use native Wayland.
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
||||
# Removable drives and trash/mounts in the file manager.
|
||||
services.udisks2.enable = true;
|
||||
services.gvfs.enable = true;
|
||||
@@ -89,9 +78,29 @@ in
|
||||
kbOptions = osConfig.services.xserver.xkb.options;
|
||||
terminal = "wezterm";
|
||||
fileManager = "dolphin";
|
||||
# Binds start apps through this, so each runs as its own scope of the
|
||||
# session (app-graphical.slice) and is stopped before the compositor at
|
||||
# logout, instead of living inside Hyprland's unit.
|
||||
appLauncher = "${lib.getExe' osConfig.programs.uwsm.package "uwsm-app"} --";
|
||||
cursorSize = if cursor.enable then cursor.size else 24;
|
||||
cursorTheme = if cursor.enable then cursor.name else "";
|
||||
};
|
||||
|
||||
# The only place these are defined. UWSM sources uwsm/env-<desktop>
|
||||
# (lowercased XDG_CURRENT_DESKTOP) before the compositor starts and puts
|
||||
# the result into the systemd and D-Bus activation environments, so every
|
||||
# app of the Hyprland session sees them, and nothing outside it does.
|
||||
waylandEnv = {
|
||||
# Electron/Chromium apps use native Wayland.
|
||||
NIXOS_OZONE_WL = "1";
|
||||
ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
||||
GDK_BACKEND = "wayland,x11,*";
|
||||
QT_QPA_PLATFORM = "wayland;xcb";
|
||||
# Falls back to X11 when an SDL app has no Wayland support, but some
|
||||
# older SDL games still break with it (set SDL_VIDEODRIVER=x11 for those).
|
||||
SDL_VIDEODRIVER = "wayland,x11";
|
||||
CLUTTER_BACKEND = "wayland";
|
||||
};
|
||||
in
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
@@ -123,6 +132,26 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile."uwsm/env-hyprland".text = lib.concatLines (
|
||||
lib.mapAttrsToList (name: value: "export ${name}=${lib.escapeShellArg value}") waylandEnv
|
||||
);
|
||||
|
||||
# Home-manager's session variables (hm-session-vars.sh) reach shells only.
|
||||
# The compositor, and so the binds, and the user services (Noctalia, and
|
||||
# so the launcher) inherit the systemd user manager's environment instead,
|
||||
# which systemd.user.sessionVariables (environment.d) feeds. Of the
|
||||
# variables home-manager sets, the editor is the one programs outside a
|
||||
# shell look for. Taken from home.sessionVariables, so the neovim aspect
|
||||
# stays the only place that defines them (and nothing breaks when it is
|
||||
# not imported). They apply from the next login.
|
||||
systemd.user.sessionVariables = lib.filterAttrs (
|
||||
name: _:
|
||||
builtins.elem name [
|
||||
"EDITOR"
|
||||
"VISUAL"
|
||||
]
|
||||
) config.home.sessionVariables;
|
||||
|
||||
# Tools the binds call (screenshots, file manager).
|
||||
home.packages = with pkgs; [
|
||||
grim
|
||||
|
||||
@@ -87,3 +87,41 @@ hl.window_rule({
|
||||
|
||||
float = true,
|
||||
})
|
||||
|
||||
-- Proton games map as XWayland windows of class steam_app_<id>, but so do the
|
||||
-- launchers, installers and tools that run in the same prefix (Paradox,
|
||||
-- Rockstar, EA app, Ubisoft Connect, redistributable setups, crash reporters),
|
||||
-- so the class alone cannot tell them apart; the title does. Static rules run
|
||||
-- once, when the window maps: a launcher that sets its title later counts as a
|
||||
-- game. Native Linux Steam games do not use this class and are not covered.
|
||||
local protonClass = "^steam_app_\\d+$"
|
||||
local launcherTitle = "(?i).*("
|
||||
.. "launch(er|ing)|setup|install|updat|redistributable|config|settings"
|
||||
.. "|\\berrors?\\b|crash(ed| ?report| ?handler|pad)|eula|licen[cs]e agreement"
|
||||
.. "|\\bea app\\b|ubisoft connect|\\buplay\\b|social club|battle\\.net|gog galaxy"
|
||||
.. ").*"
|
||||
|
||||
-- Games start fullscreen. float = false skips windows Hyprland floats on its own
|
||||
-- (dialogs, transient and fixed-size windows, menus, tooltips); the negated
|
||||
-- title skips launchers. A game can still leave fullscreen through its own
|
||||
-- settings: suppress_event is deliberately not set.
|
||||
hl.window_rule({
|
||||
name = "steam-games-fullscreen",
|
||||
match = {
|
||||
class = protonClass,
|
||||
title = "negative:" .. launcherTitle,
|
||||
float = false,
|
||||
},
|
||||
|
||||
fullscreen = true,
|
||||
})
|
||||
|
||||
-- Launchers and popups of those games float in the middle of the screen. Same
|
||||
-- title regex as above, not negated, so the two rules never match one window.
|
||||
hl.window_rule({
|
||||
name = "steam-games-launchers",
|
||||
match = { class = protonClass, title = launcherTitle },
|
||||
|
||||
float = true,
|
||||
center = true,
|
||||
})
|
||||
@@ -8,7 +8,7 @@ local nix = require("nixvars")
|
||||
|
||||
-- Any output, native mode, placed automatically. Use mode = "highrr" to prefer
|
||||
-- the highest refresh rate instead.
|
||||
hl.env("AQ_DRM_DEVICES", "/dev/dri/card1:/dev/dri/card0")
|
||||
-- hl.env("AQ_DRM_DEVICES", "/dev/dri/card1:/dev/dri/card0")
|
||||
hl.monitor({
|
||||
output = "DP-1",
|
||||
mode = "preferred",
|
||||
@@ -51,10 +51,18 @@ hl.monitor({
|
||||
---- ENVIRONMENT VARIABLES ----
|
||||
-------------------------------
|
||||
|
||||
hl.env("XCURSOR_SIZE", tostring(nix.cursorSize))
|
||||
hl.env("HYPRCURSOR_SIZE", tostring(nix.cursorSize))
|
||||
-- The Wayland toolkit variables (GDK_BACKEND, QT_QPA_PLATFORM, ...) are exported
|
||||
-- for the whole session by UWSM (uwsm/env-hyprland, see default.nix), not here.
|
||||
|
||||
-- hl.env sets a variable for Hyprland and what it starts. With true as the third
|
||||
-- argument it also exports it to the systemd user manager and the D-Bus
|
||||
-- activation environment (systemctl --user import-environment and
|
||||
-- dbus-update-activation-environment --systemd), so apps started by Noctalia,
|
||||
-- the portals or D-Bus activation use the same cursor.
|
||||
hl.env("XCURSOR_SIZE", tostring(nix.cursorSize), true)
|
||||
hl.env("HYPRCURSOR_SIZE", tostring(nix.cursorSize), true)
|
||||
if nix.cursorTheme ~= "" then
|
||||
hl.env("XCURSOR_THEME", nix.cursorTheme)
|
||||
hl.env("XCURSOR_THEME", nix.cursorTheme, true)
|
||||
end
|
||||
|
||||
-----------------------
|
||||
|
||||
Reference in new issue
Block a user