From 83f7d084c60fc1312860938c6a150ae056a62b4b Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Sat, 1 Mar 2025 14:00:08 +0100 Subject: [PATCH] make vscode settings mutable, try to make gtk theme work on hyprland and restart portals on login --- .config/i3/config | 2 +- home-manager/code.nix | 20 +++++++++++++++++++- home-manager/hyprland/hyprland-settings.nix | 10 +++++++++- home-manager/stylix.nix | 5 +++++ modules/graphical/hyprland.nix | 10 ++++++---- 5 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 9e529fe..21706f7 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -363,7 +363,7 @@ exec --no-startup-id sleep 5 && nvidia-settings -a "[gpu:0]/GPUGraphicsClockOffs #exec --no-startup-id sleep 7 && firefox https://github.com/endeavouros-team/endeavouros-i3wm-setup/blob/main/force-knowledge.md #exec --no-startup-id sleep 3 && thunar exec --no-startup-id i3-msg workspace $ws9; exec discord -exec --no-startup-id i3-msg workspace $ws10; exec firefox +exec --no-startup-id i3-msg workspace $ws10; exec floorp ############### # system tray # diff --git a/home-manager/code.nix b/home-manager/code.nix index 0ebefbe..a8da703 100644 --- a/home-manager/code.nix +++ b/home-manager/code.nix @@ -1,5 +1,20 @@ { osConfig, config, pkgs, inputs, lib, ... }: { - config = lib.mkIf osConfig.custom.graphical.code.enable { + config = lib.mkIf osConfig.custom.graphical.code.enable rec { + home.activation.makeVSCodeConfigWritable = let + configDirName = { + "vscode" = "Code"; + "vscode-insiders" = "Code - Insiders"; + "vscodium" = "VSCodium"; + }.${programs.vscode.package.pname}; + configPath = + "${config.xdg.configHome}/${configDirName}/User/settings.json"; + in { + after = [ "writeBoundary" ]; + before = [ ]; + data = '' + install -m 0640 "$(readlink ${configPath})" ${configPath} + ''; + }; programs.vscode = { enable = true; package = pkgs.vscodium; @@ -10,6 +25,7 @@ ]; "editor.mouseWheelZoom" = true; "files.autoSave" = "afterDelay"; + "clangd.path" = "/run/current-system/sw/bin/clangd"; }; extensions = with pkgs.vscode-extensions; [ jnoortheen.nix-ide @@ -17,6 +33,8 @@ myriad-dreamin.tinymist #tomoki1207.pdf latex-workshop is faster to preview pdf james-yu.latex-workshop + twxs.cmake + llvm-vs-code-extensions.vscode-clangd ]; }; }; diff --git a/home-manager/hyprland/hyprland-settings.nix b/home-manager/hyprland/hyprland-settings.nix index 4e8666c..4a9a0c9 100644 --- a/home-manager/hyprland/hyprland-settings.nix +++ b/home-manager/hyprland/hyprland-settings.nix @@ -3,6 +3,13 @@ let cfg = osConfig.custom.graphical.hyprland; isPc = osConfig.networking.hostName == "kop-pc"; isLaptop = osConfig.networking.hostName == "nix-laptop"; + restartPortals = pkgs.writeShellScript "restart-portals" '' + #!/usr/bin/env bash + systemctl --user restart xdg-desktop-portal-gtk + systemctl --user restart xdg-desktop-portal-hyprland + sleep 4 + systemctl --user restart xdg-desktop-portal + ''; in { config = lib.mkIf cfg.enable { @@ -290,9 +297,10 @@ in { ] ++ lib.lists.optionals (osConfig.networking.hostName == "kop-pc") [ "[workspace 9 silent] discord" "[workspace 9 silent] discordcanary" - "[workspace 10 silent] firefox" + "[workspace 10 silent] floorp" ] ++ [ "sleep 3 && ${pkgs.waybar}/bin/waybar &" + "${restartPortals}" ]; }; extraConfig = let diff --git a/home-manager/stylix.nix b/home-manager/stylix.nix index 0183e24..1f8cdad 100644 --- a/home-manager/stylix.nix +++ b/home-manager/stylix.nix @@ -8,7 +8,12 @@ in { hyprlock.enable = false; hyprland.enable = false; waybar.enable = false; + gtk.flatpakSupport.enable = true; #edits ~/.themes/adw-gtk3 }; }; + + wayland.windowManager.hyprland.settings.env = lib.mkIf osConfig.custom.graphical.hyprland.enable [ + "GTK_THEME,adw-gtk3" + ]; }; } diff --git a/modules/graphical/hyprland.nix b/modules/graphical/hyprland.nix index a235a0f..1a544be 100644 --- a/modules/graphical/hyprland.nix +++ b/modules/graphical/hyprland.nix @@ -14,7 +14,8 @@ in { xkb.variant = config.mainUser.variant; enable = true; }; - services.displayManager.sddm.enable = !config.services.xserver.displayManager.gdm.enable; + services.displayManager.sddm.enable = + !config.services.xserver.displayManager.gdm.enable; #nix.settings = { # substituters = [ "https://hyprland.cachix.org" ]; @@ -24,7 +25,10 @@ in { #}; xdg.portal.enable = true; - xdg.portal.extraPortals = lib.mkDefault [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ]; + xdg.portal.extraPortals = lib.mkDefault [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-hyprland + ]; programs.hyprland = { enable = true; }; @@ -46,8 +50,6 @@ in { #qt6.qmake #qt6.qtwayland #waybar - #xdg-desktop-portal-hyprland - #xdg-desktop-portal-gtk #xdg-utils #xwayland ];