add kitty conf and auto kitty theme change

This commit is contained in:
2024-05-05 17:41:27 +01:00
parent 1b884b440e
commit 3557e89936
9 changed files with 2746 additions and 3 deletions

3
.gitignore vendored
View File

@@ -76,3 +76,6 @@ $RECYCLE.BIN/
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux
.env
.zshenv

1
.zshenv.example Normal file
View File

@@ -0,0 +1 @@
KITTY_REMOTE_CONTROL_PW=

66
auto_theme.py Normal file
View File

@@ -0,0 +1,66 @@
import os
import sys
import signal
import subprocess
import time
from pathlib import Path
from threading import Thread
def main():
t = Thread(target=check_dark_mode)
t.start()
def check_dark_mode():
while True:
try:
result = subprocess.run(["defaults", "read", "-g", "AppleInterfaceStyle"])
# the command above returns an error if the system is in light mode
# and returns "Dark" in dark mode
if result.returncode == 1:
enable_light_theme()
else:
enable_dark_theme()
time.sleep(3)
except:
# the command above returns an error if the system is in light mode
# and returns "Dark" in dark mode
enable_light_theme()
time.sleep(3)
def set_kitty_theme(theme: str):
kitty_light_theme_conf = Path.home() / "dotfiles" / "kitty" / f"{theme}.conf"
subprocess.run(
[
"kitten",
"@",
"--password-env=KITTY_REMOTE_CONTROL_PW",
"set-colors",
"--all",
"--configured",
kitty_light_theme_conf.resolve().as_posix(),
]
)
def enable_light_theme():
set_kitty_theme("Catppuccin-Latte")
def enable_dark_theme():
set_kitty_theme("Catppuccin-Mocha")
if __name__ == "__main__":
def signal_handler(sig, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
main()
signal.pause()

View File

@@ -0,0 +1,80 @@
# vim:ft=kitty
## name: Catppuccin-Latte
## author: Pocco81 (https://github.com/Pocco81)
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/latte.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #4C4F69
background #EFF1F5
selection_foreground #EFF1F5
selection_background #DC8A78
# Cursor colors
cursor #DC8A78
cursor_text_color #EFF1F5
# URL underline color when hovering with mouse
url_color #DC8A78
# Kitty window border colors
active_border_color #7287FD
inactive_border_color #9CA0B0
bell_border_color #DF8E1D
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #EFF1F5
active_tab_background #8839EF
inactive_tab_foreground #4C4F69
inactive_tab_background #9CA0B0
tab_bar_background #BCC0CC
# Colors for marks (marked text in the terminal)
mark1_foreground #EFF1F5
mark1_background #7287fD
mark2_foreground #EFF1F5
mark2_background #8839EF
mark3_foreground #EFF1F5
mark3_background #209FB5
# The 16 terminal colors
# black
color0 #5C5F77
color8 #6C6F85
# red
color1 #D20F39
color9 #D20F39
# green
color2 #40A02B
color10 #40A02B
# yellow
color3 #DF8E1D
color11 #DF8E1D
# blue
color4 #1E66F5
color12 #1E66F5
# magenta
color5 #EA76CB
color13 #EA76CB
# cyan
color6 #179299
color14 #179299
# white
color7 #ACB0BE
color15 #BCC0CC

View File

@@ -0,0 +1,80 @@
# vim:ft=kitty
## name: Catppuccin-Mocha
## author: Pocco81 (https://github.com/Pocco81)
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #CDD6F4
background #1E1E2E
selection_foreground #1E1E2E
selection_background #F5E0DC
# Cursor colors
cursor #F5E0DC
cursor_text_color #1E1E2E
# URL underline color when hovering with mouse
url_color #F5E0DC
# Kitty window border colors
active_border_color #B4BEFE
inactive_border_color #6C7086
bell_border_color #F9E2AF
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #11111B
active_tab_background #CBA6F7
inactive_tab_foreground #CDD6F4
inactive_tab_background #181825
tab_bar_background #11111B
# Colors for marks (marked text in the terminal)
mark1_foreground #1E1E2E
mark1_background #B4BEFE
mark2_foreground #1E1E2E
mark2_background #CBA6F7
mark3_foreground #1E1E2E
mark3_background #74C7EC
# The 16 terminal colors
# black
color0 #45475A
color8 #585B70
# red
color1 #F38BA8
color9 #F38BA8
# green
color2 #A6E3A1
color10 #A6E3A1
# yellow
color3 #F9E2AF
color11 #F9E2AF
# blue
color4 #89B4FA
color12 #89B4FA
# magenta
color5 #F5C2E7
color13 #F5C2E7
# cyan
color6 #94E2D5
color14 #94E2D5
# white
color7 #BAC2DE
color15 #A6ADC8

2489
kitty/kitty.conf Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -100,12 +100,12 @@ function setup_plugins()
require("auto-dark-mode").setup({
set_dark_mode = function()
vim.opt.background = "dark"
vim.cmd("colorscheme duskfox")
vim.cmd("colorscheme catppuccin-mocha")
end,
set_light_mode = function()
vim.opt.background = "light"
vim.cmd("colorscheme dawnfox")
vim.cmd("colorscheme catppuccin-latte")
end,
})
@@ -374,6 +374,20 @@ function config_vim()
extension = {
typ = "typst",
},
filename = {
["Dockerfile"] = "dockerfile",
["docker-compose.yml"] = "yaml.docker-compose",
["docker-compose.yaml"] = "yaml.docker-compose",
["compose.yml"] = "yaml.docker-compose",
["compose.yaml"] = "yaml.docker-compose",
},
pattern = {
["Dockerfile.*"] = "dockerfile",
["docker%-compose%b..yml"] = "yaml.docker-compose",
["compose%b..yml"] = "yaml.docker-compose",
},
})
local augroup = vim.api.nvim_create_augroup
@@ -384,13 +398,20 @@ function config_vim()
command = ":FormatWrite",
})
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
vim.diagnostic.config({
virtual_text = false,
update_in_insert = true,
})
local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶 ", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
end
PLUGINS = {
{ "EdenEast/nightfox.nvim" },
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{ "shortcuts/no-neck-pain.nvim" },
{ "nvim-tree/nvim-web-devicons" },
{ "nvim-tree/nvim-tree.lua" },

View File

@@ -1,6 +1,7 @@
{
"LuaSnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" },
"auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
"catppuccin": { "branch": "main", "commit": "6af91673ceccbd6e073b66c439e7fce239f72d24" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },

2
startup.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/zsh
python ./auto_theme.py