This commit is contained in:
Daan Vanoverloop 2019-10-17 16:34:26 +02:00
commit 87000b607c
2 changed files with 99 additions and 36 deletions

View File

@ -490,12 +490,12 @@ awful.screen.connect_for_each_screen(function(s)
s.dock_trigger = wibox({ bg = "#00000000", opacity = 0, ontop = true, visible = true })
s.dock_trigger:geometry({ width = 3, height = 3 })
s.topwibox:connect_signal("mouse::enter", function() start_switcher() end)
s.topwibox:connect_signal("mouse::leave", function() switcher_timer:again() end)
s.bottomwibox:connect_signal("mouse::enter", function() start_switcher() end)
s.bottomwibox:connect_signal("mouse::leave", function() switcher_timer:again() end)
s.dock_trigger:connect_signal("mouse::enter", function() start_switcher() end)
s.dock_trigger:connect_signal("mouse::leave", function() switcher_timer:again() end)
s.topwibox:connect_signal("mouse::enter", function() enable_bars() end)
s.topwibox:connect_signal("mouse::leave", function() bar_timer:again() end)
s.bottomwibox:connect_signal("mouse::enter", function() enable_bars() end)
s.bottomwibox:connect_signal("mouse::leave", function() bar_timer:again() end)
s.dock_trigger:connect_signal("mouse::enter", function() enable_bars() end)
s.dock_trigger:connect_signal("mouse::leave", function() bar_timer:again() end)
end)
-- }}}
@ -507,12 +507,22 @@ root.buttons(gears.table.join(
))
-- }}}
function table.copy(t)
local u = { }
for k, v in pairs(t) do u[k] = v end
return setmetatable(u, getmetatable(t))
end
switcher_layout = awful.layout.suit.fair
switcher_mode = false
switcher_timer = timer({ timeout = 1 })
switcher_timer:connect_signal("timeout", function () end_switcher() end)
bar_timer = timer({ timeout = 1 })
bar_timer:connect_signal("timeout", function () disable_bars() end)
bar_mode = false
layout_table = {}
previous_tags = {}
function start_switcher ()
if switcher_timer.started then switcher_timer:stop() end
@ -524,14 +534,15 @@ function start_switcher ()
for _, tag in ipairs(root.tags()) do
layout_table[tag] = tag.layout
tag.layout = switcher_layout
tag.selected = true
end
-- Enable all bars
for s in screen do
s.topwibox.visible = true
s.bottomwibox.visible = true
for k,v in pairs(s.selected_tags) do table.insert(previous_tags, v) end
end
enable_bars()
for _, c in ipairs(client.get()) do
set_borders(c)
end
@ -546,29 +557,53 @@ function end_switcher ()
-- Restore layout of all tags
for _, tag in ipairs(root.tags()) do
tag.layout = layout_table[tag]
if client.focus and tag ~= client.focus.first_tag or client.focus == nil then
tag.selected = false
end
end
-- Set the master window
for _, c in ipairs(client.get()) do
remove_borders(c)
end
-- Set focused client as master
if client.focus then client.focus:swap(awful.client.getmaster()) end
-- Disable all bars
for s in screen do
s.topwibox.visible = false
s.bottomwibox.visible = false
if client.focus then
client.focus:swap(awful.client.getmaster())
else
for _, tag in ipairs(previous_tags) do
tag.selected = true
end
end
--rofi_kill()
disable_bars()
previous_tags = {}
end
function toggle_switcher ()
if switcher_mode then end_switcher() else start_switcher() end
end
function enable_bars ()
if bar_timer.started then bar_timer:stop() end
if bar_mode == true then return else bar_mode = true end
for s in screen do
s.topwibox.visible = true
s.bottomwibox.visible = true
end
end
function disable_bars ()
if bar_timer.started then bar_timer:stop() end
if bar_mode == false then return else bar_mode = false end
for s in screen do
s.topwibox.visible = false
s.bottomwibox.visible = false
end
end
function set_borders (c)
c.border_width = beautiful.border_width
awful.titlebar.show(c)
@ -790,6 +825,12 @@ clientkeys = gears.table.join(
{description = "close", group = "client"}),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
{description = "toggle floating", group = "client"}),
awful.key({ modkey, "Control", "Shift" }, "space", function (c)
c.maximized = false
c.maximized_vertical = false
c.maximized_horizontal = false
end,
{description = "toggle floating", group = "client"}),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
{description = "move to master", group = "client"}),
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
@ -891,7 +932,11 @@ 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,
maximized_vertical = false,
maximized_horizontal = false,
floating = false,
maximized = false
}
},

54
.vimrc
View File

@ -9,10 +9,8 @@ call plug#begin()
Plug 'arcticicestudio/nord-vim'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'fweep/vim-tabber.git'
Plug 'rhysd/vim-clang-format'
Plug 'kana/vim-operator-user'
Plug 'https://github.com/antoyo/vim-licenses'
Plug 'rust-lang/rust.vim'
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
@ -32,11 +30,44 @@ let g:deoplete#enable_at_startup = 1
set tags+=./.tags
" Session management
set switchbuf=useopen,usetab
fu! SaveSess()
execute 'mksession! ' . getcwd() . '/.session.vim'
endfunction
fu! RestoreSess()
if filereadable(getcwd() . '/.session.vim')
let initial_args = argv()
execute 'so ' . getcwd() . '/.session.vim'
for file in initial_args
if bufloaded(file) != 1
execute 'tabnew ' . getcwd() . '/' . file
else
execute 'sb ' . file
endif
endfor
endif
endfunction
" Save session on quitting Vim
autocmd VimLeave * NERDTreeTabsClose
autocmd VimLeave * call SaveSess()
" Restore session on starting Vim
autocmd VimEnter * nested call RestoreSess()
"----------------------
" move between tabs
nnoremap <A-Left> :tabprevious<CR>
nnoremap <A-Right> :tabnext<CR>
nnoremap <A-Left> :tabprevious<CR>
nnoremap <A-Right> :tabnext<CR>
map <C-n> :NERDTreeMirrorToggle<CR>
" prevent mouse vanishing
set nomousehide
@ -52,10 +83,6 @@ endfunction
map <F12> <Esc>:call ToggleGUICruft()<cr>
set tabline=%!tabber#TabLine()
let g:tabber_filename_style = 'filename' " README.md\
let g:tabber_divider_style = 'compatible'
set number
set linebreak
set nobackup
@ -73,25 +100,16 @@ nnoremap K <nop>
runtime! ftplugin/man.vim
nnoremap K :Man <cword>
noremap <C-S> :update<CR><CR>
vnoremap <C-S> <C-C>:update<CR><CR>
inoremap <C-S> <C-O>:update<CR><CR>
set mouse=a
set nu
let g:clang_format#code_style="webkit"
let g:clang_format#code_style="llvm"
set clipboard=unnamed
set backspace=indent,eol,start " allow backspacing over everything in insert mode
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
" where it should get the dictionary files
let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
set laststatus=2
let g:nord_uniform_diff_background = 1
let g:nord_cursor_line_number_background = 1