mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
use gruvbox material
This commit is contained in:
parent
384114d2ca
commit
91b011a725
33 changed files with 607 additions and 221 deletions
|
|
@ -3,29 +3,37 @@
|
|||
-- https://www.reddit.com/r/neovim/comments/1d3hk1t/automatic_dark_mode_following_system_theme_on/
|
||||
local function get_system_theme()
|
||||
-- Default value
|
||||
local background = 'light'
|
||||
local background = "light"
|
||||
-- First check whether we are on MacOS
|
||||
if vim.loop.os_uname().sysname == "Darwin" then
|
||||
-- Check if 'defaults' is executable
|
||||
if vim.fn.executable('defaults') ~= 0 then
|
||||
if vim.fn.executable("defaults") ~= 0 then
|
||||
-- Execute command to check if the macOS appearance is set to Dark
|
||||
local appleInterfaceStyle = vim.fn.system({ "defaults", "read", "-g", "AppleInterfaceStyle" })
|
||||
if appleInterfaceStyle:find("Dark") then
|
||||
background = 'dark'
|
||||
background = "dark"
|
||||
end
|
||||
end
|
||||
-- Check if 'busctl' is executable (part of systemd)
|
||||
elseif vim.fn.executable('busctl') ~= 0 then
|
||||
elseif vim.fn.executable("busctl") ~= 0 then
|
||||
-- Get the current color scheme from xdg-desktop-portal using busctl
|
||||
local result = vim.fn.system({
|
||||
"busctl", "--user", "call", "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop",
|
||||
"org.freedesktop.portal.Settings", "ReadOne", "ss", "org.freedesktop.appearance", "color-scheme"
|
||||
"busctl",
|
||||
"--user",
|
||||
"call",
|
||||
"org.freedesktop.portal.Desktop",
|
||||
"/org/freedesktop/portal/desktop",
|
||||
"org.freedesktop.portal.Settings",
|
||||
"ReadOne",
|
||||
"ss",
|
||||
"org.freedesktop.appearance",
|
||||
"color-scheme",
|
||||
})
|
||||
-- The result is in the form of "v u 0" for light and "v u 1" for dark
|
||||
local color_scheme = result:match("u%s+(%d+)")
|
||||
|
||||
if color_scheme == '1' then
|
||||
background = 'dark'
|
||||
if color_scheme == "1" then
|
||||
background = "dark"
|
||||
end
|
||||
else
|
||||
end
|
||||
|
|
@ -33,11 +41,13 @@ local function get_system_theme()
|
|||
return background
|
||||
end
|
||||
|
||||
if get_system_theme() == 'dark' then
|
||||
vim.o.background = 'dark'
|
||||
vim.cmd.colorscheme("catppuccin-mocha")
|
||||
else
|
||||
vim.o.background = 'light'
|
||||
vim.cmd.colorscheme("catppuccin-latte")
|
||||
end
|
||||
vim.cmd.colorscheme("gruvbox-material")
|
||||
|
||||
-- if get_system_theme() == 'dark' then
|
||||
-- vim.o.background = 'dark'
|
||||
-- vim.cmd.colorscheme("catppuccin-mocha")
|
||||
-- else
|
||||
-- vim.o.background = 'light'
|
||||
-- vim.cmd.colorscheme("catppuccin-latte")
|
||||
-- end
|
||||
--
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"f4z3r/gruvbox-material.nvim",
|
||||
name = "gruvbox-material",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ return {
|
|||
opts = {},
|
||||
-- dev = true,
|
||||
-- dir = "~/Source/Forks/luasnip-latex-snippets.nvim/"
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue