diff --git a/core/layout.lua b/core/layout.lua index faf5f8f..3238b36 100644 --- a/core/layout.lua +++ b/core/layout.lua @@ -49,56 +49,31 @@ awful.screen.connect_for_each_screen(function(s) s.mytasklist = require("core.widgets.tasklist")(s) -- Create the wibox s.mywibox = awful.wibar({ - position = "top", + position = "bottom", screen = s, bg = beautiful.topbar_bg, + border_width = 1, + border_color = beautiful.bg_normal }) -- Add screen lock require("widgets.lock")({screen = s, obscure = true}) - require("widgets.unitybar")(s,{ - top_widgets = { - require("widgets.polytasklist")({ - vertical = true, - stretch = false, - --constraint = 180, - names = false, - margins = 5 - })(s), - }, - bottom_widgets = { - require("widgets.polylauncher")({vertical = true}) - } - }) -- Add widgets to the wibox s.mywibox:setup { layout = wibox.layout.align.horizontal, { -- Left widgets layout = wibox.layout.fixed.horizontal, - { - { - require("core.widgets.menu_launcher"), - widget = wibox.container.place, - halign = "center" - }, - bg = "#26262633", - widget = wibox.container.background, - forced_width = require("beautiful.xresources").apply_dpi(61), - }, - --require("widgets.polylauncher")({vertical = false}), - --s.mytaglist, + require("core.widgets.menu_launcher"), + require("widgets.polylauncher")({vertical = false}), s.mypromptbox, - require("widgets.wintitle")({}), spacing = 3 }, -- Middle widget { - --[[require("widgets.polytasklist")({ - vertical = false, - stretch = false, + require("widgets.polytasklist")({ constraint = 180, names = true, margins = 5 - })(s),]] + })(s), layout = wibox.layout.fixed.horizontal }, { -- Right widgets @@ -121,7 +96,6 @@ awful.screen.connect_for_each_screen(function(s) percentage = true, }), wibox.widget.textclock(), - require("widgets.username")({}), s.mylayoutbox, spacing = 4 }, diff --git a/presets/carbon-gnome/layout.lua b/presets/carbon-gnome/layout.lua new file mode 100644 index 0000000..faf5f8f --- /dev/null +++ b/presets/carbon-gnome/layout.lua @@ -0,0 +1,130 @@ +local beautiful = require("beautiful") +local awful = require("awful") +local gears = require("gears") +local wibox = require("wibox") +-- {{{ Wibar + +-- Create a wibox for each screen and add it + +local function set_wallpaper(s) + -- Wallpaper + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end + +-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) +screen.connect_signal("property::geometry", set_wallpaper) + +-- {{{ Non-widget modules +-- The following modules are not exactly widgets, however they are part of the ui. + +-- Load the keybindings list +require("core.widgets.hotkeys_popup") + +-- Load the menubar +require("core.widgets.menubar") +-- }}} + +awful.screen.connect_for_each_screen(function(s) + -- Wallpaper + set_wallpaper(s) + + -- Each screen has its own tag table. + awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) + + -- Create a promptbox for each screen + s.mypromptbox = require("core.widgets.prompt")() + -- Create an imagebox widget which will contain an icon indicating which layout we're using. + -- Create the taglist + s.mytaglist = require("core.widgets.taglist")(s) + -- We need one layoutbox per screen. + s.mylayoutbox = require("core.widgets.layout_box")(s) + -- Create a tasklist widget + s.mytasklist = require("core.widgets.tasklist")(s) + -- Create the wibox + s.mywibox = awful.wibar({ + position = "top", + screen = s, + bg = beautiful.topbar_bg, + }) + -- Add screen lock + require("widgets.lock")({screen = s, obscure = true}) + require("widgets.unitybar")(s,{ + top_widgets = { + require("widgets.polytasklist")({ + vertical = true, + stretch = false, + --constraint = 180, + names = false, + margins = 5 + })(s), + }, + bottom_widgets = { + require("widgets.polylauncher")({vertical = true}) + } + }) + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + { + { + require("core.widgets.menu_launcher"), + widget = wibox.container.place, + halign = "center" + }, + bg = "#26262633", + widget = wibox.container.background, + forced_width = require("beautiful.xresources").apply_dpi(61), + }, + --require("widgets.polylauncher")({vertical = false}), + --s.mytaglist, + s.mypromptbox, + require("widgets.wintitle")({}), + spacing = 3 + }, + -- Middle widget + { + --[[require("widgets.polytasklist")({ + vertical = false, + stretch = false, + constraint = 180, + names = true, + margins = 5 + })(s),]] + layout = wibox.layout.fixed.horizontal + }, + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + awful.widget.keyboardlayout(), + require("widgets.drawer")({ + wibox.widget.systray(), + vertical = false + }), + require("widgets.wallpapers")({ + screen = s, + path = os.getenv("HOME").."/Pictures/Wallpapers/", + }), + require("widgets.mailbox")({ + screen = s, + }), + --wibox.widget.systray(), + require("widgets.volume")({}), + require("widgets.battery")({ + percentage = true, + }), + wibox.widget.textclock(), + require("widgets.username")({}), + s.mylayoutbox, + spacing = 4 + }, + } +end) +-- }}} diff --git a/presets/carbon-gnome/titlebar.lua b/presets/carbon-gnome/titlebar.lua new file mode 100644 index 0000000..45662df --- /dev/null +++ b/presets/carbon-gnome/titlebar.lua @@ -0,0 +1,155 @@ +local awful = require("awful") +local gears = require("gears") +local wibox = require("wibox") +local menu = require("widgets.polymenu") +local move_screentags = {} +local toggle_screentags = {} +awful.screen.connect_for_each_screen(function(s) + local move_tags = {} + local toggle_tags = {} + for _,tag in pairs(s.tags) do + table.insert(move_tags,{ + tag.name, + function() + if client.focus then + client.focus:tags({tag}) + end + end + }) + table.insert(toggle_tags,{ + tag.name, + function() + if client.focus then + local tags = client.focus:tags() + for k,v in pairs(tags) do + if v == tag then + table.remove(tags,k) + client.focus:tags(tags) + return + end + end + table.insert(tags,tag) + client.focus:tags(tags) + end + end + }) + end + table.insert(move_screentags,{ + "Screen "..tostring(s.index), + move_tags + }) + table.insert(toggle_screentags,{ + "Screen "..tostring(s.index), + toggle_tags + }) +end) +local controls_widget = wibox.widget { + forced_width = 72, + forced_height = 24, + layout = wibox.layout.fixed.horizontal, +} +-- To conserve memory we keep one menu at a time +local menu_widget = menu({ + before = { + controls_widget + }, + after = { + require("widgets.client-volume")({}) + }, + items = { + { "Move to tag" , + move_screentags + }, + { "Toggle on tag", + toggle_screentags + }, + { "Stop task", + function() + awful.spawn("kill "..tostring(c.pid)) + end + }, + { "Kill task", + function() + awful.spawn("kill -s KILL "..tostring(c.pid)) + end + }, + { "Debug info", + { + before = { + require("widgets.window-debug")() + } + } + } + }, + vertical = true +}) + +return function(c) + local buttons = gears.table.join( + awful.button({ }, 1, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ }, 3, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.resize(c) + end) + ) + c.menu_button = awful.titlebar.widget.iconwidget(c) + -- A little trick we do to conserve memory and cpu usage on regenerating + -- buttons is we pop up a menu in the location of the icon + -- and insert buttons into the controls widget layout. + c.hidden_floatingbutton = awful.titlebar.widget.floatingbutton(c) + c.hidden_stickybutton = awful.titlebar.widget.stickybutton(c) + c.hidden_ontopbutton = awful.titlebar.widget.ontopbutton(c) + c.menu_button:connect_signal("button::press", function() + menu_widget.toggle() + if controls_widget then + controls_widget:reset() + controls_widget:add(c.hidden_floatingbutton) + controls_widget:add(c.hidden_stickybutton) + controls_widget:add(c.hidden_ontopbutton) + end + c:emit_signal("request::activate", "titlebar", {raise = true}) + end) + c:connect_signal("unfocus",function() + if menu_widget.visible then + menu_widget.toggle(0,0) + end + end) + return awful.titlebar(c) : setup { + { -- Left + c.menu_button, + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + awful.titlebar.widget.titlewidget(c), + buttons = buttons, + layout = wibox.layout.flex.horizontal + }, + { -- Right + { + { + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.minimizebutton (c), + awful.titlebar.widget.closebutton (c), + layout = wibox.layout.fixed.horizontal(), + widget = wibox.container.margin, + margins = 3 + }, + widget = wibox.container.background, + shape = gears.shape.rounded_bar, + bg = { + type = "linear", + from = { 0, 15 }, + to = { 0, 0}, + stops = { { 0, "#5d5d5955"} , {1, "39383555"} } + }, + }, + widget = wibox.container.margin, + margins = 2 + }, + spacing = 10, + layout = wibox.layout.align.horizontal, + } +end diff --git a/presets/carbon-gnome/vars.lua b/presets/carbon-gnome/vars.lua new file mode 100644 index 0000000..8d8c5e3 --- /dev/null +++ b/presets/carbon-gnome/vars.lua @@ -0,0 +1,31 @@ +local awful = require("awful") +local gears = require("gears") +-- {{{ Variable definitions +global = {} +global.awesome_dir = os.getenv("HOME").."/.config/awesome/" +global.config_dir = os.getenv("HOME").."/.awesome/" +global.themes_dir = os.getenv("HOME").."/.config/awesome/themes/" +global.theme = global.awesome_dir .. "themes/carbon/theme.lua" +global.terminal = "xterm" +global.editor = os.getenv("EDITOR") or "vim" +global.editor_cmd = global.terminal .. " -e ".. global.editor +global.modkey = "Mod4" +awful.layout.layouts = { + awful.layout.suit.floating, + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, + awful.layout.suit.spiral, + awful.layout.suit.spiral.dwindle, + awful.layout.suit.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.corner.nw, + -- awful.layout.suit.corner.ne, + -- awful.layout.suit.corner.sw, + -- awful.layout.suit.corner.se, +} +-- }}} diff --git a/presets/carbon-xfce/layout.lua b/presets/carbon-xfce/layout.lua new file mode 100644 index 0000000..3238b36 --- /dev/null +++ b/presets/carbon-xfce/layout.lua @@ -0,0 +1,104 @@ +local beautiful = require("beautiful") +local awful = require("awful") +local gears = require("gears") +local wibox = require("wibox") +-- {{{ Wibar + +-- Create a wibox for each screen and add it + +local function set_wallpaper(s) + -- Wallpaper + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end + +-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) +screen.connect_signal("property::geometry", set_wallpaper) + +-- {{{ Non-widget modules +-- The following modules are not exactly widgets, however they are part of the ui. + +-- Load the keybindings list +require("core.widgets.hotkeys_popup") + +-- Load the menubar +require("core.widgets.menubar") +-- }}} + +awful.screen.connect_for_each_screen(function(s) + -- Wallpaper + set_wallpaper(s) + + -- Each screen has its own tag table. + awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) + + -- Create a promptbox for each screen + s.mypromptbox = require("core.widgets.prompt")() + -- Create an imagebox widget which will contain an icon indicating which layout we're using. + -- Create the taglist + s.mytaglist = require("core.widgets.taglist")(s) + -- We need one layoutbox per screen. + s.mylayoutbox = require("core.widgets.layout_box")(s) + -- Create a tasklist widget + s.mytasklist = require("core.widgets.tasklist")(s) + -- Create the wibox + s.mywibox = awful.wibar({ + position = "bottom", + screen = s, + bg = beautiful.topbar_bg, + border_width = 1, + border_color = beautiful.bg_normal + }) + -- Add screen lock + require("widgets.lock")({screen = s, obscure = true}) + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + require("core.widgets.menu_launcher"), + require("widgets.polylauncher")({vertical = false}), + s.mypromptbox, + spacing = 3 + }, + -- Middle widget + { + require("widgets.polytasklist")({ + constraint = 180, + names = true, + margins = 5 + })(s), + layout = wibox.layout.fixed.horizontal + }, + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + awful.widget.keyboardlayout(), + require("widgets.drawer")({ + wibox.widget.systray(), + vertical = false + }), + require("widgets.wallpapers")({ + screen = s, + path = os.getenv("HOME").."/Pictures/Wallpapers/", + }), + require("widgets.mailbox")({ + screen = s, + }), + --wibox.widget.systray(), + require("widgets.volume")({}), + require("widgets.battery")({ + percentage = true, + }), + wibox.widget.textclock(), + s.mylayoutbox, + spacing = 4 + }, + } +end) +-- }}} diff --git a/presets/carbon-xfce/titlebar.lua b/presets/carbon-xfce/titlebar.lua new file mode 100644 index 0000000..45662df --- /dev/null +++ b/presets/carbon-xfce/titlebar.lua @@ -0,0 +1,155 @@ +local awful = require("awful") +local gears = require("gears") +local wibox = require("wibox") +local menu = require("widgets.polymenu") +local move_screentags = {} +local toggle_screentags = {} +awful.screen.connect_for_each_screen(function(s) + local move_tags = {} + local toggle_tags = {} + for _,tag in pairs(s.tags) do + table.insert(move_tags,{ + tag.name, + function() + if client.focus then + client.focus:tags({tag}) + end + end + }) + table.insert(toggle_tags,{ + tag.name, + function() + if client.focus then + local tags = client.focus:tags() + for k,v in pairs(tags) do + if v == tag then + table.remove(tags,k) + client.focus:tags(tags) + return + end + end + table.insert(tags,tag) + client.focus:tags(tags) + end + end + }) + end + table.insert(move_screentags,{ + "Screen "..tostring(s.index), + move_tags + }) + table.insert(toggle_screentags,{ + "Screen "..tostring(s.index), + toggle_tags + }) +end) +local controls_widget = wibox.widget { + forced_width = 72, + forced_height = 24, + layout = wibox.layout.fixed.horizontal, +} +-- To conserve memory we keep one menu at a time +local menu_widget = menu({ + before = { + controls_widget + }, + after = { + require("widgets.client-volume")({}) + }, + items = { + { "Move to tag" , + move_screentags + }, + { "Toggle on tag", + toggle_screentags + }, + { "Stop task", + function() + awful.spawn("kill "..tostring(c.pid)) + end + }, + { "Kill task", + function() + awful.spawn("kill -s KILL "..tostring(c.pid)) + end + }, + { "Debug info", + { + before = { + require("widgets.window-debug")() + } + } + } + }, + vertical = true +}) + +return function(c) + local buttons = gears.table.join( + awful.button({ }, 1, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ }, 3, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.resize(c) + end) + ) + c.menu_button = awful.titlebar.widget.iconwidget(c) + -- A little trick we do to conserve memory and cpu usage on regenerating + -- buttons is we pop up a menu in the location of the icon + -- and insert buttons into the controls widget layout. + c.hidden_floatingbutton = awful.titlebar.widget.floatingbutton(c) + c.hidden_stickybutton = awful.titlebar.widget.stickybutton(c) + c.hidden_ontopbutton = awful.titlebar.widget.ontopbutton(c) + c.menu_button:connect_signal("button::press", function() + menu_widget.toggle() + if controls_widget then + controls_widget:reset() + controls_widget:add(c.hidden_floatingbutton) + controls_widget:add(c.hidden_stickybutton) + controls_widget:add(c.hidden_ontopbutton) + end + c:emit_signal("request::activate", "titlebar", {raise = true}) + end) + c:connect_signal("unfocus",function() + if menu_widget.visible then + menu_widget.toggle(0,0) + end + end) + return awful.titlebar(c) : setup { + { -- Left + c.menu_button, + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + awful.titlebar.widget.titlewidget(c), + buttons = buttons, + layout = wibox.layout.flex.horizontal + }, + { -- Right + { + { + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.minimizebutton (c), + awful.titlebar.widget.closebutton (c), + layout = wibox.layout.fixed.horizontal(), + widget = wibox.container.margin, + margins = 3 + }, + widget = wibox.container.background, + shape = gears.shape.rounded_bar, + bg = { + type = "linear", + from = { 0, 15 }, + to = { 0, 0}, + stops = { { 0, "#5d5d5955"} , {1, "39383555"} } + }, + }, + widget = wibox.container.margin, + margins = 2 + }, + spacing = 10, + layout = wibox.layout.align.horizontal, + } +end diff --git a/presets/carbon-xfce/vars.lua b/presets/carbon-xfce/vars.lua new file mode 100644 index 0000000..8d8c5e3 --- /dev/null +++ b/presets/carbon-xfce/vars.lua @@ -0,0 +1,31 @@ +local awful = require("awful") +local gears = require("gears") +-- {{{ Variable definitions +global = {} +global.awesome_dir = os.getenv("HOME").."/.config/awesome/" +global.config_dir = os.getenv("HOME").."/.awesome/" +global.themes_dir = os.getenv("HOME").."/.config/awesome/themes/" +global.theme = global.awesome_dir .. "themes/carbon/theme.lua" +global.terminal = "xterm" +global.editor = os.getenv("EDITOR") or "vim" +global.editor_cmd = global.terminal .. " -e ".. global.editor +global.modkey = "Mod4" +awful.layout.layouts = { + awful.layout.suit.floating, + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, + awful.layout.suit.spiral, + awful.layout.suit.spiral.dwindle, + awful.layout.suit.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.corner.nw, + -- awful.layout.suit.corner.ne, + -- awful.layout.suit.corner.sw, + -- awful.layout.suit.corner.se, +} +-- }}} diff --git a/themes/carbon/theme.lua b/themes/carbon/theme.lua index 9439187..322ede9 100644 --- a/themes/carbon/theme.lua +++ b/themes/carbon/theme.lua @@ -28,7 +28,7 @@ local dpi = xresources.apply_dpi local theme = {} -- {{{ Color definitions -- These variables define a fallback state for all widgets to use. -theme.font = "sans 8" +theme.font = "sans 9" theme.name = "carbon" theme.bg_normal = "#19191D"