mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 09:42:10 -04:00
Neovim template enhancements (#2078)
* feat: add neovim-lualine template, set vim.o.background automatically based on dms light/dark mode * feat(matugen): add option to follow dms background color or not on neovim * chore: regenerate settings and translation index after merging master
This commit is contained in:
@@ -494,6 +494,7 @@ Singleton {
|
|||||||
"harmony": 0.5
|
"harmony": 0.5
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
property bool matugenTemplateNeovimSetBackground: true
|
||||||
|
|
||||||
property bool showDock: false
|
property bool showDock: false
|
||||||
property bool dockAutoHide: false
|
property bool dockAutoHide: false
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ var SPEC = {
|
|||||||
light: { baseTheme: "github_light", harmony: 0.5 }
|
light: { baseTheme: "github_light", harmony: 0.5 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
matugenTemplateNeovimSetBackground: true,
|
||||||
|
|
||||||
showDock: { def: false },
|
showDock: { def: false },
|
||||||
dockAutoHide: { def: false },
|
dockAutoHide: { def: false },
|
||||||
|
|||||||
@@ -2671,6 +2671,15 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsToggleRow {
|
||||||
|
text: I18n.tr("Follow DMS background color")
|
||||||
|
tags: ["matugen", "neovim", "terminal", "template"]
|
||||||
|
settingKey: "matugenTemplateNeovimSetBackground"
|
||||||
|
visible: neovimThemeToggle.visible && neovimThemeToggle.checked
|
||||||
|
checked: SettingsData.matugenTemplateNeovimSetBackground ?? true
|
||||||
|
onToggled: checked => SettingsData.set("matugenTemplateNeovimSetBackground", checked)
|
||||||
|
}
|
||||||
|
|
||||||
SettingsDivider {
|
SettingsDivider {
|
||||||
visible: neovimThemeToggle.visible && neovimThemeToggle.checked
|
visible: neovimThemeToggle.visible && neovimThemeToggle.checked
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
[templates.dmsneovim]
|
[templates.dmsneovim-colors]
|
||||||
input_path = 'SHELL_DIR/matugen/templates/neovim.lua'
|
input_path = 'SHELL_DIR/matugen/templates/neovim-colors.lua'
|
||||||
output_path = 'CONFIG_DIR/nvim/colors/dms.lua'
|
output_path = 'CONFIG_DIR/nvim/colors/dms.lua'
|
||||||
|
|
||||||
|
[templates.dmsneovim-lualine]
|
||||||
|
input_path = 'SHELL_DIR/matugen/templates/neovim-lualine.lua'
|
||||||
|
output_path = 'CONFIG_DIR/nvim/lua/lualine/themes/dms.lua'
|
||||||
|
|||||||
@@ -35,6 +35,15 @@ local function deepGet(t, k)
|
|||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local mode = vim.system({ "dms", "ipc", "call", "theme", "getMode" }, { text = true }):wait().stdout
|
||||||
|
if mode ~= nil then
|
||||||
|
if mode:match("light") then
|
||||||
|
vim.o.background = "light"
|
||||||
|
elseif mode:match("dark") then
|
||||||
|
vim.o.background = "dark"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local current_file_path = debug.getinfo(1, "S").source:sub(2)
|
local current_file_path = debug.getinfo(1, "S").source:sub(2)
|
||||||
local theme_base = deepGet(settings, { "matugenTemplateNeovimSettings", vim.o.background, "baseTheme" })
|
local theme_base = deepGet(settings, { "matugenTemplateNeovimSettings", vim.o.background, "baseTheme" })
|
||||||
or ("github_" .. vim.o.background)
|
or ("github_" .. vim.o.background)
|
||||||
@@ -74,7 +83,9 @@ end
|
|||||||
if not base46.theme_tables[theme_name] or base46.theme_tables[theme_name].type ~= vim.o.background then
|
if not base46.theme_tables[theme_name] or base46.theme_tables[theme_name].type ~= vim.o.background then
|
||||||
local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base)))
|
local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base)))
|
||||||
local harmonized = base46.theme_harmonize(builtin, "{{colors.source_color.default.hex}}", harmony)
|
local harmonized = base46.theme_harmonize(builtin, "{{colors.source_color.default.hex}}", harmony)
|
||||||
harmonized = base46.theme_set_bg(harmonized, "{{colors.background.default.hex}}")
|
if settings.matugenTemplateNeovimSetBackground ~= false then
|
||||||
|
harmonized = base46.theme_set_bg(harmonized, "{{colors.background.default.hex}}")
|
||||||
|
end
|
||||||
|
|
||||||
base46.theme_tables[theme_name] = harmonized
|
base46.theme_tables[theme_name] = harmonized
|
||||||
end
|
end
|
||||||
3
quickshell/matugen/templates/neovim-lualine.lua
Normal file
3
quickshell/matugen/templates/neovim-lualine.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
-- NOTE: this file should never be accessed if AvengeMedia/base46 is not installed,
|
||||||
|
-- the neovim-colors.lua template will fail first.
|
||||||
|
return require("lualine.themes._base46")("dms")
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2696,6 +2696,31 @@
|
|||||||
"theme"
|
"theme"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"section": "matugenTemplateNeovimSetBackground",
|
||||||
|
"label": "Follow DMS background color",
|
||||||
|
"tabIndex": 10,
|
||||||
|
"category": "Theme & Colors",
|
||||||
|
"keywords": [
|
||||||
|
"appearance",
|
||||||
|
"background",
|
||||||
|
"color",
|
||||||
|
"colors",
|
||||||
|
"colour",
|
||||||
|
"dms",
|
||||||
|
"follow",
|
||||||
|
"hue",
|
||||||
|
"look",
|
||||||
|
"matugen",
|
||||||
|
"neovim",
|
||||||
|
"scheme",
|
||||||
|
"style",
|
||||||
|
"template",
|
||||||
|
"terminal",
|
||||||
|
"theme",
|
||||||
|
"tint"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"section": "matugenTemplateGtk",
|
"section": "matugenTemplateGtk",
|
||||||
"label": "GTK",
|
"label": "GTK",
|
||||||
@@ -4359,6 +4384,27 @@
|
|||||||
],
|
],
|
||||||
"description": "Automatically lock the screen when DMS starts"
|
"description": "Automatically lock the screen when DMS starts"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"section": "lockBeforeSuspend",
|
||||||
|
"label": "Lock before suspend",
|
||||||
|
"tabIndex": 11,
|
||||||
|
"category": "Lock Screen",
|
||||||
|
"keywords": [
|
||||||
|
"automatic",
|
||||||
|
"automatically",
|
||||||
|
"before",
|
||||||
|
"lock",
|
||||||
|
"login",
|
||||||
|
"password",
|
||||||
|
"prepares",
|
||||||
|
"screen",
|
||||||
|
"security",
|
||||||
|
"sleep",
|
||||||
|
"suspend",
|
||||||
|
"system"
|
||||||
|
],
|
||||||
|
"description": "Automatically lock the screen when the system prepares to suspend"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"section": "lockScreenNotificationMode",
|
"section": "lockScreenNotificationMode",
|
||||||
"label": "Notification Display",
|
"label": "Notification Display",
|
||||||
@@ -6361,27 +6407,6 @@
|
|||||||
"icon": "schedule",
|
"icon": "schedule",
|
||||||
"description": "Gradually fade the screen before locking with a configurable grace period"
|
"description": "Gradually fade the screen before locking with a configurable grace period"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"section": "lockBeforeSuspend",
|
|
||||||
"label": "Lock before suspend",
|
|
||||||
"tabIndex": 21,
|
|
||||||
"category": "Power & Sleep",
|
|
||||||
"keywords": [
|
|
||||||
"automatically",
|
|
||||||
"before",
|
|
||||||
"energy",
|
|
||||||
"lock",
|
|
||||||
"power",
|
|
||||||
"prepares",
|
|
||||||
"screen",
|
|
||||||
"security",
|
|
||||||
"shutdown",
|
|
||||||
"sleep",
|
|
||||||
"suspend",
|
|
||||||
"system"
|
|
||||||
],
|
|
||||||
"description": "Automatically lock the screen when the system prepares to suspend"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"section": "fadeToLockGracePeriod",
|
"section": "fadeToLockGracePeriod",
|
||||||
"label": "Lock fade grace period",
|
"label": "Lock fade grace period",
|
||||||
|
|||||||
@@ -5977,6 +5977,13 @@
|
|||||||
"reference": "",
|
"reference": "",
|
||||||
"comment": ""
|
"comment": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"term": "Follow DMS background color",
|
||||||
|
"translation": "",
|
||||||
|
"context": "",
|
||||||
|
"reference": "",
|
||||||
|
"comment": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"term": "Follow Monitor Focus",
|
"term": "Follow Monitor Focus",
|
||||||
"translation": "",
|
"translation": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user