a lot of stuff

This commit is contained in:
2022-12-11 17:30:18 +01:00
parent 42a888c311
commit d45e2496b1
89 changed files with 1067 additions and 1424 deletions

View File

@@ -0,0 +1,93 @@
Copyright 2011 The Comfortaa Project Authors (https://github.com/alexeiva/comfortaa), with Reserved Font Name "Comfortaa".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -0,0 +1,67 @@
Comfortaa Variable Font
=======================
This download contains Comfortaa as both a variable font and static fonts.
Comfortaa is a variable font with this axis:
wght
This means all the styles are contained in a single file:
Comfortaa-VariableFont_wght.ttf
If your app fully supports variable fonts, you can now pick intermediate styles
that arent available as static fonts. Not all apps support variable fonts, and
in those cases you can use the static font files for Comfortaa:
static/Comfortaa-Light.ttf
static/Comfortaa-Regular.ttf
static/Comfortaa-Medium.ttf
static/Comfortaa-SemiBold.ttf
static/Comfortaa-Bold.ttf
Get started
-----------
1. Install the font files you want to use
2. Use your app's font picker to view the font family and all the
available styles
Learn more about variable fonts
-------------------------------
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
https://variablefonts.typenetwork.com
https://medium.com/variable-fonts
In desktop apps
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
Online
https://developers.google.com/fonts/docs/getting_started
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
Installing fonts
MacOS: https://support.apple.com/en-us/HT201749
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
Android Apps
https://developers.google.com/fonts/docs/android
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
License
-------
Please read the full license text (OFL.txt) to understand the permissions,
restrictions and requirements for usage, redistribution, and modification.
You can use them in your products & projects print or digital,
commercial or otherwise.
This isn't legal advice, please consider consulting a lawyer and see the full
license for all details.

View File

@@ -0,0 +1,93 @@
Copyright 2010 The Raleway Project Authors (impallari@gmail.com), with Reserved Font Name "Raleway".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -0,0 +1,81 @@
Raleway Variable Font
=====================
This download contains Raleway as both variable fonts and static fonts.
Raleway is a variable font with this axis:
wght
This means all the styles are contained in these files:
Raleway-VariableFont_wght.ttf
Raleway-Italic-VariableFont_wght.ttf
If your app fully supports variable fonts, you can now pick intermediate styles
that arent available as static fonts. Not all apps support variable fonts, and
in those cases you can use the static font files for Raleway:
static/Raleway-Thin.ttf
static/Raleway-ExtraLight.ttf
static/Raleway-Light.ttf
static/Raleway-Regular.ttf
static/Raleway-Medium.ttf
static/Raleway-SemiBold.ttf
static/Raleway-Bold.ttf
static/Raleway-ExtraBold.ttf
static/Raleway-Black.ttf
static/Raleway-ThinItalic.ttf
static/Raleway-ExtraLightItalic.ttf
static/Raleway-LightItalic.ttf
static/Raleway-Italic.ttf
static/Raleway-MediumItalic.ttf
static/Raleway-SemiBoldItalic.ttf
static/Raleway-BoldItalic.ttf
static/Raleway-ExtraBoldItalic.ttf
static/Raleway-BlackItalic.ttf
Get started
-----------
1. Install the font files you want to use
2. Use your app's font picker to view the font family and all the
available styles
Learn more about variable fonts
-------------------------------
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
https://variablefonts.typenetwork.com
https://medium.com/variable-fonts
In desktop apps
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
Online
https://developers.google.com/fonts/docs/getting_started
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
Installing fonts
MacOS: https://support.apple.com/en-us/HT201749
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
Android Apps
https://developers.google.com/fonts/docs/android
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
License
-------
Please read the full license text (OFL.txt) to understand the permissions,
restrictions and requirements for usage, redistribution, and modification.
You can use them in your products & projects print or digital,
commercial or otherwise.
This isn't legal advice, please consider consulting a lawyer and see the full
license for all details.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="#212121" d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" />
</svg>

After

Width:  |  Height:  |  Size: 243 B

View File

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#00000000">
<path d="M0 0h24v24H0z" />
<path fill="#ef9a9a" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
</svg>

After

Width:  |  Height:  |  Size: 273 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="#F0F0F0" d="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" />
</svg>

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="#F0F0F0" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" />
</svg>

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

After

Width:  |  Height:  |  Size: 305 KiB

View File

@@ -7,9 +7,6 @@ local ruled = require("ruled")
-- Third party libs
local json = require("src.lib.json-lua.json-lua")
-- Own libs
local backlight_helper = require("src.tools.helpers.backlight")
local capi = {
awesome = awesome,
mousegrabber = mousegrabber,

View File

@@ -8,7 +8,6 @@ local gears = require("gears")
local menubar = require('menubar')
local naughty = require("naughty")
local wibox = require("wibox")
local wtemplate = require("wibox.template")
local rubato = require("src.lib.rubato")
@@ -32,153 +31,149 @@ naughty.config.defaults.spacing = Theme_config.notification.spacing
Theme.notification_spacing = Theme_config.notification.corner_spacing
naughty.connect_signal(
'request::icon',
function(n, context, hints)
if context ~= 'app_icon' then
return
end
local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower())
if path then
n.icon = path
end
naughty.connect_signal('request::icon', function(n, context, hints)
if context ~= 'app_icon' then
return
end
)
local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower())
if path then
n.icon = path
end
end)
naughty.connect_signal(
"request::display",
function(n)
if User_config.dnd then
n:destroy()
naughty.connect_signal("request::display", function(n)
if User_config.dnd then
n:destroy()
else
if n.urgency == "critical" then
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
Theme_config.notification.fg_urgent_title, n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_urgent_message,
n.message) or ""
n.app_name = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_urgent_app_name,
n.app_name) or ""
n.bg = Theme_config.notification.bg_urgent
else
if n.urgency == "critical" then
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
Theme_config.notification.fg_urgent_title, n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_urgent_message,
n.message) or ""
n.app_name = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_urgent_app_name,
n.app_name) or ""
n.bg = Theme_config.notification.bg_urgent
else
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
Theme_config.notification.fg_normal_title, n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_normal_message,
n.message) or ""
n.bg = Theme_config.notification.bg_normal
n.timeout = n.timeout or Theme_config.notification.timeout or 3
end
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
Theme_config.notification.fg_normal_title, n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_normal_message,
n.message) or ""
n.bg = Theme_config.notification.bg_normal
n.timeout = n.timeout or Theme_config.notification.timeout or 3
end
local use_image = false
local use_image = false
if n.app_name == "Spotify" then
n.actions = {
naughty.action {
program = "Spotify",
id = "skip-prev",
icon = gears.color.recolor_image(icondir .. "skip-prev.svg",
Theme_config.notification.spotify_button_icon_color)
}, naughty.action {
program = "Spotify",
id = "play-pause",
icon = gears.color.recolor_image(icondir .. "play-pause.svg",
Theme_config.notification.spotify_button_icon_color)
}, naughty.action {
program = "Spotify",
id = "skip-next",
icon = gears.color.recolor_image(icondir .. "skip-next.svg",
Theme_config.notification.spotify_button_icon_color)
}
if n.app_name == "Spotify" then
n.actions = {
naughty.action {
program = "Spotify",
id = "skip-prev",
icon = gears.color.recolor_image(icondir .. "skip-prev.svg",
Theme_config.notification.spotify_button_icon_color)
}, naughty.action {
program = "Spotify",
id = "play-pause",
icon = gears.color.recolor_image(icondir .. "play-pause.svg",
Theme_config.notification.spotify_button_icon_color)
}, naughty.action {
program = "Spotify",
id = "skip-next",
icon = gears.color.recolor_image(icondir .. "skip-next.svg",
Theme_config.notification.spotify_button_icon_color)
}
use_image = true
end
}
use_image = true
end
local action_template_widget
local action_template_widget
if use_image then
action_template_widget = wibox.template {
if use_image then
action_template_widget = wibox.template {
{
{
{
{
{
id = "icon_role",
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
id = "centered",
id = "icon_role",
valign = "center",
halign = "center",
widget = wibox.container.place
widget = wibox.widget.imagebox
},
margins = dpi(5),
widget = wibox.container.margin
id = "centered",
valign = "center",
halign = "center",
widget = wibox.container.place
},
forced_height = dpi(35),
forced_width = dpi(35),
bg = Theme_config.notification.action_bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
margins = dpi(5),
widget = wibox.container.margin
},
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin
}
else
action_template_widget = wibox.template {
forced_height = dpi(35),
forced_width = dpi(35),
bg = Theme_config.notification.action_bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
},
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin
}
else
action_template_widget = wibox.template {
{
{
{
{
{
id = "text_role",
font = "JetBrainsMono Nerd Font, Regular 12",
widget = wibox.widget.textbox
},
id = "centered",
widget = wibox.container.place
id = "text_role",
font = "JetBrainsMono Nerd Font, Regular 12",
widget = wibox.widget.textbox
},
margins = dpi(5),
widget = wibox.container.margin
id = "centered",
widget = wibox.container.place
},
fg = Theme_config.notification.action_fg,
bg = Theme_config.notification.action_bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
margins = dpi(5),
widget = wibox.container.margin
},
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin
}
end
local actions_template = wibox.widget {
notification = n,
base_layout = wibox.widget {
spacing = dpi(40),
layout = wibox.layout.fixed.horizontal
fg = Theme_config.notification.action_fg,
bg = Theme_config.notification.action_bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
},
widget_template = action_template_widget,
style = {
underline_normal = false,
underline_selected = true
},
widget = naughty.list.actions
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin
}
end
local arc_start = n.timeout
if n.timeout == 0 then
arc_start = 10
end
local actions_template = wibox.widget {
notification = n,
base_layout = wibox.widget {
spacing = dpi(40),
layout = wibox.layout.fixed.horizontal
},
widget_template = action_template_widget,
style = {
underline_normal = false,
underline_selected = true
},
widget = naughty.list.actions
}
local w_template = wibox.template {
widget = wibox.widget {
local arc_start = n.timeout
if n.timeout == 0 then
arc_start = 10
end
local w_template = wibox.template {
widget = wibox.widget {
{
{
{
{
@@ -188,241 +183,239 @@ naughty.connect_signal(
{
{
{
{
image = gears.color.recolor_image(icondir .. "notification-outline.svg",
Theme_config.notification.icon_color),
resize = false,
valign = "center",
halign = "center",
widget = wibox.widget.imagebox
},
right = dpi(5),
widget = wibox.container.margin
},
{
markup = n.app_name or 'System Notification',
align = "center",
image = gears.color.recolor_image(icondir .. "notification-outline.svg",
Theme_config.notification.icon_color),
resize = false,
valign = "center",
widget = wibox.widget.textbox
halign = "center",
widget = wibox.widget.imagebox
},
layout = wibox.layout.fixed.horizontal
right = dpi(5),
widget = wibox.container.margin
},
fg = Theme_config.notification.fg_appname,
widget = wibox.container.background
},
margins = dpi(10),
widget = wibox.container.margin
},
nil,
{
{
{
text = os.date("%H:%M"),
markup = n.app_name or 'System Notification',
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "background",
fg = Theme_config.notification.fg_time,
widget = wibox.container.background
layout = wibox.layout.fixed.horizontal
},
fg = Theme_config.notification.fg_appname,
widget = wibox.container.background
},
margins = dpi(10),
widget = wibox.container.margin
},
nil,
{
{
{
text = os.date("%H:%M"),
widget = wibox.widget.textbox
},
id = "background",
fg = Theme_config.notification.fg_time,
widget = wibox.container.background
},
{
{
{
{
{
{
font = User_config.font.specify .. ", 10",
text = "",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
start_angle = 4.71239,
thickness = dpi(2),
min_value = 0,
max_value = arc_start,
value = arc_start,
widget = wibox.container.arcchart,
id = "arc_chart"
font = User_config.font.specify .. ", 10",
text = "",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "background1",
fg = Theme_config.notification.fg_close,
bg = Theme_config.notification.bg_close,
widget = wibox.container.background
start_angle = 4.71239,
thickness = dpi(2),
min_value = 0,
max_value = arc_start,
value = arc_start,
widget = wibox.container.arcchart,
id = "arc_chart"
},
strategy = "exact",
width = dpi(20),
height = dpi(20),
widget = wibox.container.constraint,
id = "const1"
id = "background1",
fg = Theme_config.notification.fg_close,
bg = Theme_config.notification.bg_close,
widget = wibox.container.background
},
margins = dpi(10),
widget = wibox.container.margin,
id = "arc_margin"
strategy = "exact",
width = dpi(20),
height = dpi(20),
widget = wibox.container.constraint,
id = "const1"
},
layout = wibox.layout.fixed.horizontal,
id = "arc_app_layout_2"
margins = dpi(10),
widget = wibox.container.margin,
id = "arc_margin"
},
id = "arc_app_layout",
layout = wibox.layout.align.horizontal
layout = wibox.layout.fixed.horizontal,
id = "arc_app_layout_2"
},
id = "arc_app_bg",
border_color = Theme_config.notification.title_border_color,
border_width = Theme_config.notification.title_border_width,
widget = wibox.container.background
id = "arc_app_layout",
layout = wibox.layout.align.horizontal
},
id = "arc_app_bg",
border_color = Theme_config.notification.title_border_color,
border_width = Theme_config.notification.title_border_width,
widget = wibox.container.background
},
{
{
{
{
{
{
image = n.icon,
resize = true,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end
},
width = naughty.config.defaults.icon_size,
height = naughty.config.defaults.icon_size,
strategy = "exact",
widget = wibox.container.constraint
image = n.icon,
resize = true,
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end
},
halign = "center",
valign = "top",
widget = wibox.container.place
width = naughty.config.defaults.icon_size,
height = naughty.config.defaults.icon_size,
strategy = "exact",
widget = wibox.container.constraint
},
left = dpi(20),
bottom = dpi(15),
top = dpi(15),
right = dpi(10),
widget = wibox.container.margin
halign = "center",
valign = "top",
widget = wibox.container.place
},
left = dpi(20),
bottom = dpi(15),
top = dpi(15),
right = dpi(10),
widget = wibox.container.margin
},
{
{
{
{
widget = naughty.widget.title,
align = "left"
},
{
widget = naughty.widget.message,
align = "left"
},
{
actions_template,
widget = wibox.container.place
},
layout = wibox.layout.fixed.vertical
widget = naughty.widget.title,
align = "left"
},
left = dpi(10),
bottom = dpi(10),
top = dpi(10),
right = dpi(20),
widget = wibox.container.margin
{
widget = naughty.widget.message,
align = "left"
},
{
actions_template,
widget = wibox.container.place
},
layout = wibox.layout.fixed.vertical
},
layout = wibox.layout.fixed.horizontal
left = dpi(10),
bottom = dpi(10),
top = dpi(10),
right = dpi(20),
widget = wibox.container.margin
},
id = "widget_layout",
layout = wibox.layout.fixed.vertical
layout = wibox.layout.fixed.horizontal
},
id = "min_size",
strategy = "min",
width = dpi(100),
widget = wibox.container.constraint
id = "widget_layout",
layout = wibox.layout.fixed.vertical
},
id = "max_size",
strategy = "max",
width = Theme.notification_max_width or dpi(500),
id = "min_size",
strategy = "min",
width = dpi(100),
widget = wibox.container.constraint
},
id = "background",
bg = Theme_config.notification.bg,
border_color = Theme_config.notification.border_color,
border_width = Theme_config.notification.border_width,
shape = Theme_config.notification.shape_inside,
widget = wibox.container.background
id = "max_size",
strategy = "max",
width = Theme.notification_max_width or dpi(500),
widget = wibox.container.constraint
},
update_callback = function()
id = "background",
bg = Theme_config.notification.bg,
border_color = Theme_config.notification.border_color,
border_width = Theme_config.notification.border_width,
shape = Theme_config.notification.shape_inside,
widget = wibox.container.background
},
update_callback = function()
end
}
local close = w_template:get_widget().max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin
.const1.background1
local arc = close.arc_chart
local timeout = n.timeout
if timeout ~= 0 then
local rubato_timer = rubato.timed {
duration = n.timeout,
pos = n.timeout,
easing = rubato.linear,
subscribed = function(value)
arc.value = value
end
}
rubato_timer.target = 0
w_template:get_widget():connect_signal(
"mouse::enter",
function()
n.timeout = 99999
rubato_timer.pause = true
end
)
w_template:get_widget():connect_signal(
"mouse::leave",
function()
n.timeout = rubato_timer.pos
rubato_timer.pause = false
rubato_timer.target = 0
end
)
end
}
local close = w_template:get_widget().max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin
.const1.background1
local arc = close.arc_chart
Hover_signal(close)
local timeout = n.timeout
close:connect_signal("button::press", function()
n:destroy()
end)
if timeout ~= 0 then
w_template:get_widget():connect_signal("button::press", function(_, _, _, key)
if key == 3 then
n:destroy()
local rubato_timer = rubato.timed {
duration = n.timeout,
pos = n.timeout,
easing = rubato.linear,
subscribed = function(value)
arc.value = value
end
-- Raise the client on click
if key == 1 then
for _, client in ipairs(capi.client.get()) do
if client.name:match(n.app_name) then
if not client:isvisible() and client.first_tag then
client.first_tag:view_only()
end
client:emit_signal('request::activate')
client:raise()
end
end
end
end)
local box = naughty.layout.box {
notification = n,
timeout = 5,
type = "notification",
screen = capi.screen.primary,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
widget_template = w_template
}
box.buttons = {}
n.buttons = {}
rubato_timer.target = 0
w_template:get_widget():connect_signal(
"mouse::enter",
function()
n.timeout = 99999
rubato_timer.pause = true
end
)
w_template:get_widget():connect_signal(
"mouse::leave",
function()
n.timeout = rubato_timer.pos
rubato_timer.pause = false
rubato_timer.target = 0
end
)
end
Hover_signal(close)
close:connect_signal("button::press", function()
n:destroy()
end)
w_template:get_widget():connect_signal("button::press", function(_, _, _, key)
if key == 3 then
n:destroy()
end
-- Raise the client on click
if key == 1 then
for _, client in ipairs(capi.client.get()) do
if client.name:match(n.app_name) then
if not client:isvisible() and client.first_tag then
client.first_tag:view_only()
end
client:emit_signal('request::activate')
client:raise()
end
end
end
end)
local box = naughty.layout.box {
notification = n,
timeout = 5,
type = "notification",
screen = capi.screen.primary,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
widget_template = w_template
}
box.buttons = {}
n.buttons = {}
end
)
end)
naughty.connect_signal(
"destroyed",

View File

@@ -14,85 +14,61 @@ local capi = {
tag = tag
}
capi.screen.connect_signal(
"added",
function()
capi.awesome.restart()
end
)
capi.screen.connect_signal("added", function()
capi.awesome.restart()
end)
capi.screen.connect_signal(
"removed",
function()
capi.awesome.restart()
end
)
capi.screen.connect_signal("removed", function()
capi.awesome.restart()
end)
capi.client.connect_signal(
"manage",
function(c)
if capi.awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then
awful.placement.no_offscreen(c)
end
if c.class == "Brave-browser" then
c.floating = false
end
if c.transient_for then
c.floating = true
end
if c.fullscreen then
gears.timer.delayed_call(function()
if c.valid then
c:geometry(c.screen.geometry)
end
end)
end
capi.client.connect_signal("manage", function(c)
if capi.awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then
awful.placement.no_offscreen(c)
end
)
if c.class == "Brave-browser" then
c.floating = false
end
if c.transient_for then
c.floating = true
end
if c.fullscreen then
gears.timer.delayed_call(function()
if c.valid then
c:geometry(c.screen.geometry)
end
end)
end
end)
capi.client.connect_signal(
'unmanage',
function(c)
if #awful.screen.focused().clients > 0 then
awful.screen.focused().clients[1]:emit_signal(
'request::activate',
'mouse_enter',
{
raise = true
}
)
end
capi.client.connect_signal('unmanage', function(c)
if #awful.screen.focused().clients > 0 then
awful.screen.focused().clients[1]:emit_signal(
'request::activate',
'mouse_enter', {
raise = true
})
end
)
end)
capi.tag.connect_signal(
'property::selected',
function(c)
if #awful.screen.focused().clients > 0 then
awful.screen.focused().clients[1]:emit_signal(
'request::activate',
'mouse_enter',
{
raise = true
}
)
end
capi.tag.connect_signal('property::selected', function(c)
if #awful.screen.focused().clients > 0 then
awful.screen.focused().clients[1]:emit_signal(
'request::activate',
'mouse_enter', {
raise = true
})
end
)
end)
-- Sloppy focus
--[[ client.connect_signal(
"mouse::enter",
function(c)
c:emit_signal(
"request::activate",
"mouse_enter",
{
raise = true
}
)
end
) ]]
--[[ client.connect_signal("mouse::enter", function(c)
c:emit_signal(
"request::activate",
"mouse_enter",{
raise = true
})
end) ]]
--- Takes a wibox.container.background and connects four signals to it
---@param widget wibox.container.background a background widget

View File

@@ -18,8 +18,6 @@ local gshape = require('gears.shape')
local gobject = require('gears.object')
local mousegrabber = mousegrabber
local rubato = require("src.lib.rubato")
local overflow = { mt = {} }
-- Determine the required space to draw the layout's children and, if necessary,
@@ -275,7 +273,7 @@ end
--- Scroll the layout's content by `amount * step`.
--
-- A positive amount scroll down/right, a negative amount scrolls up/left.
-- A positive amount scrolls down/right, a negative amount scrolls up/left.
--
-- The amount of units scrolled is affected by `step`.
--
@@ -307,9 +305,6 @@ end
-- @tparam number scroll_factor The scroll factor.
-- @propemits true false
overflow.rubato_timed = rubato.timed { duration = 0.2 }
local first_call = true
function overflow:set_scroll_factor(factor)
local current = self._private.scroll_factor
local interval = self._private.used_in_dir - self._private.avail_in_dir
@@ -323,22 +318,10 @@ function overflow:set_scroll_factor(factor)
return
end
self._private.scroll_factor = math.min(1, math.max(factor, 0))
local function update_scroll()
self._private.scroll_factor = self.rubato_timed.pos
self:emit_signal("widget::layout_changed")
self:emit_signal("property::scroll_factor", factor)
end
-- Make sure it only subscribes once
if first_call then
self.rubato_timed:subscribe(update_scroll)
--first_call = false
end
-- Set the target to the new target + remaining target from last scroll. This makes it scroll faster and correctly.
self.rubato_timed.target = math.min(1,
math.max(factor + (self.rubato_timed.target - self.rubato_timed.pos), 0))
self:emit_signal("widget::layout_changed")
self:emit_signal("property::scroll_factor", factor)
end
function overflow:get_scroll_factor()
@@ -486,6 +469,19 @@ function overflow:get_scrollbar_widget()
return self._private.scrollbar_widget
end
function overflow:reset()
self._private.widgets = {}
self._private.scroll_factor = 0
local scrollbar_widget = separator({ shape = gshape.rectangle })
apply_scrollbar_mouse_signal(self, scrollbar_widget)
self._private.scrollbar_widget = scrollbar_widget
self:emit_signal("widget::layout_changed")
self:emit_signal("widget::reset")
self:emit_signal("widget::reseted")
end
local function new(dir, ...)
local ret = fixed[dir](...)
@@ -538,7 +534,7 @@ end
-- widgets exceeds the height available whithin the layout's outer container
-- a scrollbar will be added and scrolling behavior enabled.
-- @tparam widget ... Widgets that should be added to the layout.
-- @constructorfct wibox.layout.overflow.horizontal
-- @constructorfct wibox.layout.overflow.vertical
function overflow.vertical(...)
return new("vertical", ...)
end

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function(s, w)

View File

@@ -4,7 +4,6 @@
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
return function(s, w)
@@ -56,6 +55,7 @@ return function(s, w)
bg = Theme_config.right_bar.bg,
visible = true,
screen = s,
maximum_width = dpi(650),
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end
}

View File

@@ -14,8 +14,6 @@ awful.screen.connect_for_each_screen(function(s)
require("src.modules.audio.volume_osd") { screen = s }
--require("src.modules.audio.volume_controller") { screen = s }
require("src.modules.brightness.brightness_osd") { screen = s }
require("src.lib.nice") { titlebar_font = User_config.font.bold,
titlebar_items = { left = { "icon" }, right = { "minimize", "maximize", "close" } } }
require("src.modules.crylia_bar.init")(s)
--require("src.modules.crylia_wibox.init")(s)
require("src.modules.notification-center.init")(s)
@@ -23,3 +21,8 @@ awful.screen.connect_for_each_screen(function(s)
require("src.modules.application_launcher.init") { screen = s }
require("src.modules.network_controller.init") { screen = s }
end)
do
require("src.lib.nice") { titlebar_font = User_config.font.bold,
titlebar_items = { left = { "icon" }, right = { "minimize", "maximize", "close" } } }
end

View File

@@ -59,6 +59,7 @@ network.DeviceState = {
function network:get_wifi_proxy()
local devices = self._private.NetworkManager:GetDevices()
if (not devices) or (#devices == 0) then return end
for _, path in ipairs(devices) do
local NetworkManagerDevice = dbus_proxy.Proxy:new {
bus = dbus_proxy.Bus.SYSTEM,
@@ -117,6 +118,7 @@ end
---Scan for access points and create a widget for each one.
function network:scan_access_points()
if not self._private.NetworkManagerDeviceWireless then return end
local ap_list = self:get_children_by_id("wifi_ap_list")[1]
ap_list:reset()
self._private.NetworkManagerDeviceWireless:RequestScanAsync(function(proxy, context, success, failure)
@@ -358,7 +360,7 @@ function network.new(args)
ret:scan_access_points()
gtimer.delayed_call(function()
--[[ gtimer.delayed_call(function()
local active_access_point = ret._private.NetworkManagerDeviceWireless.ActiveAccessPoint
if ret._private.NetworkManager.State == network.DeviceState.ACTIVATED and active_access_point ~= "/" then
local active_access_point_proxy = dbus_proxy.Proxy:new {
@@ -368,7 +370,7 @@ function network.new(args)
path = active_access_point,
}
end
end)
end) ]]
--#endregion

View File

@@ -497,7 +497,6 @@ return function()
local rubato_timer = rubato.timed {
duration = 1,
pos = bar.value,
easing = rubato.linear,
subscribed = function(v)
bar.value = v
end
@@ -594,7 +593,6 @@ return function()
local rubato_timer = rubato.timed {
duration = 1,
pos = bar.value,
easing = rubato.linear,
subscribed = function(v)
bar.value = v
end

View File

@@ -6,7 +6,6 @@
-- ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ --
-- ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ --
--------------------------------------------------
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
@@ -14,9 +13,6 @@ local capi = {
screen = screen,
}
require("src.theme.user_config")
require("src.theme.theme_config")
Theme_path = gears.filesystem.get_configuration_dir() .. "/src/theme/"
Theme = {}
@@ -53,9 +49,6 @@ Theme.hotkeys_label_bg = Theme_config.hotkeys.label_bg
Theme.hotkeys_label_fg = Theme_config.hotkeys.label_fg
--#endregion
Theme.awesome_icon = Theme_path .. "../assets/icons/ArchLogo.png"
Theme.awesome_subicon = Theme_path .. "../assets/icons/ArchLogo.png"
-- Wallpaper
beautiful.wallpaper = User_config.wallpaper
capi.screen.connect_signal(

View File

@@ -93,7 +93,10 @@ Theme_config.kblayout = {
Theme_config.layout_list = {
bg = color["LightBlue200"],
fg = color["Grey900"]
fg = color["Grey900"],
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(6))
end
}
Theme_config.network = {
@@ -672,6 +675,73 @@ Theme_config.context_menu = {
icon_color_hover = color["Teal200"]
}
}
Theme_config.setup = {
bg = color["Grey900"],
border_color = color["Grey800"],
border_width = dpi(4),
wallpaper = {
bg = color["Grey900"],
fg = color["Grey100"],
clip_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(12))
end,
button_bg = color["Yellow200"],
button_fg = color["Grey900"],
button_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(12))
end,
close_fg = color["Red200"],
path_bg = color["Grey800"],
path_fg = color["Grey100"],
path_border_color = color["Grey700"],
path_border_width = dpi(2),
path_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(12))
end,
},
bar = {
shape = gshape.circle,
color = color["Green200"],
padding = dpi(4),
border_width = dpi(2),
border_color = color["Grey800"],
widget_bg = color["Grey800"],
widget_fg = color["Grey100"],
widget_border_color = color["Grey700"],
widget_border_width = dpi(2),
widget_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(8))
end,
widget_toggle_color = color["Blue200"],
bar_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(8))
end,
bar_image_shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
},
notification = {
separator_color = color["Grey800"],
checkbox_color = color["Purple200"],
checkbox_paddings = dpi(4),
checkbox_shape = gshape.circle,
border_color = color["Grey800"],
border_width = dpi(2),
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
},
layout = {
bg = color["Orange200"],
border_color = color["Grey800"],
border_width = dpi(2),
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(8))
end,
border_color_selected = color["DeepOrange200"]
}
}
-- #endregion
--[[

View File

@@ -18,11 +18,9 @@ User_config = {
]] --
autostart = {
"picom",
"xfce4-power-manager",
"light-locker --lock-on-suspend --lock-on-lid &",
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1",
"setxkbmap -option caps:swapescape",
"/home/crylia/.screenlayout/single.sh"
"/home/crylia/.screenlayout/double.sh"
},
--[[
@@ -45,7 +43,7 @@ User_config = {
"MEDIA_PLAYER"
More information at: https://lazka.github.io/pgi-docs/UPowerGlib-1.0/enums.html#UPowerGlib.DeviceKind.KEYBOARD
]] --
battery_kind = "BATTERY",
battery_kind = "LINE_POWER",
--[[
If your battery is not found you can specify its path here.
@@ -208,8 +206,6 @@ User_config = {
"volume",
"gpu_temp",
"gpu_usage",
"battery",
"backlight"
},
--[[
@@ -267,7 +263,7 @@ User_config = {
unit = "metric"
},
web_browser = "brave-browser",
web_browser = "firefox",
--[[
You can configure your bar's here, if you leave it empty the bar will not be shown.
@@ -305,16 +301,36 @@ User_config = {
"Tasklist"
},
right_bar = {
"Battery",
"Network",
"Bluetooth",
"Cpu Frequency",
"Cpu Temperature",
"Cpu Usage",
"Audio",
"Keyboard Layout",
"Date",
"Clock",
"Power Button"
}
}
},
--[[ [2] = {
left_bar = {
"Tiling Layout",
"Systray",
"Taglist"
},
center_bar = {
"Tasklist"
},
right_bar = {
"Gpu Temperature",
"Gpu Usage",
"Ram",
"Audio",
"Keyboard Layout",
"Date",
"Clock",
"Power Button"
}
}]]
},
crylia_wibox = {

View File

@@ -1,87 +0,0 @@
local cairo = require("lgi").cairo
local gcolor = require("gears.color")
local gdk = require("lgi").Gdk
local gsurface = require("gears.surface")
local gtable = require("gears.table")
local color_helper = { mt = {} }
color_helper.color_rules = {}
function color_helper.set_color_rule(c, color)
color_helper.color_rules[c.instance] = color
end
function color_helper.get_color_rule(c)
return color_helper.color_rules[c.instance]
end
function color_helper.lighten(color, amount)
local r, g, b
r, g, b = gcolor.parse_color(color)
r = 255 * r
g = 255 * g
b = 255 * b
r = r + math.floor(2.55 * amount)
g = g + math.floor(2.55 * amount)
b = b + math.floor(2.55 * amount)
r = r > 255 and 255 or r
g = g > 255 and 255 or g
b = b > 255 and 255 or b
return ("#%02x%02x%02x"):format(r, g, b)
end
function color_helper.duotone_gradient_vertical(color_1, color_2, height, offset_1, offset_2)
local fill_pattern = cairo.Pattern.create_linear(0, 0, 0, height)
local r, g, b, a
r, g, b, a = gcolor.parse_color(color_1)
fill_pattern:add_color_stop_rgba(offset_1 or 0, r, g, b, a)
r, g, b, a = gcolor.parse_color(color_2)
fill_pattern:add_color_stop_rgba(offset_2 or 1, r, g, b, a)
return fill_pattern
end
function color_helper.get_dominant_color(client)
local color, pb, bytes
local tally, content, cgeo = {}, gsurface(client.content), client:geometry()
local x_offset, y_offset, x_lim = 2, 2, math.floor(cgeo.width / 2)
for x_pos = 0, x_lim, 2 do
for y_pos = 0, 8, 1 do
pb = gdk.pixbuf_get_from_surface(content, x_offset + x_pos, y_offset + y_pos, 1, 1)
bytes = pb:get_pixels()
color = "#" .. bytes:gsub(".", function(c)
return ("%02x"):format(c:byte())
end)
if not tally[color] then
tally[color] = 1
else
tally[color] = tally[color] + 1
end
end
end
local mode
local mode_c = 0
for k, v in pairs(tally) do
if v > mode_c then
mode_c = v
mode = k
end
end
color = mode
color_helper.set_color_rule(client, color)
return color
end
function color_helper.new(args)
local ret = {}
gtable.crush(ret, color_helper, true)
return ret
end
function color_helper.mt:__call(...)
return color_helper.new(...)
end
return setmetatable(color_helper, color_helper.mt)

View File

@@ -1,146 +0,0 @@
local awful = require("awful")
local gears = require("gears")
local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy")
local lgi = require("lgi")
local capi = {
awesome = awesome,
}
return function()
local function get_device_info(object_path)
if object_path ~= nil and object_path:match("/org/bluez/hci0/dev") then
local device = dbus_proxy.Proxy:new {
bus = dbus_proxy.Bus.SYSTEM,
name = "org.bluez",
interface = "org.bluez.Device1",
path = object_path
}
local battery = dbus_proxy.Proxy:new {
bus = dbus_proxy.Bus.SYSTEM,
name = "org.bluez",
interface = "org.bluez.Battery1",
path = object_path
}
local device_properties = dbus_proxy.Proxy:new {
bus = dbus_proxy.Bus.SYSTEM,
name = "org.bluez",
interface = "org.freedesktop.DBus.Properties",
path = object_path
}
capi.awesome.emit_signal("bluetooth::scan")
if (device.Name ~= nil) or (device.Alias ~= nil) then
device_properties:connect_signal(function()
capi.awesome.emit_signal("bluetooth::device_changed", device, battery)
end, "PropertiesChanged")
capi.awesome.emit_signal("bluetooth::device_changed", device, battery)
end
end
end
awful.spawn.easy_async_with_shell(
"lsusb | grep Bluetooth",
function(stdout)
stdout = stdout:gsub("\n", "")
if stdout ~= "" or stdout == nil then
local ObjectManager = dbus_proxy.Proxy:new {
bus = dbus_proxy.Bus.SYSTEM,
name = "org.bluez",
interface = "org.freedesktop.DBus.ObjectManager",
path = "/"
}
local Adapter = dbus_proxy.Proxy:new {
bus = dbus_proxy.Bus.SYSTEM,
name = "org.bluez",
interface = "org.bluez.Adapter1",
path = "/org/bluez/hci0"
}
local AdapterProperties = dbus_proxy.Proxy:new {
bus = dbus_proxy.Bus.SYSTEM,
name = "org.bluez",
interface = "org.freedesktop.DBus.Properties",
path = "/org/bluez/hci0"
}
ObjectManager:connect_signal(
function(interface)
get_device_info(interface)
end,
"InterfacesAdded"
)
ObjectManager:connect_signal(
function(interface)
capi.awesome.emit_signal("device_removed", interface)
end,
"InterfacesRemoved"
)
Adapter:connect_signal(
function(data)
if data.Powered ~= nil then
capi.awesome.emit_signal("state", data.Powered)
end
end,
"PropertiesChanged"
)
capi.awesome.connect_signal(
"bluetooth::scan",
function()
Adapter:StartDiscovery()
end
)
capi.awesome.connect_signal(
"bluetooth::stop",
function()
Adapter:StopDiscovery()
end
)
AdapterProperties:connect_signal(
function(data)
if data.Powered ~= nil then
if data.Powered then
Adapter:StartDiscovery()
end
end
end,
"PropertiesChanged"
)
capi.awesome.connect_signal("toggle_bluetooth",
function()
local is_powered = Adapter.Powered
Adapter:Set(
"org.bluez.Adapter1",
"Powered",
lgi.GLib.Variant("b", not is_powered)
)
Adapter.Powered = { signature = "b", value = not is_powered }
capi.awesome.emit_signal("state", Adapter.Powered)
end)
gears.timer.delayed_call(
function()
local objects = ObjectManager:GetManagedObjects()
for object_path, _ in pairs(objects) do
get_device_info(object_path)
end
capi.awesome.emit_signal("state", Adapter.Powered)
end
)
end
end
)
end

View File

@@ -1,165 +0,0 @@
local gears = require("gears")
local GLib = require("lgi").GLib
local m = {}
---Will return every $XDG_DATA_DIRS
---@return table
local function get_paths()
local dirs = {}
local dir
for _, value in ipairs(GLib.get_system_data_dirs()) do
dir = GLib.build_filenamev({ value, "applications" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
end
dir = GLib.build_filenamev({ GLib.get_user_data_dir(), "applications" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
return dirs
end
---Returns every found .desktop file that has NoDesktop=false or unset
---@return table
function m.Get_all_visible_desktop()
local dirs = get_paths()
local desktops = {}
for _, dir in ipairs(dirs) do
local files = io.popen('find "' .. dir .. '" -type f,l')
if files then
for file in files:lines() do
if gears.filesystem.file_readable(file) then
--[[ local symlink = lfs.symlinkattributes(file, "target")
if symlink then
file = dir .. symlink
end ]]
local handler = io.open(file, "r")
if not handler then
return {}
end
while true do
local line = handler:read()
if not line then break end
if line:match("^%[Desktop Entry%]") then
local name, comment, icon, exec, keywords, terminal, categories, nodisplay = "", "", "", "", "", "", "",
false
while true do
local prop = handler:read() or nil
if ((not prop) and name ~= "") or prop:match("^%[(.+)%]") then
local desktop_table = {
name = name or "",
comment = comment or "",
icon = icon or "",
exec = exec or "",
keywords = keywords or "",
terminal = terminal or false,
categories = categories or "",
nodisplay = nodisplay or false,
file = file
}
table.insert(desktops, desktop_table)
break
end
if prop:match("^Name=") then
name = prop:match("Name=(.+)")
end
if prop:match("^Comment=") then
comment = prop:match("Comment=(.+)")
end
if prop:match("^Icon=") then
icon = prop:match("Icon=(.+)")
end
if prop:match("^Exec=") then
exec = prop:match("Exec=(.+)"):gsub("%%u", ""):gsub("%%U", ""):gsub("%%f", ""):gsub("%%F", ""):gsub("%%i"
, ""):gsub("%%c", ""):gsub("%%k", "")
end
if prop:match("^Keywords=") then
keywords = prop:match("Keywords=(.+)")
end
if prop:match("^Terminal=") then
terminal = prop:match("Terminal=(.+)")
end
if prop:match("^Categories=") then
categories = prop:match("Categories=(.+)")
end
if prop:match("^NoDisplay=") then
nodisplay = prop:match("NoDisplay=(.+)")
if nodisplay == "false" then
nodisplay = false
else
nodisplay = true
end
end
end
break
end
end
handler:close()
end
end
files:close()
end
end
return desktops
end
---Returns every .desktop file into a table
---@param file table .desktop files
---@return table
function m.Get_desktop_values(file)
if not file or file == "" then
return {}
end
local handler = nil
for _, dir in ipairs(get_paths()) do
handler = io.open(dir .. "/" .. file, "r")
if handler then
break
end
end
if not handler then
return {}
end
local desktop_table = {}
while true do
local line = handler:read()
if not line then
break
end
if line:match("^%[Desktop Entry%]") then
while true do
local property = handler:read()
if not property then
break
end
if property:match("^%[(.+)%]") then
return desktop_table
end
if property:match("^Name=") then
desktop_table["Name"] = property:match("Name=(.+)")
elseif property:match("^Exec") then
-- Second match is to remove the %u, %U and %f, %F some applications use to open a URI/URL. It's not needed here
desktop_table["Exec"] = property:match("Exec=(.+)"):gsub("%%u", ""):gsub("%%U", ""):gsub("%%f", ""):gsub("%%F"
, ""):gsub("%%i", ""):gsub("%%c", ""):gsub("%%k", "")
elseif property:match("^Icon=") then
desktop_table["Icon"] = property:match("Icon=(.+)")
end
end
end
end
handler:close()
return desktop_table
end
return m

View File

@@ -1,116 +1,59 @@
local awful = require("awful")
local aspawn = require("awful.spawn")
local capi = {
awesome = awesome,
}
local lgi = require("lgi")
--[[ ctx:connect(nil, function(state)
if state == 4 then
print("Connection is ready")
ctx:get_sinks(function(sinks)
print(sinks[1])
end)
end
end) ]]
--local address = pulse.get_address()
--[[ local connection = pulse.get_connection(address)
local core = pulse.get_core(connection)
local sink = pulse.get_device(connection, core:get_sinks()[1])
sink:set_muted(false)
--assert(not sink:is_muted())
sink:set_volume_percent({ 75 }) ]]
awful.spawn.with_line_callback(
[[bash -c "LC_ALL=C pactl subscribe"]],
{
stdout = function(line)
-- Volume changed
if line:match("on sink") or line:match("on source") then
capi.awesome.emit_signal("audio::volume_changed")
capi.awesome.emit_signal("microphone::volume_changed")
end
-- Device added/removed
if line:match("on server") then
capi.awesome.emit_signal("audio::device_changed")
capi.awesome.emit_signal("microphone::device_changed")
end
end,
output_done = function()
-- Kill the pulseaudio subscribe command to prevent it from spawning multiple instances
awful.spawn.with_shell("pkill pactl && pkill grep")
aspawn.with_line_callback([[bash -c "LC_ALL=C pactl subscribe"]], {
stdout = function(line)
-- Volume changed
if line:match("on sink") or line:match("on source") then
capi.awesome.emit_signal("audio::volume_changed")
capi.awesome.emit_signal("microphone::volume_changed")
end
}
)
capi.awesome.connect_signal(
"exit",
function()
awful.spawn.with_shell("pkill pactl && pkill grep")
-- Device added/removed
if line:match("on server") then
capi.awesome.emit_signal("audio::device_changed")
capi.awesome.emit_signal("microphone::device_changed")
end
end,
output_done = function()
aspawn.with_shell("pkill pactl && pkill grep")
end
)
})
capi.awesome.connect_signal(
"audio::volume_changed",
function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout == "" or stdout == nil then
return
end
local muted = false
if stdout:match("yes") then
muted = true
end
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout2)
if stdout == "" or stdout == nil then
return
end
capi.awesome.emit_signal("audio::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
end
)
capi.awesome.connect_signal("audio::volume_changed", function()
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/vol.sh mute", function(stdout)
if stdout == "" or stdout == nil then
return
end
local muted = false
if stdout:match("yes") then
muted = true
end
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/vol.sh volume", function(stdout2)
if stdout == "" or stdout == nil then
return
end
)
end
)
capi.awesome.emit_signal("audio::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
end)
end)
end)
capi.awesome.connect_signal(
"microphone::volume_changed",
function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh mute",
function(stdout)
local muted = false
if stdout:match("yes") then
muted = true
end
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh volume",
function(stdout2)
if stdout2 == nil or stdout2 == "awful" then
return
end
capi.awesome.emit_signal("microphone::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
end
)
capi.awesome.connect_signal("microphone::volume_changed", function()
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/mic.sh mute", function(stdout)
local muted = false
if stdout:match("yes") then
muted = true
end
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/mic.sh volume", function(stdout2)
if stdout2 == nil or stdout2 == "awful" then
return
end
)
end
)
capi.awesome.emit_signal("microphone::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
end)
end)
end)
capi.awesome.emit_signal("audio::volume_changed")
capi.awesome.emit_signal("microphone::volume_changed")

View File

@@ -1,16 +0,0 @@
local lgi = require("lgi")
local Gtk = lgi.require("Gtk", "3.0")
local gtk_theme = Gtk.IconTheme.new()
Gtk.IconTheme.set_custom_theme(gtk_theme, User_config.icon_theme)
function Get_gicon_path(app)
local icon_info = gtk_theme:lookup_by_gicon(app, 64, 0)
if icon_info then
local path = icon_info:get_filename()
if path then
return path
end
end
return ""
end

View File

@@ -1,106 +0,0 @@
local theme_index = { mt = {} }
theme_index.new = function(cls, theme, basedirs)
local self = {}
setmetatable(self, { __index = cls })
self.icon_theme_name = theme or User_config.icon_theme
self.base_dir = nil
self["Directories"] = {}
self["Inherits"] = {}
self.per_directory_keys = {}
local basedir, handler = nil, nil
for _, dir in ipairs(basedirs) do
basedir = dir .. "/" .. self.icon_theme_name
handler = io.open(basedir .. "/index.theme", "r")
if handler then
break
end
end
if not handler then
return self
end
self.base_dir = basedir
while true do
local line = handler:read()
if not line then
break
end
local header = line:match("^%[(.+)%]$")
if header then
if header == "Icon Theme" then
while true do
local property = handler:read()
if not property then
break
end
if property:match("^%[(.+)%]$") then
handler:seek("cur", -string.len(property) - 1)
break
end
local key, value = property:match("^(%w+)=(.*)$")
if key == "Directories" or key == "Inherits" then
string.gsub(value, "([^,]+),?", function(match)
table.insert(self[key], match)
end)
end
end
else
local keys = {}
while true do
local property = handler:read()
if not property then
break
end
if property:match("^%[(.+)%]$") then
handler:seek("cur", -string.len(property) - 1)
break
end
local key, value = property:match("^(%w+)=(%w+)$")
if key == "Size" or key == "MinSize" or key == "MaxSize" or key == "Threshold" then
keys[key] = tonumber(value)
elseif key == "Type" then
keys[key] = value
end
end
if keys["Size"] then
if not keys["Type"] then keys["Type"] = "Threshold" end
if not keys["MinSize"] then keys["MinSize"] = keys["Size"] end
if not keys["MaxSize"] then keys["MaxSize"] = keys["Size"] end
if not keys["Threshold"] then keys["Threshold"] = 2 end
self.per_directory_keys[header] = keys
end
end
end
end
handler:close()
return self
end
theme_index.get_subdirectories = function(self)
return self["Directories"]
end
theme_index.get_inherits = function(self)
return self["Inherits"]
end
theme_index.mt.__call = function(cls, theme, basedirs)
return theme_index.new(cls, theme, basedirs)
end
return setmetatable(theme_index, theme_index.mt)

View File

@@ -1,245 +0,0 @@
-----------------------------------------------------
-- Helper to get icons from a program/program name --
-----------------------------------------------------
local gears = require("gears")
local GLib = require("lgi").GLib
local theme_index = require("src.tools.theme_index")
local function get_basedir()
local dirs = {}
local dir = GLib.build_filenamev({ GLib.get_home_dir(), ".icons" })
if gears.filesystem.dir_readable(dir) then
table.insert(dirs, dir)
end
dir = GLib.build_filenamev({ GLib.get_user_data_dir(), "icons" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
for _, value in ipairs(GLib.get_system_data_dirs()) do
dir = GLib.build_filenamev({ value, "icons" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
end
local need_usr_share_pixmaps = true
for _, value in ipairs(GLib.get_system_data_dirs()) do
dir = GLib.build_filenamev({ value, "icons" })
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
if dir == "/usr/share/pixmaps" then
need_usr_share_pixmaps = false
end
end
dir = "/usr/share/pixmaps"
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
if need_usr_share_pixmaps and gears.filesystem.dir_readable(dir) then
table.insert(dirs, dir)
end
return dirs
end
local xdg_icon_lookup = { mt = {} }
local icon_cache = {}
xdg_icon_lookup.new = function(theme, base_dirs)
local self = {}
self.icon_theme = theme or User_config.icon_theme
self.base_directories = base_dirs or get_basedir()
self.file_extension = { "svg", "png", "xpm" }
if not icon_cache[self.icon_theme] then
icon_cache[self.icon_theme] = {}
end
local cache_key = table.concat(self.base_directories, ":")
if not icon_cache[self.icon_theme][cache_key] then
icon_cache[self.icon_theme][cache_key] = theme_index(self.icon_theme, self.base_directories)
end
self.theme_index = icon_cache[self.icon_theme][cache_key]
return setmetatable(self, { __index = xdg_icon_lookup })
end
---Look for an fallback icon
---@param iconname any
---@return string|nil nil
local function lookup_fallback_icon(self, iconname)
for _, dir in ipairs(self.base_directories) do
for _, ext in ipairs(self.file_extension) do
local filename = string.format("%s/%s.%s", dir, iconname, ext)
if gears.filesystem.file_readable(filename) then
return filename
end
end
end
return nil
end
---Checkes if the size equals the actual icon size
---@param subdir any
---@param iconsize any
---@return boolean
local function directory_matches_size(self, subdir, iconsize)
local type, size, min_size, max_size, threshold = self.theme_index.per_directory_keys[subdir]["Type"],
self.theme_index.per_directory_keys[subdir]["Size"], self.theme_index.per_directory_keys[subdir]["MinSize"],
self.theme_index.per_directory_keys[subdir]["MaxSize"], self.theme_index.per_directory_keys[subdir]["Threshold"]
if type == "Fixed" then
return iconsize == size
elseif type == "Scalable" then
return iconsize >= min_size and iconsize <= max_size
elseif type == "Threshold" then
return iconsize >= size - threshold and iconsize <= size + threshold
end
return false
end
---Returns how far off the size is from the actual icon size
---@param subdir table
---@param iconsize number
---@return number
local function directory_size_distance(self, subdir, iconsize)
local type, size, min_size, max_size, threshold = self.theme_index.per_directory_keys[subdir]["Type"],
self.theme_index.per_directory_keys[subdir]["Size"], self.theme_index.per_directory_keys[subdir]["MinSize"],
self.theme_index.per_directory_keys[subdir]["MaxSize"], self.theme_index.per_directory_keys[subdir]["Threshold"]
if type and min_size and max_size and threshold then
if type == "Fixed" then
return math.abs(size - iconsize)
elseif type == "Scalable" then
if iconsize < min_size then
return min_size - iconsize
elseif iconsize > max_size then
return iconsize - max_size
end
return 0
elseif type == "Threshold" then
if iconsize < size - threshold then
return min_size - iconsize
elseif iconsize > size + threshold then
return iconsize - max_size
end
return 0
end
end
return 0xffffffff
end
---Checks each and every sub directory for an icon
---@param iconname any
---@param size any
---@return string|unknown|nil path_to_icon
local function lookup_icon(self, iconname, size)
local already_checked = {}
for _, subdir in ipairs(self.theme_index:get_subdirectories()) do
for _, dir in ipairs(self.base_directories) do
for _, ext in ipairs(self.file_extension) do
if directory_matches_size(self, subdir, size) then
local filename = string.format("%s/%s/%s/%s.%s", dir, self.icon_theme, subdir, iconname, ext)
if gears.filesystem.file_readable(filename) then
return filename
else
already_checked[filename] = true
end
end
end
end
end
local min_size = 0xffffffff
local closest_filename = nil
for _, subdir in ipairs(self.theme_index:get_subdirectories()) do
local dist = directory_size_distance(self, subdir, size)
if dist < min_size then
for _, dir in ipairs(self.base_directories) do
for _, ext in ipairs(self.file_extension) do
local filename = string.format("%s/%s/%s/%s.%s", dir, self.icon_theme, subdir, iconname, ext)
if not already_checked[filename] then
if gears.filesystem.file_readable(filename) then
closest_filename = filename
min_size = dist
end
end
end
end
end
end
return closest_filename or nil
end
---Check if the icon inherits from another icon theme and search that for an icon
---@param icon any
---@param size any
---@param self any
---@return string|unknown|nil path_to_icon
local function find_icon_helper(self, icon, size)
local filename = lookup_icon(self, icon, size)
if filename then return filename end
-- Exists purely for clients in hope to find a matching icon.
filename = lookup_icon(self, icon:lower(), size)
if filename then return filename end
-- !Disabled for now until memory leak can be fixed.
--[[ for _, parent in ipairs(self.theme_index:get_inherits()) do
if parent == "hicolor" then
return
end
filename = find_icon_helper(xdg_icon_lookup(parent, self.base_directories), icon, size)
if filename then return filename end
end ]]
return nil
end
local iconcache = {}
---Takes an icon and its props and theme to search for it inside the theme
---@param icon any
---@param size any
---@return string|nil path_to_icon
function xdg_icon_lookup:find_icon(icon, size)
size = size or 64
if icon_cache[icon] == "" then return nil end
if iconcache[icon] then return iconcache[icon] end
if not icon or icon == "" then return nil end
if gears.filesystem.file_readable(icon) then
iconcache[icon] = icon
return icon
end
local filename = find_icon_helper(self, icon, size)
if filename then
iconcache[icon] = filename
return filename
end
filename = find_icon_helper(xdg_icon_lookup("hicolor", self.base_directories), icon, size)
if filename then
iconcache[icon] = filename
return filename
end
filename = lookup_fallback_icon(self, icon)
if filename then
iconcache[icon] = filename
return filename
end
iconcache[icon] = ""
return nil
end
xdg_icon_lookup.mt.__call = function(_, ...)
return xdg_icon_lookup.new(...)
end
return setmetatable(xdg_icon_lookup, xdg_icon_lookup.mt)

View File

@@ -2,7 +2,7 @@
-- This is the audio widget --
------------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -61,50 +61,39 @@ return function(s)
widget = wibox.container.background
}
capi.awesome.connect_signal(
"audio::get",
function(muted, volume)
if muted then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", Theme_config.audio.fg))
else
audio_widget.container:set_right(10)
local icon = icondir .. "volume"
audio_widget.container.audio_layout.spacing = dpi(5)
audio_widget.container.audio_layout.label.visible = true
volume = tonumber(volume)
if not volume then
return
end
if volume < 1 then
icon = icon .. "-mute"
audio_widget.container.audio_layout.spacing = dpi(0)
audio_widget.container.audio_layout.label.visible = false
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 67 then
icon = icon .. "-high"
end
audio_widget.container.audio_layout.label:set_text(volume .. "%")
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icon .. ".svg", Theme_config.audio.fg))
capi.awesome.connect_signal("audio::get", function(muted, volume)
if muted then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", Theme_config.audio.fg))
else
audio_widget.container:set_right(10)
local icon = icondir .. "volume"
audio_widget.container.audio_layout.spacing = dpi(5)
audio_widget.container.audio_layout.label.visible = true
volume = tonumber(volume)
if not volume then
return
end
if volume < 1 then
icon = icon .. "-mute"
audio_widget.container.audio_layout.spacing = dpi(0)
audio_widget.container.audio_layout.label.visible = false
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 67 then
icon = icon .. "-high"
end
audio_widget.container.audio_layout.label:set_text(volume .. "%")
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icon .. ".svg", Theme_config.audio.fg))
end
)
end)
-- Signals
Hover_signal(audio_widget)
audio_widget:connect_signal(
"button::press",
function()
capi.awesome.emit_signal("volume_controller::toggle", s)
capi.awesome.emit_signal("volume_controller::toggle:keygrabber")
end
)
return audio_widget
end

View File

@@ -3,7 +3,6 @@
---------------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
@@ -13,7 +12,7 @@ local rubato = require("src.lib.rubato")
require("src.tools.helpers.cpu_freq")
require("src.tools.helpers.cpu_temp")
--!Has to be disabled until rewritten to perform better require("src.tools.helpers.cpu_usage")
require("src.tools.helpers.cpu_usage")
local capi = {
awesome = awesome,
@@ -22,7 +21,7 @@ local capi = {
local icon_dir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/cpu/"
--TODO: Add tooltip with more CPU and per core information
return function(widget, _)
return function(widget)
local cpu_usage_widget = wibox.widget {
{
@@ -153,12 +152,9 @@ return function(widget, _)
widget = wibox.container.background
}
capi.awesome.connect_signal(
"update::cpu_usage",
function(usage)
cpu_usage_widget.container.cpu_layout.label.text = usage .. "%"
end
)
capi.awesome.connect_signal("update::cpu_usage", function(usage)
cpu_usage_widget.container.cpu_layout.label.text = usage .. "%"
end)
local r_timed_cpu_bg = rubato.timed { duration = 2.5 }
local g_timed_cpu_bg = rubato.timed { duration = 2.5 }
@@ -180,42 +176,33 @@ return function(widget, _)
r_timed_cpu_bg.target, g_timed_cpu_bg.target, b_timed_cpu_bg.target = color.utils.hex_to_rgba(newbg)
end
capi.awesome.connect_signal(
"update::cpu_temp",
function(temp)
local temp_icon
local temp_color
capi.awesome.connect_signal("update::cpu_temp", function(temp)
local temp_icon
local temp_color
if temp < 50 then
temp_color = Theme_config.cpu_temp.bg_low
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp >= 50 and temp < 80 then
temp_color = Theme_config.cpu_temp.bg_mid
temp_icon = icon_dir .. "thermometer.svg"
elseif temp >= 80 then
temp_color = Theme_config.cpu_temp.bg_high
temp_icon = icon_dir .. "thermometer-high.svg"
end
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp) .. "°C"
capi.awesome.emit_signal("update::cpu_temp_widget", temp, temp_icon)
if temp < 50 then
temp_color = Theme_config.cpu_temp.bg_low
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp >= 50 and temp < 80 then
temp_color = Theme_config.cpu_temp.bg_mid
temp_icon = icon_dir .. "thermometer.svg"
elseif temp >= 80 then
temp_color = Theme_config.cpu_temp.bg_high
temp_icon = icon_dir .. "thermometer-high.svg"
end
)
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp) .. "°C"
capi.awesome.emit_signal("update::cpu_temp_widget", temp, temp_icon)
end)
capi.awesome.connect_signal(
"update::cpu_freq_average",
function(average)
cpu_clock.container.cpu_layout.label.text = average .. "Mhz"
end
)
capi.awesome.connect_signal("update::cpu_freq_average", function(average)
cpu_clock.container.cpu_layout.label.text = average .. "Mhz"
end)
capi.awesome.connect_signal(
"update::cpu_freq_core",
function(freq)
cpu_clock.container.cpu_layout.label.text = freq .. "Mhz"
end
)
capi.awesome.connect_signal("update::cpu_freq_core", function(freq)
cpu_clock.container.cpu_layout.label.text = freq .. "Mhz"
end)
Hover_signal(cpu_temp)
Hover_signal(cpu_usage_widget)

View File

@@ -3,25 +3,32 @@
----------------------------------
-- Awesome Libs
local awful = require("awful")
local abutton = require("awful.button")
local alayout = require("awful.layout")
local awidget = require("awful.widget")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local gtable = require("gears.table")
local wibox = require("wibox")
--#region Layout icons
local layout_path = Theme_path .. "../assets/layout/"
Theme.layout_floating = layout_path .. "floating.svg"
Theme.layout_tile = layout_path .. "tile.svg"
Theme.layout_dwindle = layout_path .. "dwindle.svg"
Theme.layout_fairh = layout_path .. "fairh.svg"
Theme.layout_fairv = layout_path .. "fairv.svg"
Theme.layout_fullscreen = layout_path .. "fullscreen.svg"
Theme.layout_max = layout_path .. "max.svg"
Theme.layout_cornerne = layout_path .. "cornerne.svg"
Theme.layout_cornernw = layout_path .. "cornernw.svg"
Theme.layout_cornerse = layout_path .. "cornerse.svg"
Theme.layout_cornersw = layout_path .. "cornersw.svg"
Theme.layout_cornerne = layout_path .. "cornerne.png"
Theme.layout_cornernw = layout_path .. "cornernw.png"
Theme.layout_cornerse = layout_path .. "cornerse.png"
Theme.layout_cornersw = layout_path .. "cornersw.png"
Theme.layout_dwindle = layout_path .. "dwindle.png"
Theme.layout_fairh = layout_path .. "fairh.png"
Theme.layout_fairv = layout_path .. "fairv.png"
Theme.layout_floating = layout_path .. "floating.png"
Theme.layout_fullscreen = layout_path .. "fullscreen.png"
Theme.layout_magnifier = layout_path .. "magnifier.png"
Theme.layout_max = layout_path .. "max.png"
Theme.layout_spiral = layout_path .. "spiral.png"
Theme.layout_tile = layout_path .. "tile.png"
Theme.layout_tilebottom = layout_path .. "tilebottom.png"
Theme.layout_tileleft = layout_path .. "tileleft.png"
Theme.layout_tiletop = layout_path .. "tiletop.png"
--#endregion
-- Returns the layoutbox widget
@@ -29,32 +36,40 @@ return function()
local layout = wibox.widget {
{
{
awful.widget.layoutbox(),
id = "icon_layout",
widget = wibox.container.place
{
awidget.layoutbox(),
widget = wibox.container.place,
halign = "center",
valign = "center"
},
left = dpi(5),
right = dpi(5),
widget = wibox.container.margin,
},
id = "icon_margin",
left = dpi(5),
right = dpi(5),
forced_width = dpi(40),
widget = wibox.container.margin
widget = wibox.container.constraint,
width = dpi(40)
},
bg = Theme_config.layout_list.bg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
shape = Theme_config.layout_list.shape,
widget = wibox.container.background
}
-- Signals
Hover_signal(layout)
layout:connect_signal(
"button::press",
function()
awful.layout.inc(-1)
end
)
layout:buttons(gtable.join(
abutton({}, 1, function()
alayout.inc(1)
end),
abutton({}, 3, function()
alayout.inc(-1)
end),
abutton({}, 4, function()
alayout.inc(1)
end),
abutton({}, 5, function()
alayout.inc(-1)
end)
))
return layout
end