diff --git a/rc.lua b/rc.lua index 5dfe3a5..9dd369d 100644 --- a/rc.lua +++ b/rc.lua @@ -32,6 +32,8 @@ local function batteryarc() -- detect if there are any batteries before showing end end +local zombies = {} + -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to -- 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 -- Create a launcher widget and a main menu myawesomemenu = { { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, { "manual", terminal .. " -e man awesome" }, { "edit config", editor_cmd .. " " .. awesome.conffile }, - { "restart", awesome.restart }, + { "restart", restart }, { "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, 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.utils.terminal = terminal -- Set the terminal for applications that require it menubar.menu_gen.all_menu_dirs = { "/usr/share/applications/", ".local/share/applications/" } @@ -171,9 +197,9 @@ local function set_wallpaper(s) print(s) local wpath if s.geometry.width > s.geometry.height then -- landscape - wpath = "/home/izaya/Nextcloud/Pictures/Wallpapers" + wpath = "/home/izaya/Pictures/Wallpapers" else -- portrait - wpath = "/home/izaya/Nextcloud/Pictures/Wallpapers/Phone" + wpath = "/home/izaya/Pictures/Wallpapers/Phone" end return awful.spawn.easy_async_with_shell(string.format('ls "%s"',wpath), function(out) local tWP = {} @@ -278,6 +304,7 @@ awful.screen.connect_for_each_screen(function(s) s.mytasklist, -- Middle widget { -- Right widgets layout = wibox.layout.fixed.horizontal, + mpdwidget, mysystray, cpu_widget(), ram_widget(), @@ -362,7 +389,7 @@ globalkeys = gears.table.join( -- Standard program awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, {description = "open a terminal", group = "launcher"}), - awful.key({ modkey, "Control" }, "r", awesome.restart, + awful.key({ modkey, "Control" }, "r", restart, {description = "reload awesome", group = "awesome"}), awful.key({ modkey, "Shift" }, "q", awesome.quit, {description = "quit awesome", group = "awesome"}), @@ -634,7 +661,7 @@ awful.rules.rules = { -- { rule = { class = "Firefox" }, -- properties = { screen = 1, tag = "2" } }, { 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.*"}, properties = {tag = "6", titlebars_enabled = false } }, { rule = { class = "Pidgin"},