diff --git a/awesome/src/assets/icons/titlebar/close.svg b/awesome/src/assets/icons/titlebar/close.svg index 989837c..2636197 100644 --- a/awesome/src/assets/icons/titlebar/close.svg +++ b/awesome/src/assets/icons/titlebar/close.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/awesome/src/assets/icons/titlebar/maximize.svg b/awesome/src/assets/icons/titlebar/maximize.svg index 422ad55..79a277d 100644 --- a/awesome/src/assets/icons/titlebar/maximize.svg +++ b/awesome/src/assets/icons/titlebar/maximize.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/awesome/src/assets/icons/titlebar/minimize.svg b/awesome/src/assets/icons/titlebar/minimize.svg index 36a771f..78a2feb 100644 --- a/awesome/src/assets/icons/titlebar/minimize.svg +++ b/awesome/src/assets/icons/titlebar/minimize.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/awesome/src/assets/icons/titlebar/stick.svg b/awesome/src/assets/icons/titlebar/stick.svg index c832e29..e675735 100644 --- a/awesome/src/assets/icons/titlebar/stick.svg +++ b/awesome/src/assets/icons/titlebar/stick.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/awesome/src/assets/icons/titlebar/unmaximize.svg b/awesome/src/assets/icons/titlebar/unmaximize.svg index 12d171f..ab373a2 100644 --- a/awesome/src/assets/icons/titlebar/unmaximize.svg +++ b/awesome/src/assets/icons/titlebar/unmaximize.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/awesome/src/assets/icons/titlebar/unstick.svg b/awesome/src/assets/icons/titlebar/unstick.svg index 475f722..5e44e75 100644 --- a/awesome/src/assets/icons/titlebar/unstick.svg +++ b/awesome/src/assets/icons/titlebar/unstick.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/awesome/src/lib/rubato b/awesome/src/lib/rubato index 7ed12e1..d486ee3 160000 --- a/awesome/src/lib/rubato +++ b/awesome/src/lib/rubato @@ -1 +1 @@ -Subproject commit 7ed12e183583a7ce3b59714452217af9a1f02ce6 +Subproject commit d486ee33a8b96ba76a4d948e341c7e89ba0554a5 diff --git a/awesome/src/modules/titlebar.lua b/awesome/src/modules/titlebar.lua index 34c6b75..5d79b8c 100644 --- a/awesome/src/modules/titlebar.lua +++ b/awesome/src/modules/titlebar.lua @@ -23,36 +23,12 @@ Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg" Theme.titlebar_maximized_button_active = icondir .. "maximize.svg" Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg" -local double_click_event_handler = function(double_click_event) - if double_click_timer then - double_click_timer:stop() - double_click_timer = nil - double_click_event() - return - end - double_click_timer = gears.timer.start_new( - 0.20, - function() - double_click_timer = nil - return false - end - ) -end - -local create_click_events = function(c) +local create_buttons = function(c) local buttons = gears.table.join( awful.button( {}, 1, function() - double_click_event_handler(function() - if c.floating then - c.float = false - return - end - c.maximized = not c.maximized - c:raise() - end) c:activate { context = 'titlebar', action = 'mouse_move' } end ), @@ -67,145 +43,381 @@ local create_click_events = function(c) return buttons end -local create_titlebar = function(c, size) - local titlebar = awful.titlebar(c, { - position = "left", - bg = Theme_config.titlebar.bg, - size = size - }) +local create_titlebar = function(c, size, position) + local close_button = awful.titlebar.widget.closebutton(c) + local minimize_button = awful.titlebar.widget.minimizebutton(c) + local maximize_button = awful.titlebar.widget.maximizedbutton(c) - titlebar:setup { - { + local tb + + if position == "left" then + local titlebar = awful.titlebar(c, { + position = "left", + bg = Theme_config.titlebar.bg, + size = size + }) + + tb = wibox.widget { { { { - widget = awful.titlebar.widget.closebutton(c), + close_button, + widget = wibox.container.background, + border_color = Theme_config.titlebar.close_button.border_color, + border_width = dpi(2), + shape = function(cr, height, width) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + id = "closebutton" }, - widget = wibox.container.background, - bg = Theme_config.titlebar.close_button_bg, - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(4)) - end, - id = "closebutton" - }, - { { - widget = awful.titlebar.widget.maximizedbutton(c), + maximize_button, + widget = wibox.container.background, + border_color = Theme_config.titlebar.maximize_button.border_color, + border_width = dpi(2), + shape = function(cr, height, width) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + id = "maximizebutton" }, - widget = wibox.container.background, - bg = Theme_config.titlebar.minimize_button_bg, - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(4)) - end, - id = "maximizebutton" - }, - { { - widget = awful.titlebar.widget.minimizebutton(c), + minimize_button, + widget = wibox.container.background, + border_color = Theme_config.titlebar.minimize_button.border_color, + border_width = dpi(2), + shape = function(cr, height, width) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + id = "minimizebutton" }, - widget = wibox.container.background, - bg = Theme_config.titlebar.maximize_button_bg, - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(4)) - end, - id = "minimizebutton" + spacing = dpi(10), + layout = wibox.layout.fixed.vertical, + id = "spacing" }, - spacing = dpi(10), - layout = wibox.layout.fixed.vertical, - id = "spacing" + margins = dpi(5), + widget = wibox.container.margin, + id = "margin" }, - margins = dpi(8), - widget = wibox.container.margin, - id = "margin" - }, - { - buttons = create_click_events(c), - layout = wibox.layout.flex.vertical - }, - { { - widget = awful.titlebar.widget.iconwidget(c), + buttons = create_buttons(c), + layout = wibox.layout.flex.vertical }, - margins = dpi(5), - widget = wibox.container.margin - }, - layout = wibox.layout.align.vertical, - id = "main" - } - Hover_signal(titlebar.main.margin.spacing.closebutton) - Hover_signal(titlebar.main.margin.spacing.maximizebutton) - Hover_signal(titlebar.main.margin.spacing.minimizebutton) + { + awful.titlebar.widget.iconwidget(c), + margins = dpi(5), + widget = wibox.container.margin + }, + layout = wibox.layout.align.vertical, + id = "main" + } + + titlebar:setup { tb, layout = wibox.layout.fixed.horizontal } + + elseif position == "top" then + local titlebar = awful.titlebar(c, { + position = "top", + bg = Theme_config.titlebar.bg, + size = size + }) + + tb = wibox.widget { + { + awful.titlebar.widget.iconwidget(c), + margins = dpi(5), + widget = wibox.container.margin + }, + { + { + awful.titlebar.widget.titlewidget(c), + valign = "center", + halign = "center", + layout = wibox.container.place, + }, + buttons = create_buttons(c), + fill_space = true, + layout = wibox.layout.stack + }, + { + { + { + minimize_button, + widget = wibox.container.background, + border_color = Theme_config.titlebar.minimize_button.border_color, + border_width = dpi(2), + shape = function(cr, height, width) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + id = "minimizebutton" + }, + { + maximize_button, + widget = wibox.container.background, + border_color = Theme_config.titlebar.maximize_button.border_color, + border_width = dpi(2), + shape = function(cr, height, width) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + id = "maximizebutton" + }, + { + close_button, + widget = wibox.container.background, + border_color = Theme_config.titlebar.close_button.border_color, + border_width = dpi(2), + shape = function(cr, height, width) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + id = "closebutton" + }, + spacing = dpi(10), + layout = wibox.layout.fixed.horizontal, + id = "spacing" + }, + margins = dpi(5), + widget = wibox.container.margin, + id = "margin" + }, + layout = wibox.layout.align.horizontal, + id = "main" + } + + titlebar:setup { tb, layout = wibox.layout.fixed.vertical } + end + + if not tb then return end + + close_button:connect_signal( + "mouse::enter", + function() + c.border_color = Theme_config.titlebar.close_button.hover_border + local cb = tb:get_children_by_id("closebutton")[1] + cb.border_color = Theme_config.titlebar.close_button.hover_border + cb.bg = Theme_config.titlebar.close_button.hover_bg + end + ) + + close_button:connect_signal( + "mouse::leave", + function() + c.border_color = Theme_config.window.border_normal + local cb = tb:get_children_by_id("closebutton")[1] + cb.border_color = Theme_config.titlebar.close_button.border_color + cb.bg = Theme_config.titlebar.close_button.bg + end + ) + + minimize_button:connect_signal( + "mouse::enter", + function() + c.border_color = Theme_config.titlebar.minimize_button.hover_border + local mb = tb:get_children_by_id("minimizebutton")[1] + mb.border_color = Theme_config.titlebar.minimize_button.hover_border + mb.bg = Theme_config.titlebar.minimize_button.hover_bg + end + ) + + minimize_button:connect_signal( + "mouse::leave", + function() + c.border_color = Theme_config.window.border_normal + local mb = tb:get_children_by_id("minimizebutton")[1] + mb.border_color = Theme_config.titlebar.minimize_button.border_color + mb.bg = Theme_config.titlebar.minimize_button.bg + end + ) + + maximize_button:connect_signal( + "mouse::enter", + function() + c.border_color = Theme_config.titlebar.maximize_button.hover_border + local mb = tb:get_children_by_id("maximizebutton")[1] + mb.border_color = Theme_config.titlebar.maximize_button.hover_border + mb.bg = Theme_config.titlebar.maximize_button.hover_bg + end + ) + + maximize_button:connect_signal( + "mouse::leave", + function() + c.border_color = Theme_config.window.border_normal + local mb = tb:get_children_by_id("maximizebutton")[1] + mb.border_color = Theme_config.titlebar.maximize_button.border_color + mb.bg = Theme_config.titlebar.maximize_button.bg + end + ) end -local create_titlebar_dialog_modal = function(c, size) - local titlebar = awful.titlebar(c, { - position = "left", - bg = Theme_config.titlebar.bg, - size = size - }) +local create_titlebar_dialog_modal = function(c, size, position) + local close_button = awful.titlebar.widget.closebutton(c) + local minimize_button = awful.titlebar.widget.minimizebutton(c) + local maximize_button = awful.titlebar.widget.maximizedbutton(c) - titlebar:setup { - { + local tb + + if position == "left" then + local titlebar = awful.titlebar(c, { + position = "left", + bg = Theme_config.titlebar.bg, + size = size + }) + + tb = wibox.widget { { { - awful.titlebar.widget.closebutton(c), + close_button, widget = wibox.container.background, - bg = Theme_config.titlebar.close_button_bg, + border_color = Theme_config.titlebar.close_button.border_color, + border_width = dpi(2), shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(4)) + gears.shape.rounded_rect(cr, width, height, dpi(6)) end, id = "closebutton" }, - { - awful.titlebar.widget.minimizebutton(c), - widget = wibox.container.background, - bg = Theme_config.titlebar.minimize_button_bg, - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(4)) - end, - id = "minimizebutton" - }, - spacing = dpi(10), - layout = wibox.layout.fixed.vertical, - id = "spacing" + margins = dpi(5), + widget = wibox.container.margin, + id = "margin" }, - margins = dpi(8), - widget = wibox.container.margin, - id = "margin" - }, - { - buttons = create_click_events(c), - layout = wibox.layout.flex.vertical - }, - { { - widget = awful.widget.clienticon(c) + buttons = create_buttons(c), + layout = wibox.layout.flex.vertical }, - margins = dpi(5), - widget = wibox.container.margin - }, - layout = wibox.layout.align.vertical, - id = "main" - } - Hover_signal(titlebar.main.margin.spacing.closebutton) - Hover_signal(titlebar.main.margin.spacing.minimizebutton) + { + awful.titlebar.widget.iconwidget(c), + margins = dpi(5), + widget = wibox.container.margin + }, + layout = wibox.layout.align.vertical, + id = "main" + } + + titlebar:setup { tb, layout = wibox.layout.fixed.horizontal } + + elseif position == "top" then + local titlebar = awful.titlebar(c, { + position = "top", + bg = Theme_config.titlebar.bg, + size = size + }) + + tb = wibox.widget { + { + awful.titlebar.widget.iconwidget(c), + margins = dpi(5), + widget = wibox.container.margin + }, + { + { + awful.titlebar.widget.titlewidget(c), + valign = "center", + halign = "center", + layout = wibox.container.place, + }, + buttons = create_buttons(c), + fill_space = true, + layout = wibox.layout.stack + }, + { + { + close_button, + widget = wibox.container.background, + border_color = Theme_config.titlebar.close_button.border_color, + border_width = dpi(2), + shape = function(cr, height, width) + gears.shape.rounded_rect(cr, width, height, dpi(6)) + end, + id = "closebutton" + }, + margins = dpi(5), + widget = wibox.container.margin, + id = "margin" + }, + layout = wibox.layout.align.horizontal, + id = "main" + } + + titlebar:setup { tb, layout = wibox.layout.fixed.vertical } + end + + if not tb then return end + + close_button:connect_signal( + "mouse::enter", + function() + c.border_color = Theme_config.titlebar.close_button.hover_border + local cb = tb:get_children_by_id("closebutton")[1] + cb.border_color = Theme_config.titlebar.close_button.hover_border + cb.bg = Theme_config.titlebar.close_button.hover_bg + end + ) + + close_button:connect_signal( + "mouse::leave", + function() + c.border_color = Theme_config.window.border_normal + local cb = tb:get_children_by_id("closebutton")[1] + cb.border_color = Theme_config.titlebar.close_button.border_color + cb.bg = Theme_config.titlebar.close_button.bg + end + ) + + minimize_button:connect_signal( + "mouse::enter", + function() + c.border_color = Theme_config.titlebar.minimize_button.hover_border + local mb = tb:get_children_by_id("minimizebutton")[1] + mb.border_color = Theme_config.titlebar.minimize_button.hover_border + mb.bg = Theme_config.titlebar.minimize_button.hover_bg + end + ) + + minimize_button:connect_signal( + "mouse::leave", + function() + c.border_color = Theme_config.window.border_normal + local mb = tb:get_children_by_id("minimizebutton")[1] + mb.border_color = Theme_config.titlebar.minimize_button.border_color + mb.bg = Theme_config.titlebar.minimize_button.bg + end + ) + + maximize_button:connect_signal( + "mouse::enter", + function() + c.border_color = Theme_config.titlebar.maximize_button.hover_border + local mb = tb:get_children_by_id("maximizebutton")[1] + mb.border_color = Theme_config.titlebar.maximize_button.hover_border + mb.bg = Theme_config.titlebar.maximize_button.hover_bg + end + ) + + maximize_button:connect_signal( + "mouse::leave", + function() + c.border_color = Theme_config.window.border_normal + local mb = tb:get_children_by_id("maximizebutton")[1] + mb.border_color = Theme_config.titlebar.maximize_button.border_color + mb.bg = Theme_config.titlebar.maximize_button.bg + end + ) end client.connect_signal( "request::titlebars", function(c) - if c.type == "normal" then - create_titlebar(c, dpi(35)) - elseif c.type == "dialog" then - create_titlebar_dialog_modal(c, dpi(35)) + if c.type == "dialog" then + create_titlebar_dialog_modal(c, dpi(35), User_config.titlebar_position) elseif c.type == "modal" then - create_titlebar_dialog_modal(c, dpi(35)) + create_titlebar_dialog_modal(c, dpi(35), User_config.titlebar_position) else - create_titlebar(c, dpi(35)) + create_titlebar(c, dpi(35), User_config.titlebar_position) end if not c.floating or c.maximized or c.fullscreen then - awful.titlebar.hide(c, "left") + if User_config.titlebar_position == "left" then + awful.titlebar.hide(c, "left") + elseif User_config.titlebar_position == "top" then + awful.titlebar.hide(c, "top") + end end end ) @@ -214,9 +426,17 @@ client.connect_signal( "property::floating", function(c) if c.floating and not (c.maximized or c.fullscreen) then - awful.titlebar.show(c, "left") + if User_config.titlebar_position == "left" then + awful.titlebar.show(c, "left") + elseif User_config.titlebar_position == "top" then + awful.titlebar.show(c, "top") + end else - awful.titlebar.hide(c, "left") + if User_config.titlebar_position == "left" then + awful.titlebar.hide(c, "left") + elseif User_config.titlebar_position == "top" then + awful.titlebar.hide(c, "top") + end end end ) diff --git a/awesome/src/theme/theme_config.lua b/awesome/src/theme/theme_config.lua index 73810c6..ab44d66 100644 --- a/awesome/src/theme/theme_config.lua +++ b/awesome/src/theme/theme_config.lua @@ -368,13 +368,30 @@ Theme_config.right_bar = { Theme_config.titlebar = { bg = "#121212AA", - close_button_bg = color["Red200"], - close_button_fg = color["Grey900"], - minimize_button_bg = color["Yellow200"], - minimize_button_fg = color["Grey900"], - maximize_button_bg = color["Green200"], - maximize_button_fg = color["Grey900"], - + close_button = { + border_color = "#00000000", + bg = "#00000000", + fg = color["Grey100"], + hover_border = color["Red800"], + hover_bg = color["Red800"] .. "bb", + hover_fg = color["Red800"], + }, + minimize_button = { + border_color = "#00000000", + fg = color["Grey100"], + bg = "#00000000", + hover_border = color["Orange800"], + hover_fg = color["Orange800"], + hover_bg = color["Orange800"] .. "bb", + }, + maximize_button = { + border_color = "#00000000", + fg = color["Grey100"], + bg = "#00000000", + hover_border = color["Green800"], + hover_fg = color["Green800"], + hover_bg = color["Green800"] .. "bb", + }, } Theme_config.volume_controller = { @@ -505,7 +522,7 @@ Theme_config.context_menu = { --#region General Settings Theme_config.window = { - border_width = dpi(0), + border_width = dpi(2), border_normal = color["Grey800"], border_marked = color["Red200"], useless_gap = dpi(5) diff --git a/awesome/src/theme/user_config.lua b/awesome/src/theme/user_config.lua index 4e89697..a14fe93 100644 --- a/awesome/src/theme/user_config.lua +++ b/awesome/src/theme/user_config.lua @@ -215,6 +215,13 @@ User_config = { ]] -- titlebar_exception = {}, + --[[ + The titlebar position can be "left" (default) or "top" + Example: + titlebar_position = "top" + ]] -- + titlebar_position = "top", + --[[ This is the path to your wallpaper. home is $HOME, you can also use an absolute path. diff --git a/awesome/src/tools/auto_starter.lua b/awesome/src/tools/auto_starter.lua index b4a884c..dd13865 100644 --- a/awesome/src/tools/auto_starter.lua +++ b/awesome/src/tools/auto_starter.lua @@ -2,6 +2,6 @@ local awful = require("awful") return function(table) for _, t in ipairs(table) do - --awful.spawn(t); + awful.spawn(t); end end