From 6d4bfdb7b37d675bd082ca262c238281a8162ea0 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Sun, 1 Oct 2023 14:17:04 -0500 Subject: [PATCH] hypr code fixes and such --- home/features/desktop/default.nix | 1 + home/features/desktop/gtk.nix | 9 ++++++ home/features/desktop/hyprland/binds.nix | 4 +++ home/features/desktop/hyprland/default.nix | 6 ++-- .../desktop/hyprland/systemd-fixes.nix | 30 +++++++++++++++++++ home/features/desktop/hyprland/tty-init.nix | 9 ++++++ hosts/pixnix/default.nix | 5 ++++ 7 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 home/features/desktop/gtk.nix create mode 100644 home/features/desktop/hyprland/systemd-fixes.nix create mode 100644 home/features/desktop/hyprland/tty-init.nix diff --git a/home/features/desktop/default.nix b/home/features/desktop/default.nix index 1f35703..562205e 100644 --- a/home/features/desktop/default.nix +++ b/home/features/desktop/default.nix @@ -2,6 +2,7 @@ # Common GUI apps imports = [ ./firefox.nix + ./gtk.nix ./vscode.nix ]; diff --git a/home/features/desktop/gtk.nix b/home/features/desktop/gtk.nix new file mode 100644 index 0000000..7f24657 --- /dev/null +++ b/home/features/desktop/gtk.nix @@ -0,0 +1,9 @@ +{ config, pkgs, inputs, ... }: { + gtk = { + enable = true; + }; + + services.xsettingsd = { + enable = true; + }; +} diff --git a/home/features/desktop/hyprland/binds.nix b/home/features/desktop/hyprland/binds.nix index eea3046..68c4775 100644 --- a/home/features/desktop/hyprland/binds.nix +++ b/home/features/desktop/hyprland/binds.nix @@ -3,6 +3,10 @@ # See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER + # Alt-Tab action + bind = ALT, Tab, cyclenext, + bind = ALT, Tab, bringactivetotop, + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, Q, exec, kitty bind = $mainMod, C, killactive, diff --git a/home/features/desktop/hyprland/default.nix b/home/features/desktop/hyprland/default.nix index 7e0e256..c4a51de 100644 --- a/home/features/desktop/hyprland/default.nix +++ b/home/features/desktop/hyprland/default.nix @@ -2,14 +2,16 @@ imports = [ ./binds.nix + # ./systemd-fixes.nix + ./tty-init.nix ../wayland-wm ]; wayland.windowManager.hyprland = { enable = true; systemdIntegration = true; - xwayland.enable = true; - recommendedEnvironment = true; +# xwayland.enable = true; +# recommendedEnvironment = true; extraConfig = '' # This is an example Hyprland config file. # diff --git a/home/features/desktop/hyprland/systemd-fixes.nix b/home/features/desktop/hyprland/systemd-fixes.nix new file mode 100644 index 0000000..3d31e09 --- /dev/null +++ b/home/features/desktop/hyprland/systemd-fixes.nix @@ -0,0 +1,30 @@ +{ lib, config, ... }: +let + cfg = config.wayland.windowManager.hyprland; +in +{ + config = lib.mkIf (cfg.enable && cfg.systemdIntegration) { + # stolen from https://github.com/alebastr/sway-systemd/commit/0fdb2c4b10beb6079acd6073c5b3014bd58d3b74 + systemd.user.targets.hyprland-session-shutdown = { + Unit = { + Description = "Shutdown running Hyprland session"; + DefaultDependencies = "no"; + StopWhenUnneeded = "true"; + + Conflicts = [ + "graphical-session.target" + "graphical-session-pre.target" + "hyprland-session.target" + ]; + After = [ + "graphical-session.target" + "graphical-session-pre.target" + "hyprland-session.target" + ]; + }; + }; + wayland.windowManager.hyprland.settings.bind = lib.mkAfter [ + "SUPERSHIFT,e,exec,systemctl --user start hyprland-session-shutdown.target; hyprctl dispatch exit" + ]; + }; +} diff --git a/home/features/desktop/hyprland/tty-init.nix b/home/features/desktop/hyprland/tty-init.nix new file mode 100644 index 0000000..9ca836c --- /dev/null +++ b/home/features/desktop/hyprland/tty-init.nix @@ -0,0 +1,9 @@ +{ + programs = { + fish.loginShellInit = '' + if test (tty) = "/dev/tty1" + exec Hyprland &> /dev/null + end + ''; + }; +} diff --git a/hosts/pixnix/default.nix b/hosts/pixnix/default.nix index 6c8638b..f069087 100644 --- a/hosts/pixnix/default.nix +++ b/hosts/pixnix/default.nix @@ -22,6 +22,11 @@ networkmanager.enable = true; }; + xdg.portal = { + enable = true; + wlr.enable = true; + }; + system.stateVersion = "23.05"; }