Dump nixos config after scrubing

This commit is contained in:
Mariano Uvalle 2025-05-03 23:42:03 -07:00
commit 5fa4c76c24
854 changed files with 30072 additions and 0 deletions

View file

@ -0,0 +1,42 @@
# Docker / Podman Widget
[![GitHub issues by-label](https://img.shields.io/github/issues-raw/streetturtle/awesome-wm-widgets/docker)](https://github.com/streetturtle/awesome-wm-widgets/labels/docker)
![Twitter URL](https://img.shields.io/twitter/url?url=https%3A%2F%2Fgithub.com%2Fstreetturtle%2Fawesome-wm-widgets%2Fedit%2Fmaster%2Fdocker-widget)
The widget allows to manage docker and podman containers, namely start/stop/pause/unpause:
<p align="center">
<img src="https://github.com/streetturtle/awesome-wm-widgets/raw/master/docker-widget/docker.gif"/>
</p>
## Customization
It is possible to customize widget by providing a table with all or some of the following config parameters:
| Name | Default | Description |
|---|---|---|
| `icon` | `./docker-widget/icons/docker.svg` | Path to the icon |
| `number_of_containers` | -1 | Number of last created containers to show |
| `executable_name` | `docker` | Name of the executable to use, defaults to `docker` |
| `max_widget_width` | 270 | Maximum width of the widget before the text breaks |
The `executable_name` allows you to use `Podman` instead of docker. This works since `Podman` is compatible to `docker` in the sense that the syntax and command outputs are identical.
## Installation
Clone the repo under **~/.config/awesome/** and add widget in **rc.lua**:
```lua
local docker_widget = require("awesome-wm-widgets.docker-widget.docker")
...
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
-- default
docker_widget(),
-- customized
docker_widget{
number_of_containers = 5
},
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 KiB

View file

@ -0,0 +1,403 @@
-------------------------------------------------
-- Docker Widget for Awesome Window Manager
-- Lists containers and allows to manage them
-- More details could be found here:
-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/docker-widget
-- @author Pavel Makhov
-- @copyright 2020 Pavel Makhov
-------------------------------------------------
local awful = require("awful")
local wibox = require("wibox")
local spawn = require("awful.spawn")
local naughty = require("naughty")
local gears = require("gears")
local beautiful = require("beautiful")
local HOME_DIR = os.getenv("HOME")
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/docker-widget'
local ICONS_DIR = WIDGET_DIR .. '/icons/'
local LIST_CONTAINERS_CMD = [[bash -c "%s container ls -a -s -n %s]]
.. [[ --format '{{.Names}}::{{.ID}}::{{.Image}}::{{.Status}}::{{.Size}}'"]]
local DOCKER_DEFAULT_STATUS_PATTERN = '(.*)::(.*)::(.*)::(%w*) (.*)::(.*)'
local DOCKER_CREATED_STATUS_PATTERN = '(.*)::(.*)::(.*)::Created::(.*)'
--- Utility function to show warning messages
local function show_warning(message)
naughty.notify{
preset = naughty.config.presets.critical,
title = 'Docker Widget',
text = message}
end
local popup = awful.popup{
ontop = true,
visible = false,
shape = gears.shape.rounded_rect,
border_width = 1,
border_color = beautiful.bg_focus,
maximum_width = 400,
offset = { y = 5 },
widget = {}
}
local docker_widget = wibox.widget {
{
{
id = 'icon',
widget = wibox.widget.imagebox
},
margins = 4,
layout = wibox.container.margin
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end,
widget = wibox.container.background,
set_icon = function(self, new_icon)
self:get_children_by_id("icon")[1].image = new_icon
end
}
local parse_container = function(line)
local name, id, image, status, how_long, size, actual_status
if string.find(line, '::Created::') then
name, id, image, size = line:match(DOCKER_CREATED_STATUS_PATTERN)
actual_status = 'Created'
how_long = 'Never started'
else
name, id, image, status, how_long, size = line:match(DOCKER_DEFAULT_STATUS_PATTERN)
if status == 'Up' and how_long:find('Paused') then actual_status = 'Paused'
else actual_status = status end
end
how_long = how_long:gsub('%s?%(.*%)%s?', '')
local container = {
name = name,
id = id,
image = image,
status = actual_status,
how_long = how_long,
size = size,
is_up = function() return status == 'Up' end,
is_paused = function() return actual_status:find('Paused') end,
is_exited = function() return status == 'Exited' end,
is_created = function() return status == 'Created' end
}
return container
end
local status_to_icon_name = {
Up = ICONS_DIR .. 'play.svg',
Created = ICONS_DIR .. 'square.svg',
Exited = ICONS_DIR .. 'square.svg',
Paused = ICONS_DIR .. 'pause.svg'
}
local function worker(user_args)
local args = user_args or {}
local icon = args.icon or ICONS_DIR .. 'docker.svg'
local number_of_containers = args.number_of_containers or -1
local executable_name = args.executable_name or 'docker'
-- 180 is the default width of the container details part of the widget and
-- 90 is the default width of the control buttons
local max_widget_width = args.max_widget_width or 180 + 90
docker_widget:set_icon(icon)
local rows = {
{ widget = wibox.widget.textbox },
layout = wibox.layout.fixed.vertical,
}
local function rebuild_widget(containers, errors, _, _)
if errors ~= '' then
show_warning(errors)
return
end
for i = 0, #rows do rows[i]=nil end
for line in containers:gmatch("[^\r\n]+") do
local container = parse_container(line)
local status_icon = wibox.widget {
image = status_to_icon_name[container['status']],
resize = false,
widget = wibox.widget.imagebox
}
local start_stop_button
if container.is_up() or container.is_exited() or container.is_created() then
start_stop_button = wibox.widget {
{
{
id = 'icon',
image = ICONS_DIR .. (container:is_exited() and 'play-btn.svg' or 'stop-btn.svg'),
opacity = 0.4,
resize = false,
widget = wibox.widget.imagebox
},
left = 2,
right = 2,
layout = wibox.container.margin
},
shape = gears.shape.circle,
bg = '#00000000',
widget = wibox.container.background
}
local old_cursor, old_wibox
start_stop_button:connect_signal("mouse::enter", function(c)
c:set_bg('#3B4252')
local wb = mouse.current_wibox
old_cursor, old_wibox = wb.cursor, wb
wb.cursor = "hand1"
c:get_children_by_id("icon")[1]:set_opacity(1)
c:get_children_by_id("icon")[1]:emit_signal('widget::redraw_needed') end)
start_stop_button:connect_signal("mouse::leave", function(c)
c:set_bg('#00000000')
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
c:get_children_by_id("icon")[1]:set_opacity(0.4)
c:get_children_by_id("icon")[1]:emit_signal('widget::redraw_needed')
end)
start_stop_button:buttons(
gears.table.join( awful.button({}, 1, function()
local command
if container:is_exited() then command = 'start' else command = 'stop' end
status_icon:set_opacity(0.2)
status_icon:emit_signal('widget::redraw_needed')
spawn.easy_async(executable_name .. ' ' .. command .. ' ' .. container['name'],
function(_, stderr)
if stderr ~= '' then show_warning(stderr) end
spawn.easy_async(
string.format(LIST_CONTAINERS_CMD,executable_name, number_of_containers),
function(stdout, container_errors)
rebuild_widget(stdout, container_errors)
end
)
end
)
end) )
)
else
start_stop_button = nil
end
local pause_unpause_button
if container.is_up() then
pause_unpause_button = wibox.widget {
{
{
id = 'icon',
image = ICONS_DIR .. (container:is_paused() and 'unpause-btn.svg' or 'pause-btn.svg'),
opacity = 0.4,
resize = false,
widget = wibox.widget.imagebox
},
left = 2,
right = 2,
layout = wibox.container.margin
},
shape = gears.shape.circle,
bg = '#00000000',
widget = wibox.container.background
}
local old_cursor, old_wibox
pause_unpause_button:connect_signal("mouse::enter", function(c)
c:set_bg('#3B4252')
local wb = mouse.current_wibox
old_cursor, old_wibox = wb.cursor, wb
wb.cursor = "hand1"
c:get_children_by_id("icon")[1]:set_opacity(1)
c:get_children_by_id("icon")[1]:emit_signal('widget::redraw_needed')
end)
pause_unpause_button:connect_signal("mouse::leave", function(c)
c:set_bg('#00000000')
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
c:get_children_by_id("icon")[1]:set_opacity(0.4)
c:get_children_by_id("icon")[1]:emit_signal('widget::redraw_needed')
end)
pause_unpause_button:buttons(
gears.table.join( awful.button({}, 1, function()
local command
if container:is_paused() then command = 'unpause' else command = 'pause' end
status_icon:set_opacity(0.2)
status_icon:emit_signal('widget::redraw_needed')
awful.spawn.easy_async(executable_name .. ' ' .. command .. ' ' .. container['name'],
function(_, stderr)
if stderr ~= '' then show_warning(stderr) end
spawn.easy_async(string.format(LIST_CONTAINERS_CMD,
executable_name, number_of_containers),
function(stdout, container_errors)
rebuild_widget(stdout, container_errors)
end)
end)
end) ) )
else
pause_unpause_button = nil
end
local delete_button
if not container.is_up() then
delete_button = wibox.widget {
{
{
id = 'icon',
image = ICONS_DIR .. 'trash-btn.svg',
opacity = 0.4,
resize = false,
widget = wibox.widget.imagebox
},
margins = 4,
layout = wibox.container.margin
},
shape = gears.shape.circle,
bg = '#00000000',
widget = wibox.container.background
}
delete_button:buttons(
gears.table.join( awful.button({}, 1, function()
awful.spawn.easy_async(executable_name .. ' rm ' .. container['name'],
function(_, rm_stderr)
if rm_stderr ~= '' then show_warning(rm_stderr) end
spawn.easy_async(string.format(LIST_CONTAINERS_CMD,
executable_name, number_of_containers),
function(lc_stdout, lc_stderr)
rebuild_widget(lc_stdout, lc_stderr)
end)
end)
end)))
local old_cursor, old_wibox
delete_button:connect_signal("mouse::enter", function(c)
c:set_bg('#3B4252')
local wb = mouse.current_wibox
old_cursor, old_wibox = wb.cursor, wb
wb.cursor = "hand1"
c:get_children_by_id("icon")[1]:set_opacity(1)
c:get_children_by_id("icon")[1]:emit_signal('widget::redraw_needed')
end)
delete_button:connect_signal("mouse::leave", function(c)
c:set_bg('#00000000')
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
c:get_children_by_id("icon")[1]:set_opacity(0.4)
c:get_children_by_id("icon")[1]:emit_signal('widget::redraw_needed')
end)
else
delete_button = nil
end
local row = wibox.widget {
{
{
{
{
status_icon,
margins = 8,
layout = wibox.container.margin
},
valign = 'center',
layout = wibox.container.place
},
{
{
{
markup = '<b>' .. container['name'] .. '</b>',
widget = wibox.widget.textbox
},
{
text = container['size'],
widget = wibox.widget.textbox
},
{
text = container['how_long'],
widget = wibox.widget.textbox
},
-- 90 is the reserved width of the control buttons
forced_width = max_widget_width - 90,
layout = wibox.layout.fixed.vertical
},
valign = 'center',
layout = wibox.container.place
},
{
{
start_stop_button,
pause_unpause_button,
delete_button,
layout = wibox.layout.align.horizontal
},
forced_width = 90,
valign = 'center',
haligh = 'center',
layout = wibox.container.place,
},
spacing = 8,
layout = wibox.layout.align.horizontal
},
margins = 8,
layout = wibox.container.margin
},
bg = beautiful.bg_normal,
widget = wibox.container.background
}
row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end)
row:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end)
table.insert(rows, row)
end
popup:setup(rows)
end
docker_widget:buttons(
gears.table.join(
awful.button({}, 1, function()
if popup.visible then
docker_widget:set_bg('#00000000')
popup.visible = not popup.visible
else
docker_widget:set_bg(beautiful.bg_focus)
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, executable_name, number_of_containers),
function(stdout, stderr)
rebuild_widget(stdout, stderr)
popup:move_next_to(mouse.current_widget_geometry)
end)
end
end)
)
)
return docker_widget
end
return setmetatable(docker_widget, { __call = function(_, ...) return worker(...) end })

View file

@ -0,0 +1 @@
<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>Docker icon</title><path fill="#D8DEE9" d="M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,10 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M11 7H8V17H11V7Z" fill="#D8DEE9" />
<path d="M13 17H16V7H13V17Z" fill="#D8DEE9" />
</svg>

After

Width:  |  Height:  |  Size: 209 B

View file

@ -0,0 +1,16 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M9 9H11V15H9V9Z" fill="#EBCB8B" />
<path d="M15 15H13V9H15V15Z" fill="#EBCB8B" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12ZM21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
fill="#EBCB8B"
/>
</svg>

After

Width:  |  Height:  |  Size: 523 B

View file

@ -0,0 +1,9 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M9 17L17 12L9 7V17Z" fill="#D8DEE9" />
</svg>

After

Width:  |  Height:  |  Size: 163 B

View file

@ -0,0 +1,9 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M15 12.3301L9 16.6603L9 8L15 12.3301Z" fill="#D8DEE9" />
</svg>

After

Width:  |  Height:  |  Size: 181 B

View file

@ -0,0 +1,15 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23Z"
fill="#A3BE8C"
/>
<path d="M16 12L10 16.3301V7.66987L16 12Z" fill="#A3BE8C" />
</svg>

After

Width:  |  Height:  |  Size: 491 B

View file

@ -0,0 +1,15 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M15 9H9V15H15V9Z" fill="#BF616A" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12ZM21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
fill="#BF616A"
/>
</svg>

After

Width:  |  Height:  |  Size: 475 B

View file

@ -0,0 +1,10 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M7 7H17V17H7V7Z" fill="#D8DEE9" />
</svg>

After

Width:  |  Height:  |  Size: 161 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#BF616A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>

After

Width:  |  Height:  |  Size: 443 B

View file

@ -0,0 +1,10 @@
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M6 17L14 12L6 7V17Z" fill="#D8DEE9" />
<path d="M18 7H15V12V17H18V7Z" fill="#D8DEE9" />
</svg>

After

Width:  |  Height:  |  Size: 214 B