Bring master more in line with Laptop
This commit is contained in:
		
							parent
							
								
									2b598d3efd
								
							
						
					
					
						commit
						82c30ed921
					
				|  | @ -208,6 +208,13 @@ keys.globalkeys = gears.table.join( | |||
|         {description = "-10%", group = "hotkeys"} | ||||
|     ), | ||||
| 
 | ||||
|     -- Brightness | ||||
|     awful.key({ }, "XF86MonBrightnessDown", function () | ||||
|         awful.util.spawn("xbacklight -dec 15") end), | ||||
| 
 | ||||
|     awful.key({ }, "XF86MonBrightnessUp", function () | ||||
|         awful.util.spawn("xbacklight -inc 15") end), | ||||
| 
 | ||||
|     -- ALSA volume control | ||||
|     awful.key({}, "XF86AudioRaiseVolume", | ||||
|        function() | ||||
|  | @ -245,6 +252,24 @@ keys.globalkeys = gears.table.join( | |||
|         end, | ||||
|         {description = "play/pause music", group = "hotkeys"} | ||||
|     ), | ||||
|     awful.key({modkey}, "XF86AudioMute", | ||||
|         function() | ||||
|             awful.spawn("playerctl play-pause", false) | ||||
|         end, | ||||
|         {description = "play/pause music", group = "hotkeys"} | ||||
|     ), | ||||
|     awful.key({modkey}, "XF86AudioRaiseVolume", | ||||
|        function() | ||||
|             awful.spawn("playerctl next", false) | ||||
|        end, | ||||
|        {description = "volume up", group = "hotkeys"} | ||||
|     ), | ||||
|     awful.key({modkey}, "XF86AudioLowerVolume", | ||||
|        function() | ||||
|             awful.spawn("playerctl previous", false) | ||||
|        end, | ||||
|        {description = "volume down", group = "hotkeys"} | ||||
|     ), | ||||
| 
 | ||||
|     -- Screenshot on prtscn using scrot | ||||
|     awful.key({}, "Print", | ||||
|  | @ -275,7 +300,7 @@ keys.globalkeys = gears.table.join( | |||
|     awful.key({}, "XF86PowerOff", | ||||
|         function() | ||||
|             -- emit signal to show the exit screen | ||||
|             awesome.emit_signal("show_exit_screen") | ||||
|             awful.util.spawn("rofi -show power-menu -modi power-menu:~/.config/awesome/scripts/rofi-power-menu") | ||||
|         end, | ||||
|         {description = "toggle exit screen", group = "hotkeys"} | ||||
|     ), | ||||
|  |  | |||
|  | @ -125,20 +125,25 @@ local function worker(user_args) | |||
|         local battery_info = {} | ||||
|         local capacities = {} | ||||
|         for s in stdout:gmatch("[^\r\n]+") do | ||||
|             -- Match a line with status and charge level | ||||
|             local status, charge_str, _ = string.match(s, '.+: ([%a%s]+), (%d?%d?%d)%%,?(.*)') | ||||
|             if status ~= nil then | ||||
|                 -- Enforce that for each entry in battery_info there is an | ||||
|                 -- entry in capacities of zero. If a battery has status | ||||
|                 -- "Unknown" then there is no capacity reported and we treat it | ||||
|                 -- as zero capactiy for later calculations. | ||||
|                 table.insert(battery_info, {status = status, charge = tonumber(charge_str)}) | ||||
|             else | ||||
|                 table.insert(capacities, 0) | ||||
|             end | ||||
| 
 | ||||
|             -- Match a line where capacity is reported | ||||
|             local cap_str = string.match(s, '.+:.+last full capacity (%d+)') | ||||
|                 table.insert(capacities, tonumber(cap_str)) | ||||
|             if cap_str ~= nil then | ||||
|                 capacities[#capacities] = tonumber(cap_str) or 0 | ||||
|             end | ||||
|         end | ||||
| 
 | ||||
|         local capacity = 0 | ||||
|         for _, cap in ipairs(capacities) do | ||||
|             capacity = capacity + cap | ||||
|         end | ||||
| 
 | ||||
|         local charge = 0 | ||||
|         local status | ||||
|         for i, batt in ipairs(battery_info) do | ||||
|  | @ -148,7 +153,11 @@ local function worker(user_args) | |||
|                     -- this is arbitrary, and maybe another metric should be used | ||||
|                 end | ||||
| 
 | ||||
|                 -- Adds up total (capacity-weighted) charge and total capacity. | ||||
|                 -- It effectively ignores batteries with status "Unknown" as we | ||||
|                 -- treat them with capacity zero. | ||||
|                 charge = charge + batt.charge * capacities[i] | ||||
|                 capacity = capacity + capacities[i] | ||||
|             end | ||||
|         end | ||||
|         charge = charge / capacity | ||||
|  |  | |||
|  | @ -59,12 +59,19 @@ local function list_update(w, buttons, label, data, objects) | |||
|     for _ in pairs(objects) do | ||||
|          count = count + 1 | ||||
|     end | ||||
|     local static_length = 16 * count | ||||
|     local total_text_length = 0 | ||||
|     for _, o in ipairs(objects) do | ||||
|         total_text_length = total_text_length + o.name:len() | ||||
|     end | ||||
|     local truncate = (total_text_length + static_length) > 170 | ||||
| 
 | ||||
|     for i, o in ipairs(objects) do | ||||
|         index = index + 1 | ||||
|         local ib, cb, tb, cbm, bgb, tbm, ibm, tt, l, ll | ||||
|         ib = wibox.widget.imagebox() | ||||
|         tb = wibox.widget.textbox() | ||||
|         cb = wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(9), dpi(9), dpi(9)) | ||||
|         cb = wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(0), dpi(9), dpi(9)) | ||||
|         cb.shape = gears.shape.circle | ||||
|         cbm = wibox.container.margin(cb, dpi(0), dpi(0), dpi(0), dpi(0)) -- 4, 8 ,12 ,12 -- close button | ||||
|         cbm:buttons(gears.table.join(awful.button({}, 1, nil, | ||||
|  | @ -114,10 +121,10 @@ local function list_update(w, buttons, label, data, objects) | |||
|         else | ||||
|              -- truncate when title is too long | ||||
|             local text_only = text:match('>(.*)<') | ||||
|             local max_length = math.floor(220 / count) | ||||
|             if (text_only:len() > max_length) then | ||||
|             local max_length = math.floor((155 - static_length) / count) | ||||
|             if (truncate and text_only:len() > max_length) then | ||||
|                 text = text:gsub('>(.*)<', '>' .. utf8.char(utf8.codepoint(text_only, 1, max_length)) .. '...<') | ||||
|                 tt:set_text(text_only) | ||||
|                 tt:set_text(text) | ||||
|                 tt:add_to_object(tb) | ||||
|             else | ||||
|                 tt:remove_from_object(tb) | ||||
|  | @ -138,10 +145,6 @@ local function list_update(w, buttons, label, data, objects) | |||
|                 ibm:set_margins(0) | ||||
|             end | ||||
| 
 | ||||
|         bgb.shape = args.shape | ||||
|         bgb.shape_border_width = args.shape_border_width | ||||
|         bgb.shape_border_color = args.shape_border_color | ||||
| 
 | ||||
|         w:add(bgb) | ||||
|     end | ||||
| end | ||||
|  |  | |||
|  | @ -167,7 +167,7 @@ local function worker(user_args) | |||
|     local widget_type = args.widget_type | ||||
|     local refresh_rate = args.refresh_rate or 1 | ||||
|     local step = args.step or 5 | ||||
|     local device = args.device or 'pulse' | ||||
|     local device = args.device or 'pipewire' | ||||
| 
 | ||||
|     if widget_types[widget_type] == nil then | ||||
|         volume.widget = widget_types['icon_and_text'].get_widget(args.icon_and_text_args) | ||||
|  |  | |||
|  | @ -1160,11 +1160,16 @@ function osc_init() | |||
| 
 | ||||
|     if (mp.get_property('video') == 'no') then -- dummy/forced window | ||||
|         user_opts.visibility = "always" | ||||
| <<<<<<< HEAD | ||||
|         user_opts.last_visibility = "always" | ||||
|         visibility_mode('always', true) | ||||
| ======= | ||||
| <<<<<<< HEAD | ||||
| ======= | ||||
|         user_opts.last_visibility = "always" | ||||
|         visibility_mode('always', true) | ||||
| >>>>>>> a21cfe5 (Fix OSC when playing audio) | ||||
| >>>>>>> master | ||||
|         scale = user_opts.scaleforcedwindow | ||||
|     elseif state.fullscreen then | ||||
|         scale = user_opts.scalefullscreen | ||||
|  | @ -1646,6 +1651,11 @@ function pause_state(name, enabled) | |||
|             visibility_mode('always', true) | ||||
|             show_osc() | ||||
|         else | ||||
| <<<<<<< HEAD | ||||
|             if (mp.get_property('video') ~= 'no') then | ||||
|                 visibility_mode(state.lastvisibility, true) | ||||
|             end | ||||
| ======= | ||||
| <<<<<<< HEAD | ||||
|             visibility_mode(state.lastvisibility, true) | ||||
| ======= | ||||
|  | @ -1653,6 +1663,7 @@ function pause_state(name, enabled) | |||
|                 visibility_mode(state.lastvisibility, true) | ||||
|             end | ||||
| >>>>>>> a21cfe5 (Fix OSC when playing audio) | ||||
| >>>>>>> master | ||||
|         end | ||||
|     end | ||||
|     request_tick() | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue