Comments (3)
DRAFT1: New style configuration
Here is an overview.
config.lua
-- use `require`, do not define in global implicitly
local tym = require('tym')
local home = os.getenv('HOME')
-- set config using table
tym.set_config({
width = 120,
shell = home .. '/bin/tmux-attach-or-new',
title = 'tym',
cursor_blink_mode = 'off',
cjk_width = 'narrow',
ignore_default_keymap = false,
-- use theme
-- if true, theme loading will be skipped after loading config
ignore_theme = false,
})
-- get value
print(tym.get('height'))
-- set single value
tym.set('height', 40)
-- default `nil` so get nil
local y = tym.get('role')
-- get nil and warning printed
local x = tym.get('not exist')
-- only warning and no effect
tym.set('not exist', 123)
-- clear all custom keymaps
tym.reset_keymaps()
-- set keymap using table
tym.set_keymaps({
['<Ctrl><Shift>1'] = function()
-- simply load this script
-- config on that time will be keeped and overwritten
tym.reload()
tym.notify('reset and loaded')
end,
['<Ctrl><Shift>2'] = function()
-- restore default config
tym.reset()
-- certainly, get default value
print(tym.get('height'))
end,
})
-- set keymap individually
tym.set_keymap('<Ctrl><Shift>j', function()
local h = tym.get('height')
-- the value will not be applied immediatelly
tym.set('height', h + 2)
-- you need to do below
tym.apply()
end)
tym.set_keymap('<Ctrl><Shift>t', function()
-- reload theme. if `ignore_theme` is true, do nothing
-- if true provided like `tym.reload_theme(true)`, reset theme before reload
tym.reload_theme()
end)
-- custom event handler
tym.set_hook('bell', function()
print('got bell')
end)
-- by table
tym.set_hooks({
focus_in = function()
print('focus in')
end,
focus_out = function()
print('focus out')
end,
})
-- after excuting `config.lua`, `theme.lua` will be evaluated and the theme will be applied if `ignore_theme` is not true
theme.lua
Simply return theme table
local fg = '#d0d0d0'
local bg = '#181818'
return {
color_foreground = fg,
color_background = bg,
color_cursor = fg,
--- SNIP
color_0 = '#181818',
color_1 = '#ac4142',
--- SNIP
color_15 = '#f5f5f5',
}
from tym.
DRAFT1 was adopted to v2 almost as it is. But there are something changed.
theme
was add to config instead ofignore_theme
.hook
feature was postponed tov2.1
from tym.
Implementation was done.
from tym.
Related Issues (20)
- Background image option not working as expected HOT 2
- Support ligatures HOT 1
- would a universal package or precompiled "universal"(per architecture) binary be possible
- deb/rpm packages
- there are some misspellings in the README HOT 1
- Possible for daemon to start without GUI? HOT 7
- Migrate CI to GitHub actions. HOT 1
- request: allow for using a custom handler/opener, or xdg-open as an alternative to the current way(which opens the wrong browser for me) HOT 8
- Fonts not working HOT 3
- Accept unquoted or remaining arguments as the shell command HOT 10
- viu support HOT 4
- Api function to reload all tym instances HOT 1
- Add Wayland Support HOT 4
- specific padding for parts of terminal HOT 2
- I can't load my theme file with --theme HOT 2
- It appears that tym.get_config_path() does not work when I state --use explicitly HOT 4
- Border around tym window HOT 3
- setting theme from main config not working right
- Terminal Image Protocol HOT 3
- Doesn't respect CFLAGS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tym.