Ship out-of-the-box VSCode-style config and sharp rendering defaults

- quilt patch: first-run user init.lua template now writes a tuned
  default config (Dark Modern theme, JetBrains Mono with grayscale AA,
  line-height/indent guides, compact treeview with hover highlight)
- new theme module usr/share/lite-xl/colors/vscode_dark.lua
- default config in /etc/skel/.config/lite-xl/ for new users
- desktop: launch via SDL software renderer with LITE_SCALE=1.5 so text
  renders 1:1 on fractional-scaled Wayland outputs and avoids panfrost
  GPU artifacts
- depend on fonts-jetbrains-mono for the default code font
This commit is contained in:
2026-09-16 21:52:46 +02:00
parent ad7256b4fb
commit a693cb645c
9 changed files with 310 additions and 1 deletions
+3
View File
@@ -25,3 +25,6 @@ LiteXL*
!resources/macos/*.py !resources/macos/*.py
!scripts/innosetup/lite-xl@*.bmp !scripts/innosetup/lite-xl@*.bmp
!scripts/innosetup/lite-xl-banner@*.bmp !scripts/innosetup/lite-xl-banner@*.bmp
debian/.debhelper/
debian/files
debhelper-build-stamp
+11
View File
@@ -1,3 +1,14 @@
lite-xl (2.1.8-3) stonking; urgency=medium
* Ship a VSCode-style dark theme and out-of-the-box config:
- first-run template writes a tuned default init.lua (quilt patch)
- theme module in /usr/share/lite-xl/colors, default config in /etc/skel
- default config uses JetBrains Mono (new fonts-jetbrains-mono dependency)
* desktop: launch with SDL software rendering and LITE_SCALE=1.5 so text is
sharp on fractional-scaled Wayland panels and avoids panfrost artifacts.
-- Valentin Haudiquet <valentin.haudiquet@canonical.com> Wed, 16 Sep 2026 21:50:00 +0200
lite-xl (2.1.8-2) stonking; urgency=medium lite-xl (2.1.8-2) stonking; urgency=medium
* Drop the ":native" qualifiers on the meson/ninja-build Build-Depends. * Drop the ":native" qualifiers on the meson/ninja-build Build-Depends.
+1 -1
View File
@@ -15,7 +15,7 @@ Homepage: https://lite-xl.com/
Package: lite-xl Package: lite-xl
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends} Depends: ${shlibs:Depends}, ${misc:Depends}, fonts-jetbrains-mono
Description: A lightweight text editor written in Lua Description: A lightweight text editor written in Lua
A lightweight, fast and extensible text editor written in Lua, designed to be A lightweight, fast and extensible text editor written in Lua, designed to be
highly customizable and to have a small footprint. It is written in C and Lua highly customizable and to have a small footprint. It is written in C and Lua
+70
View File
@@ -0,0 +1,70 @@
-- Lite XL default configuration (shipped via /etc/skel or the first-run
-- template). This file is yours to edit; it is reloaded automatically on save.
-- It gives the editor a VSCode-style dark look out of the box.
local core = require "core"
local common = require "core.common"
local config = require "core.config"
local style = require "core.style"
------------------------------ Appearance -------------------------------------
-- VSCode "Dark Modern" theme (shipped in /usr/share/lite-xl/colors).
core.reload_module("colors.vscode_dark")
-- Sharp text: grayscale antialiasing with light autohinting renders crisper
-- than the defaults on high-DPI panels.
local font_opts = { antialiasing = "grayscale", hinting = "slight", smoothing = true }
-- Bump these for a bigger/smaller UI; ctrl+wheel also zooms live.
local UI_FONT_SIZE = 15
local CODE_FONT_SIZE = 16
style.font = renderer.font.load(DATADIR .. "/fonts/FiraSans-Regular.ttf",
UI_FONT_SIZE * SCALE, font_opts)
style.big_font = style.font:copy(46 * SCALE)
style.code_font = renderer.font.load(
"/usr/share/fonts/truetype/jetbrains-mono/JetBrainsMono-Regular.ttf",
CODE_FONT_SIZE * SCALE, font_opts)
------------------------------ Behavior ---------------------------------------
config.line_height = 1.3 -- airy lines, like VSCode's default
config.indent_size = 4
config.plugins.lineguide = true -- indent guides, like VSCode
------------------------------ Treeview sidebar -------------------------------
-- Tighter rows and VSCode-style hover/selection highlight. Method overrides so
-- the shared style.padding used by the editor margins is untouched.
local TreeView = require "plugins.treeview"
local tv_row_pad = common.round(3 * SCALE)
function TreeView:get_item_height()
return style.font:get_height() + tv_row_pad
end
local tv_base_indent = common.round(8 * SCALE)
local tv_level_indent = common.round(10 * SCALE)
function TreeView:draw_item(item, active, hovered, x, y, w, h)
self:draw_item_background(item, active, hovered, x, y, w, h)
x = x + tv_base_indent + item.depth * tv_level_indent
x = x + self:draw_item_chevron(item, active, hovered, x, y, w, h)
self:draw_item_body(item, active, hovered, x, y, w, h)
end
function TreeView:get_item_text(item, active, hovered)
local color = (active or hovered)
and (style.treeview_text_active or style.accent)
or (style.treeview_text or style.text)
return item.name, style.font, color
end
function TreeView:draw_item_background(item, active, hovered, x, y, w, h)
if hovered then
local c = { table.unpack(style.treeview_hover_bg or style.line_highlight) }
c[4] = 160
renderer.draw_rect(x, y, w, h, c)
elseif active then
renderer.draw_rect(x, y, w, h, style.treeview_active_bg or style.line_highlight)
end
end
+60
View File
@@ -0,0 +1,60 @@
-- VSCode "Dark Modern" (the default modern VSCode look) for Lite XL
-- Editor surface #1f1f1f, chrome #181818, accent #0078d4, Dark+ token colors.
local style = require "core.style"
local common = require "core.common"
-- Chrome / surfaces
style.background = { common.color "#1f1f1f" } -- editor
style.background2 = { common.color "#181818" } -- treeview / sidebar
style.background3 = { common.color "#181818" } -- command view
style.text = { common.color "#cccccc" }
style.caret = { common.color "#aeafad" }
style.accent = { common.color "#0078d4" }
style.dim = { common.color "#9e9e9e" } -- inactive tabs, log prefixes
style.divider = { common.color "#2b2b2b" }
style.selection = { common.color "#264f78" }
style.line_number = { common.color "#6e7681" }
style.line_number2 = { common.color "#cccccc" } -- line number with cursor
style.line_highlight = { common.color "#282828" }
style.scrollbar = { common.color "#4a4a4a" }
style.scrollbar2 = { common.color "#646464" } -- hovered
style.scrollbar_track = { common.color "#181818" }
style.guide = { common.color "#404040" } -- indent guides (lineguide)
style.nagbar = { common.color "#5a1d1d" }
style.nagbar_text = { common.color "#ffffff" }
style.nagbar_dim = { common.color "rgba(0, 0, 0, 0.45)" }
style.drag_overlay = { common.color "rgba(255, 255, 255, 0.08)" }
style.drag_overlay_tab = { common.color "#0078d4" }
style.good = { common.color "#89d185" }
style.warn = { common.color "#cca700" }
style.error = { common.color "#f14c4c" }
style.modified = { common.color "#e2c08d" }
-- Syntax: VSCode Dark+ token colors
style.syntax["normal"] = { common.color "#d4d4d4" }
style.syntax["symbol"] = { common.color "#d4d4d4" }
style.syntax["comment"] = { common.color "#6a9955" }
style.syntax["keyword"] = { common.color "#569cd6" } -- local function end if
style.syntax["keyword2"] = { common.color "#4ec9b0" } -- self int float (types)
style.syntax["number"] = { common.color "#b5cea8" }
style.syntax["literal"] = { common.color "#569cd6" } -- true false nil
style.syntax["string"] = { common.color "#ce9178" }
style.syntax["operator"] = { common.color "#d4d4d4" }
style.syntax["function"] = { common.color "#dcdcaa" }
-- Treeview (sidebar) specifics, VSCode list colors
style.treeview_text = { common.color "#c5c5c5" }
style.treeview_text_active = { common.color "#ffffff" }
style.treeview_hover_bg = { common.color "#2a2d2e" } -- list.hoverBackground
style.treeview_active_bg = { common.color "#37373d" } -- list.inactiveSelectionBackground
-- Git status (gitstatus plugin), VSCode git decoration colors
style.gitstatus_addition = { common.color "#73c991" } -- untracked/added green
style.gitstatus_modification = { common.color "#e2c08d" } -- modified amber
style.gitstatus_deletion = { common.color "#f14c4c" } -- deleted red
style.log["INFO"] = { icon = "i", color = style.text }
style.log["WARN"] = { icon = "!", color = style.warn }
style.log["ERROR"] = { icon = "!", color = style.error }
return style
+2
View File
@@ -0,0 +1,2 @@
debian/extra/vscode_dark.lua usr/share/lite-xl/colors/
debian/extra/init.lua etc/skel/.config/lite-xl/
+150
View File
@@ -0,0 +1,150 @@
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -475,79 +475,79 @@
local init_file = io.open(init_filename, "w")
if not init_file then error("cannot create file: \"" .. init_filename .. "\"") end
init_file:write([[
--- put user settings here
--- this module will be loaded after everything else when the application starts
--- it will be automatically reloaded when saved
+-- Default configuration shipped with the Lite XL package (VSCode-style dark
+-- theme). This file is written to USERDIR/init.lua on first run only; the
+-- system copy lives in /etc/skel/.config/lite-xl/init.lua.
+-- Lite XL default configuration (shipped via /etc/skel or the first-run
+-- template). This file is yours to edit; it is reloaded automatically on save.
+-- It gives the editor a VSCode-style dark look out of the box.
local core = require "core"
-local keymap = require "core.keymap"
+local common = require "core.common"
local config = require "core.config"
local style = require "core.style"
------------------------------- Themes ----------------------------------------
-
--- light theme:
--- core.reload_module("colors.summer")
-
---------------------------- Key bindings -------------------------------------
-
--- key binding:
--- keymap.add { ["ctrl+escape"] = "core:quit" }
-
--- pass 'true' for second parameter to overwrite an existing binding
--- keymap.add({ ["ctrl+pageup"] = "root:switch-to-previous-tab" }, true)
--- keymap.add({ ["ctrl+pagedown"] = "root:switch-to-next-tab" }, true)
-
-------------------------------- Fonts ----------------------------------------
-
--- customize fonts:
--- style.font = renderer.font.load(DATADIR .. "/fonts/FiraSans-Regular.ttf", 14 * SCALE)
--- style.code_font = renderer.font.load(DATADIR .. "/fonts/JetBrainsMono-Regular.ttf", 14 * SCALE)
---
--- DATADIR is the location of the installed Lite XL Lua code, default color
--- schemes and fonts.
--- USERDIR is the location of the Lite XL configuration directory.
---
--- font names used by lite:
--- style.font : user interface
--- style.big_font : big text in welcome screen
--- style.icon_font : icons
--- style.icon_big_font : toolbar icons
--- style.code_font : code
---
--- the function to load the font accept a 3rd optional argument like:
---
--- {antialiasing="grayscale", hinting="full", bold=true, italic=true, underline=true, smoothing=true, strikethrough=true}
---
--- possible values are:
--- antialiasing: grayscale, subpixel
--- hinting: none, slight, full
--- bold: true, false
--- italic: true, false
--- underline: true, false
--- smoothing: true, false
--- strikethrough: true, false
-
------------------------------- Plugins ----------------------------------------
-
--- disable plugin loading setting config entries:
-
--- disable plugin detectindent, otherwise it is enabled by default:
--- config.plugins.detectindent = false
-
----------------------------- Miscellaneous -------------------------------------
-
--- modify list of files to ignore when indexing the project:
--- config.ignore_files = {
--- -- folders
--- "^%.svn/", "^%.git/", "^%.hg/", "^CVS/", "^%.Trash/", "^%.Trash%-.*/",
--- "^node_modules/", "^%.cache/", "^__pycache__/",
--- -- files
--- "%.pyc$", "%.pyo$", "%.exe$", "%.dll$", "%.obj$", "%.o$",
--- "%.a$", "%.lib$", "%.so$", "%.dylib$", "%.ncb$", "%.sdf$",
--- "%.suo$", "%.pdb$", "%.idb$", "%.class$", "%.psd$", "%.db$",
--- "^desktop%.ini$", "^%.DS_Store$", "^%.directory$",
--- }
+------------------------------ Appearance -------------------------------------
+-- VSCode "Dark Modern" theme (shipped in /usr/share/lite-xl/colors).
+core.reload_module("colors.vscode_dark")
+
+-- Sharp text: grayscale antialiasing with light autohinting renders crisper
+-- than the defaults on high-DPI panels.
+local font_opts = { antialiasing = "grayscale", hinting = "slight", smoothing = true }
+
+-- Bump these for a bigger/smaller UI; ctrl+wheel also zooms live.
+local UI_FONT_SIZE = 15
+local CODE_FONT_SIZE = 16
+
+style.font = renderer.font.load(DATADIR .. "/fonts/FiraSans-Regular.ttf",
+ UI_FONT_SIZE * SCALE, font_opts)
+style.big_font = style.font:copy(46 * SCALE)
+style.code_font = renderer.font.load(
+ "/usr/share/fonts/truetype/jetbrains-mono/JetBrainsMono-Regular.ttf",
+ CODE_FONT_SIZE * SCALE, font_opts)
+
+------------------------------ Behavior ---------------------------------------
+
+config.line_height = 1.3 -- airy lines, like VSCode's default
+config.indent_size = 4
+config.plugins.lineguide = true -- indent guides, like VSCode
+
+------------------------------ Treeview sidebar -------------------------------
+-- Tighter rows and VSCode-style hover/selection highlight. Method overrides so
+-- the shared style.padding used by the editor margins is untouched.
+
+local TreeView = require "plugins.treeview"
+
+local tv_row_pad = common.round(3 * SCALE)
+function TreeView:get_item_height()
+ return style.font:get_height() + tv_row_pad
+end
+
+local tv_base_indent = common.round(8 * SCALE)
+local tv_level_indent = common.round(10 * SCALE)
+function TreeView:draw_item(item, active, hovered, x, y, w, h)
+ self:draw_item_background(item, active, hovered, x, y, w, h)
+ x = x + tv_base_indent + item.depth * tv_level_indent
+ x = x + self:draw_item_chevron(item, active, hovered, x, y, w, h)
+ self:draw_item_body(item, active, hovered, x, y, w, h)
+end
+
+function TreeView:get_item_text(item, active, hovered)
+ local color = (active or hovered)
+ and (style.treeview_text_active or style.accent)
+ or (style.treeview_text or style.text)
+ return item.name, style.font, color
+end
+
+function TreeView:draw_item_background(item, active, hovered, x, y, w, h)
+ if hovered then
+ local c = { table.unpack(style.treeview_hover_bg or style.line_highlight) }
+ c[4] = 160
+ renderer.draw_rect(x, y, w, h, c)
+ elseif active then
+ renderer.draw_rect(x, y, w, h, style.treeview_active_bg or style.line_highlight)
+ end
+end
]])
init_file:close()
+11
View File
@@ -0,0 +1,11 @@
--- a/resources/linux/org.lite_xl.lite_xl.desktop
+++ b/resources/linux/org.lite_xl.lite_xl.desktop
@@ -2,7 +2,7 @@
Type=Application
Name=Lite XL
Comment=A lightweight text editor written in Lua
-Exec=lite-xl %F
+Exec=env SDL_RENDER_DRIVER=software LITE_SCALE=1.5 lite-xl %F
Icon=lite-xl
Terminal=false
StartupWMClass=lite-xl
+2
View File
@@ -0,0 +1,2 @@
0001-first-run-config-vscode-dark.patch
0002-desktop-software-rendering.patch