1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-02 02:22:06 -04:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Jonas Bloch
faa5e7e02d fix: set default value for matugenTemplateNeovimSetBackground (#2081) 2026-03-25 11:35:17 -04:00
Jonas Bloch
516c478f3d 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
2026-03-25 09:16:01 -04:00
Kangheng Liu
906c6a2501 feat: FileBrowser video thumbnail (#2077)
* feat(filebrowser): add filebrowser video thumbnails display

- Find cached thumbnails first
- If not found, generate with ffmpegthumbnailer
- Fallback to placeholder icon if dependency not met

* fix(filebrowser): create thumbnail cache dir if not exists

* refactor(filebrowser): prefer using Paths lib

* fix(filebrowser): only check filetype once for each file

* fix(filebrowser): early test for thumbnails

* feat: add xdgCache path
2026-03-25 09:14:59 -04:00
Viet Dinh
86d8fe4fa4 fix: pywalfox light theme template (#2075)
The current template doesn't work for an OOTB config of pywalfox
without manual configuration. This commit fixes the colors to work
better with its defaults.
2026-03-25 09:12:41 -04:00
13 changed files with 387 additions and 225 deletions

View File

@@ -10,6 +10,7 @@ Singleton {
readonly property url home: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
readonly property url pictures: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
readonly property url xdgCache: StandardPaths.standardLocations(StandardPaths.GenericCacheLocation)[0]
readonly property url data: `${StandardPaths.standardLocations(StandardPaths.GenericDataLocation)[0]}/DankMaterialShell`
readonly property url state: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/DankMaterialShell`

View File

@@ -494,6 +494,7 @@ Singleton {
"harmony": 0.5
}
})
property bool matugenTemplateNeovimSetBackground: true
property bool showDock: false
property bool dockAutoHide: false

View File

@@ -305,6 +305,7 @@ var SPEC = {
light: { baseTheme: "github_light", harmony: 0.5 }
}
},
matugenTemplateNeovimSetBackground: { def: true },
showDock: { def: false },
dockAutoHide: { def: false },

View File

@@ -75,6 +75,50 @@ StyledRect {
return determineFileType(fileName) === "image";
}
function isVideoFile(fileName) {
if (!fileName) {
return false;
}
return determineFileType(fileName) === "video";
}
property bool isImage: isImageFile(delegateRoot.fileName)
property bool isVideo: isVideoFile(delegateRoot.fileName)
property string _xdgCacheHome: Paths.strip(Paths.xdgCache)
property string _thumbnailSize: iconSizeIndex >= 2 ? "x-large" : "large"
property int _thumbnailPx: iconSizeIndex >= 2 ? 512 : 256
property string videoThumbnailPath: {
if (!delegateRoot.fileIsDir && isVideo) {
const hash = Qt.md5("file://" + delegateRoot.filePath);
return _xdgCacheHome + "/thumbnails/" + _thumbnailSize + "/" + hash + ".png";
}
return "";
}
property string _videoThumb: ""
onVideoThumbnailPathChanged: {
_videoThumb = "";
if (!videoThumbnailPath)
return;
const thumbPath = videoThumbnailPath;
const thumbDir = _xdgCacheHome + "/thumbnails/" + _thumbnailSize;
const size = _thumbnailPx;
const fp = delegateRoot.filePath;
Paths.mkdir(thumbDir);
Proc.runCommand(null, ["test", "-f", thumbPath], function(output, exitCode) {
if (exitCode === 0) {
_videoThumb = thumbPath;
} else {
Proc.runCommand(null, ["ffmpegthumbnailer", "-i", fp, "-o", thumbPath, "-s", String(size), "-f"], function(output, exitCode) {
if (exitCode === 0)
_videoThumb = thumbPath;
});
}
});
}
function getIconForFile(fileName) {
const lowerName = fileName.toLowerCase();
if (lowerName.startsWith("dockerfile")) {
@@ -124,7 +168,11 @@ StyledRect {
property string imagePath: {
if (weMode && delegateRoot.fileIsDir)
return delegateRoot.filePath + "/preview" + weExtensions[weExtIndex];
return (!delegateRoot.fileIsDir && isImageFile(delegateRoot.fileName)) ? delegateRoot.filePath : "";
if (!delegateRoot.fileIsDir && isImage)
return delegateRoot.filePath;
if (_videoThumb)
return _videoThumb;
return "";
}
source: imagePath ? "file://" + imagePath.split('/').map(s => encodeURIComponent(s)).join('/') : ""
onStatusChanged: {
@@ -149,7 +197,7 @@ StyledRect {
source: gridPreviewImage
maskEnabled: true
maskSource: gridImageMask
visible: gridPreviewImage.status === Image.Ready && ((!delegateRoot.fileIsDir && isImageFile(delegateRoot.fileName)) || (weMode && delegateRoot.fileIsDir))
visible: gridPreviewImage.status === Image.Ready && ((!delegateRoot.fileIsDir && (isImage || isVideo)) || (weMode && delegateRoot.fileIsDir))
maskThresholdMin: 0.5
maskSpreadAtMin: 1
}
@@ -175,7 +223,7 @@ StyledRect {
name: delegateRoot.fileIsDir ? "folder" : getIconForFile(delegateRoot.fileName)
size: iconSizes[iconSizeIndex] * 0.45
color: delegateRoot.fileIsDir ? Theme.primary : Theme.surfaceText
visible: (!delegateRoot.fileIsDir && !isImageFile(delegateRoot.fileName)) || (delegateRoot.fileIsDir && !weMode)
visible: (!delegateRoot.fileIsDir && !isImage && !(isVideo && gridPreviewImage.status === Image.Ready)) || (delegateRoot.fileIsDir && !weMode)
}
}

View File

@@ -74,6 +74,46 @@ StyledRect {
return determineFileType(fileName) === "image";
}
function isVideoFile(fileName) {
if (!fileName) {
return false;
}
return determineFileType(fileName) === "video";
}
property bool isImage: isImageFile(listDelegateRoot.fileName)
property bool isVideo: isVideoFile(listDelegateRoot.fileName)
property string _xdgCacheHome: Paths.strip(Paths.xdgCache)
property string videoThumbnailPath: {
if (!listDelegateRoot.fileIsDir && isVideo) {
const hash = Qt.md5("file://" + listDelegateRoot.filePath);
return _xdgCacheHome + "/thumbnails/normal/" + hash + ".png";
}
return "";
}
property string _videoThumb: ""
onVideoThumbnailPathChanged: {
_videoThumb = "";
if (!videoThumbnailPath)
return;
const thumbPath = videoThumbnailPath;
const fp = listDelegateRoot.filePath;
Paths.mkdir(_xdgCacheHome + "/thumbnails/normal");
Proc.runCommand(null, ["test", "-f", thumbPath], function(output, exitCode) {
if (exitCode === 0) {
_videoThumb = thumbPath;
} else {
Proc.runCommand(null, ["ffmpegthumbnailer", "-i", fp, "-o", thumbPath, "-s", "128", "-f"], function(output, exitCode) {
if (exitCode === 0)
_videoThumb = thumbPath;
});
}
});
}
function getIconForFile(fileName) {
const lowerName = fileName.toLowerCase();
if (lowerName.startsWith("dockerfile")) {
@@ -127,7 +167,13 @@ StyledRect {
Image {
id: listPreviewImage
anchors.fill: parent
property string imagePath: (!listDelegateRoot.fileIsDir && isImageFile(listDelegateRoot.fileName)) ? listDelegateRoot.filePath : ""
property string imagePath: {
if (!listDelegateRoot.fileIsDir && isImage)
return listDelegateRoot.filePath;
if (_videoThumb)
return _videoThumb;
return "";
}
source: imagePath ? "file://" + imagePath.split('/').map(s => encodeURIComponent(s)).join('/') : ""
fillMode: Image.PreserveAspectCrop
sourceSize.width: 32
@@ -141,7 +187,7 @@ StyledRect {
source: listPreviewImage
maskEnabled: true
maskSource: listImageMask
visible: listPreviewImage.status === Image.Ready && !listDelegateRoot.fileIsDir && isImageFile(listDelegateRoot.fileName)
visible: listPreviewImage.status === Image.Ready && !listDelegateRoot.fileIsDir && (isImage || isVideo)
maskThresholdMin: 0.5
maskSpreadAtMin: 1
}
@@ -166,7 +212,7 @@ StyledRect {
name: listDelegateRoot.fileIsDir ? "folder" : getIconForFile(listDelegateRoot.fileName)
size: Theme.iconSize - 2
color: listDelegateRoot.fileIsDir ? Theme.primary : Theme.surfaceText
visible: listDelegateRoot.fileIsDir || !isImageFile(listDelegateRoot.fileName)
visible: listDelegateRoot.fileIsDir || (!isImage && !(isVideo && listPreviewImage.status === Image.Ready))
}
}

View File

@@ -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 {
visible: neovimThemeToggle.visible && neovimThemeToggle.checked
}

View File

@@ -1,3 +1,7 @@
[templates.dmsneovim]
input_path = 'SHELL_DIR/matugen/templates/neovim.lua'
[templates.dmsneovim-colors]
input_path = 'SHELL_DIR/matugen/templates/neovim-colors.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'

View File

@@ -35,6 +35,15 @@ local function deepGet(t, k)
return t
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 theme_base = deepGet(settings, { "matugenTemplateNeovimSettings", vim.o.background, "baseTheme" })
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
local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base)))
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
end

View 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")

View File

@@ -2,21 +2,21 @@
"wallpaper": "{{image}}",
"alpha": "100",
"colors": {
"color0": "{{colors.background.default.hex}}",
"color1": "",
"color2": "",
"color3": "",
"color4": "",
"color5": "",
"color6": "",
"color7": "",
"color8": "",
"color9": "",
"color10": "{{colors.primary.default.hex}}",
"color11": "",
"color12": "",
"color13": "{{colors.surface_bright.default.hex}}",
"color14": "",
"color15": "{{colors.on_surface.default.hex}}"
"color0": "{{colors.background.dark.hex}}",
"color1": "{{colors.surface_container_highest.light.hex}}",
"color2": "{{colors.surface_container_lowest.light.hex}}",
"color3": "{{colors.primary.light.hex}}",
"color4": "{{colors.tertiary_fixed.default.hex}}",
"color5": "{{colors.secondary.light.hex}}",
"color6": "{{colors.on_tertiary_fixed.default.hex}}",
"color7": "{{colors.surface_dim.light.hex}}",
"color8": "{{colors.on_secondary.light.hex}}",
"color9": "{{colors.error_container.default.hex}}",
"color10": "{{colors.primary.dark.hex}}",
"color11": "{{colors.on_error_container.default.hex}}",
"color12": "{{colors.on_primary_fixed_variant.default.hex}}",
"color13": "{{colors.secondary.dark.hex}}",
"color14": "{{colors.inverse_primary.default.hex}}",
"color15": "{{colors.on_surface.dark.hex}}"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -2696,6 +2696,31 @@
"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",
"label": "GTK",
@@ -4359,6 +4384,27 @@
],
"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",
"label": "Notification Display",
@@ -6361,27 +6407,6 @@
"icon": "schedule",
"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",
"label": "Lock fade grace period",

View File

@@ -5977,6 +5977,13 @@
"reference": "",
"comment": ""
},
{
"term": "Follow DMS background color",
"translation": "",
"context": "",
"reference": "",
"comment": ""
},
{
"term": "Follow Monitor Focus",
"translation": "",