Merge branch 'awesomeWM:master' into master

This commit is contained in:
Rayhan Kafi Pratama 2022-07-16 13:48:31 +07:00 committed by GitHub
commit 3382646e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 27 deletions

View File

@ -508,10 +508,10 @@ function widget.new(args)
end end
current_column.layout:add(self:_group_label(group)) current_column.layout:add(self:_group_label(group))
local function insert_keys(_keys, _add_new_column) local function insert_keys(ik_keys, ik_add_new_column)
local max_label_width = 0 local max_label_width = 0
local joined_labels = "" local joined_labels = ""
for i, key in ipairs(_keys) do for i, key in ipairs(ik_keys) do
local modifiers = key.mod local modifiers = key.mod
if not modifiers or modifiers == "none" then if not modifiers or modifiers == "none" then
modifiers = "" modifiers = ""
@ -538,7 +538,7 @@ function widget.new(args)
if label_width > max_label_width then if label_width > max_label_width then
max_label_width = label_width max_label_width = label_width
end end
joined_labels = joined_labels .. rendered_hotkey .. (i~=#_keys and "\n" or "") joined_labels = joined_labels .. rendered_hotkey .. (i~=#ik_keys and "\n" or "")
end end
current_column.layout:add(wibox.widget.textbox(joined_labels)) current_column.layout:add(wibox.widget.textbox(joined_labels))
local max_width = max_label_width + self.group_margin local max_width = max_label_width + self.group_margin
@ -548,7 +548,7 @@ function widget.new(args)
-- +1 for group label: -- +1 for group label:
current_column.height_px = (current_column.height_px or 0) + current_column.height_px = (current_column.height_px or 0) +
gstring.linecount(joined_labels)*line_height + group_label_height gstring.linecount(joined_labels)*line_height + group_label_height
if _add_new_column then if ik_add_new_column then
table.insert(column_layouts, current_column) table.insert(column_layouts, current_column)
end end
end end
@ -643,23 +643,23 @@ function widget.new(args)
awful.button({ }, 3, function () widget_obj:hide() end) awful.button({ }, 3, function () widget_obj:hide() end)
} }
function widget_obj.page_next(_self) function widget_obj.page_next(w_self)
if _self.current_page == #pages then return end if w_self.current_page == #pages then return end
_self.current_page = _self.current_page + 1 w_self.current_page = w_self.current_page + 1
_self.popup:set_widget(pages[_self.current_page]) w_self.popup:set_widget(pages[w_self.current_page])
end end
function widget_obj.page_prev(_self) function widget_obj.page_prev(w_self)
if _self.current_page == 1 then return end if w_self.current_page == 1 then return end
_self.current_page = _self.current_page - 1 w_self.current_page = w_self.current_page - 1
_self.popup:set_widget(pages[_self.current_page]) w_self.popup:set_widget(pages[w_self.current_page])
end end
function widget_obj.show(_self) function widget_obj.show(w_self)
_self.popup.visible = true w_self.popup.visible = true
end end
function widget_obj.hide(_self) function widget_obj.hide(w_self)
_self.popup.visible = false w_self.popup.visible = false
if _self.keygrabber then if w_self.keygrabber then
awful.keygrabber.stop(_self.keygrabber) awful.keygrabber.stop(w_self.keygrabber)
end end
end end

View File

@ -135,6 +135,7 @@ function widgetprompt.new(args)
promptbox.exe_callback = args.exe_callback or function (...) promptbox.exe_callback = args.exe_callback or function (...)
promptbox:spawn_and_handle_error(...) promptbox:spawn_and_handle_error(...)
end end
promptbox.with_shell = args.with_shell or false
promptbox.completion_callback = args.completion_callback or completion.shell promptbox.completion_callback = args.completion_callback or completion.shell
promptbox.history_path = args.history_path or promptbox.history_path = args.history_path or
gfs.get_cache_dir() .. 'history' gfs.get_cache_dir() .. 'history'

View File

@ -29,35 +29,35 @@ local function convert_gtk_color_to_hex(gtk_color)
convert_gtk_channel_to_hex(gtk_color.alpha) convert_gtk_channel_to_hex(gtk_color.alpha)
end end
local function lookup_gtk_color_to_hex(_style_context, color_name) local function lookup_gtk_color_to_hex(style_context, color_name)
local gtk_color = _style_context:lookup_color(color_name) local gtk_color = style_context:lookup_color(color_name)
if not gtk_color then if not gtk_color then
return nil return nil
end end
return convert_gtk_color_to_hex(gtk_color) return convert_gtk_color_to_hex(gtk_color)
end end
local function get_gtk_property(_style_context, property_name) local function get_gtk_property(style_context, property_name)
local state = _style_context:get_state() local state = style_context:get_state()
local property = _style_context:get_property(property_name, state) local property = style_context:get_property(property_name, state)
if not property then if not property then
return nil return nil
end end
return property.value return property.value
end end
local function get_gtk_color_property_to_hex(_style_context, property_name) local function get_gtk_color_property_to_hex(style_context, property_name)
return convert_gtk_color_to_hex( return convert_gtk_color_to_hex(
get_gtk_property(_style_context, property_name) get_gtk_property(style_context, property_name)
) )
end end
local function read_gtk_color_properties_from_widget(gtk_widget, properties) local function read_gtk_color_properties_from_widget(gtk_widget, properties)
local _style_context = gtk_widget:get_style_context() local style_context = gtk_widget:get_style_context()
local result = {} local result = {}
for result_key, style_context_property in pairs(properties) do for result_key, style_context_property in pairs(properties) do
result[result_key] = get_gtk_color_property_to_hex( result[result_key] = get_gtk_color_property_to_hex(
_style_context, style_context_property style_context, style_context_property
) )
end end
return result return result

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 4.9 KiB