2012-10-23 20:32:59 +02:00
|
|
|
---------------------------------------------------------------------------
|
2021-12-21 06:54:15 +01:00
|
|
|
--- Create widget area on the edge of a client.
|
2021-12-17 22:46:08 +01:00
|
|
|
--
|
|
|
|
-- Create a titlebar
|
|
|
|
-- =================
|
2017-07-02 16:56:53 +02:00
|
|
|
--
|
|
|
|
-- This example reproduces what the default `rc.lua` does. It shows how to
|
|
|
|
-- handle the titlebars on a lower level.
|
|
|
|
--
|
|
|
|
-- @DOC_awful_titlebar_default_EXAMPLE@
|
2014-05-20 13:02:39 +02:00
|
|
|
--
|
2012-10-23 20:32:59 +02:00
|
|
|
-- @author Uli Schlachter
|
|
|
|
-- @copyright 2012 Uli Schlachter
|
2019-06-06 08:44:00 +02:00
|
|
|
-- @popupmod awful.titlebar
|
2012-10-23 20:32:59 +02:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
local error = error
|
2019-07-22 10:12:16 +02:00
|
|
|
local pairs = pairs
|
|
|
|
local table = table
|
2012-10-23 20:32:59 +02:00
|
|
|
local type = type
|
2017-03-06 17:11:05 +01:00
|
|
|
local gmath = require("gears.math")
|
2012-10-23 20:32:59 +02:00
|
|
|
local abutton = require("awful.button")
|
|
|
|
local aclient = require("awful.client")
|
2015-07-29 21:03:58 +02:00
|
|
|
local atooltip = require("awful.tooltip")
|
2017-03-06 17:00:44 +01:00
|
|
|
local clienticon = require("awful.widget.clienticon")
|
2012-10-23 20:32:59 +02:00
|
|
|
local beautiful = require("beautiful")
|
|
|
|
local drawable = require("wibox.drawable")
|
|
|
|
local imagebox = require("wibox.widget.imagebox")
|
|
|
|
local textbox = require("wibox.widget.textbox")
|
2016-02-12 18:19:22 +01:00
|
|
|
local base = require("wibox.widget.base")
|
2012-10-23 20:32:59 +02:00
|
|
|
local capi = {
|
|
|
|
client = client
|
|
|
|
}
|
2018-12-17 18:47:14 +01:00
|
|
|
|
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
local titlebar = {
|
2018-12-17 18:47:14 +01:00
|
|
|
widget = {},
|
|
|
|
enable_tooltip = true,
|
|
|
|
fallback_name = '<unknown>'
|
2012-10-23 20:32:59 +02:00
|
|
|
}
|
|
|
|
|
2022-09-04 00:31:24 +02:00
|
|
|
local default_tooltip_messages = {
|
|
|
|
close = "Close",
|
|
|
|
minimize = "Minimize",
|
|
|
|
maximized_active = "Unmaximize",
|
|
|
|
maximized_inactive = "Maximize",
|
|
|
|
floating_active = "Tiling",
|
|
|
|
floating_inactive = "Floating",
|
|
|
|
ontop_active = "NotOnTop",
|
|
|
|
ontop_inactive = "OnTop",
|
|
|
|
sticky_active = "NotSticky",
|
|
|
|
sticky_inactive = "Sticky"
|
|
|
|
}
|
2018-12-17 18:47:14 +01:00
|
|
|
|
|
|
|
--- Show tooltips when hover on titlebar buttons.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2018-12-17 18:47:14 +01:00
|
|
|
-- @tfield[opt=true] boolean awful.titlebar.enable_tooltip
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @param boolean
|
2018-12-17 18:47:14 +01:00
|
|
|
|
|
|
|
--- Title to display if client name is not set.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2018-12-17 18:47:14 +01:00
|
|
|
-- @field[opt='\<unknown\>'] awful.titlebar.fallback_name
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam[opt='\<unknown\>'] string fallback_name
|
2018-12-17 18:47:14 +01:00
|
|
|
|
2016-08-14 06:25:31 +02:00
|
|
|
--- The titlebar foreground (text) color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_fg_normal
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
|
|
|
--- The titlebar background color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bg_normal
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
|
|
|
--- The titlebar background image image.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bgimage_normal
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
|
|
|
--- The titlebar foreground (text) color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_fg
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
|
|
|
--- The titlebar background color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bg
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
|
|
|
--- The titlebar background image image.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bgimage
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
|
|
|
--- The focused titlebar foreground (text) color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_fg_focus
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
|
|
|
--- The focused titlebar background color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bg_focus
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
|
|
|
--- The focused titlebar background image image.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bgimage_focus
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-10-17 03:57:56 +02:00
|
|
|
--- The urgent titlebar foreground (text) color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2021-10-17 03:57:56 +02:00
|
|
|
-- @beautiful beautiful.titlebar_fg_urgent
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
|
|
|
--- The urgent titlebar background color.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2021-10-17 03:57:56 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bg_urgent
|
|
|
|
-- @param color
|
|
|
|
-- @see gears.color
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The urgent titlebar background image.
|
|
|
|
--
|
2021-10-17 03:57:56 +02:00
|
|
|
-- @beautiful beautiful.titlebar_bgimage_urgent
|
|
|
|
-- @tparam gears.surface|string path
|
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The normal non-floating button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_normal
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The normal non-maximized button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_normal
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The normal minimize button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_minimize_button_normal
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered minimize button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_minimize_button_normal_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed minimize button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_minimize_button_normal_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The normal close button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_close_button_normal
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered close button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_close_button_normal_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed close button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_close_button_normal_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The normal non-ontop button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_normal
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The normal non-sticky button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_normal
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The focused client non-floating button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_focus
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The focused client non-maximized button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_focus
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The focused client minimize button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_minimize_button_focus
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+focused client minimize button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_minimize_button_focus_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+focused minimize button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_minimize_button_focus_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The focused client close button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_close_button_focus
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+focused close button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_close_button_focus_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+focused close button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_close_button_focus_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The focused client non-ontop button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_focus
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The focused client sticky button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_focus
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The normal floating button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_normal_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered floating client button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_normal_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed floating client button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_normal_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The maximized client button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_normal_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hozered+maximized client button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_normal_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+maximized button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_normal_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The ontop button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_normal_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+ontop client button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_normal_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+ontop client button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_normal_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The sticky button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_normal_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+sticky button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_normal_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+sticky client button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_normal_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The floating+focused client button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_focus_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+floating+focused button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_focus_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+floating+focused button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_focus_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The maximized+focused button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_focus_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+maximized+focused button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_focus_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+maximized+focused button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_focus_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The ontop+focused button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_focus_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+ontop+focused button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_focus_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+ontop+focused button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_focus_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The sticky+focused button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_focus_active
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+sticky+focused button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_focus_active_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+sticky+focused button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_focus_active_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+floating button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_normal_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+floating button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_normal_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+inactive+floating button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_normal_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+maximized button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_normal_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+maximized button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_normal_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+maximized+inactive button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_normal_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+ontop button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_normal_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+ontop button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_normal_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+inactive+ontop button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_normal_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+sticky button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_normal_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+sticky button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_normal_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+inactive+sticky button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_normal_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+focused+floating button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_focus_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+focused+floating button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_focus_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+inactive+focused+floating button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_floating_button_focus_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+focused+maximized button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_focus_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+focused+maximized button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_focus_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+inactive+focused+maximized button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_maximized_button_focus_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+focused+ontop button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_focus_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+focused+ontop button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_focus_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+inactive+focused+ontop button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_ontop_button_focus_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The inactive+focused+sticky button image.
|
|
|
|
--
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_focus_inactive
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2016-08-14 06:25:31 +02:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The hovered+inactive+focused+sticky button image.
|
|
|
|
--
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_focus_inactive_hover
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2021-12-21 06:54:15 +01:00
|
|
|
--- The pressed+inactive+focused+sticky button image.
|
|
|
|
--
|
2017-03-03 00:01:22 +01:00
|
|
|
-- @beautiful beautiful.titlebar_sticky_button_focus_inactive_press
|
2019-06-08 06:15:59 +02:00
|
|
|
-- @tparam gears.surface|string path
|
2017-03-02 22:49:14 +01:00
|
|
|
-- @see gears.surface
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the close button tooltip.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_close
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_close
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the minimize button tooltip.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_minimize
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_minimize
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the maximize button tooltip when the client is maximized.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_maximized_active
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_maximized_active
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the maximize button tooltip when the client is unmaximized.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_maximized_inactive
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_maximized_inactive
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the floating button tooltip when then client is floating.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_floating_active
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_floating_active
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the floating button tooltip when then client isn't floating.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_floating_inactive
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_floating_inactive
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the onTop button tooltip when the client is onTop.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_ontop_active
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_ontop_active
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the onTop button tooltip when client isn't onTop.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_ontop_inactive
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_ontop_inactive
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the sticky button tooltip when the client is sticky.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_sticky_active
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_sticky_active
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The message in the sticky button tooltip when the client isn't sticky.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_messages_sticky_inactive
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_messages_sticky_inactive
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.titlebar
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The delay in second before the titlebar buttons tooltip is shown.
|
|
|
|
-- It is used as the `delay_show` parameter passed to the `awful.tooltip` constructor function.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_delay_show
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam integer titlebar_tooltip_delay_show
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.tooltip
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The inner left and right margins for tooltip messages.
|
|
|
|
-- It is used as the `margins_leftright` parameter passed to the `awful.tooltip` constructor function.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_margins_leftright
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam integer titlebar_tooltip_margins_leftright
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.tooltip
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The inner top and bottom margins for the tooltip messages.
|
|
|
|
-- It is used as the `margins_topbottom` parameter passed to the `awful.tooltip` constructor function.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_margins_topbottom
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam integer titlebar_tooltip_margins_topbottom
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.tooltip
|
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The time in second before invoking the `timer_function` callback.
|
|
|
|
-- It is used as the `timeout` parameter passed to the `awful.tooltip` constructor function.
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_timeout
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam number titlebar_tooltip_timeout
|
|
|
|
-- @see awful.tooltip.timeout
|
2022-09-04 00:31:24 +02:00
|
|
|
|
2022-09-18 18:22:52 +02:00
|
|
|
--- The text horizontal alignment in tooltips.
|
|
|
|
-- It is used as the `align` parameter passed to the `awful.tooltip` constructor function.
|
|
|
|
--
|
|
|
|
-- Valid values are:
|
|
|
|
--
|
|
|
|
-- * `"right"`
|
|
|
|
-- * `"top_right"`
|
|
|
|
-- * `"left"`
|
|
|
|
-- * `"bottom_left"`
|
|
|
|
-- * `"top_left"`
|
|
|
|
-- * `"bottom"`
|
|
|
|
-- * `"top"`
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @beautiful beautiful.titlebar_tooltip_align
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @tparam string titlebar_tooltip_align
|
2022-09-04 00:31:24 +02:00
|
|
|
-- @see awful.tooltip
|
|
|
|
|
2015-09-27 17:00:01 +02:00
|
|
|
--- Set a declarative widget hierarchy description.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2015-09-27 17:00:01 +02:00
|
|
|
-- See [The declarative layout system](../documentation/03-declarative-layout.md.html)
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam table args An array containing the widgets disposition
|
2019-06-08 01:08:05 +02:00
|
|
|
-- @method setup
|
2022-07-05 10:37:14 +02:00
|
|
|
-- @noreturn
|
2015-09-27 17:00:01 +02:00
|
|
|
|
2016-01-06 13:20:04 +01:00
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
local all_titlebars = setmetatable({}, { __mode = 'k' })
|
|
|
|
|
|
|
|
-- Get a color for a titlebar, this tests many values from the array and the theme
|
|
|
|
local function get_color(name, c, args)
|
|
|
|
local suffix = "_normal"
|
2021-10-17 03:57:56 +02:00
|
|
|
|
|
|
|
if c.urgent then
|
|
|
|
suffix = "_urgent"
|
|
|
|
elseif c.active then
|
2012-10-23 20:32:59 +02:00
|
|
|
suffix = "_focus"
|
|
|
|
end
|
|
|
|
local function get(array)
|
|
|
|
return array["titlebar_"..name..suffix] or array["titlebar_"..name] or array[name..suffix] or array[name]
|
|
|
|
end
|
|
|
|
return get(args) or get(beautiful)
|
|
|
|
end
|
|
|
|
|
2013-09-19 14:37:07 +02:00
|
|
|
local function get_titlebar_function(c, position)
|
|
|
|
if position == "left" then
|
|
|
|
return c.titlebar_left
|
|
|
|
elseif position == "right" then
|
|
|
|
return c.titlebar_right
|
|
|
|
elseif position == "top" then
|
|
|
|
return c.titlebar_top
|
|
|
|
elseif position == "bottom" then
|
|
|
|
return c.titlebar_bottom
|
|
|
|
else
|
|
|
|
error("Invalid titlebar position '" .. position .. "'")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-10-07 00:11:23 +02:00
|
|
|
--- Call `request::titlebars` to allow themes or rc.lua to create them even
|
|
|
|
-- when `titlebars_enabled` is not set in the rules.
|
|
|
|
-- @tparam client c The client.
|
|
|
|
-- @tparam[opt=false] boolean hide_all Hide all titlebars except `keep`
|
2019-12-01 07:53:12 +01:00
|
|
|
-- @tparam string keep Keep the titlebar at this position.
|
|
|
|
-- @tparam string context The reason why this was called.
|
2018-10-07 00:11:23 +02:00
|
|
|
-- @treturn boolean If the titlebars were loaded
|
2019-12-01 07:53:12 +01:00
|
|
|
local function load_titlebars(c, hide_all, keep, context)
|
2018-10-07 00:11:23 +02:00
|
|
|
if c._request_titlebars_called then return false end
|
|
|
|
|
2019-12-01 07:53:12 +01:00
|
|
|
c:emit_signal("request::titlebars", context, {})
|
2018-10-07 00:11:23 +02:00
|
|
|
|
|
|
|
if hide_all then
|
|
|
|
-- Don't bother checking if it has been created, `.hide` don't works
|
|
|
|
-- anyway.
|
|
|
|
for _, tb in ipairs {"top", "bottom", "left", "right"} do
|
|
|
|
if tb ~= keep then
|
|
|
|
titlebar.hide(c, tb)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
c._request_titlebars_called = true
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2018-12-27 05:34:17 +01:00
|
|
|
local function get_children_by_id(self, name)
|
|
|
|
--TODO v5: Move the ID management to the hierarchy.
|
|
|
|
if self._drawable._widget
|
|
|
|
and self._drawable._widget._private
|
|
|
|
and self._drawable._widget._private.by_id then
|
|
|
|
return self._drawable.widget._private.by_id[name]
|
|
|
|
end
|
|
|
|
|
|
|
|
return {}
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2021-06-16 19:40:00 +02:00
|
|
|
--- Create a new titlebar for the given client.
|
|
|
|
--
|
|
|
|
-- Every client can hold up to four titlebars, one for each side (i.e. each
|
|
|
|
-- value of `args.position`).
|
|
|
|
--
|
|
|
|
-- If this constructor is called again with the same
|
2021-06-20 11:39:15 +02:00
|
|
|
-- values for the client (`c`) and the titlebar position (`args.position`),
|
|
|
|
-- the previous titlebar will be removed and replaced by the new one.
|
2021-06-16 19:40:00 +02:00
|
|
|
--
|
2021-06-20 13:47:27 +02:00
|
|
|
-- @DOC_awful_titlebar_constructor_EXAMPLE@
|
2021-06-16 19:40:00 +02:00
|
|
|
--
|
|
|
|
-- @tparam client c The client the titlebar will be attached to.
|
2016-11-21 22:38:23 +01:00
|
|
|
-- @tparam[opt={}] table args A table with extra arguments for the titlebar.
|
2021-06-16 19:40:00 +02:00
|
|
|
-- @tparam[opt=font.height*1.5] number args.size The size of the titlebar. Will
|
|
|
|
-- be interpreted as `height` for horizontal titlebars or as `width` for
|
|
|
|
-- vertical titlebars.
|
2021-06-20 11:39:15 +02:00
|
|
|
-- @tparam[opt="top"] string args.position Possible values are `"top"`,
|
|
|
|
-- `"left"`, `"right"` and `"bottom"`.
|
|
|
|
-- @tparam[opt] string args.bg_normal
|
|
|
|
-- @tparam[opt] string args.bg_focus
|
2021-10-17 03:57:56 +02:00
|
|
|
-- @tparam[opt] string args.bg_urgent
|
2021-06-20 11:39:15 +02:00
|
|
|
-- @tparam[opt] string args.bgimage_normal
|
|
|
|
-- @tparam[opt] string args.bgimage_focus
|
|
|
|
-- @tparam[opt] string args.fg_normal
|
|
|
|
-- @tparam[opt] string args.fg_focus
|
2021-10-17 03:57:56 +02:00
|
|
|
-- @tparam[opt] string args.fg_urgent
|
2021-06-20 11:39:15 +02:00
|
|
|
-- @tparam[opt] string args.font
|
2019-06-07 20:59:34 +02:00
|
|
|
-- @constructorfct awful.titlebar
|
2021-06-16 19:40:00 +02:00
|
|
|
-- @treturn wibox.drawable The newly created titlebar object.
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @usebeautiful beautiful.titlebar_fg_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_bg_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_bgimage_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_fg
|
|
|
|
-- @usebeautiful beautiful.titlebar_bg
|
|
|
|
-- @usebeautiful beautiful.titlebar_bgimage
|
|
|
|
-- @usebeautiful beautiful.titlebar_fg_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_bg_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_bgimage_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_fg_urgent
|
|
|
|
-- @usebeautiful beautiful.titlebar_bg_urgent
|
|
|
|
-- @usebeautiful beautiful.titlebar_bgimage_urgent
|
2012-10-23 20:32:59 +02:00
|
|
|
local function new(c, args)
|
2016-02-07 15:02:25 +01:00
|
|
|
args = args or {}
|
2012-10-23 20:32:59 +02:00
|
|
|
local position = args.position or "top"
|
2017-03-06 17:11:05 +01:00
|
|
|
local size = args.size or gmath.round(beautiful.get_font_height(args.font) * 1.5)
|
2013-09-19 14:37:07 +02:00
|
|
|
local d = get_titlebar_function(c, position)(c, size)
|
2012-10-23 20:32:59 +02:00
|
|
|
|
|
|
|
-- Make sure that there is never more than one titlebar for any given client
|
|
|
|
local bars = all_titlebars[c]
|
|
|
|
if not bars then
|
|
|
|
bars = {}
|
|
|
|
all_titlebars[c] = bars
|
|
|
|
end
|
|
|
|
|
|
|
|
local ret
|
|
|
|
if not bars[position] then
|
2015-08-08 13:13:47 +02:00
|
|
|
local context = {
|
|
|
|
client = c,
|
|
|
|
position = position
|
|
|
|
}
|
|
|
|
ret = drawable(d, context, "awful.titlebar")
|
2016-10-04 21:18:18 +02:00
|
|
|
ret:_inform_visible(true)
|
2012-11-29 16:52:19 +01:00
|
|
|
local function update_colors()
|
2016-02-07 15:02:25 +01:00
|
|
|
local args_ = bars[position].args
|
|
|
|
ret:set_bg(get_color("bg", c, args_))
|
|
|
|
ret:set_fg(get_color("fg", c, args_))
|
|
|
|
ret:set_bgimage(get_color("bgimage", c, args_))
|
2012-11-29 16:52:19 +01:00
|
|
|
end
|
2012-10-23 20:32:59 +02:00
|
|
|
|
|
|
|
bars[position] = {
|
|
|
|
args = args,
|
2012-11-29 16:52:19 +01:00
|
|
|
drawable = ret,
|
2021-10-26 05:22:42 +02:00
|
|
|
font = args.font or beautiful.titlebar_font,
|
2012-11-29 16:52:19 +01:00
|
|
|
update_colors = update_colors
|
2012-10-23 20:32:59 +02:00
|
|
|
}
|
2012-11-29 16:52:19 +01:00
|
|
|
|
|
|
|
-- Update the colors when focus changes
|
2019-11-11 03:04:04 +01:00
|
|
|
c:connect_signal("property::active", update_colors)
|
2021-10-17 03:57:56 +02:00
|
|
|
c:connect_signal("property::urgent", update_colors)
|
2016-10-04 21:18:18 +02:00
|
|
|
|
|
|
|
-- Inform the drawable when it becomes invisible
|
2019-11-10 07:12:43 +01:00
|
|
|
c:connect_signal("request::unmanage", function()
|
|
|
|
ret:_inform_visible(false)
|
|
|
|
end)
|
2012-10-23 20:32:59 +02:00
|
|
|
else
|
|
|
|
bars[position].args = args
|
|
|
|
ret = bars[position].drawable
|
|
|
|
end
|
|
|
|
|
2012-11-29 16:52:19 +01:00
|
|
|
-- Make sure the titlebar has the right colors applied
|
|
|
|
bars[position].update_colors()
|
2012-10-23 20:32:59 +02:00
|
|
|
|
2015-09-27 17:00:01 +02:00
|
|
|
-- Handle declarative/recursive widget container
|
|
|
|
ret.setup = base.widget.setup
|
2018-12-27 05:34:17 +01:00
|
|
|
ret.get_children_by_id = get_children_by_id
|
2015-09-27 17:00:01 +02:00
|
|
|
|
2016-10-09 07:27:39 +02:00
|
|
|
c._private = c._private or {}
|
|
|
|
c._private.titlebars = bars
|
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
return ret
|
|
|
|
end
|
|
|
|
|
2021-06-16 19:40:00 +02:00
|
|
|
--- Show the client's titlebar.
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client whose titlebar is modified
|
2021-06-20 11:39:15 +02:00
|
|
|
-- @tparam[opt="top"] string position The position of the titlebar. Must be one of `"left"`,
|
|
|
|
-- `"right"`, `"top"`, `"bottom"`.
|
2022-07-05 10:37:14 +02:00
|
|
|
-- @noreturn
|
2019-06-08 01:08:05 +02:00
|
|
|
-- @staticfct awful.titlebar.show
|
2019-12-01 07:53:12 +01:00
|
|
|
-- @request client titlebars show granted Called when `awful.titlebar.show` is
|
|
|
|
-- called.
|
2013-09-19 14:37:07 +02:00
|
|
|
function titlebar.show(c, position)
|
2016-02-07 15:02:25 +01:00
|
|
|
position = position or "top"
|
2019-12-01 07:53:12 +01:00
|
|
|
if load_titlebars(c, true, position, "show") then return end
|
2013-09-19 14:37:07 +02:00
|
|
|
local bars = all_titlebars[c]
|
|
|
|
local data = bars and bars[position]
|
|
|
|
local args = data and data.args
|
|
|
|
new(c, args)
|
|
|
|
end
|
|
|
|
|
2021-06-16 19:40:00 +02:00
|
|
|
--- Hide the client's titlebar.
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client whose titlebar is modified
|
2021-06-20 11:39:15 +02:00
|
|
|
-- @tparam[opt="top"] string position The position of the titlebar. Must be one of `"left"`,
|
|
|
|
-- `"right"`, `"top"`, `"bottom"`.
|
2022-07-05 10:37:14 +02:00
|
|
|
-- @noreturn
|
2019-06-08 01:08:05 +02:00
|
|
|
-- @staticfct awful.titlebar.hide
|
2013-09-19 14:37:07 +02:00
|
|
|
function titlebar.hide(c, position)
|
2016-02-07 15:02:25 +01:00
|
|
|
position = position or "top"
|
2013-09-19 14:37:07 +02:00
|
|
|
get_titlebar_function(c, position)(c, 0)
|
|
|
|
end
|
|
|
|
|
2021-06-16 19:40:00 +02:00
|
|
|
--- Toggle the client's titlebar, hiding it if it is visible, otherwise showing it.
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client whose titlebar is modified
|
2021-06-20 11:39:15 +02:00
|
|
|
-- @tparam[opt="top"] string position The position of the titlebar. Must be one of `"left"`,
|
|
|
|
-- `"right"`, `"top"`, `"bottom"`.
|
2022-07-05 10:37:14 +02:00
|
|
|
-- @noreturn
|
2019-06-08 01:08:05 +02:00
|
|
|
-- @staticfct awful.titlebar.toggle
|
2019-12-01 07:53:12 +01:00
|
|
|
-- @request client titlebars toggle granted Called when `awful.titlebar.toggle` is
|
|
|
|
-- called.
|
2013-09-19 14:37:07 +02:00
|
|
|
function titlebar.toggle(c, position)
|
2016-02-07 15:02:25 +01:00
|
|
|
position = position or "top"
|
2019-12-01 07:53:12 +01:00
|
|
|
if load_titlebars(c, true, position, "toggle") then return end
|
2016-02-07 15:02:25 +01:00
|
|
|
local _, size = get_titlebar_function(c, position)(c)
|
2013-09-19 14:37:07 +02:00
|
|
|
if size == 0 then
|
|
|
|
titlebar.show(c, position)
|
|
|
|
else
|
|
|
|
titlebar.hide(c, position)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-07-22 10:12:16 +02:00
|
|
|
local instances = {}
|
|
|
|
|
|
|
|
-- Do the equivalent of
|
|
|
|
-- c:connect_signal(signal, widget.update)
|
|
|
|
-- without keeping a strong reference to the widget.
|
|
|
|
local function update_on_signal(c, signal, widget)
|
|
|
|
local sig_instances = instances[signal]
|
|
|
|
if sig_instances == nil then
|
|
|
|
sig_instances = setmetatable({}, { __mode = "k" })
|
|
|
|
instances[signal] = sig_instances
|
|
|
|
capi.client.connect_signal(signal, function(cl)
|
|
|
|
local widgets = sig_instances[cl]
|
|
|
|
if widgets then
|
|
|
|
for _, w in pairs(widgets) do
|
|
|
|
w.update()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
local widgets = sig_instances[c]
|
|
|
|
if widgets == nil then
|
|
|
|
widgets = setmetatable({}, { __mode = "v" })
|
|
|
|
sig_instances[c] = widgets
|
|
|
|
end
|
|
|
|
table.insert(widgets, widget)
|
|
|
|
end
|
|
|
|
|
2021-10-26 05:22:42 +02:00
|
|
|
--- Honor the font.
|
|
|
|
local function draw_title(self, ctx, cr, width, height)
|
|
|
|
if ctx.position and ctx.client then
|
|
|
|
local bars = all_titlebars[ctx.client]
|
|
|
|
local data = bars and bars[ctx.position]
|
|
|
|
|
|
|
|
if data and data.font then
|
|
|
|
self:set_font(data.font)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
textbox.draw(self, ctx, cr, width, height)
|
|
|
|
end
|
|
|
|
|
2021-06-16 19:40:00 +02:00
|
|
|
--- Create a new title widget.
|
|
|
|
--
|
|
|
|
-- A title widget displays the name of a client.
|
2012-10-23 20:32:59 +02:00
|
|
|
-- Please note that this returns a textbox and all of textbox' API is available.
|
|
|
|
-- This way, you can e.g. modify the font that is used.
|
2021-06-16 19:40:00 +02:00
|
|
|
--
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which a titlewidget should be created.
|
2012-10-23 20:32:59 +02:00
|
|
|
-- @return The title widget.
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.titlewidget
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.titlewidget(c)
|
|
|
|
local ret = textbox()
|
2021-10-26 05:22:42 +02:00
|
|
|
|
|
|
|
rawset(ret, "draw", draw_title)
|
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
local function update()
|
2018-12-17 18:47:14 +01:00
|
|
|
ret:set_text(c.name or titlebar.fallback_name)
|
2012-10-23 20:32:59 +02:00
|
|
|
end
|
2019-07-22 10:12:16 +02:00
|
|
|
ret.update = update
|
|
|
|
update_on_signal(c, "property::name", ret)
|
2012-10-23 20:32:59 +02:00
|
|
|
update()
|
|
|
|
|
|
|
|
return ret
|
|
|
|
end
|
|
|
|
|
2021-06-16 19:40:00 +02:00
|
|
|
--- Create a new icon widget.
|
|
|
|
--
|
|
|
|
-- An icon widget displays the icon of a client.
|
2012-10-23 20:32:59 +02:00
|
|
|
-- Please note that this returns an imagebox and all of the imagebox' API is
|
|
|
|
-- available. This way, you can e.g. disallow resizes.
|
2021-06-16 19:40:00 +02:00
|
|
|
--
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which an icon widget should be created.
|
2012-10-23 20:32:59 +02:00
|
|
|
-- @return The icon widget.
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.iconwidget
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.iconwidget(c)
|
2017-03-06 17:00:44 +01:00
|
|
|
return clienticon(c)
|
2012-10-23 20:32:59 +02:00
|
|
|
end
|
|
|
|
|
2021-06-16 19:40:00 +02:00
|
|
|
--- Create a new button widget.
|
|
|
|
--
|
|
|
|
-- A button widget displays an image and reacts to
|
2012-10-23 20:32:59 +02:00
|
|
|
-- mouse clicks. Please note that the caller has to make sure that this widget
|
2021-06-20 11:39:15 +02:00
|
|
|
-- gets redrawn when needed by calling the returned widget's `:update()` method.
|
2012-10-23 20:32:59 +02:00
|
|
|
-- The selector function should return a value describing a state. If the value
|
2021-06-20 11:39:15 +02:00
|
|
|
-- is a boolean, either `"active"` or `"inactive"` are used. The actual image is
|
2021-06-16 19:40:00 +02:00
|
|
|
-- then found in the theme as `titlebar_[name]_button_[normal/focus]_[state]`.
|
2012-10-23 20:32:59 +02:00
|
|
|
-- If that value does not exist, the focused state is ignored for the next try.
|
2021-06-16 19:40:00 +02:00
|
|
|
--
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which a button is created.
|
2015-07-29 21:03:58 +02:00
|
|
|
-- @tparam string name Name of the button, used for accessing the theme and
|
|
|
|
-- in the tooltip.
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam function selector A function that selects the image that should be displayed.
|
|
|
|
-- @tparam function action Function that is called when the button is clicked.
|
|
|
|
-- @treturn wibox.widget The widget
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.button
|
2022-09-18 18:22:52 +02:00
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_close
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_minimize
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_maximized_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_maximized_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_floating_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_floating_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_ontop_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_ontop_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_sticky_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_messages_sticky_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_delay_show
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_margins_leftright
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_margins_topbottom
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_timeout
|
|
|
|
-- @usebeautiful beautiful.titlebar_tooltip_align
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.button(c, name, selector, action)
|
|
|
|
local ret = imagebox()
|
2016-01-06 13:20:04 +01:00
|
|
|
if titlebar.enable_tooltip then
|
2022-09-04 00:31:24 +02:00
|
|
|
ret._private.tooltip = atooltip({
|
|
|
|
objects = {ret},
|
|
|
|
delay_show = beautiful["titlebar_tooltip_delay_show"] or 1,
|
|
|
|
margins_leftright = beautiful["titlebar_tooltip_margins_leftright"],
|
|
|
|
margins_topbottom = beautiful["titlebar_tooltip_margins_topbottom"],
|
|
|
|
timeout = beautiful["titlebar_tooltip_timeout"],
|
|
|
|
align = beautiful["titlebar_tooltip_align"]
|
|
|
|
})
|
2016-01-06 13:20:04 +01:00
|
|
|
end
|
2015-07-29 21:03:58 +02:00
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
local function update()
|
|
|
|
local img = selector(c)
|
|
|
|
if type(img) ~= "nil" then
|
|
|
|
-- Convert booleans automatically
|
|
|
|
if type(img) == "boolean" then
|
|
|
|
if img then
|
|
|
|
img = "active"
|
|
|
|
else
|
|
|
|
img = "inactive"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local prefix = "normal"
|
2019-11-11 00:39:26 +01:00
|
|
|
if c.active then
|
2012-10-23 20:32:59 +02:00
|
|
|
prefix = "focus"
|
|
|
|
end
|
|
|
|
if img ~= "" then
|
|
|
|
prefix = prefix .. "_"
|
|
|
|
end
|
2017-03-15 17:29:53 +01:00
|
|
|
local state = ret.state
|
|
|
|
if state ~= "" then
|
|
|
|
state = "_" .. state
|
2017-03-02 22:49:14 +01:00
|
|
|
end
|
2022-09-04 00:31:24 +02:00
|
|
|
-- try select user defined tooltip texts according to state
|
|
|
|
local tooltip_text = beautiful["titlebar_tooltip_messages_" .. name .. "_" .. img]
|
|
|
|
or beautiful["titlebar_tooltip_messages_" .. name]
|
|
|
|
or default_tooltip_messages[name .. "_" .. img]
|
|
|
|
or default_tooltip_messages[name]
|
|
|
|
or name
|
2016-09-15 16:21:49 +02:00
|
|
|
-- First try with a prefix based on the client's focus state,
|
|
|
|
-- then try again without that prefix if nothing was found,
|
|
|
|
-- and finally, try a fallback for compatibility with Awesome 3.5 themes
|
2017-03-15 17:29:53 +01:00
|
|
|
local theme = beautiful["titlebar_" .. name .. "_button_" .. prefix .. img .. state]
|
2017-03-02 22:49:14 +01:00
|
|
|
or beautiful["titlebar_" .. name .. "_button_" .. prefix .. img]
|
2016-09-15 16:21:49 +02:00
|
|
|
or beautiful["titlebar_" .. name .. "_button_" .. img]
|
|
|
|
or beautiful["titlebar_" .. name .. "_button_" .. prefix .. "_inactive"]
|
2012-10-23 20:32:59 +02:00
|
|
|
if theme then
|
|
|
|
img = theme
|
|
|
|
end
|
2022-09-04 00:31:24 +02:00
|
|
|
-- Set tooltip text for button
|
|
|
|
if titlebar.enable_tooltip then
|
|
|
|
ret._private.tooltip:set_text(tooltip_text)
|
|
|
|
end
|
2012-10-23 20:32:59 +02:00
|
|
|
end
|
2022-09-04 00:31:24 +02:00
|
|
|
-- Set button image by focus and activity state
|
2012-10-23 20:32:59 +02:00
|
|
|
ret:set_image(img)
|
|
|
|
end
|
2017-03-02 22:49:14 +01:00
|
|
|
ret.state = ""
|
2012-10-23 20:32:59 +02:00
|
|
|
if action then
|
2019-10-06 09:04:51 +02:00
|
|
|
ret.buttons = {
|
|
|
|
abutton({ }, 1, nil, function()
|
|
|
|
ret.state = ""
|
|
|
|
update()
|
|
|
|
action(c, selector(c))
|
|
|
|
end)
|
|
|
|
}
|
2017-03-02 22:49:14 +01:00
|
|
|
else
|
2019-10-06 09:04:51 +02:00
|
|
|
ret.buttons = {
|
|
|
|
abutton({ }, 1, nil, function()
|
|
|
|
ret.state = ""
|
|
|
|
update()
|
|
|
|
end)
|
|
|
|
}
|
2012-10-23 20:32:59 +02:00
|
|
|
end
|
2017-03-02 22:49:14 +01:00
|
|
|
ret:connect_signal("mouse::enter", function()
|
|
|
|
ret.state = "hover"
|
|
|
|
update()
|
|
|
|
end)
|
|
|
|
ret:connect_signal("mouse::leave", function()
|
|
|
|
ret.state = ""
|
|
|
|
update()
|
|
|
|
end)
|
2017-03-03 00:01:22 +01:00
|
|
|
ret:connect_signal("button::press", function(_, _, _, b)
|
2017-03-02 22:49:14 +01:00
|
|
|
if b == 1 then
|
2017-03-03 00:01:22 +01:00
|
|
|
ret.state = "press"
|
2017-03-02 22:49:14 +01:00
|
|
|
update()
|
|
|
|
end
|
|
|
|
end)
|
2012-10-23 20:32:59 +02:00
|
|
|
ret.update = update
|
|
|
|
update()
|
|
|
|
|
|
|
|
-- We do magic based on whether a client is focused above, so we need to
|
|
|
|
-- connect to the corresponding signal here.
|
2019-07-22 10:12:16 +02:00
|
|
|
update_on_signal(c, "focus", ret)
|
|
|
|
update_on_signal(c, "unfocus", ret)
|
2012-10-23 20:32:59 +02:00
|
|
|
|
|
|
|
return ret
|
|
|
|
end
|
|
|
|
|
|
|
|
--- Create a new float button for a client.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.floatingbutton
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which the button is wanted.
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_normal_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_normal_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_normal_active_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_focus_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_focus_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_focus_active_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_normal_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_normal_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_normal_inactive_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_focus_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_focus_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_floating_button_focus_inactive_press
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.floatingbutton(c)
|
2016-03-14 07:21:29 +01:00
|
|
|
local widget = titlebar.widget.button(c, "floating", aclient.object.get_floating, aclient.floating.toggle)
|
2019-07-22 10:12:16 +02:00
|
|
|
update_on_signal(c, "property::floating", widget)
|
2012-10-23 20:32:59 +02:00
|
|
|
return widget
|
|
|
|
end
|
|
|
|
|
|
|
|
--- Create a new maximize button for a client.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.maximizedbutton
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which the button is wanted.
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_focus_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_focus_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_focus_active_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_normal_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_normal_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_normal_inactive_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_focus_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_focus_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_focus_inactive_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_normal_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_normal_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_maximized_button_normal_active_press
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.maximizedbutton(c)
|
2016-02-07 15:02:25 +01:00
|
|
|
local widget = titlebar.widget.button(c, "maximized", function(cl)
|
2017-01-24 10:19:45 +01:00
|
|
|
return cl.maximized
|
2016-02-07 15:02:25 +01:00
|
|
|
end, function(cl, state)
|
2017-01-24 10:19:45 +01:00
|
|
|
cl.maximized = not state
|
2012-10-23 20:32:59 +02:00
|
|
|
end)
|
2019-07-22 10:12:16 +02:00
|
|
|
update_on_signal(c, "property::maximized", widget)
|
2012-10-23 20:32:59 +02:00
|
|
|
return widget
|
|
|
|
end
|
|
|
|
|
2013-11-03 00:02:09 +01:00
|
|
|
--- Create a new minimize button for a client.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.minimizebutton
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which the button is wanted.
|
|
|
|
-- @usebeautiful beautiful.titlebar_minimize_button_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_minimize_button_normal_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_minimize_button_normal_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_minimize_button_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_minimize_button_focus_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_minimize_button_focus_press
|
2013-11-03 00:02:09 +01:00
|
|
|
function titlebar.widget.minimizebutton(c)
|
2017-03-03 23:11:06 +01:00
|
|
|
local widget = titlebar.widget.button(c, "minimize",
|
|
|
|
function() return "" end,
|
|
|
|
function(cl) cl.minimized = not cl.minimized end)
|
2019-07-22 10:12:16 +02:00
|
|
|
update_on_signal(c, "property::minimized", widget)
|
2013-11-03 00:02:09 +01:00
|
|
|
return widget
|
|
|
|
end
|
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
--- Create a new closing button for a client.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.closebutton
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which the button is wanted.
|
|
|
|
-- @usebeautiful beautiful.titlebar_close_button_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_close_button_normal_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_close_button_normal_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_close_button_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_close_button_focus_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_close_button_focus_press
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.closebutton(c)
|
2016-02-07 15:02:25 +01:00
|
|
|
return titlebar.widget.button(c, "close", function() return "" end, function(cl) cl:kill() end)
|
2012-10-23 20:32:59 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
--- Create a new ontop button for a client.
|
2021-12-21 06:54:15 +01:00
|
|
|
--
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.ontopbutton
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which the button is wanted.
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_normal_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_normal_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_normal_active_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_focus_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_focus_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_focus_active_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_normal_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_normal_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_normal_inactive_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_focus_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_focus_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_ontop_button_focus_inactive_press
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.ontopbutton(c)
|
2017-03-03 23:11:06 +01:00
|
|
|
local widget = titlebar.widget.button(c, "ontop",
|
|
|
|
function(cl) return cl.ontop end,
|
|
|
|
function(cl, state) cl.ontop = not state end)
|
2019-07-22 10:12:16 +02:00
|
|
|
update_on_signal(c, "property::ontop", widget)
|
2012-10-23 20:32:59 +02:00
|
|
|
return widget
|
|
|
|
end
|
|
|
|
|
|
|
|
--- Create a new sticky button for a client.
|
2021-03-22 07:55:34 +01:00
|
|
|
-- @constructorfct awful.titlebar.widget.stickybutton
|
2021-12-21 06:54:15 +01:00
|
|
|
-- @tparam client c The client for which the button is wanted.
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_normal
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_focus
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_normal_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_normal_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_normal_active_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_focus_active
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_focus_active_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_focus_active_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_normal_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_normal_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_normal_inactive_press
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_focus_inactive
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_focus_inactive_hover
|
|
|
|
-- @usebeautiful beautiful.titlebar_sticky_button_focus_inactive_press
|
2012-10-23 20:32:59 +02:00
|
|
|
function titlebar.widget.stickybutton(c)
|
2017-03-03 23:11:06 +01:00
|
|
|
local widget = titlebar.widget.button(c, "sticky",
|
|
|
|
function(cl) return cl.sticky end,
|
|
|
|
function(cl, state) cl.sticky = not state end)
|
2019-07-22 10:12:16 +02:00
|
|
|
update_on_signal(c, "property::sticky", widget)
|
2012-10-23 20:32:59 +02:00
|
|
|
return widget
|
|
|
|
end
|
|
|
|
|
2019-11-10 07:12:43 +01:00
|
|
|
client.connect_signal("request::unmanage", function(c)
|
2016-01-24 16:27:31 +01:00
|
|
|
all_titlebars[c] = nil
|
|
|
|
end)
|
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
return setmetatable(titlebar, { __call = function(_, ...) return new(...) end})
|
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|