From 38c18f7b3dd3bee4678058ec226538ff91075fda Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Wed, 29 May 2024 14:48:08 +0200 Subject: rc.lua: replace tasklist with flexible wibox --- rc.lua | 56 +++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/rc.lua b/rc.lua index f428213..0a2a47b 100644 --- a/rc.lua +++ b/rc.lua @@ -32,6 +32,7 @@ editor = "emacs" editor_cmd = terminal .. " -e emacs -nw" modkey = "Mod4" altkey = "Mod1" +home = os.getenv("HOME") exec = awful.spawn scount = screen.count() @@ -67,11 +68,11 @@ awful.layout.layouts = { -- {{{ Wibar -- -- {{{ Reusable separator -myseparator = wibox.widget.imagebox("/home/anrxc/.config/awesome/icons/separator.png", false) +myseparator = wibox.widget.imagebox(home .. "/.config/awesome/icons/separator.png", false) -- }}} -- {{{ CPU temperature -mycpuicon = wibox.widget.imagebox("/home/anrxc/.config/awesome/icons/cpu.png", false) +mycpuicon = wibox.widget.imagebox(home .. "/.config/awesome/icons/cpu.png", false) -- Initialize widget mycpuwidget = wibox.widget.textbox() -- Register widget @@ -79,7 +80,7 @@ vicious.register(mycpuwidget, vicious.widgets.thermal, "$1C", 19, "thermal_zone0 -- }}} -- {{{ Battery state -mybaticon = wibox.widget.imagebox("/home/anrxc/.config/awesome/icons/bat.png", false) +mybaticon = wibox.widget.imagebox(home .. "/.config/awesome/icons/bat.png", false) -- Initialize widget mybatwidget = wibox.widget.textbox() -- Register widget @@ -87,8 +88,8 @@ vicious.register(mybatwidget, vicious.widgets.bat, "$1$2%", 61, "BAT0") -- }}} -- {{{ Network usage -mydnicon = wibox.widget.imagebox("/home/anrxc/.config/awesome/icons/down.png", false) -myupicon = wibox.widget.imagebox("/home/anrxc/.config/awesome/icons/up.png", false) +mydnicon = wibox.widget.imagebox(home .. "/.config/awesome/icons/down.png", false) +myupicon = wibox.widget.imagebox(home .. "/.config/awesome/icons/up.png", false) -- Initialize widget mynetwidget = wibox.widget.textbox() vicious.register(mynetwidget, vicious.widgets.net, '${eth0 up_kb}', 3) -- }}} +-- {{{ Volume level +myvolicon = wibox.widget.imagebox(home .. "/.config/awesome/icons/vol.png", false) +-- Initialize widget +myvolwidget = wibox.widget.textbox() +vicious.register(myvolwidget, vicious.widgets.volume, "$1%", 2, "Master") +-- Register buttons +myvolwidget:buttons(gears.table.join( + awful.button({ }, 1, function () exec("urxvt -T Alsamixer -e alsamixer") end), + awful.button({ }, 4, function () exec("amixer -q -c 0 set Master 1dB+") end), + awful.button({ }, 5, function () exec("amixer -q -c 0 set Master 1dB-") end) +)) +-- }}} + -- {{{ Date and time -mydateicon = wibox.widget.imagebox("/home/anrxc/.config/awesome/icons/time.png", false) +mydateicon = wibox.widget.imagebox(home .. "/.config/awesome/icons/time.png", false) -- Initialize widgets mydatewidget = wibox.widget.textbox() mydatestwidget = wibox.widget.textbox() @@ -106,6 +120,10 @@ vicious.register(mydatewidget, vicious.widgets.date, "%R", 61) -- Amst vicious.register(mydatestwidget, vicious.widgets.date, "%R", 61, -21600) -- New York -- }}} +-- {{{ Flexible widget +myflexeidget = wibox.widget.textbox() +-- }}} + -- {{{ Wibox initialisation local taglist_buttons = gears.table.join( @@ -187,11 +205,11 @@ awful.screen.connect_for_each_screen(function(s) } -- Create the tasklist - s.mytasklist = awful.widget.tasklist { - screen = s, - filter = awful.widget.tasklist.filter.currenttags, - buttons = tasklist_buttons - } + --s.mytasklist = awful.widget.tasklist { + -- screen = s, + -- filter = awful.widget.tasklist.filter.currenttags, + -- buttons = tasklist_buttons + --} -- Create the wibox -- * theme font "Terminus 8" or "ProFont 8" for this widget bar height @@ -207,7 +225,11 @@ awful.screen.connect_for_each_screen(function(s) myseparator, s.mypromptbox, }, - s.mytasklist, -- Middle widget + { -- Middle widget + layout = wibox.layout.flex.horizontal, + myflexwidget, + }, + --s.mytasklist, { -- Right widgets layout = wibox.layout.fixed.horizontal, myseparator, @@ -221,6 +243,9 @@ awful.screen.connect_for_each_screen(function(s) mynetwidget, myupicon, myseparator, + myvolicon, + myvolwidget, + myseparator, mydateicon, mydatestwidget, myseparator, @@ -523,6 +548,7 @@ awful.rules.rules = { name = { "Library", -- firefox downloads, history... "Event Tester", -- xev + "Alsamixer", }, role = { @@ -619,7 +645,7 @@ end -- {{{ Autostart -awful.spawn("/usr/bin/xinput set-prop 9 334 0 1 0") -- touchpad single finger scrolling -awful.spawn("/home/anrxc/bin/autostart-keychain-agent.sh") -- launch the ssh-agent -awful.spawn("/home/anrxc/bin/autostart-xmodmap-xdefaults.sh") -- xrdb merge defaults and keymap +awful.spawn("/usr/bin/xinput set-prop 9 334 0 1 0") -- touchpad single finger scrolling +awful.spawn(home .. "/bin/autostart-keychain-agent.sh") -- launch the ssh-agent +awful.spawn(home .. "/bin/autostart-xmodmap-xdefaults.sh") -- xrdb merge defaults and keymap -- }}} -- cgit v1.2.3