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 gears = require("gears")
local lain = require("lain") local lain = require("lain")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local icons = gears.filesystem.get_configuration_dir() .. "/icons/top-panel/" local mycpufreq = require("widgets/cpufreq")
-- import widgets -- import widgets
local task_list = require("widgets.task-list") local task_list = require("widgets.task-list")
@ -25,6 +25,11 @@ local task_list = require("widgets.task-list")
-- define module table -- define module table
local top_panel = {} 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 -- Bar Creation
@ -59,7 +64,7 @@ top_panel.create = function(s)
panel:setup { panel:setup {
expand = "none", expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
task_list.create(s), task_lists,
wibox.widget.textclock('%a %b %d, %H:%M:%S', 1), wibox.widget.textclock('%a %b %d, %H:%M:%S', 1),
{ {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
@ -81,10 +86,11 @@ top_panel.create = function(s)
wibox.widget.textbox(' | '), 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), 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 | '), 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), awful.widget.watch('bash -c "sensors | grep Tctl | cut -f 10 -d \' \' | cut -c 2-"', 5),
wibox.widget.textbox(' | '), wibox.widget.textbox(' | '),
wibox.layout.margin(require("widgets.layout-box"), dpi(5), dpi(5), dpi(5), dpi(5)), 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"} {description = "open a terminal", group = "launcher"}
), ),
-- Spawn browser -- Spawn browser
awful.key({modkey}, "f", awful.key({modkey}, "b",
function() function()
awful.spawn("firefox-developer-edition") awful.spawn("firefox-developer-edition")
end, end,
{description = "open a terminal", group = "launcher"} {description = "Open Firefox", group = "launcher"}
), ),
-- launch rofi -- launch rofi
awful.key({modkey}, "d", awful.key({modkey}, "d",
@ -156,6 +156,13 @@ keys.globalkeys = gears.table.join(
end, end,
{description = "application launcher", group = "launcher"} {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 -- Quake
awful.key({ }, "F9", function () awful.screen.focused().quake:toggle() end), awful.key({ }, "F9", function () awful.screen.focused().quake:toggle() end),
@ -548,12 +555,12 @@ keys.clientkeys = gears.table.join(
), ),
-- toggle fullscreen -- toggle fullscreen
awful.key({modkey}, "f", -- awful.key({modkey}, "f",
function(c) -- function(c)
c.fullscreen = not c.fullscreen -- c.fullscreen = not c.fullscreen
end, -- end,
{description = "toggle fullscreen", group = "client"} -- {description = "toggle fullscreen", group = "client"}
), -- ),
-- close client -- close client
awful.key({modkey}, "q", awful.key({modkey}, "q",
@ -563,6 +570,14 @@ keys.clientkeys = gears.table.join(
{description = "close", group = "client"} {description = "close", group = "client"}
), ),
-- float client
awful.key({modkey}, "f",
function(c)
awful.client.floating.toggle(c)
end,
{description = "float", group = "client"}
),
-- Minimize -- Minimize
awful.key({modkey}, "n", awful.key({modkey}, "n",
function(c) function(c)

View File

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

View File

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