Seperate taglist tasklist and layoutbox for each screen

This commit is contained in:
Thomas Avé 2023-01-15 18:11:55 +01:00
parent 75eebc16c4
commit 7ab7fdbb81
6 changed files with 71 additions and 42 deletions

View File

@ -1,4 +1,5 @@
-- ████████╗ ██████╗ ██████╗ ██████╗ █████╗ ███╗ ██╗███████╗██╗ -- ████████╗ ██████╗ ██████╗ █
-- █████╗ █████╗ ███╗ ██╗███████╗██╗
-- ╚══██╔══╝██╔═══██╗██╔══██╗ ██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ -- ╚══██╔══╝██╔═══██╗██╔══██╗ ██╔══██╗██╔══██╗████╗ ██║██╔════╝██║
-- ██║ ██║ ██║██████╔╝ ██████╔╝███████║██╔██╗ ██║█████╗ ██║ -- ██║ ██║ ██║██████╔╝ ██████╔╝███████║██╔██╗ ██║█████╗ ██║
-- ██║ ██║ ██║██╔═══╝ ██╔═══╝ ██╔══██║██║╚██╗██║██╔══╝ ██║ -- ██║ ██║ ██║██╔═══╝ ██╔═══╝ ██╔══██║██║╚██╗██║██╔══╝ ██║
@ -16,6 +17,7 @@ local wibox = require("wibox")
local theme = require("theme") local theme = require("theme")
local lain = require("lain") local lain = require("lain")
local tag_list = require("widgets.tag-list") local tag_list = require("widgets.tag-list")
local layout_box = require("widgets.layout-box")
local battery_widget = require("widgets.battery-widget.battery") local battery_widget = require("widgets.battery-widget.battery")
local volume_widget = require("widgets.volume-widget.volume") local volume_widget = require("widgets.volume-widget.volume")
local pl = require("powerline") local pl = require("powerline")
@ -23,8 +25,6 @@ local pl = require("powerline")
-- import widgets -- import widgets
local task_list = require("widgets.task-list") local task_list = require("widgets.task-list")
-- =================================================================== -- ===================================================================
-- Custom Widgets -- Custom Widgets
-- =================================================================== -- ===================================================================
@ -80,6 +80,21 @@ local cpu_widget = wibox.widget{
local clock = wibox.widget.textclock('%a %b %d, %H:%M:%S', 1) local clock = wibox.widget.textclock('%a %b %d, %H:%M:%S', 1)
local tag_lists = {}
local current_tag_list = wibox.widget {
layout = wibox.layout.fixed.horizontal
}
local layout_boxes = {}
local current_layout_box = wibox.widget {
layout = wibox.layout.fixed.horizontal
}
local task_lists = {}
local current_task_list = wibox.widget {
layout = wibox.layout.fixed.horizontal
}
-- =================================================================== -- ===================================================================
-- Bar Creation -- Bar Creation
-- =================================================================== -- ===================================================================
@ -94,11 +109,19 @@ top_panel.create = function(s)
bg = theme.bg_normal .. "99" bg = theme.bg_normal .. "99"
}) })
for t in screen do
tag_lists[t] = tag_list.create(t)
layout_boxes[t] = layout_box.create(t)
end
current_tag_list:add(tag_lists[s])
current_layout_box:add(layout_boxes[s])
panel:setup { panel:setup {
expand = "none", expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
task_list.create(s), task_list.create(s),
tag_list.create(s), current_tag_list,
{ {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
pl(wibox.widget{}, theme.bg_normal .. "00", theme.top_panel_powerline), pl(wibox.widget{}, theme.bg_normal .. "00", theme.top_panel_powerline),
@ -109,7 +132,7 @@ top_panel.create = function(s)
pl(cpu_widget, theme.top_panel_powerline, theme.bg_normal), pl(cpu_widget, theme.top_panel_powerline, theme.bg_normal),
pl(frequency_widget, theme.bg_normal, theme.top_panel_powerline), pl(frequency_widget, theme.bg_normal, theme.top_panel_powerline),
pl(updates_indicator, theme.top_panel_powerline, theme.bg_normal), pl(updates_indicator, theme.top_panel_powerline, theme.bg_normal),
pl(require("widgets.layout-box"), theme.bg_normal, theme.top_panel_powerline), pl(current_layout_box, theme.bg_normal, theme.top_panel_powerline),
pl(clock, theme.top_panel_powerline, theme.top_panel_powerline), pl(clock, theme.top_panel_powerline, theme.top_panel_powerline),
} }
} }
@ -119,18 +142,14 @@ top_panel.create = function(s)
-- Functionality -- Functionality
-- =================================================================== -- ===================================================================
client.connect_signal("focus", function (c, _)
-- hide panel when client is fullscreen current_tag_list:reset(current_tag_list)
local function change_panel_visibility(client) current_tag_list:add(tag_lists[c.screen])
if client.screen == s then current_layout_box:reset(current_layout_box)
panel.ontop = not client.fullscreen current_layout_box:add(layout_boxes[c.screen])
end end)
end
-- connect panel visibility function to relevant signals -- connect panel visibility function to relevant signals
client.connect_signal("property::fullscreen", change_panel_visibility)
client.connect_signal("focus", change_panel_visibility)
updates_indicator:connect_signal("button::press", function(c, _, _, button) updates_indicator:connect_signal("button::press", function(c, _, _, button)
awful.spawn.with_shell('WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c "yay ; echo \'\nDone, press any key to exit...\' ; read"') awful.spawn.with_shell('WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c "yay ; echo \'\nDone, press any key to exit...\' ; read"')
end) end)

