Compare commits

..

2 Commits

39
rc.lua
View File

@ -32,6 +32,8 @@ local function batteryarc() -- detect if there are any batteries before showing
end end
end end
local zombies = {}
-- {{{ Error handling -- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) -- another config (This code will only ever execute for the fallback config)
@ -95,13 +97,19 @@ awful.layout.layouts = {
} }
-- }}} -- }}}
function restart()
for k,v in pairs(zombies) do
awful.spawn.easy_async(string.format("kill %d",v))
end
awesome.restart()
end
-- {{{ Menu -- {{{ Menu
-- Create a launcher widget and a main menu -- Create a launcher widget and a main menu
myawesomemenu = { myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" }, { "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile }, { "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart }, { "restart", restart },
{ "quit", function() awesome.quit() end }, { "quit", function() awesome.quit() end },
} }
@ -113,6 +121,24 @@ mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesom
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu }) menu = mymainmenu })
mpdwidget = wibox.widget({
align = 'center',
valign = 'center',
widget = wibox.widget.textbox
})
function updatempdwidget()
local states = {}
states.playing = ""
states.paused = "||"
awful.spawn.easy_async("mpc status", function(s)
song,status = s:match("([^\n]+)\n%[(.-)%]")
mpdwidget.text = string.format("🎶 %s %s ",(status and states[status]) or "", song or "")
end)
end
updatempdwidget()
zombies[#zombies+1] = awful.spawn.with_line_callback("mpc idleloop", {stdout=updatempdwidget})
-- Menubar configuration -- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it menubar.utils.terminal = terminal -- Set the terminal for applications that require it
menubar.menu_gen.all_menu_dirs = { "/usr/share/applications/", ".local/share/applications/" } menubar.menu_gen.all_menu_dirs = { "/usr/share/applications/", ".local/share/applications/" }
@ -124,8 +150,6 @@ menubar.menu_gen.all_menu_dirs = { "/usr/share/applications/", ".local/share/app
-- Create a textclock widget -- Create a textclock widget
mytextclock = wibox.widget.textclock("%Y-%m-%d %H:%M") mytextclock = wibox.widget.textclock("%Y-%m-%d %H:%M")
mysystray = wibox.widget.systray() mysystray = wibox.widget.systray()
print(mysystray)
for k,v in pairs(mysystray) do print(k,v) end
-- Create a wibox for each screen and add it -- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join( local taglist_buttons = gears.table.join(
@ -171,9 +195,9 @@ local function set_wallpaper(s)
print(s) print(s)
local wpath local wpath
if s.geometry.width > s.geometry.height then -- landscape if s.geometry.width > s.geometry.height then -- landscape
wpath = "/home/izaya/Nextcloud/Pictures/Wallpapers" wpath = "/home/izaya/Pictures/Wallpapers"
else -- portrait else -- portrait
wpath = "/home/izaya/Nextcloud/Pictures/Wallpapers/Phone" wpath = "/home/izaya/Pictures/Wallpapers/Phone"
end end
return awful.spawn.easy_async_with_shell(string.format('ls "%s"',wpath), function(out) return awful.spawn.easy_async_with_shell(string.format('ls "%s"',wpath), function(out)
local tWP = {} local tWP = {}
@ -278,6 +302,7 @@ awful.screen.connect_for_each_screen(function(s)
s.mytasklist, -- Middle widget s.mytasklist, -- Middle widget
{ -- Right widgets { -- Right widgets
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
mpdwidget,
mysystray, mysystray,
cpu_widget(), cpu_widget(),
ram_widget(), ram_widget(),
@ -362,7 +387,7 @@ globalkeys = gears.table.join(
-- Standard program -- Standard program
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
{description = "open a terminal", group = "launcher"}), {description = "open a terminal", group = "launcher"}),
awful.key({ modkey, "Control" }, "r", awesome.restart, awful.key({ modkey, "Control" }, "r", restart,
{description = "reload awesome", group = "awesome"}), {description = "reload awesome", group = "awesome"}),
awful.key({ modkey, "Shift" }, "q", awesome.quit, awful.key({ modkey, "Shift" }, "q", awesome.quit,
{description = "quit awesome", group = "awesome"}), {description = "quit awesome", group = "awesome"}),
@ -634,7 +659,7 @@ awful.rules.rules = {
-- { rule = { class = "Firefox" }, -- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } }, -- properties = { screen = 1, tag = "2" } },
{ rule = { class = "Steam", name = "Steam" }, { rule = { class = "Steam", name = "Steam" },
properties = {tag = "3", titlebars_enabled = false } }, properties = {screen = 1, tag = "3", titlebars_enabled = false } },
{ rule = { class = "Steam", name = "Friends List.*"}, { rule = { class = "Steam", name = "Friends List.*"},
properties = {tag = "6", titlebars_enabled = false } }, properties = {tag = "6", titlebars_enabled = false } },
{ rule = { class = "Pidgin"}, { rule = { class = "Pidgin"},