Add custom Taglist

This commit is contained in:
Thomas Avé 2022-07-27 01:43:14 +02:00
parent 8b817e1f19
commit 33b6b84815
8 changed files with 84 additions and 37 deletions

View File

@ -15,6 +15,7 @@ local beautiful = require("beautiful")
local wibox = require("wibox") 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 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")
@ -95,7 +96,7 @@ top_panel.create = function(s)
expand = "none", expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
task_list.create(s), task_list.create(s),
nil, tag_list.create(s),
{ {
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),

View File

@ -18,7 +18,7 @@ local beautiful = require("beautiful")
local volume_widget = require("widgets.volume-widget.volume") local volume_widget = require("widgets.volume-widget.volume")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
-- Define mod keys
local modkey = "Mod4" local modkey = "Mod4"
local altkey = "Shift" local altkey = "Shift"
@ -162,7 +162,7 @@ keys.globalkeys = gears.table.join(
{description = "Open Nautilus", group = "launcher"} {description = "Open Nautilus", group = "launcher"}
), ),
-- launch rofi -- launch rofi
awful.key({modkey}, "d", awful.key({modkey, altkey}, "F9",
function() function()
awful.spawn("/home/user/.config/awesome/scripts/toggle_rofi.sh") awful.spawn("/home/user/.config/awesome/scripts/toggle_rofi.sh")
end, end,

View File

@ -11,9 +11,8 @@
local awful = require("awful") local awful = require("awful")
local gears = require("gears")
local lain = require("lain") local lain = require("lain")
local quake = lain.util.quake({app="kitty", followtag=true, argname = '--class %s', extra="-e tmux", height=0.3}) local quake = lain.util.quake({app="alacritty", followtag=true, argname = '--class %s', extra="--option=window.opacity=1.0 --option=\"colors.primary.background='#000d2b'\" -e tmux", height=0.3})
local pastel = {} local pastel = {}
@ -35,8 +34,7 @@ pastel.initialize = function()
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
for i = 1, 9, 1 for i = 1, 9, 1
do do
awful.tag.add(i, { awful.tag.add(tostring(i), {
icon_only = true,
layout = awful.layout.suit.tile, layout = awful.layout.suit.tile,
screen = s, screen = s,
selected = i == 1 selected = i == 1

View File

@ -16,8 +16,6 @@ local awful = require("awful")
-- =================================================================== -- ===================================================================
local theme_config_dir = gears.filesystem.get_configuration_dir() .. "/configuration/"
-- define default apps (global variable so other components can access it) -- define default apps (global variable so other components can access it)
apps = { apps = {
network_manager = "nm-connection-editor", -- recommended: nm-connection-editor network_manager = "nm-connection-editor", -- recommended: nm-connection-editor
@ -29,18 +27,11 @@ apps = {
filebrowser = "nautilus" filebrowser = "nautilus"
} }
-- define wireless and ethernet interface names for the network widget
-- use `ip link` command to determine these
network_interfaces = {
lan = 'enp4s0'
}
-- List of apps to run on start-up -- List of apps to run on start-up
local run_on_start_up = { local run_on_start_up = {
"numlockx on", "numlockx on",
"bluetoothctl power on",
"nm-applet", "nm-applet",
"xcape -e \"Super_L=Super_L|d\"" "xcape -e \"Super_L=Super_L|Shift_L|F9\""
} }
-- =================================================================== -- ===================================================================
@ -90,16 +81,6 @@ awful.layout.layouts = {
awful.layout.suit.fair.horizontal, awful.layout.suit.fair.horizontal,
} }
-- remove gaps if layout is set to max
tag.connect_signal('property::layout', function(t)
local current_layout = awful.tag.getproperty(t, 'layout')
if (current_layout == awful.layout.suit.max) then
t.gap = 0
else
t.gap = beautiful.useless_gap
end
end)
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c) client.connect_signal("manage", function (c)
-- Set the window as a slave (put it at the end of others instead of setting it as master) -- Set the window as a slave (put it at the end of others instead of setting it as master)
@ -152,7 +133,7 @@ require("awesomewm-vim-tmux-navigator") {
right = {"Right", "l"}, right = {"Right", "l"},
mod = "Mod4", mod = "Mod4",
mod_keysym = "Super_L", mod_keysym = "Super_L",
-- experimental = true experimental = true
} }
local handle_single_win = function(focused) local handle_single_win = function(focused)

View File

@ -53,12 +53,6 @@ theme.border_normal = theme.bg_normal
theme.border_focus = "#ff0000" theme.border_focus = "#ff0000"
theme.border_marked = theme.fg_urgent theme.border_marked = theme.fg_urgent
-- Taglist
theme.taglist_bg_empty = theme.bg_normal
theme.taglist_bg_occupied = "#ffffff1a"
theme.taglist_bg_urgent = "#e91e6399"
theme.taglist_bg_focus = theme.bg_focus
-- Tasklist -- Tasklist
theme.tasklist_font = theme.font theme.tasklist_font = theme.font
@ -74,6 +68,9 @@ theme.tasklist_fg_normal = theme.fg_normal
theme.top_panel_height = dpi(30) theme.top_panel_height = dpi(30)
theme.top_panel_powerline = "#002F5F" theme.top_panel_powerline = "#002F5F"
-- Taglist
theme.taglist_bg_focus = theme.top_panel_powerline
-- Notification Sizing -- Notification Sizing
theme.notification_max_width = dpi(350) theme.notification_max_width = dpi(350)

View File

@ -0,0 +1,67 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local theme = require("theme")
local naughty = require("naughty")
local tag_list = {}
tag_list.create = function(s)
local filter = function(tag)
count = 0
for idx, tag in ipairs(s.tags) do
if #tag:clients() > 0 or tag.selected then
count = count + 1
end
end
return (#tag:clients() > 0 and count > 1) or (tag.selected and #tag:clients() == 0)
end
local taglist_buttons = awful.util.table.join(
awful.button({}, 1,
function(c)
c.selected = true
for idx, tag in ipairs(s.tags) do
if tag.index ~= c.index then
tag.selected = false
end
end
end
)
)
return awful.widget.taglist {
screen = s,
-- filter = awful.widget.taglist.filter.noempty,
filter = filter,
widget_template = {
{
{
id = 'index_role',
widget = wibox.widget.textbox,
},
left = 10,
right = 10,
widget = wibox.container.margin
},
id = 'background_role',
widget = wibox.container.background,
create_callback = function(self, c3, index, objects)
self:get_children_by_id('index_role')[1].markup = '<b> '..c3.name..' </b>'
self:connect_signal('mouse::enter', function()
if self.bg ~= theme.top_panel_powerline then
self.backup = self.bg
self.has_backup = true
end
self.bg = theme.top_panel_powerline
end)
self:connect_signal('mouse::leave', function()
if self.has_backup and not c3.selected then self.bg = self.backup end
end)
end,
},
buttons = taglist_buttons,
}
end
return tag_list

View File

@ -104,7 +104,10 @@ require('lspconfig').texlab.setup {
} }
require('lspconfig').clangd.setup { require('lspconfig').clangd.setup {
capabilities = capabilities capabilities = capabilities,
-- root_dir = function()
-- return require('lspconfig').util.root_pattern({'.clang-format', 'build/', 'compile_flags.txt'})
-- end
} }
require('lspconfig').bashls.setup { require('lspconfig').bashls.setup {

View File

@ -2,7 +2,7 @@ configuration {
font: "SF Pro Rounded 13"; font: "SF Pro Rounded 13";
show-icons: true; show-icons: true;
icon-theme: "Papirus"; icon-theme: "Papirus";
kb-cancel: "Super_L+d,Escape"; kb-cancel: "Super_L+Shift_L+F9,Escape";
combi-hide-mode-prefix: true; combi-hide-mode-prefix: true;
} }
@theme "~/.config/rofi/material-ocean.rasi" @theme "~/.config/rofi/material-ocean.rasi"