From 4b6b00859e21a33457c1039c964ea8d56e6b332e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Thu, 21 Jul 2022 15:40:10 +0200 Subject: [PATCH] fix shortening when maximized --- awesome/components/pastel/top-panel.lua | 12 +++++++--- awesome/keys.lua | 31 ++++++++++++++++++------- awesome/rc.lua | 4 +++- awesome/widgets/task-list.lua | 8 +++---- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/awesome/components/pastel/top-panel.lua b/awesome/components/pastel/top-panel.lua index 72b58e2..3ea02aa 100644 --- a/awesome/components/pastel/top-panel.lua +++ b/awesome/components/pastel/top-panel.lua @@ -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(' '), } } diff --git a/awesome/keys.lua b/awesome/keys.lua index 81c7bb1..64c7b8e 100644 --- a/awesome/keys.lua +++ b/awesome/keys.lua @@ -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) diff --git a/awesome/rc.lua b/awesome/rc.lua index 07a8dd5..e03f192 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -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" } -- =================================================================== diff --git a/awesome/widgets/task-list.lua b/awesome/widgets/task-list.lua index 7eda949..6ea4e71 100644 --- a/awesome/widgets/task-list.lua +++ b/awesome/widgets/task-list.lua @@ -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