Compare commits
5 Commits
1449ff5d5c
...
977e27cdf8
| Author | SHA1 | Date | |
|---|---|---|---|
| 977e27cdf8 | |||
| e8bc08f0b2 | |||
| 4d979f2600 | |||
| a7c7862815 | |||
| e6cb4df579 |
@@ -484,7 +484,8 @@ awful.rules.rules = {
|
||||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
||||
size_hints_honor = false,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -536,6 +537,19 @@ awful.rules.rules = {
|
||||
-- }}}
|
||||
|
||||
-- {{{ Signals
|
||||
|
||||
local function set_border_width(c)
|
||||
local t = awful.screen.focused().selected_tag
|
||||
if #t:clients() == 1 or t.layout.name == 'max' then
|
||||
c = c or client.focus
|
||||
c.border_width = 0
|
||||
else
|
||||
for _, cl in ipairs(t:clients()) do
|
||||
cl.border_width = beautiful.border_width
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.connect_signal("manage", function(c)
|
||||
-- Set the windows at the slave,
|
||||
@@ -548,6 +562,7 @@ client.connect_signal("manage", function(c)
|
||||
-- Prevent clients from being unreachable after screen count changes.
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
set_border_width(c)
|
||||
end)
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
@@ -555,6 +570,23 @@ client.connect_signal("mouse::enter", function(c)
|
||||
c:emit_signal("request::activate", "mouse_enter", { raise = false })
|
||||
end)
|
||||
|
||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||
-- local function set_border(c)
|
||||
-- local s = awful.screen.focused()
|
||||
-- if c.maximized
|
||||
-- or (#s.tiled_clients == 1 and not c.floating)
|
||||
-- or (s.selected_tag and s.selected_tag.layout.name == 'max')
|
||||
-- then
|
||||
-- c.border_width = 0
|
||||
-- else
|
||||
-- c.border_width = beautiful.border_width
|
||||
-- end
|
||||
-- end
|
||||
|
||||
client.connect_signal("focus", function(c)
|
||||
c.border_color = beautiful.border_focus
|
||||
set_border_width(c)
|
||||
end)
|
||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal; end)
|
||||
tag.connect_signal("property::layout", function() set_border_width(nil) end)
|
||||
|
||||
-- }}}
|
||||
|
||||
@@ -22,6 +22,7 @@ theme.fg_urgent = theme.bg_focus
|
||||
theme.fg_minimize = theme.fg_normal
|
||||
theme.taglist_fg_empty = "#454f54" -- hsl(200 10% 30%)
|
||||
|
||||
theme.gap_single_client = false
|
||||
theme.useless_gap = dpi(1)
|
||||
theme.border_width = dpi(2)
|
||||
theme.border_normal = "#73848c" -- hsl(200 10% 50%)
|
||||
|
||||
@@ -22,6 +22,7 @@ theme.fg_urgent = "#70675c" -- hsl(34 10% 40%)
|
||||
theme.fg_minimize = "#70675c" -- hsl(34 10% 40%)
|
||||
theme.taglist_fg_empty = theme.fg_minimize
|
||||
|
||||
theme.gap_single_client = false
|
||||
theme.useless_gap = dpi(1)
|
||||
theme.border_width = dpi(2)
|
||||
theme.border_normal = theme.bg_minimize
|
||||
|
||||
@@ -29,5 +29,5 @@ ta() {
|
||||
}
|
||||
|
||||
vf() {
|
||||
fzf --bind 'enter:become:vis {}' -q "$1"
|
||||
vis "+fzf-files auto-files '$1'"
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ local function cmd_action(cmd, action)
|
||||
end
|
||||
end
|
||||
|
||||
local function fzf_sh(arg)
|
||||
local function fzf_sh(arg, query)
|
||||
action = function(out)
|
||||
if (out:find('\n') or #out) == #out then
|
||||
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
|
||||
@@ -102,16 +102,19 @@ local function fzf_sh(arg)
|
||||
local home = os.getenv('HOME')
|
||||
local path = vis.win.file.path or ''
|
||||
local dir = path:match('^.*/') or ''
|
||||
local reg = ''
|
||||
if vis.register ~= '"' then
|
||||
reg = string.gsub(vis.registers[vis.register][1], '%z', '')
|
||||
if not query and vis.register ~= '"' then
|
||||
query = string.gsub(vis.registers[vis.register][1], '%z', '')
|
||||
end
|
||||
local cmd = home ..
|
||||
'/.config/vis/fzf.sh ' ..
|
||||
escape_and_quoted(arg) .. ' ' .. escape_and_quoted(dir) .. ' ' .. escape_and_quoted(reg)
|
||||
escape_and_quoted(arg) .. ' ' .. escape_and_quoted(dir) .. ' ' .. escape_and_quoted(query or '')
|
||||
cmd_action(cmd, action)
|
||||
end
|
||||
|
||||
vis:command_register('fzf-files', function(argv, force, win, selection, range)
|
||||
fzf_sh(argv[1] or 'auto-files', argv[2])
|
||||
end)
|
||||
|
||||
local function search(cmd, action)
|
||||
if action == nil then
|
||||
action = function(out)
|
||||
@@ -189,12 +192,27 @@ local function add_global_mark()
|
||||
end
|
||||
end
|
||||
|
||||
local lfs = require('lfs')
|
||||
local theme_modification = 0
|
||||
local last_theme = 'default'
|
||||
|
||||
function set_current_theme()
|
||||
local f = io.open(os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf')
|
||||
local path = os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf'
|
||||
local m = lfs.attributes(path, 'modification')
|
||||
if m == theme_modification then
|
||||
return
|
||||
end
|
||||
theme_modification = m
|
||||
local f = io.open(path)
|
||||
if f then
|
||||
local s = f:read('*all')
|
||||
f:close()
|
||||
if s:match('light') then
|
||||
local theme = s:match('light') and 'light' or 'dark'
|
||||
if theme == last_theme then
|
||||
return
|
||||
end
|
||||
last_theme = theme
|
||||
if theme == 'light' then
|
||||
vis:command('set theme lupan-light')
|
||||
else
|
||||
vis:command('set theme lupan-dark')
|
||||
@@ -242,9 +260,9 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:map(vis.modes.NORMAL, ' K', close_prev_win)
|
||||
vis:map(vis.modes.NORMAL, ' J', close_next_win)
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' l[', ':lspc-prev-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' l]', ':lspc-next-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' l=', ':lspc-format<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' [', '<vis-prompt-show>lspc-prev-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' ]', '<vis-prompt-show>lspc-next-diagnostic<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' =', '<vis-prompt-show>lspc-format<Enter>')
|
||||
|
||||
for num = 1, 9 do
|
||||
vis:map(vis.modes.NORMAL, ' r' .. num, function() set_file_slot(num) end, 'set file slot ' .. num)
|
||||
@@ -254,13 +272,8 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
'open file slot ' .. num)
|
||||
end
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' s', function()
|
||||
fzf_sh('auto-search')
|
||||
end, 'fzf: search')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' f', function()
|
||||
fzf_sh('auto-files')
|
||||
end, 'fzf: files')
|
||||
vis:map(vis.modes.NORMAL, ' s', '<vis-prompt-show>fzf-files auto-search<Enter>', 'fzf: search')
|
||||
vis:map(vis.modes.NORMAL, ' f', '<vis-prompt-show>fzf-files auto-files<Enter>', 'fzf: files')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' /', function()
|
||||
search(fzf_reload(ripgrep .. ' --with-filename {q} ' .. escape_and_quoted(vis.win.file.path)))
|
||||
@@ -317,20 +330,16 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
end)
|
||||
end, 'fzf change directory')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' yy', function()
|
||||
vis:command('!yazi')
|
||||
end, 'yazi')
|
||||
vis:map(vis.modes.NORMAL, ' l', '<vis-prompt-show>!lf<Enter>', 'lf file manager')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' y.', function()
|
||||
vis:map(vis.modes.NORMAL, ' L', function()
|
||||
local path = vis.win.file.path
|
||||
if path then
|
||||
local dir = path:match('^.*/')
|
||||
local arg = escape_and_quoted(dir)
|
||||
vis:command('!cd ' .. arg .. ' && yazi')
|
||||
vis:command('!lf ' .. escape_and_quoted(path:match('^.*/')))
|
||||
else
|
||||
vis:command('!yazi')
|
||||
vis:command('!lf')
|
||||
end
|
||||
end, 'yazi in file directory')
|
||||
end, 'lf file manager in current file directory')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' ma', add_global_mark, 'global marks: add')
|
||||
|
||||
@@ -349,7 +358,11 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:map(vis.modes.NORMAL, ' tl', function()
|
||||
vis:command('set theme lupan-light')
|
||||
end, 'change to light theme')
|
||||
vis:map(vis.modes.NORMAL, ' tt', set_current_theme)
|
||||
|
||||
vis:map(vis.modes.NORMAL, '<C-l>', function()
|
||||
vis:feedkeys('<vis-selections-remove-column-except>')
|
||||
set_current_theme()
|
||||
end, 'Remove all but the count selection column and update theme if needed')
|
||||
|
||||
set_current_theme()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user