From 9842227176ad89abcb28cc86302f73b34de0f723 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Fri, 15 Apr 2022 14:02:00 +0400 Subject: [PATCH 1/7] Phone style + smarter ubuntu layout --- core/binds/globalbuttons.lua | 2 +- core/layout.lua | 106 ++++++++++---------- core/widgets/menu.lua | 2 +- presets/ubuntu-phone/layout.lua | 136 ++++++++++++++++++++++++++ presets/ubuntu-phone/titlebar.lua | 155 ++++++++++++++++++++++++++++++ presets/ubuntu-phone/vars.lua | 31 ++++++ widgets/battery.lua | 3 +- widgets/polymenu.lua | 14 ++- widgets/unitybar.lua | 28 +++++- 9 files changed, 411 insertions(+), 66 deletions(-) create mode 100644 presets/ubuntu-phone/layout.lua create mode 100644 presets/ubuntu-phone/titlebar.lua create mode 100644 presets/ubuntu-phone/vars.lua diff --git a/core/binds/globalbuttons.lua b/core/binds/globalbuttons.lua index 09c8f8b..50d895b 100644 --- a/core/binds/globalbuttons.lua +++ b/core/binds/globalbuttons.lua @@ -2,7 +2,7 @@ local awful = require("awful") local gears = require("gears") return gears.table.join( - awful.button({ }, 3, function () require("core.widgets.menu"):toggle() end), + awful.button({ }, 3, function () menu:show() end), awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 5, awful.tag.viewprev) ) diff --git a/core/layout.lua b/core/layout.lua index 64e23a4..ea499c2 100644 --- a/core/layout.lua +++ b/core/layout.lua @@ -67,76 +67,72 @@ awful.screen.connect_for_each_screen(function(s) }, bottom_widgets = { require("widgets.polylauncher")({vertical = true}) - } + }, + position="left" }) + -- Menu + require("core.widgets.menu") + -- Start button + local start_button = wibox.widget { + { + { + image = beautiful.awesome_icon, + widget = wibox.widget.imagebox + }, + widget = wibox.container.place, + halign = "center", + id = "menu" + }, + bg = "#26262633", + widget = wibox.container.background, + forced_width = require("beautiful.xresources").apply_dpi(61), + } + start_button:connect_signal("button::press",function(self,x,y,button) + if button == 1 then + menu:show() + end + end) -- Add widgets to the wibox s.mywibox:setup { + expand = "outside", layout = wibox.layout.align.horizontal, { -- Left widgets + start_button, 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, 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.wallpapers")({ - screen = s, - path = os.getenv("HOME").."/Pictures/Wallpapers/", - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - require("widgets.mailbox")({ - screen = s, - style = { - rounding = 1, - icon_bg_normal = beautiful.topbar_bg - } - }), - --wibox.widget.systray(), - require("widgets.volume")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - require("widgets.battery")({ - percentage = true, - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - wibox.widget.textclock(), - require("widgets.username")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - s.mylayoutbox, - spacing = 4 + { + layout = wibox.layout.fixed.horizontal, + require("widgets.wallpapers")({ + screen = s, + path = os.getenv("HOME").."/Pictures/Wallpapers/", + }), + require("widgets.mailbox")({ + screen = s, + style = { + rounding = 1, + } + }), + require("widgets.volume")({}), + require("widgets.battery")({ + percentage = true, + }), + --wibox.widget.systray(), + awful.widget.keyboardlayout(), + wibox.widget.textclock(), + s.mylayoutbox, + spacing = 4, + }, + widget = wibox.container.place, + halign = "right", + fill_horizontal = false }, } end) diff --git a/core/widgets/menu.lua b/core/widgets/menu.lua index 2e12839..40e2dfa 100644 --- a/core/widgets/menu.lua +++ b/core/widgets/menu.lua @@ -83,7 +83,7 @@ local menu_template = { vertical = true, inverse = true } -local menu = polymenu(menu_template) +menu = polymenu(menu_template) root.keys(gears.table.join( root.keys(), awful.key({ global.modkey, }, "w", function () menu:show() end, diff --git a/presets/ubuntu-phone/layout.lua b/presets/ubuntu-phone/layout.lua new file mode 100644 index 0000000..20152a3 --- /dev/null +++ b/presets/ubuntu-phone/layout.lua @@ -0,0 +1,136 @@ +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 = false, + stretch = false, + --constraint = 180, + names = false, + margins = 5 + })(s), + }, + bottom_widgets = { + require("widgets.polylauncher")({vertical = false}) + }, + position="bottom" + }) + -- Menu + require("core.widgets.menu") + -- Start button + local start_button = wibox.widget { + { + { + image = beautiful.awesome_icon, + widget = wibox.widget.imagebox + }, + widget = wibox.container.place, + halign = "center", + id = "menu" + }, + bg = "#26262633", + widget = wibox.container.background, + forced_width = require("beautiful.xresources").apply_dpi(61), + } + start_button:connect_signal("button::press",function(self,x,y,button) + if button == 1 then + menu:show() + end + end) + -- Add widgets to the wibox + s.mywibox:setup { + expand = "outside", + layout = wibox.layout.align.horizontal, + { -- Left widgets + start_button, + layout = wibox.layout.fixed.horizontal, + --require("widgets.polylauncher")({vertical = false}), + --s.mytaglist, + s.mypromptbox, + spacing = 3 + }, + wibox.widget.textclock(), + { -- Right widgets + { + layout = wibox.layout.fixed.horizontal, + awful.widget.keyboardlayout(), + require("widgets.wallpapers")({ + screen = s, + path = os.getenv("HOME").."/Pictures/Wallpapers/", + }), + require("widgets.mailbox")({ + screen = s, + style = { + rounding = 1, + } + }), + --wibox.widget.systray(), + require("widgets.volume")({}), + require("widgets.battery")({ + percentage = true, + }), + s.mylayoutbox, + spacing = 4, + }, + widget = wibox.container.place, + halign = "right", + fill_horizontal = true + }, + } +end) +-- }}} diff --git a/presets/ubuntu-phone/titlebar.lua b/presets/ubuntu-phone/titlebar.lua new file mode 100644 index 0000000..6bd711d --- /dev/null +++ b/presets/ubuntu-phone/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(client.focus.pid)) + end + }, + { "Kill task", + function() + awful.spawn("kill -s KILL "..tostring(client.focus.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/ubuntu-phone/vars.lua b/presets/ubuntu-phone/vars.lua new file mode 100644 index 0000000..9c6ef06 --- /dev/null +++ b/presets/ubuntu-phone/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/unity/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/widgets/battery.lua b/widgets/battery.lua index 6f22842..43fc4b7 100644 --- a/widgets/battery.lua +++ b/widgets/battery.lua @@ -31,7 +31,8 @@ return function(args) local icon_name = out:match("icon%-name:%s+'(battery%-[^']+)'") local value = out:match("percentage:%s+(%d+%%)") icon:get_children_by_id("widget_icon")[1].image = - style[icon_name:gsub("%-","_")] + style[icon_name:gsub("%-","_")] or + style["battery_missing_symbolic"] if args.percentage and value then icon:get_children_by_id("widget_text")[1].markup = value end diff --git a/widgets/polymenu.lua b/widgets/polymenu.lua index c53db94..1757263 100644 --- a/widgets/polymenu.lua +++ b/widgets/polymenu.lua @@ -138,9 +138,13 @@ local function loader(options) end end) elseif type(v[2]) == "function" then - new_button:connect_signal("button::press",v[2]) + new_button:connect_signal("button::press",function() + cascade_close(tree_path,1) + v[2]() + end) elseif type(v[2]) == "string" then new_button:connect_signal("button::press",function() + cascade_close(tree_path,1) awful.spawn(v[2]) end) end @@ -152,9 +156,6 @@ local function loader(options) menu.current_button = new_button menu.current_button.bg = button_bg_on end) - new_button:connect_signal("button::press",function() - cascade_close(tree_path,1) - end) table.insert(menu,new_button) end end @@ -182,7 +183,10 @@ local function loader(options) end tree_path[1] = menu menu.visible = (not menu.visible) - end + end + menu.show = function(self) + menu.toggle() + end return menu end diff --git a/widgets/unitybar.lua b/widgets/unitybar.lua index 179f1a8..753ed8a 100644 --- a/widgets/unitybar.lua +++ b/widgets/unitybar.lua @@ -5,7 +5,7 @@ local awmtk = require("awmtk") function unitybar(s,args) local style = awmtk.style(awmtk.defaults,args.style or {},"unitybar_") s.myunitybar = awful.wibar({ - position = "left", + position = args.position or "left", screen = s, border_width = style.unitybar_border_width or 1, border_color = style.unitybar_border_color or "#262626AA", @@ -13,7 +13,21 @@ function unitybar(s,args) (type(style.bg_normal) == "string") and (style.bg_normal:len() < 8) and style.bg_normal.."AA"), - width = style.unitybar_width or 50, + width = (function() + if (not args.position) or + (args.position == "left") or + (args.position == "right") + then + return style.unitybar_width or 50 + end + end)(), + height = (function() + if (args.position == "bottom") or + (args.posiiton == "top") + then + return style.unitybar_width or 50 + end + end)() }) local top_widgets = { layout = wibox.layout.fixed.vertical, @@ -31,7 +45,15 @@ function unitybar(s,args) widget = wibox.container.margin, margins = style.unitybar_inner_margin, { - layout = wibox.layout.align.vertical, + layout = (function() + if (s.myunitybar.position == "left") or + (s.myunitybar.position == "right") + then + return wibox.layout.align.vertical + else + return wibox.layout.align.horizontal + end + end)(), top_widgets, { --Middle spacer widget = wibox.container.background From b80ec3fdb41e6bb255d84cc1c7467c38c41cc263 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Fri, 15 Apr 2022 20:46:47 +0400 Subject: [PATCH 2/7] Fixed a couple of error-creating bugs for battery and client-volume --- widgets/battery.lua | 2 +- widgets/client-volume.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/widgets/battery.lua b/widgets/battery.lua index 43fc4b7..37a70d1 100644 --- a/widgets/battery.lua +++ b/widgets/battery.lua @@ -31,7 +31,7 @@ return function(args) local icon_name = out:match("icon%-name:%s+'(battery%-[^']+)'") local value = out:match("percentage:%s+(%d+%%)") icon:get_children_by_id("widget_icon")[1].image = - style[icon_name:gsub("%-","_")] or + style[(icon_name or ""):gsub("%-","_")] or style["battery_missing_symbolic"] if args.percentage and value then icon:get_children_by_id("widget_text")[1].markup = value diff --git a/widgets/client-volume.lua b/widgets/client-volume.lua index f924b80..a0e9021 100644 --- a/widgets/client-volume.lua +++ b/widgets/client-volume.lua @@ -22,7 +22,7 @@ local get_app_volume = function(pid) for key,process in pairs(get_pactl_data()) do -- Match app by pid if process:match("application.process.id = \""..tostring(pid).."\"") then - return process:match("Volume: .-(%d?%d?%d)%%") + return tonumber(process:match("Volume: .-(%d?%d?%d)%%")) end end -- Return nil and an error if not found matching process @@ -93,7 +93,7 @@ return function(args) if value then slider.value = value widget.children[2] = slider - widget.children[1].image = get_icon(tonumber(value)) + widget.children[1].image = get_icon(value) else warning_text.markup = err widget.children[2] = warning_text @@ -102,7 +102,7 @@ return function(args) end) slider:connect_signal("widget::redraw_needed",function() set_app_volume(client.focus.pid,slider.value) - widget.children[1].image = get_icon(tonumber(slider.value)) + widget.children[1].image = get_icon(slider.value) end) else warning_text.markup = "pactl is not available" From dcfcc459a1335060393716fa046d9c0d66298371 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Sat, 16 Apr 2022 01:36:24 +0400 Subject: [PATCH 3/7] Fixed pager limit calculation --- widgets/pager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widgets/pager.lua b/widgets/pager.lua index a0bcd4d..6a806a1 100644 --- a/widgets/pager.lua +++ b/widgets/pager.lua @@ -21,7 +21,7 @@ return function(widget,list,max_elements) end end function new_pager:next() - if #list >= self.index*self.max then + if #list >= (self.index+1)*self.max then self.index = self.index + 1 new_pager:update() end From 768e6d49d3de7ba219384f77500f3d1421ff7cf8 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Mon, 18 Apr 2022 13:02:01 +0400 Subject: [PATCH 4/7] Made the lock screen a little bit prettier --- widgets/lock.lua | 72 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/widgets/lock.lua b/widgets/lock.lua index e420f58..25a5327 100644 --- a/widgets/lock.lua +++ b/widgets/lock.lua @@ -59,33 +59,69 @@ return function(args) s.lockscreen = awful.popup({ widget = { { - --Top bar + -- Bottom layer { { + --Top bar { - markup = "AwesomewWM", - widget = wibox.widget.textbox - }, - { - widget = wibox.container.background + { + -- Top bar contents + { + markup = "AwesomewWM", + widget = wibox.widget.textbox + }, + { + widget = wibox.container.background + }, + { + require("widgets.battery")({ + percentage = true + }), + wibox.widget.textclock(), + widget = wibox.container.background, + layout = wibox.layout.fixed.horizontal + }, + layout = wibox.layout.align.horizontal, + }, + widget = wibox.container.margin, + left = 5, + right = 5 }, - { - require("widgets.battery")({percentage = true}), - wibox.widget.textclock(), - widget = wibox.container.background, - layout = wibox.layout.fixed.horizontal - }, - layout = wibox.layout.align.horizontal, + widget = wibox.container.background, + forced_width = s.geometry.width, + forced_height = style.lockscreen_bar_height or 25, + bg = style.lockscreen_bar_bg or + style.lockscreen_bg_normal }, - widget = wibox.container.background, - forced_width = s.geometry.width, - forced_height = style.lockscreen_bar_height or 25, - bg = style.lockscreen_bar_bg or style.lockscreen_bg_normal + { + --Drop shadow + { + markup = "", + widget = wibox.widget.textbox, + }, + widget = wibox.container.background, + forced_height = style.lockscreen_bar_shadow or 5, + forced_width = s.geometry.width, + bg = { + -- Gradient + type = "linear", + from = { 0, 0 }, + to = { 0, style.lockscreen_bar_shadow or 5}, + stops = { + { 0, style.lockscreen_bar_shadow_color_start or + "#00000055" }, + { 1, style.lockscreen_bar_shadow_color_end or + "#00000000" } + } + } + }, + layout = wibox.layout.fixed.vertical }, widget = wibox.container.place, valign = "top", halign = "center" - },{ + }, + { --Combo box (face, nickname, password entry) style.container({ (read("./.face") and style.container { From 7cd97ec4b0660b762f245817223e38a0fbd1ed7f Mon Sep 17 00:00:00 2001 From: Yessiest Date: Mon, 18 Apr 2022 13:08:10 +0400 Subject: [PATCH 5/7] Made ubuntu-11.10 preset a little better --- core/layout.lua | 29 ++++--- presets/ubuntu-11.10/core/layout.lua | 125 ++++++++++++++------------- 2 files changed, 84 insertions(+), 70 deletions(-) diff --git a/core/layout.lua b/core/layout.lua index ea499c2..05b6468 100644 --- a/core/layout.lua +++ b/core/layout.lua @@ -96,20 +96,29 @@ awful.screen.connect_for_each_screen(function(s) s.mywibox:setup { expand = "outside", layout = wibox.layout.align.horizontal, - { -- Left widgets - start_button, - layout = wibox.layout.fixed.horizontal, - --require("widgets.polylauncher")({vertical = false}), - --s.mytaglist, - s.mypromptbox, - spacing = 3 + { + { + -- Left widgets + start_button, + --require("widgets.polylauncher")({vertical = false}), + --s.mytaglist, + s.mypromptbox, + layout = wibox.layout.fixed.horizontal, + spacing = 3 + }, + widget = wibox.container.place, + halign = "left", + fill_horizontal = false }, { layout = wibox.layout.fixed.horizontal }, - { -- Right widgets + { { - layout = wibox.layout.fixed.horizontal, + -- Right widgets + require("widgets.drawer")({ + wibox.widget.systray(), + }), require("widgets.wallpapers")({ screen = s, path = os.getenv("HOME").."/Pictures/Wallpapers/", @@ -124,10 +133,10 @@ awful.screen.connect_for_each_screen(function(s) require("widgets.battery")({ percentage = true, }), - --wibox.widget.systray(), awful.widget.keyboardlayout(), wibox.widget.textclock(), s.mylayoutbox, + layout = wibox.layout.fixed.horizontal, spacing = 4, }, widget = wibox.container.place, diff --git a/presets/ubuntu-11.10/core/layout.lua b/presets/ubuntu-11.10/core/layout.lua index 64e23a4..05b6468 100644 --- a/presets/ubuntu-11.10/core/layout.lua +++ b/presets/ubuntu-11.10/core/layout.lua @@ -67,76 +67,81 @@ awful.screen.connect_for_each_screen(function(s) }, bottom_widgets = { require("widgets.polylauncher")({vertical = true}) - } + }, + position="left" }) + -- Menu + require("core.widgets.menu") + -- Start button + local start_button = wibox.widget { + { + { + image = beautiful.awesome_icon, + widget = wibox.widget.imagebox + }, + widget = wibox.container.place, + halign = "center", + id = "menu" + }, + bg = "#26262633", + widget = wibox.container.background, + forced_width = require("beautiful.xresources").apply_dpi(61), + } + start_button:connect_signal("button::press",function(self,x,y,button) + if button == 1 then + menu:show() + end + end) -- Add widgets to the wibox s.mywibox:setup { + expand = "outside", 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), + -- Left widgets + start_button, + --require("widgets.polylauncher")({vertical = false}), + --s.mytaglist, + s.mypromptbox, + layout = wibox.layout.fixed.horizontal, + spacing = 3 }, - --require("widgets.polylauncher")({vertical = false}), - --s.mytaglist, - s.mypromptbox, - spacing = 3 + widget = wibox.container.place, + halign = "left", + fill_horizontal = false }, - -- 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.wallpapers")({ - screen = s, - path = os.getenv("HOME").."/Pictures/Wallpapers/", - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - require("widgets.mailbox")({ - screen = s, - style = { - rounding = 1, - icon_bg_normal = beautiful.topbar_bg - } - }), - --wibox.widget.systray(), - require("widgets.volume")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - require("widgets.battery")({ - percentage = true, - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - wibox.widget.textclock(), - require("widgets.username")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - s.mylayoutbox, - spacing = 4 + { + { + -- Right widgets + require("widgets.drawer")({ + wibox.widget.systray(), + }), + require("widgets.wallpapers")({ + screen = s, + path = os.getenv("HOME").."/Pictures/Wallpapers/", + }), + require("widgets.mailbox")({ + screen = s, + style = { + rounding = 1, + } + }), + require("widgets.volume")({}), + require("widgets.battery")({ + percentage = true, + }), + awful.widget.keyboardlayout(), + wibox.widget.textclock(), + s.mylayoutbox, + layout = wibox.layout.fixed.horizontal, + spacing = 4, + }, + widget = wibox.container.place, + halign = "right", + fill_horizontal = false }, } end) From 579c46f4f44b6ffe1d2d7534e9ce6de692298453 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Mon, 18 Apr 2022 13:21:54 +0400 Subject: [PATCH 6/7] Made changes to ubuntu 20.04 theme --- core/titlebar.lua | 4 +- presets/ubuntu-20.04/core/layout.lua | 79 +++++++++----------- presets/ubuntu-phone/{ => core}/layout.lua | 0 presets/ubuntu-phone/{ => core}/titlebar.lua | 0 presets/ubuntu-phone/{ => core}/vars.lua | 0 themes/unity2/icons/drawer-closed.svg | 73 ++++++++++++++++++ themes/unity2/icons/drawer-open.svg | 73 ++++++++++++++++++ 7 files changed, 185 insertions(+), 44 deletions(-) rename presets/ubuntu-phone/{ => core}/layout.lua (100%) rename presets/ubuntu-phone/{ => core}/titlebar.lua (100%) rename presets/ubuntu-phone/{ => core}/vars.lua (100%) create mode 100644 themes/unity2/icons/drawer-closed.svg create mode 100644 themes/unity2/icons/drawer-open.svg diff --git a/core/titlebar.lua b/core/titlebar.lua index 6bd711d..45662df 100644 --- a/core/titlebar.lua +++ b/core/titlebar.lua @@ -65,12 +65,12 @@ local menu_widget = menu({ }, { "Stop task", function() - awful.spawn("kill "..tostring(client.focus.pid)) + awful.spawn("kill "..tostring(c.pid)) end }, { "Kill task", function() - awful.spawn("kill -s KILL "..tostring(client.focus.pid)) + awful.spawn("kill -s KILL "..tostring(c.pid)) end }, { "Debug info", diff --git a/presets/ubuntu-20.04/core/layout.lua b/presets/ubuntu-20.04/core/layout.lua index 825f249..556c5be 100644 --- a/presets/ubuntu-20.04/core/layout.lua +++ b/presets/ubuntu-20.04/core/layout.lua @@ -71,55 +71,50 @@ awful.screen.connect_for_each_screen(function(s) }) -- Add widgets to the wibox s.mywibox:setup { + expand = "outside", layout = wibox.layout.align.horizontal, { -- Left widgets - layout = wibox.layout.fixed.horizontal, - require("core.widgets.menu_launcher"), - --require("widgets.polylauncher")({vertical = false}), - --s.mytaglist, - s.mypromptbox, - spacing = 3 + { + require("core.widgets.menu_launcher"), + --require("widgets.polylauncher")({vertical = false}), + --s.mytaglist, + s.mypromptbox, + layout = wibox.layout.fixed.horizontal, + spacing = 3 + }, + widget = wibox.container.place, + halign = "left", + fill_horizontal = false, }, -- Middle widget - { - widget = wibox.container.background - }, + wibox.widget.textclock(), { -- Right widgets - wibox.widget.textclock(), { - widget = wibox.container.background, - forced_width = (math.abs(s.geometry.width/2)-200) + require("widgets.drawer")({ + wibox.widget.systray() + }), + awful.widget.keyboardlayout(), + require("widgets.wallpapers")({ + screen = s, + path = os.getenv("HOME").."/Pictures/Wallpapers/", + }), + require("widgets.mailbox")({ + screen = s, + style = { + rounding = 1, + } + }), + require("widgets.volume")({}), + require("widgets.battery")({ + percentage = false, + }), + s.mylayoutbox, + layout = wibox.layout.fixed.horizontal, + spacing = 4 }, - layout = wibox.layout.fixed.horizontal, - awful.widget.keyboardlayout(), - require("widgets.wallpapers")({ - screen = s, - path = os.getenv("HOME").."/Pictures/Wallpapers/", - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - require("widgets.mailbox")({ - screen = s, - style = { - rounding = 1, - icon_bg_normal = beautiful.topbar_bg - } - }), - --wibox.widget.systray(), - require("widgets.volume")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - require("widgets.battery")({ - percentage = false, - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), - s.mylayoutbox, - spacing = 4 + widget = wibox.container.place, + halign = "right", + fill_horizontal = false }, } end) diff --git a/presets/ubuntu-phone/layout.lua b/presets/ubuntu-phone/core/layout.lua similarity index 100% rename from presets/ubuntu-phone/layout.lua rename to presets/ubuntu-phone/core/layout.lua diff --git a/presets/ubuntu-phone/titlebar.lua b/presets/ubuntu-phone/core/titlebar.lua similarity index 100% rename from presets/ubuntu-phone/titlebar.lua rename to presets/ubuntu-phone/core/titlebar.lua diff --git a/presets/ubuntu-phone/vars.lua b/presets/ubuntu-phone/core/vars.lua similarity index 100% rename from presets/ubuntu-phone/vars.lua rename to presets/ubuntu-phone/core/vars.lua diff --git a/themes/unity2/icons/drawer-closed.svg b/themes/unity2/icons/drawer-closed.svg new file mode 100644 index 0000000..f55095d --- /dev/null +++ b/themes/unity2/icons/drawer-closed.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/themes/unity2/icons/drawer-open.svg b/themes/unity2/icons/drawer-open.svg new file mode 100644 index 0000000..02c1d88 --- /dev/null +++ b/themes/unity2/icons/drawer-open.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 780f63f1a047d9e70ed4f0f9a4f435644bb7c186 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Mon, 18 Apr 2022 15:54:23 +0400 Subject: [PATCH 7/7] Removed duplicated context menus for windows --- core/layout.lua | 1 - core/titlebar.lua | 154 +++++++++++++++++++++++----------------------- 2 files changed, 78 insertions(+), 77 deletions(-) diff --git a/core/layout.lua b/core/layout.lua index 05b6468..8dbe5b0 100644 --- a/core/layout.lua +++ b/core/layout.lua @@ -34,7 +34,6 @@ 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]) diff --git a/core/titlebar.lua b/core/titlebar.lua index 45662df..958f5d6 100644 --- a/core/titlebar.lua +++ b/core/titlebar.lua @@ -2,87 +2,89 @@ 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 +if not menu_widget then + 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) + controls_widget = wibox.widget { + forced_width = 72, + forced_height = 24, + layout = wibox.layout.fixed.horizontal, + } + menu_widget = menu({ + before = { + controls_widget }, - { "Toggle on tag", - toggle_screentags + after = { + require("widgets.client-volume")({}) }, - { "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")() + 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 -}) + }, + vertical = true + }) +end return function(c) local buttons = gears.table.join(