From 010e4bc4d703f0b02e6ef7aac73dc006e0e41fd2 Mon Sep 17 00:00:00 2001
From: Daniel Lundin <dln@arity.se>
Date: Thu, 21 Nov 2024 14:52:59 +0100
Subject: [PATCH 1/2] ghostty: automatic switching between light/dark themes

---
 home/common/ghostty.nix | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/home/common/ghostty.nix b/home/common/ghostty.nix
index caa6992..5ecdc06 100644
--- a/home/common/ghostty.nix
+++ b/home/common/ghostty.nix
@@ -5,25 +5,11 @@
   pkgs,
   ...
 }:
-let
-  launch-ghostty = pkgs.writeShellApplication {
-    name = "launch-ghostty";
-    text = ''
-      if [ "$(gsettings get org.gnome.desktop.interface color-scheme)" = "'prefer-dark'" ]; then
-        theme="theme_dark"
-      else
-        theme="theme_light"
-      fi
-      exec ghostty --config-file="$HOME/.config/ghostty/$theme" "$@"
-    '';
-  };
-in
 {
   config = lib.mkIf config.patagia.desktop.enable {
 
     home.packages = with pkgs; [
       inputs.ghostty.packages.${pkgs.system}.default
-      launch-ghostty
     ];
 
     programs.ghostty = {
@@ -56,6 +42,7 @@ in
         window-padding-balance = true;
         window-padding-color = "extend";
         window-theme = "system";
+        theme = "light:PatagiaLight,dark:PatagiaDark";
 
         keybind = [
           "alt+shift+c=copy_to_clipboard"
@@ -76,7 +63,7 @@ in
       };
     };
 
-    xdg.configFile."ghostty/theme_dark".text = ''
+    xdg.configFile."ghostty/themes/PatagiaDark".text = ''
       background = #0d1117
       foreground = #b2b2b2
       cursor-color = #00d992
@@ -100,7 +87,7 @@ in
       palette = 15=#ffffff
     '';
 
-    xdg.configFile."ghostty/theme_light".text = ''
+    xdg.configFile."ghostty/themes/PatagiaLight".text = ''
       background = #fefeff
       foreground = #222222
       cursor-color = #aa0000
@@ -130,13 +117,13 @@ in
           "System"
           "TerminalEmulator"
         ];
-        exec = ''launch-ghostty --class=com.mitchellh.ghostty-local -e "tmux new-session -A -s0 -nt1"'';
+        exec = ''ghostty --class=com.mitchellh.ghostty-local -e "tmux new-session -A -s0 -nt1"'';
         genericName = "Ghostty (local)";
         icon = "com.mitchellh.ghostty";
         name = "Ghostty (local)";
         settings = {
           StartupWMClass = "com.mitchellh.ghostty-local";
-          TryExec = "launch-ghostty";
+          TryExec = "ghostty";
         };
         terminal = false;
         type = "Application";
@@ -147,13 +134,13 @@ in
           "System"
           "TerminalEmulator"
         ];
-        exec = ''launch-ghostty --class=com.mitchellh.ghostty-nemo -e "ssh -t nemo tmux new-session -A -s0 -nt1"'';
+        exec = ''ghostty --class=com.mitchellh.ghostty-nemo -e "ssh -t nemo tmux new-session -A -s0 -nt1"'';
         genericName = "Ghostty (nemo)";
         icon = "com.mitchellh.ghostty";
         name = "Ghostty (nemo)";
         settings = {
           StartupWMClass = "com.mitchellh.ghostty-nemo";
-          TryExec = "launch-ghostty";
+          TryExec = "ghostty";
         };
         terminal = false;
         type = "Application";

From 2994a40003ba2fd64ad816630d40fbc00d3edbf2 Mon Sep 17 00:00:00 2001
From: Daniel Lundin <dln@arity.se>
Date: Thu, 21 Nov 2024 14:52:59 +0100
Subject: [PATCH 2/2] nix: update

---
 flake.lock | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/flake.lock b/flake.lock
index 79dd621..5f5e30f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -103,11 +103,11 @@
         "zig": "zig"
       },
       "locked": {
-        "lastModified": 1731971697,
-        "narHash": "sha256-6JNMcpy0z19yOLBRt3eE4Rk4A96kcEsRv5+ym1hkv1c=",
+        "lastModified": 1732159111,
+        "narHash": "sha256-dIHQDtvPXsuv0z6DVgK6GvTh/jJn14B7Q9J0gT38Pl4=",
         "ref": "refs/heads/main",
-        "rev": "29c3a52e964a97dddaed876ce472aeb167774acf",
-        "revCount": 8021,
+        "rev": "63bf16ff00ccac2f730519b4f0dd14cde857792d",
+        "revCount": 8050,
         "type": "git",
         "url": "ssh://git@github.com/ghostty-org/ghostty"
       },
@@ -145,11 +145,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1731363552,
-        "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
+        "lastModified": 1732021966,
+        "narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=",
         "owner": "cachix",
         "repo": "git-hooks.nix",
-        "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
+        "rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
         "type": "github"
       },
       "original": {
@@ -209,11 +209,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1731968878,
-        "narHash": "sha256-+hTCwETOE9N8voTAaF+IzdUZz28Ws3LDpH90FWADrEE=",
+        "lastModified": 1732025103,
+        "narHash": "sha256-qjEI64RKvDxRyEarY0jTzrZMa8ebezh2DEZmJJrpVdo=",
         "owner": "nix-community",
         "repo": "home-manager",
-        "rev": "a42fa14b53ceab66274a21da480c9f8e06204173",
+        "rev": "a46e702093a5c46e192243edbd977d5749e7f294",
         "type": "github"
       },
       "original": {
@@ -232,11 +232,11 @@
         "nixpkgs": "nixpkgs"
       },
       "locked": {
-        "lastModified": 1732002290,
-        "narHash": "sha256-v17KxlCf0O7hoD9AjiF94T2nuZuh7ZREyI6Ww/Tr4R0=",
+        "lastModified": 1732173780,
+        "narHash": "sha256-pszcETwWdItBmb/Z2CqIiTfEiVl3K5TPpgFSwyQrghY=",
         "owner": "nix-community",
         "repo": "neovim-nightly-overlay",
-        "rev": "2a9b9e821c7f91eb6ae540925a453f9ebacd0513",
+        "rev": "151fab1aa35e1cbc6f5caad1e175e3d621d67951",
         "type": "github"
       },
       "original": {
@@ -248,11 +248,11 @@
     "neovim-src": {
       "flake": false,
       "locked": {
-        "lastModified": 1731949793,
-        "narHash": "sha256-ZXZInL8J38JaVpglSPa78ptn1zlqbaRHDtpa73CqpfI=",
+        "lastModified": 1732143030,
+        "narHash": "sha256-XKPsbjqHmwbiyzZdqNtw0tKxWLGFCkVB1+Awbi8tjQU=",
         "owner": "neovim",
         "repo": "neovim",
-        "rev": "989a37a594649528f28432388c0e7e28e8be2753",
+        "rev": "07db909eb5ae2a559771068be64439eba394cd61",
         "type": "github"
       },
       "original": {
@@ -311,11 +311,11 @@
     },
     "nixpkgs_2": {
       "locked": {
-        "lastModified": 1731676054,
-        "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
+        "lastModified": 1732014248,
+        "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
+        "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
         "type": "github"
       },
       "original": {