View File

@ -90,6 +90,7 @@ client.connect_signal("manage", function (c)
-- Prevent clients from being unreachable after screen count changes. -- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c) awful.placement.no_offscreen(c)
end end
gears.timer.delayed_call(function() awful.placement.centered(mouse, {parent=c}) end)
end) end)
@ -106,7 +107,6 @@ client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:emit_signal("request::activate", "mouse_enter", {raise = false})
end) end)
-- =================================================================== -- ===================================================================
-- Screen Change Functions (ie multi monitor) -- Screen Change Functions (ie multi monitor)
-- =================================================================== -- ===================================================================

View File

@ -20,9 +20,12 @@ local awful = require('awful')
-- Create an imagebox widget which will contains an icon indicating which layout we're using. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen. -- We need one layoutbox per screen.
local layout_box = awful.widget.layoutbox(s)
layout_box:buttons( local layout_box = {}
layout_box.create = function(s)
local box = awful.widget.layoutbox(s)
box:buttons(
awful.util.table.join( awful.util.table.join(
awful.button({}, 1, awful.button({}, 1,
function() function()
@ -45,6 +48,8 @@ layout_box:buttons(
end end
) )
) )
) )
return box
end
return layout_box return layout_box

View File

@ -114,10 +114,10 @@ local function list_update(w, buttons, label, data, objects)
else else
-- truncate when title is too long -- truncate when title is too long
local text_only = text:match('>(.*)<') local text_only = text:match('>(.*)<')
local max_length = 10 local max_length = math.floor(220 / count)
if (text_only:len() > max_length) then if (text_only:len() > max_length) then
text = text:gsub('>(.*)<', '>' .. utf8.char(utf8.codepoint(text_only, 1, max_length)) .. '...<') text = text:gsub('>(.*)<', '>' .. utf8.char(utf8.codepoint(text_only, 1, max_length)) .. '...<')
tt:set_text(text) tt:set_text(text_only)
tt:add_to_object(tb) tt:add_to_object(tb)
else else
tt:remove_from_object(tb) tt:remove_from_object(tb)
@ -195,7 +195,7 @@ local filter = function(c, _)
if t.selected then if t.selected then
local ctags = c:tags() local ctags = c:tags()
for _, v in ipairs(ctags) do for _, v in ipairs(ctags) do
if v == t then if v == t and c.screen == client.focus.screen then
return true return true
end end
end end

View File

@ -157,6 +157,10 @@ require('lspconfig').cssls.setup {
capabilities = capabilities capabilities = capabilities
} }
require('lspconfig').jdtls.setup {
capabilities = capabilities
}
require'lspconfig'.sumneko_lua.setup { require'lspconfig'.sumneko_lua.setup {
settings = { settings = {
Lua = { Lua = {

View File

@ -1,5 +1,6 @@
require('packer').startup(function(use) require('packer').startup(function(use)
use 'mbbill/undotree' use 'mbbill/undotree'
use 'nvim-tree/nvim-web-devicons'
use 'airblade/vim-rooter' use 'airblade/vim-rooter'
use "rafamadriz/friendly-snippets" use "rafamadriz/friendly-snippets"
use 'ConradIrwin/vim-bracketed-paste' use 'ConradIrwin/vim-bracketed-paste'