fix shortening when maximized

This commit is contained in:
Thomas Avé 2022-07-21 15:40:10 +02:00
parent 3766d6ac01
commit 4b6b00859e
4 changed files with 39 additions and 16 deletions

View File

@ -17,7 +17,7 @@ local theme = require("theme")
local gears = require("gears")
local lain = require("lain")
local dpi = beautiful.xresources.apply_dpi
local icons = gears.filesystem.get_configuration_dir() .. "/icons/top-panel/"
local mycpufreq = require("widgets/cpufreq")
-- import widgets
local task_list = require("widgets.task-list")
@ -25,6 +25,11 @@ local task_list = require("widgets.task-list")
-- define module table
local top_panel = {}
local task_lists = {layout = wibox.layout.fixed.horizontal}
awful.screen.connect_for_each_screen(function(s)
table.insert(task_lists, task_list.create(s))
end)
-- ===================================================================
-- Bar Creation
@ -59,7 +64,7 @@ top_panel.create = function(s)
panel:setup {
expand = "none",
layout = wibox.layout.align.horizontal,
task_list.create(s),
task_lists,
wibox.widget.textclock('%a %b %d, %H:%M:%S', 1),
{
layout = wibox.layout.fixed.horizontal,
@ -81,10 +86,11 @@ top_panel.create = function(s)
wibox.widget.textbox(' | '),
awful.widget.watch('bash -c "/usr/bin/cat /proc/cpuinfo | grep MHz | cut -b 12- | sort -r | head -n 1 | xargs printf \'%f / 1000\n\' | bc -l | cut -b -4"', 1),
wibox.widget.textbox('GHz | '),
awful.widget.watch('bash -c "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"', 1),
wibox.widget.textbox(' | '),
awful.widget.watch('bash -c "sensors | grep Tctl | cut -f 10 -d \' \' | cut -c 2-"', 5),
wibox.widget.textbox(' | '),
wibox.layout.margin(require("widgets.layout-box"), dpi(5), dpi(5), dpi(5), dpi(5)),
wibox.widget.textbox(' '),
}
}

View File

@ -143,11 +143,11 @@ keys.globalkeys = gears.table.join(
{description = "open a terminal", group = "launcher"}
),
-- Spawn browser
awful.key({modkey}, "f",
awful.key({modkey}, "b",
function()
awful.spawn("firefox-developer-edition")
end,
{description = "open a terminal", group = "launcher"}
{description = "Open Firefox", group = "launcher"}
),
-- launch rofi
awful.key({modkey}, "d",
@ -156,6 +156,13 @@ keys.globalkeys = gears.table.join(
end,
{description = "application launcher", group = "launcher"}
),
-- launch clipman
awful.key({modkey}, "c",
function()
awful.spawn('bash -c "CM_LAUNCHER=rofi clipmenu"')
end,
{description = "Clipboard manager", group = "launcher"}
),
-- Quake
awful.key({ }, "F9", function () awful.screen.focused().quake:toggle() end),
@ -548,12 +555,12 @@ keys.clientkeys = gears.table.join(
),
-- toggle fullscreen
awful.key({modkey}, "f",
function(c)
c.fullscreen = not c.fullscreen
end,
{description = "toggle fullscreen", group = "client"}
),
-- awful.key({modkey}, "f",
-- function(c)
-- c.fullscreen = not c.fullscreen
-- end,
-- {description = "toggle fullscreen", group = "client"}
-- ),
-- close client
awful.key({modkey}, "q",
@ -563,6 +570,14 @@ keys.clientkeys = gears.table.join(
{description = "close", group = "client"}
),
-- float client
awful.key({modkey}, "f",
function(c)
awful.client.floating.toggle(c)
end,
{description = "float", group = "client"}
),
-- Minimize
awful.key({modkey}, "n",
function(c)

View File

@ -22,7 +22,7 @@ local theme_config_dir = gears.filesystem.get_configuration_dir() .. "/configura
apps = {
network_manager = "nm-connection-editor", -- recommended: nm-connection-editor
power_manager = "", -- recommended: xfce4-power-manager
terminal = "alacritty",
terminal = 'bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"',
launcher = "/home/user/.toggle_rofi.sh",
lock = "i3lock",
screenshot = "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'",
@ -37,6 +37,8 @@ network_interfaces = {
-- List of apps to run on start-up
local run_on_start_up = {
"numlockx on",
"bluetoothctl power on"
}
-- ===================================================================

View File

@ -49,7 +49,6 @@ local function create_buttons(buttons, object)
)
btns[#btns + 1] = btn
end
return btns
end
end
@ -125,9 +124,10 @@ local function list_update(w, buttons, label, data, objects)
tbm:set_margins(0)
else
-- truncate when title is too long
local text_only = text:match('>(.-)<')
if (text_only:len() > 24) then
text = text:gsub('>(.-)<', '>' .. text_only:sub(1, 21) .. '...<')
local text_only = text:match('>(.*)<')
local naughty = require("naughty")
if (text_only:len() > 25) then
text = text:gsub('>(.*)<', '>' .. text_only:sub(1, 25) .. '...<')
tt:set_text(text_only)
tt:add_to_object(tb)
else