Skip to content

Commit

Permalink
feat(widgets, config): implement new screen_layouts widget based on n…
Browse files Browse the repository at this point in the history
…ew `script_switcher` base and add it to the sidebar in the config
  • Loading branch information
actionless committed Dec 19, 2024
1 parent ee1b65d commit 76b7c03
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions actionless/widgets/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local widgets = {
backlight = require("actionless.widgets.backlight"),
script_switcher = require("actionless.widgets.script_switcher"),
pipewire_helper = require("actionless.widgets.pipewire_helper"),
screen_layouts = require("actionless.widgets.screen_layouts"),
}

return widgets
55 changes: 55 additions & 0 deletions actionless/widgets/screen_layouts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
--[[
Licensed under GNU General Public License v2
* (c) 2024, Yauheni Kirylau
--]]

--local awful = require("awful")

local script_switcher = require("actionless.widgets.script_switcher")
--local get_icon = require("actionless.util.xdg").get_icon


-- screen_layouts infos
local screen_layouts = {
}


function screen_layouts.init(widget_args)
local home = os.getenv("HOME")
widget_args = widget_args or {}
widget_args.name = widget_args.name or "screen_layouts"
widget_args.scripts = widget_args.scripts or {
{
cmd=home.."/.screenlayout/main_only.sh",
cmd_off="true",
title="Main Screen Only",
},
{
cmd=home.."/.screenlayout/two_screens_bottom_right.sh",
cmd_off="true",
title="2 screens: Main -> TouchScreen",
},
}
widget_args.extra_funcs = widget_args.extra_funcs or {
--{
-- "restuck",
-- function()
-- awful.spawn.with_shell(
-- "pw-metadata -n settings 0 clock.force-quantum 256"
-- .." ; pw-metadata -n settings 0 clock.force-quantum 1024"
-- )
-- end,
-- get_icon('actions', 'view-refresh')
--},
}
screen_layouts = script_switcher.init(widget_args)
return setmetatable(screen_layouts, { __index = screen_layouts.widget })
end

return setmetatable(
screen_layouts,
{ __call = function(_, ...)
return screen_layouts.init(...)
end
}
)
1 change: 1 addition & 0 deletions config/widgets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function widget_loader.init(awesome_context)
end

w.pipewire_helper = widgets.pipewire_helper({})
w.screen_layouts = widgets.screen_layouts({})

-- MEM
w.mem = widgets.mem({
Expand Down

0 comments on commit 76b7c03

Please sign in to comment.