Compare commits

...

2 commits

Author SHA1 Message Date
2994a40003
nix: update 2024-11-21 15:16:57 +01:00
010e4bc4d7
ghostty: automatic switching between light/dark themes 2024-11-21 15:16:16 +01:00
2 changed files with 26 additions and 39 deletions

38
flake.lock generated
View file

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

View file

@ -5,25 +5,11 @@
pkgs, 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 { config = lib.mkIf config.patagia.desktop.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
inputs.ghostty.packages.${pkgs.system}.default inputs.ghostty.packages.${pkgs.system}.default
launch-ghostty
]; ];
programs.ghostty = { programs.ghostty = {
@ -56,6 +42,7 @@ in
window-padding-balance = true; window-padding-balance = true;
window-padding-color = "extend"; window-padding-color = "extend";
window-theme = "system"; window-theme = "system";
theme = "light:PatagiaLight,dark:PatagiaDark";
keybind = [ keybind = [
"alt+shift+c=copy_to_clipboard" "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 background = #0d1117
foreground = #b2b2b2 foreground = #b2b2b2
cursor-color = #00d992 cursor-color = #00d992
@ -100,7 +87,7 @@ in
palette = 15=#ffffff palette = 15=#ffffff
''; '';
xdg.configFile."ghostty/theme_light".text = '' xdg.configFile."ghostty/themes/PatagiaLight".text = ''
background = #fefeff background = #fefeff
foreground = #222222 foreground = #222222
cursor-color = #aa0000 cursor-color = #aa0000
@ -130,13 +117,13 @@ in
"System" "System"
"TerminalEmulator" "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)"; genericName = "Ghostty (local)";
icon = "com.mitchellh.ghostty"; icon = "com.mitchellh.ghostty";
name = "Ghostty (local)"; name = "Ghostty (local)";
settings = { settings = {
StartupWMClass = "com.mitchellh.ghostty-local"; StartupWMClass = "com.mitchellh.ghostty-local";
TryExec = "launch-ghostty"; TryExec = "ghostty";
}; };
terminal = false; terminal = false;
type = "Application"; type = "Application";
@ -147,13 +134,13 @@ in
"System" "System"
"TerminalEmulator" "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)"; genericName = "Ghostty (nemo)";
icon = "com.mitchellh.ghostty"; icon = "com.mitchellh.ghostty";
name = "Ghostty (nemo)"; name = "Ghostty (nemo)";
settings = { settings = {
StartupWMClass = "com.mitchellh.ghostty-nemo"; StartupWMClass = "com.mitchellh.ghostty-nemo";
TryExec = "launch-ghostty"; TryExec = "ghostty";
}; };
terminal = false; terminal = false;
type = "Application"; type = "Application";