converted all colors to theme_config.lua; fixed and added some bugs; rewrote some stuff and added some
This commit is contained in:
@@ -17,5 +17,6 @@ require("src.core.rules")
|
|||||||
require("src.bindings.global_buttons")
|
require("src.bindings.global_buttons")
|
||||||
require("src.bindings.bind_to_tags")
|
require("src.bindings.bind_to_tags")
|
||||||
require("src.modules.init")
|
require("src.modules.init")
|
||||||
require("src.tools.auto_starter")(User_config.autostart)
|
require("src.tools.helpers.init")
|
||||||
require("src.dbus.bluetooth_dbus")()
|
--require("src.tools.auto_starter")(User_config.autostart)
|
||||||
|
require("src.tools.dbus.bluetooth_dbus")()
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 552 B |
5
awesome/src/assets/icons/notifications/default_image.svg
Normal file
5
awesome/src/assets/icons/notifications/default_image.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#414141" version="1.1" width="24" height="24" viewBox="0 0 24 24">
|
||||||
|
<path d="M17.9,10.9C14.7,9 9.35,8.8 6.3,9.75C5.8,9.9 5.3,9.6 5.15,9.15C5,8.65 5.3,8.15 5.75,8C9.3,6.95 15.15,7.15 18.85,9.35C19.3,9.6 19.45,10.2 19.2,10.65C18.95,11 18.35,11.15 17.9,10.9M17.8,13.7C17.55,14.05 17.1,14.2 16.75,13.95C14.05,12.3 9.95,11.8 6.8,12.8C6.4,12.9 5.95,12.7 5.85,12.3C5.75,11.9 5.95,11.45 6.35,11.35C10,10.25 14.5,10.8 17.6,12.7C17.9,12.85 18.05,13.35 17.8,13.7M16.6,16.45C16.4,16.75 16.05,16.85 15.75,16.65C13.4,15.2 10.45,14.9 6.95,15.7C6.6,15.8 6.3,15.55 6.2,15.25C6.1,14.9 6.35,14.6 6.65,14.5C10.45,13.65 13.75,14 16.35,15.6C16.7,15.75 16.75,16.15 16.6,16.45M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 968 B |
@@ -17,9 +17,11 @@ awful.keygrabber {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
root_keybindings = {
|
root_keybindings = {
|
||||||
awful.key { -- Has to be here and can't be nil
|
awful.key {
|
||||||
modifiers = { "Also Nothing" },
|
modifiers = { modkey },
|
||||||
key = "Nothing"
|
key = "Tab",
|
||||||
|
on_press = function()
|
||||||
|
end
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stop_key = "Mod4",
|
stop_key = "Mod4",
|
||||||
@@ -184,14 +186,6 @@ return gears.table.join(
|
|||||||
end,
|
end,
|
||||||
{ descripton = "Application launcher", group = "Application" }
|
{ descripton = "Application launcher", group = "Application" }
|
||||||
),
|
),
|
||||||
awful.key(
|
|
||||||
{ "Mod1" },
|
|
||||||
"#23",
|
|
||||||
function()
|
|
||||||
awful.spawn("rofi -kb-accept-entry '!Alt-Tab' -kb-row-down Alt-Tab -show window -theme ~/.config/rofi/window.rasi")
|
|
||||||
end,
|
|
||||||
{ descripton = "Client switcher (alt+tab)", group = "Application" }
|
|
||||||
),
|
|
||||||
awful.key(
|
awful.key(
|
||||||
{ modkey },
|
{ modkey },
|
||||||
"#26",
|
"#26",
|
||||||
@@ -221,8 +215,6 @@ return gears.table.join(
|
|||||||
"XF86AudioLowerVolume",
|
"XF86AudioLowerVolume",
|
||||||
function(c)
|
function(c)
|
||||||
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ -2%", function()
|
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ -2%", function()
|
||||||
awesome.emit_signal("module::volume_osd:show", true)
|
|
||||||
awesome.emit_signal("module::slider:update")
|
|
||||||
awesome.emit_signal("widget::volume_osd:rerun")
|
awesome.emit_signal("widget::volume_osd:rerun")
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
@@ -233,8 +225,6 @@ return gears.table.join(
|
|||||||
"XF86AudioRaiseVolume",
|
"XF86AudioRaiseVolume",
|
||||||
function(c)
|
function(c)
|
||||||
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ +2%", function()
|
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ +2%", function()
|
||||||
awesome.emit_signal("module::volume_osd:show", true)
|
|
||||||
awesome.emit_signal("module::slider:update")
|
|
||||||
awesome.emit_signal("widget::volume_osd:rerun")
|
awesome.emit_signal("widget::volume_osd:rerun")
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
@@ -245,8 +235,6 @@ return gears.table.join(
|
|||||||
"XF86AudioMute",
|
"XF86AudioMute",
|
||||||
function(c)
|
function(c)
|
||||||
awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")
|
awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")
|
||||||
awesome.emit_signal("module::volume_osd:show", true)
|
|
||||||
awesome.emit_signal("module::slider:update")
|
|
||||||
awesome.emit_signal("widget::volume_osd:rerun")
|
awesome.emit_signal("widget::volume_osd:rerun")
|
||||||
end,
|
end,
|
||||||
{ description = "Mute volume", group = "System" }
|
{ description = "Mute volume", group = "System" }
|
||||||
@@ -255,17 +243,12 @@ return gears.table.join(
|
|||||||
{},
|
{},
|
||||||
"XF86MonBrightnessUp",
|
"XF86MonBrightnessUp",
|
||||||
function(c)
|
function(c)
|
||||||
--awful.spawn("xbacklight -time 100 -inc 10%+")
|
|
||||||
awful.spawn.easy_async_with_shell(
|
awful.spawn.easy_async_with_shell(
|
||||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||||
function(stdout)
|
function(stdout)
|
||||||
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " ..
|
awful.spawn("pkexec xfpm-power-backlight-helper --set-brightness " ..
|
||||||
tostring(tonumber(stdout) + BACKLIGHT_SEPS), function(stdou2)
|
tostring(tonumber(stdout) + BACKLIGHT_SEPS))
|
||||||
|
awesome.emit_signal("brightness::update")
|
||||||
end)
|
|
||||||
awesome.emit_signal("module::brightness_osd:show", true)
|
|
||||||
awesome.emit_signal("module::brightness_slider:update")
|
|
||||||
awesome.emit_signal("widget::brightness_osd:rerun")
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
@@ -278,13 +261,10 @@ return gears.table.join(
|
|||||||
awful.spawn.easy_async_with_shell(
|
awful.spawn.easy_async_with_shell(
|
||||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||||
function(stdout)
|
function(stdout)
|
||||||
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " ..
|
awful.spawn(
|
||||||
tostring(tonumber(stdout) - BACKLIGHT_SEPS), function(stdout2)
|
"pkexec xfpm-power-backlight-helper --set-brightness " ..
|
||||||
|
tostring(tonumber(stdout) - BACKLIGHT_SEPS))
|
||||||
end)
|
awesome.emit_signal("brightness::update")
|
||||||
awesome.emit_signal("module::brightness_osd:show", true)
|
|
||||||
awesome.emit_signal("module::brightness_slider:update")
|
|
||||||
awesome.emit_signal("widget::brightness_osd:rerun")
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
@@ -322,6 +302,14 @@ return gears.table.join(
|
|||||||
end,
|
end,
|
||||||
{ description = "Toggle keyboard layout", group = "System" }
|
{ description = "Toggle keyboard layout", group = "System" }
|
||||||
),
|
),
|
||||||
|
awful.key(
|
||||||
|
{ modkey },
|
||||||
|
"#27",
|
||||||
|
function()
|
||||||
|
awesome.emit_signal("application_laucher::show")
|
||||||
|
end,
|
||||||
|
{ description = "show application launcher", group = "System" }
|
||||||
|
),
|
||||||
awful.key(
|
awful.key(
|
||||||
{ modkey },
|
{ modkey },
|
||||||
"#22",
|
"#22",
|
||||||
@@ -347,7 +335,7 @@ return gears.table.join(
|
|||||||
awful.spawn.with_shell("echo -n '" ..
|
awful.spawn.with_shell("echo -n '" ..
|
||||||
stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
|
stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
|
||||||
local c = mouse.screen.selected_tag:clients()
|
local c = mouse.screen.selected_tag:clients()
|
||||||
for j, client in ipairs(c) do
|
for _, client in ipairs(c) do
|
||||||
if client.class:match(stdout:gsub("\n", "")) then
|
if client.class:match(stdout:gsub("\n", "")) then
|
||||||
client.floating = true
|
client.floating = true
|
||||||
end
|
end
|
||||||
@@ -379,9 +367,9 @@ return gears.table.join(
|
|||||||
STR=$(cat ~/.config/awesome/src/assets/rules.txt)
|
STR=$(cat ~/.config/awesome/src/assets/rules.txt)
|
||||||
echo -n ${STR//$REMOVE/} > ~/.config/awesome/src/assets/rules.txt
|
echo -n ${STR//$REMOVE/} > ~/.config/awesome/src/assets/rules.txt
|
||||||
]],
|
]],
|
||||||
function(stdout2)
|
function()
|
||||||
local c = mouse.screen.selected_tag:clients()
|
local c = mouse.screen.selected_tag:clients()
|
||||||
for j, client in ipairs(c) do
|
for _, client in ipairs(c) do
|
||||||
if client.class:match(stdout:gsub("\n", "")) then
|
if client.class:match(stdout:gsub("\n", "")) then
|
||||||
client.floating = false
|
client.floating = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
-------------------------------
|
-------------------------------
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local menubar = require('menubar')
|
local menubar = require('menubar')
|
||||||
@@ -17,18 +16,16 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
|||||||
-- TODO: Figure out how to use hover effects without messing up the actions
|
-- TODO: Figure out how to use hover effects without messing up the actions
|
||||||
naughty.config.defaults.ontop = true
|
naughty.config.defaults.ontop = true
|
||||||
naughty.config.defaults.icon_size = dpi(80)
|
naughty.config.defaults.icon_size = dpi(80)
|
||||||
naughty.config.defaults.timeout = 3
|
naughty.config.defaults.timeout = Theme_config.notification.timeout
|
||||||
naughty.config.defaults.title = "System Notification"
|
naughty.config.defaults.title = "System Notification"
|
||||||
naughty.config.defaults.margin = dpi(10)
|
naughty.config.defaults.margin = dpi(10)
|
||||||
naughty.config.defaults.position = "bottom_right"
|
naughty.config.defaults.position = Theme_config.notification.position
|
||||||
naughty.config.defaults.shape = function(cr, width, height)
|
naughty.config.defaults.shape = Theme_config.notification.shape
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(10))
|
naughty.config.defaults.border_width = Theme_config.notification.border_width
|
||||||
end
|
naughty.config.defaults.border_color = Theme_config.notification.border_color
|
||||||
naughty.config.defaults.border_width = dpi(4)
|
naughty.config.defaults.spacing = Theme_config.notification.spacing
|
||||||
naughty.config.defaults.border_color = color["Grey800"]
|
|
||||||
naughty.config.defaults.spacing = dpi(10)
|
|
||||||
|
|
||||||
Theme.notification_spacing = dpi(20)
|
Theme.notification_spacing = Theme_config.notification.corner_spacing
|
||||||
|
|
||||||
naughty.connect_signal(
|
naughty.connect_signal(
|
||||||
'request::icon',
|
'request::icon',
|
||||||
@@ -51,34 +48,42 @@ naughty.connect_signal(
|
|||||||
else
|
else
|
||||||
if n.urgency == "critical" then
|
if n.urgency == "critical" then
|
||||||
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
|
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
|
||||||
color["RedA200"], n.title) or ""
|
Theme_config.notification.fg_urgent_title, n.title) or ""
|
||||||
n.message = string.format("<span foreground='%s'>%s</span>", color["Red200"], n.message) or ""
|
n.message = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_urgent_message,
|
||||||
n.app_name = string.format("<span foreground='%s'>%s</span>", color["RedA400"], n.app_name) or ""
|
n.message) or ""
|
||||||
n.bg = color["Grey900"]
|
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
|
else
|
||||||
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
|
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
|
||||||
color["Pink200"], n.title) or ""
|
Theme_config.notification.fg_normal_title, n.title) or ""
|
||||||
n.message = string.format("<span foreground='%s'>%s</span>", "#ffffffaa", n.message) or ""
|
n.message = string.format("<span foreground='%s'>%s</span>", Theme_config.notification.fg_normal_message,
|
||||||
n.bg = color["Grey900"]
|
n.message) or ""
|
||||||
n.timeout = n.timeout or 3
|
n.bg = Theme_config.notification.bg_normal
|
||||||
|
n.timeout = n.timeout or Theme_config.notification.timeout
|
||||||
end
|
end
|
||||||
|
|
||||||
local use_image = false
|
local use_image = false
|
||||||
|
|
||||||
if n.app_name == "Spotify" then
|
if n.app_name == "Spotify" then
|
||||||
n.actions = { naughty.action {
|
n.actions = {
|
||||||
|
naughty.action {
|
||||||
program = "Spotify",
|
program = "Spotify",
|
||||||
id = "skip-prev",
|
id = "skip-prev",
|
||||||
icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"])
|
icon = gears.color.recolor_image(icondir .. "skip-prev.svg",
|
||||||
|
Theme_config.notification.spotify_button_icon_color)
|
||||||
}, naughty.action {
|
}, naughty.action {
|
||||||
program = "Spotify",
|
program = "Spotify",
|
||||||
id = "play-pause",
|
id = "play-pause",
|
||||||
icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"])
|
icon = gears.color.recolor_image(icondir .. "play-pause.svg",
|
||||||
|
Theme_config.notification.spotify_button_icon_color)
|
||||||
}, naughty.action {
|
}, naughty.action {
|
||||||
program = "Spotify",
|
program = "Spotify",
|
||||||
id = "skip-next",
|
id = "skip-next",
|
||||||
icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"])
|
icon = gears.color.recolor_image(icondir .. "skip-next.svg",
|
||||||
} }
|
Theme_config.notification.spotify_button_icon_color)
|
||||||
|
}
|
||||||
|
}
|
||||||
use_image = true
|
use_image = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -105,8 +110,7 @@ naughty.connect_signal(
|
|||||||
},
|
},
|
||||||
forced_height = dpi(35),
|
forced_height = dpi(35),
|
||||||
forced_width = dpi(35),
|
forced_width = dpi(35),
|
||||||
fg = color["Cyan200"],
|
bg = Theme_config.notification.action_bg,
|
||||||
bg = color["Grey800"],
|
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||||
end,
|
end,
|
||||||
@@ -134,8 +138,8 @@ naughty.connect_signal(
|
|||||||
margins = dpi(5),
|
margins = dpi(5),
|
||||||
widget = wibox.container.margin
|
widget = wibox.container.margin
|
||||||
},
|
},
|
||||||
fg = color["Green200"],
|
fg = Theme_config.notification.action_fg,
|
||||||
bg = color["Grey800"],
|
bg = Theme_config.notification.action_bg,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||||
end,
|
end,
|
||||||
@@ -158,9 +162,7 @@ naughty.connect_signal(
|
|||||||
widget_template = action_template_widget,
|
widget_template = action_template_widget,
|
||||||
style = {
|
style = {
|
||||||
underline_normal = false,
|
underline_normal = false,
|
||||||
underline_selected = true,
|
underline_selected = true
|
||||||
bg_normal = color["Grey100"],
|
|
||||||
bg_selected = color["Grey200"]
|
|
||||||
},
|
},
|
||||||
widget = naughty.list.actions
|
widget = naughty.list.actions
|
||||||
}
|
}
|
||||||
@@ -181,7 +183,8 @@ naughty.connect_signal(
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]),
|
image = gears.color.recolor_image(icondir .. "notification-outline.svg",
|
||||||
|
Theme_config.notification.icon_color),
|
||||||
resize = false,
|
resize = false,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
@@ -198,7 +201,7 @@ naughty.connect_signal(
|
|||||||
},
|
},
|
||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal
|
||||||
},
|
},
|
||||||
fg = color["Teal200"],
|
fg = Theme_config.notification.fg_appname,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
margins = dpi(10),
|
margins = dpi(10),
|
||||||
@@ -212,7 +215,7 @@ naughty.connect_signal(
|
|||||||
widget = wibox.widget.textbox
|
widget = wibox.widget.textbox
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "background",
|
||||||
fg = color["Teal200"],
|
fg = Theme_config.notification.fg_time,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -235,8 +238,7 @@ naughty.connect_signal(
|
|||||||
id = "arc_chart"
|
id = "arc_chart"
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "background",
|
||||||
fg = color["Teal200"],
|
fg = Theme_config.notification.fg_close,
|
||||||
bg = color["Grey900"],
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
strategy = "exact",
|
strategy = "exact",
|
||||||
@@ -256,8 +258,8 @@ naughty.connect_signal(
|
|||||||
layout = wibox.layout.align.horizontal
|
layout = wibox.layout.align.horizontal
|
||||||
},
|
},
|
||||||
id = "arc_app_bg",
|
id = "arc_app_bg",
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification.title_border_color,
|
||||||
border_width = dpi(2),
|
border_width = Theme_config.notification.title_border_width,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -327,17 +329,15 @@ naughty.connect_signal(
|
|||||||
widget = wibox.container.constraint
|
widget = wibox.container.constraint
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "background",
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.notification.bg,
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification.border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.notification.border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.notification.shape_inside,
|
||||||
gears.shape.rounded_rect(cr, width, height, 4)
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin.
|
local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin.const
|
||||||
const.background
|
.background
|
||||||
local arc = close.arc_chart
|
local arc = close.arc_chart
|
||||||
|
|
||||||
local timeout = n.timeout
|
local timeout = n.timeout
|
||||||
@@ -378,7 +378,7 @@ naughty.connect_signal(
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
Hover_signal(close, color["Grey900"], color["Teal200"])
|
Hover_signal(close, Theme_config.notification.bg_close, Theme_config.notification.fg_close)
|
||||||
|
|
||||||
close:connect_signal(
|
close:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
@@ -389,18 +389,13 @@ naughty.connect_signal(
|
|||||||
|
|
||||||
w_template:connect_signal(
|
w_template:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function(c, d, e, key)
|
function(_, _, _, key)
|
||||||
if key == 3 then
|
if key == 3 then
|
||||||
n:destroy()
|
n:destroy()
|
||||||
end
|
end
|
||||||
-- TODO: Find out how to get the associated client
|
-- TODO: Find out how to get the associated client
|
||||||
|
-- for some reason n.clients is always empty
|
||||||
--[[ if key == 1 then
|
--[[ if key == 1 then
|
||||||
if n.clients then
|
|
||||||
n.clients[1]:activate {
|
|
||||||
switch_to_tag = true,
|
|
||||||
raise = true
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end ]]
|
end ]]
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -425,7 +420,6 @@ naughty.connect_signal(
|
|||||||
naughty.connect_signal(
|
naughty.connect_signal(
|
||||||
"destroyed",
|
"destroyed",
|
||||||
function()
|
function()
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ awful.rules.rules = {
|
|||||||
keys = require("src.bindings.client_keys"),
|
keys = require("src.bindings.client_keys"),
|
||||||
buttons = require("src.bindings.client_buttons"),
|
buttons = require("src.bindings.client_buttons"),
|
||||||
screen = awful.screen.preferred,
|
screen = awful.screen.preferred,
|
||||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen
|
placement = awful.placement.under_mouse + awful.placement.no_overlap + awful.placement.no_offscreen
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
--------------------------------------
|
||||||
|
-- This is the application launcher --
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
-- Awesome Libs
|
||||||
|
local awful = require("awful")
|
||||||
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
|
local gears = require("gears")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
return function()
|
||||||
|
|
||||||
|
local application_list = wibox.widget {
|
||||||
|
homogenous = true,
|
||||||
|
expand = false,
|
||||||
|
spacing = dpi(10),
|
||||||
|
layout = wibox.container.grid
|
||||||
|
}
|
||||||
|
|
||||||
|
return application_list
|
||||||
|
end
|
||||||
|
|||||||
@@ -4,22 +4,58 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
-- Icon directory path
|
local application_grid = require("src.modules.application_launcher.application")()
|
||||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/"
|
local searchbar = require("src.modules.application_launcher.searchbar")()
|
||||||
|
|
||||||
return function(s)
|
return function(s)
|
||||||
|
|
||||||
local applicaton_launcher = wibox.widget {
|
|
||||||
|
|
||||||
|
local applicaton_launcher = wibox.widget {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
searchbar,
|
||||||
|
wibox.widget.inputtextbox,
|
||||||
|
application_grid,
|
||||||
|
layout = wibox.layout.fixed.vertical
|
||||||
|
},
|
||||||
|
margins = dpi(20),
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
height = dpi(600),
|
||||||
|
width = dpi(800),
|
||||||
|
strategy = "exact",
|
||||||
|
widget = wibox.container.constraint
|
||||||
}
|
}
|
||||||
|
|
||||||
local application_container = awful.popup {
|
local application_container = awful.popup {
|
||||||
|
widget = wibox.container.background,
|
||||||
|
ontop = true,
|
||||||
|
visible = false,
|
||||||
|
stretch = false,
|
||||||
|
screen = s,
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
||||||
|
end,
|
||||||
|
placement = awful.placement.centered,
|
||||||
|
bg = Theme_config.application_launcher.bg,
|
||||||
|
border_color = Theme_config.application_launcher.border_color,
|
||||||
|
border_width = Theme_config.application_launcher.border_width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
application_container:setup {
|
||||||
|
applicaton_launcher,
|
||||||
|
layout = wibox.layout.fixed.vertical
|
||||||
|
}
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"application_laucher::show",
|
||||||
|
function()
|
||||||
|
application_container.visible = not application_container.visible
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
-------------------------------------------------------
|
||||||
|
-- This is the seachbar for the application launcher --
|
||||||
|
-------------------------------------------------------
|
||||||
|
|
||||||
|
-- Awesome Libs
|
||||||
|
local awful = require("awful")
|
||||||
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
|
local gears = require("gears")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/searchbar/"
|
||||||
|
|
||||||
|
return function()
|
||||||
|
|
||||||
|
local searchbar = wibox.widget {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{ -- Search icon
|
||||||
|
{
|
||||||
|
resize = false,
|
||||||
|
image = icondir .. "search.svg",
|
||||||
|
widget = wibox.widget.imagebox
|
||||||
|
},
|
||||||
|
strategy = "exact",
|
||||||
|
widget = wibox.container.constraint
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fg = Theme_config.application_launcher.searchbar.fg_hint,
|
||||||
|
text = "Search",
|
||||||
|
valign = "center",
|
||||||
|
align = "center",
|
||||||
|
widget = wibox.widget.textbox
|
||||||
|
},
|
||||||
|
widget = wibox.layout.fixed.horizontal
|
||||||
|
},
|
||||||
|
margins = dpi(5),
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
bg = Theme_config.application_launcher.searchbar.bg,
|
||||||
|
fg = Theme_config.application_launcher.searchbar.fg,
|
||||||
|
border_color = Theme_config.application_launcher.searchbar.border_color,
|
||||||
|
border_width = Theme_config.application_launcher.searchbar.border_width,
|
||||||
|
widget = wibox.container.background
|
||||||
|
},
|
||||||
|
width = dpi(400),
|
||||||
|
height = dpi(40),
|
||||||
|
strategy = "exact",
|
||||||
|
widget = wibox.container.constraint
|
||||||
|
}
|
||||||
|
|
||||||
|
return searchbar
|
||||||
|
end
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -12,17 +11,6 @@ local wibox = require("wibox")
|
|||||||
-- Icon directory path
|
-- Icon directory path
|
||||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/brightness/"
|
local icondir = awful.util.getdir("config") .. "src/assets/icons/brightness/"
|
||||||
|
|
||||||
BACKLIGHT_MAX_BRIGHTNESS = 0
|
|
||||||
BACKLIGHT_SEPS = 0
|
|
||||||
awful.spawn.easy_async_with_shell(
|
|
||||||
"pkexec xfpm-power-backlight-helper --get-max-brightness",
|
|
||||||
function(stdout)
|
|
||||||
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
|
|
||||||
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
|
|
||||||
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
return function(s)
|
return function(s)
|
||||||
|
|
||||||
local brightness_osd_widget = wibox.widget {
|
local brightness_osd_widget = wibox.widget {
|
||||||
@@ -81,30 +69,23 @@ return function(s)
|
|||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
local update_slider = function()
|
awesome.connect_signal(
|
||||||
awful.spawn.easy_async_with_shell(
|
"brightness::get",
|
||||||
[[ pkexec xfpm-power-backlight-helper --get-brightness ]],
|
function(brightness)
|
||||||
function(stdout)
|
brightness_osd_widget:get_children_by_id("progressbar1")[1].value = brightness
|
||||||
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
|
||||||
brightness_osd_widget:get_children_by_id("progressbar1")[1].value = brightness_value
|
|
||||||
|
|
||||||
awesome.emit_signal("update::backlight", brightness_value)
|
|
||||||
|
|
||||||
local icon = icondir .. "brightness"
|
local icon = icondir .. "brightness"
|
||||||
if brightness_value >= 0 and brightness_value < 34 then
|
if brightness >= 0 and brightness < 34 then
|
||||||
icon = icon .. "-low"
|
icon = icon .. "-low"
|
||||||
elseif brightness_value >= 34 and brightness_value < 67 then
|
elseif brightness >= 34 and brightness < 67 then
|
||||||
icon = icon .. "-medium"
|
icon = icon .. "-medium"
|
||||||
elseif brightness_value >= 67 then
|
elseif brightness >= 67 then
|
||||||
icon = icon .. "-high"
|
icon = icon .. "-high"
|
||||||
end
|
end
|
||||||
brightness_osd_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
|
brightness_osd_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
|
||||||
Theme_config.brightness_osd.icon_color))
|
Theme_config.brightness_osd.icon_color))
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
update_slider()
|
|
||||||
|
|
||||||
local brightness_container = awful.popup {
|
local brightness_container = awful.popup {
|
||||||
widget = {},
|
widget = {},
|
||||||
@@ -132,15 +113,13 @@ return function(s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"widget::brightness_osd:rerun",
|
"brightness::rerun",
|
||||||
function()
|
function()
|
||||||
brightness_container.visible = true
|
brightness_container.visible = true
|
||||||
if hide_brightness_osd.started then
|
if hide_brightness_osd.started then
|
||||||
hide_brightness_osd:again()
|
hide_brightness_osd:again()
|
||||||
update_slider()
|
|
||||||
else
|
else
|
||||||
hide_brightness_osd:start()
|
hide_brightness_osd:start()
|
||||||
update_slider()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
--------------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -14,7 +13,7 @@ return function(s, widgets)
|
|||||||
screen = s,
|
screen = s,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
ontop = false,
|
ontop = false,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.center_bar.bg,
|
||||||
visible = true,
|
visible = true,
|
||||||
maximum_width = dpi(500),
|
maximum_width = dpi(500),
|
||||||
placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
|
placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
|
||||||
@@ -24,7 +23,7 @@ return function(s, widgets)
|
|||||||
}
|
}
|
||||||
|
|
||||||
top_center:struts {
|
top_center:struts {
|
||||||
top = 55
|
top = dpi(55)
|
||||||
}
|
}
|
||||||
|
|
||||||
local function prepare_widgets(w)
|
local function prepare_widgets(w)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
--------------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -41,7 +40,7 @@ return function(screen, programs)
|
|||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(10))
|
gears.shape.rounded_rect(cr, width, height, dpi(10))
|
||||||
end,
|
end,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.dock.element_bg,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
id = "background"
|
id = "background"
|
||||||
},
|
},
|
||||||
@@ -55,11 +54,12 @@ return function(screen, programs)
|
|||||||
|
|
||||||
for _, c in ipairs(client.get()) do
|
for _, c in ipairs(client.get()) do
|
||||||
if string.lower(c.class):match(program["Icon"]) and c == client.focus then
|
if string.lower(c.class):match(program["Icon"]) and c == client.focus then
|
||||||
dock_element.background.bg = color["Grey800"]
|
dock_element.background.bg = Theme_config.dock.element_focused_bg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Hover_signal(dock_element.background, color["Grey800"], color["White"])
|
Hover_signal(dock_element.background, Theme_config.dock.element_focused_hover_bg,
|
||||||
|
Theme_config.dock.element_focused_hover_fg)
|
||||||
|
|
||||||
dock_element:connect_signal(
|
dock_element:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
@@ -84,7 +84,7 @@ return function(screen, programs)
|
|||||||
local dock = awful.popup {
|
local dock = awful.popup {
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
ontop = true,
|
ontop = true,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.dock.bg,
|
||||||
visible = true,
|
visible = true,
|
||||||
screen = screen,
|
screen = screen,
|
||||||
type = "dock",
|
type = "dock",
|
||||||
@@ -139,24 +139,24 @@ return function(screen, programs)
|
|||||||
local clients = client.get()
|
local clients = client.get()
|
||||||
for index, pr in ipairs(prog) do
|
for index, pr in ipairs(prog) do
|
||||||
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
|
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
|
||||||
local col = color["Grey600"]
|
local col = Theme_config.dock.indicator_bg
|
||||||
for i, c in ipairs(clients) do
|
for i, c in ipairs(clients) do
|
||||||
local icon = desktop_parser(pr)
|
local icon = desktop_parser(pr)
|
||||||
if icon then
|
if icon then
|
||||||
local icon_name = icon["Icon"] or ""
|
local icon_name = icon["Icon"] or ""
|
||||||
if icon_name:match(string.lower(c.class or c.name or nil)) then
|
if icon_name:match(string.lower(c.class or c.name or nil)) then
|
||||||
if c == client.focus then
|
if c == client.focus then
|
||||||
col = color["YellowA200"]
|
col = Theme_config.dock.indicator_focused_bg
|
||||||
elseif c.urgent then
|
elseif c.urgent then
|
||||||
col = color["RedA200"]
|
col = Theme_config.dock.indicator_urgent_bg
|
||||||
elseif c.maximized then
|
elseif c.maximized then
|
||||||
col = color["GreenA200"]
|
col = Theme_config.dock.indicator_maximized_bg
|
||||||
elseif c.minimized then
|
elseif c.minimized then
|
||||||
col = color["BlueA200"]
|
col = Theme_config.dock.indicator_minimized_bg
|
||||||
elseif c.fullscreen then
|
elseif c.fullscreen then
|
||||||
col = color["PinkA200"]
|
col = Theme_config.dock.indicator_fullscreen_bg
|
||||||
else
|
else
|
||||||
col = color["Grey600"]
|
col = Theme_config.dock.indicator_bg
|
||||||
end
|
end
|
||||||
indicators[i] = wibox.widget {
|
indicators[i] = wibox.widget {
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
--------------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -16,7 +15,7 @@ return function(s, w)
|
|||||||
|
|
||||||
},
|
},
|
||||||
ontop = false,
|
ontop = false,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.left_bar.bg,
|
||||||
visible = true,
|
visible = true,
|
||||||
maximum_width = dpi(650),
|
maximum_width = dpi(650),
|
||||||
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
|
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
|
||||||
@@ -26,7 +25,7 @@ return function(s, w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
top_left:struts {
|
top_left:struts {
|
||||||
top = 55
|
top = dpi(55)
|
||||||
}
|
}
|
||||||
|
|
||||||
local function prepare_widgets(widgets)
|
local function prepare_widgets(widgets)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
--------------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -13,7 +12,7 @@ return function(s, w)
|
|||||||
local top_right = awful.popup {
|
local top_right = awful.popup {
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
ontop = false,
|
ontop = false,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.right_bar.bg,
|
||||||
visible = true,
|
visible = true,
|
||||||
screen = s,
|
screen = s,
|
||||||
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
|
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
|
||||||
@@ -23,7 +22,7 @@ return function(s, w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
top_right:struts {
|
top_right:struts {
|
||||||
top = 55
|
top = dpi(55)
|
||||||
}
|
}
|
||||||
|
|
||||||
local function prepare_widgets(widgets)
|
local function prepare_widgets(widgets)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ awful.screen.connect_for_each_screen(
|
|||||||
-- e.g. 1 would be the primary screen and 2 the secondary screen.
|
-- e.g. 1 would be the primary screen and 2 the secondary screen.
|
||||||
function(s)
|
function(s)
|
||||||
-- Create 9 tags
|
-- Create 9 tags
|
||||||
awful.layout.layouts = User_config.layouts
|
awful.layout.append_default_layouts(User_config.layouts)
|
||||||
awful.tag(
|
awful.tag(
|
||||||
{ "1", "2", "3", "4", "5", "6", "7", "8", "9" },
|
{ "1", "2", "3", "4", "5", "6", "7", "8", "9" },
|
||||||
s,
|
s,
|
||||||
@@ -19,12 +19,13 @@ awful.screen.connect_for_each_screen(
|
|||||||
|
|
||||||
require("src.modules.powermenu")(s)
|
require("src.modules.powermenu")(s)
|
||||||
require("src.modules.volume_osd")(s)
|
require("src.modules.volume_osd")(s)
|
||||||
require("src.modules.brightness_osd")(s)
|
--require("src.modules.brightness_osd")(s)
|
||||||
require("src.modules.bluetooth_controller")(s)
|
--require("src.modules.bluetooth_controller")(s)
|
||||||
require("src.modules.titlebar")
|
require("src.modules.titlebar")
|
||||||
require("src.modules.volume_controller")(s)
|
require("src.modules.volume_controller")(s)
|
||||||
require("src.modules.crylia_bar.init")(s)
|
require("src.modules.crylia_bar.init")(s)
|
||||||
require("src.modules.notification-center.init")(s)
|
require("src.modules.notification-center.init")(s)
|
||||||
require("src.modules.window_switcher.init")(s)
|
require("src.modules.window_switcher.init")(s)
|
||||||
|
--require("src.modules.application_launcher.init")(s)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -58,8 +57,8 @@ return function(s)
|
|||||||
id = "clearall"
|
id = "clearall"
|
||||||
},
|
},
|
||||||
id = "background4",
|
id = "background4",
|
||||||
fg = color["Grey900"],
|
fg = Theme_config.notification_center.clear_all_button.fg,
|
||||||
bg = color["Blue200"],
|
bg = Theme_config.notification_center.clear_all_button.bg,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, 12)
|
gears.shape.rounded_rect(cr, width, height, 12)
|
||||||
end,
|
end,
|
||||||
@@ -81,7 +80,7 @@ return function(s)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = color["Grey700"],
|
bg = Theme_config.notification_center.dnd.disabled,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
||||||
end,
|
end,
|
||||||
@@ -104,7 +103,7 @@ return function(s)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = color["Purple200"],
|
bg = Theme_config.notification_center.dnd.border_enabled,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
||||||
end,
|
end,
|
||||||
@@ -131,8 +130,8 @@ return function(s)
|
|||||||
},
|
},
|
||||||
active = false,
|
active = false,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.notification_center.dnd.bg,
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.dnd.border_disabled,
|
||||||
border_width = dpi(2),
|
border_width = dpi(2),
|
||||||
forced_height = dpi(40),
|
forced_height = dpi(40),
|
||||||
forced_width = dpi(80),
|
forced_width = dpi(80),
|
||||||
@@ -148,13 +147,13 @@ return function(s)
|
|||||||
left_button.visible = true
|
left_button.visible = true
|
||||||
right_button.visible = false
|
right_button.visible = false
|
||||||
toggle_button.active = not toggle_button.active
|
toggle_button.active = not toggle_button.active
|
||||||
toggle_button.border_color = color["Grey800"]
|
toggle_button.border_color = Theme_config.notification_center.dnd.border_disabled
|
||||||
User_config.dnd = false
|
User_config.dnd = false
|
||||||
else
|
else
|
||||||
left_button.visible = false
|
left_button.visible = false
|
||||||
right_button.visible = true
|
right_button.visible = true
|
||||||
toggle_button.active = not toggle_button.active
|
toggle_button.active = not toggle_button.active
|
||||||
toggle_button.border_color = color["Purple200"]
|
toggle_button.border_color = Theme_config.notification_center.dnd.border_enabled
|
||||||
User_config.dnd = true
|
User_config.dnd = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -177,9 +176,9 @@ return function(s)
|
|||||||
id = "layout12"
|
id = "layout12"
|
||||||
},
|
},
|
||||||
id = "background4",
|
id = "background4",
|
||||||
fg = color["Pink200"],
|
fg = Theme_config.notification_center.dnd.fg,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, 12)
|
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
||||||
end,
|
end,
|
||||||
forced_height = dpi(40),
|
forced_height = dpi(40),
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
@@ -227,9 +226,9 @@ return function(s)
|
|||||||
--#region Notification center
|
--#region Notification center
|
||||||
local notification_center = awful.popup {
|
local notification_center = awful.popup {
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.notification_center.bg,
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.notification_center.border_width,
|
||||||
placement = function(c)
|
placement = function(c)
|
||||||
awful.placement.top(c, { margins = dpi(10) })
|
awful.placement.top(c, { margins = dpi(10) })
|
||||||
end,
|
end,
|
||||||
@@ -237,7 +236,7 @@ return function(s)
|
|||||||
screen = s,
|
screen = s,
|
||||||
visible = false,
|
visible = false,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, 12)
|
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,8 +294,7 @@ return function(s)
|
|||||||
id = "yes",
|
id = "yes",
|
||||||
spacing_widget = {
|
spacing_widget = {
|
||||||
{
|
{
|
||||||
fg = color["Grey800"],
|
bg = Theme_config.notification_center.spacing_color,
|
||||||
bg = color["Grey800"],
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
top = dpi(40),
|
top = dpi(40),
|
||||||
@@ -365,7 +363,8 @@ return function(s)
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
Hover_signal(clear_all_widget, color["Blue200"], color["Grey900"])
|
Hover_signal(clear_all_widget, Theme_config.notification_center.clear_all_button.bg,
|
||||||
|
Theme_config.notification_center.clear_all_button.fg)
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -33,7 +32,7 @@ function nl.create_notification(n)
|
|||||||
id = "txt"
|
id = "txt"
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "background",
|
||||||
fg = color["Teal200"],
|
fg = Theme_config.notification_center.notification_list.timer_fg,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
margins = dpi(10),
|
margins = dpi(10),
|
||||||
@@ -81,7 +80,7 @@ function nl.create_notification(n)
|
|||||||
id = "arc_chart"
|
id = "arc_chart"
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "background",
|
||||||
fg = color["Teal200"],
|
fg = Theme_config.notification_center.notification_list.close_color,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
strategy = "exact",
|
strategy = "exact",
|
||||||
@@ -108,7 +107,8 @@ function nl.create_notification(n)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]),
|
image = gears.color.recolor_image(icondir .. "notification-outline.svg",
|
||||||
|
Theme_config.notification_center.notification_list.icon),
|
||||||
resize = false,
|
resize = false,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
@@ -125,7 +125,7 @@ function nl.create_notification(n)
|
|||||||
},
|
},
|
||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal
|
||||||
},
|
},
|
||||||
fg = color["Teal200"],
|
fg = Theme_config.notification_center.notification_list.title_fg,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
margins = dpi(10),
|
margins = dpi(10),
|
||||||
@@ -141,8 +141,8 @@ function nl.create_notification(n)
|
|||||||
layout = wibox.layout.align.horizontal
|
layout = wibox.layout.align.horizontal
|
||||||
},
|
},
|
||||||
id = "arc_app_bg",
|
id = "arc_app_bg",
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.notification_list.title_border_color,
|
||||||
border_width = dpi(2),
|
border_width = Theme_config.notification_center.notification_list.title_border_width,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -211,12 +211,10 @@ function nl.create_notification(n)
|
|||||||
widget = wibox.container.constraint
|
widget = wibox.container.constraint
|
||||||
},
|
},
|
||||||
pk = #nl.notification_list + 1,
|
pk = #nl.notification_list + 1,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.notification_center.notification_list.notification_bg,
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.notification_list.notification_border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.notification_center.notification_list.notification_border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.notification_center.notification_list.notification_shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, 8)
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +233,8 @@ function nl.create_notification(n)
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
Hover_signal(close_widget.const.background, color["Grey900"], color["Teal200"])
|
Hover_signal(close_widget.const.background, Theme_config.notification_center.notification_list.close_bg,
|
||||||
|
Theme_config.notification_center.notification_list.close_color)
|
||||||
|
|
||||||
notification:connect_signal(
|
notification:connect_signal(
|
||||||
"mouse::enter",
|
"mouse::enter",
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -43,7 +42,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{ -- Username
|
{ -- Username
|
||||||
id = "username_prefix",
|
id = "username_prefix",
|
||||||
image = gears.color.recolor_image(icondir .. "user.svg", color["Blue200"]),
|
image = gears.color.recolor_image(icondir .. "user.svg",
|
||||||
|
Theme_config.notification_center.profile.username_icon_color),
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "left",
|
halign = "left",
|
||||||
resize = false,
|
resize = false,
|
||||||
@@ -61,7 +61,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
id = "os_prefix",
|
id = "os_prefix",
|
||||||
image = gears.color.recolor_image(icondir .. "laptop.svg", color["Blue200"]),
|
image = gears.color.recolor_image(icondir .. "laptop.svg",
|
||||||
|
Theme_config.notification_center.profile.os_prefix_icon_color),
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "left",
|
halign = "left",
|
||||||
resize = false,
|
resize = false,
|
||||||
@@ -79,7 +80,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
id = "kernel_prefix",
|
id = "kernel_prefix",
|
||||||
image = gears.color.recolor_image(icondir .. "penguin.svg", color["Blue200"]),
|
image = gears.color.recolor_image(icondir .. "penguin.svg",
|
||||||
|
Theme_config.notification_center.profile.kernel_icon_color),
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "left",
|
halign = "left",
|
||||||
resize = false,
|
resize = false,
|
||||||
@@ -97,7 +99,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
id = "uptime_prefix",
|
id = "uptime_prefix",
|
||||||
image = gears.color.recolor_image(icondir .. "clock.svg", color["Blue200"]),
|
image = gears.color.recolor_image(icondir .. "clock.svg",
|
||||||
|
Theme_config.notification_center.profile.uptime_icon_color),
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "left",
|
halign = "left",
|
||||||
resize = false,
|
resize = false,
|
||||||
@@ -129,12 +132,10 @@ return function()
|
|||||||
widget = wibox.layout.fixed.vertical
|
widget = wibox.layout.fixed.vertical
|
||||||
},
|
},
|
||||||
id = "wrapper",
|
id = "wrapper",
|
||||||
fg = color["Green200"],
|
fg = Theme_config.notification_center.profile.fg,
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.profile.border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.notification_center.profile.border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.notification_center.profile.shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
id = "const",
|
id = "const",
|
||||||
@@ -177,7 +178,6 @@ return function()
|
|||||||
profile_widget:get_children_by_id("username")[1].text = stdout:gsub("\n", "") or ""
|
profile_widget:get_children_by_id("username")[1].text = stdout:gsub("\n", "") or ""
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function to fetch uptime async
|
-- function to fetch uptime async
|
||||||
|
|||||||
@@ -4,11 +4,9 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local naughty = require("naughty")
|
|
||||||
|
|
||||||
-- Icon directory path
|
-- Icon directory path
|
||||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||||
@@ -43,7 +41,8 @@ return function(s)
|
|||||||
|
|
||||||
local shuffle_button = wibox.widget {
|
local shuffle_button = wibox.widget {
|
||||||
resize = false,
|
resize = false,
|
||||||
image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"]),
|
image = gears.color.recolor_image(icondir .. "shuffle.svg",
|
||||||
|
Theme_config.notification_center.song_info.shuffle_disabled),
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
@@ -55,10 +54,12 @@ return function(s)
|
|||||||
function(stdout)
|
function(stdout)
|
||||||
if stdout:match("On") then
|
if stdout:match("On") then
|
||||||
awful.spawn.with_shell("playerctl shuffle off")
|
awful.spawn.with_shell("playerctl shuffle off")
|
||||||
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"])
|
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
|
||||||
|
Theme_config.notification_center.song_info.shuffle_enabled)
|
||||||
else
|
else
|
||||||
awful.spawn.with_shell("playerctl shuffle on")
|
awful.spawn.with_shell("playerctl shuffle on")
|
||||||
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Green200"])
|
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
|
||||||
|
Theme_config.notification_center.song_info.shuffle_disabled)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -69,9 +70,11 @@ return function(s)
|
|||||||
"playerctl shuffle",
|
"playerctl shuffle",
|
||||||
function(stdout)
|
function(stdout)
|
||||||
if stdout:match("On") then
|
if stdout:match("On") then
|
||||||
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Green200"])
|
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
|
||||||
|
Theme_config.notification_center.song_info.shuffle_enabled)
|
||||||
else
|
else
|
||||||
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg", color["Grey800"])
|
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
|
||||||
|
Theme_config.notification_center.song_info.shuffle_disabled)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -81,7 +84,7 @@ return function(s)
|
|||||||
|
|
||||||
local repeat_button = wibox.widget {
|
local repeat_button = wibox.widget {
|
||||||
resize = false,
|
resize = false,
|
||||||
image = gears.color.recolor_image(icondir .. "repeat.svg", color["Grey800"]),
|
image = gears.color.recolor_image(icondir .. "repeat.svg", Theme_config.notification_center.song_info.repeat_disabled),
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
@@ -95,11 +98,14 @@ return function(s)
|
|||||||
function(stdout)
|
function(stdout)
|
||||||
local loop_mode = stdout:gsub("\n", "")
|
local loop_mode = stdout:gsub("\n", "")
|
||||||
if loop_mode == "Track" then
|
if loop_mode == "Track" then
|
||||||
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"), color["Green200"])
|
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"),
|
||||||
|
Theme_config.notification_center.song_info.repeat_single)
|
||||||
elseif loop_mode == "None" then
|
elseif loop_mode == "None" then
|
||||||
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Grey800"])
|
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
|
||||||
|
Theme_config.notification_center.song_info.repeat_disabled)
|
||||||
elseif loop_mode == "Playlist" then
|
elseif loop_mode == "Playlist" then
|
||||||
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Green200"])
|
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
|
||||||
|
Theme_config.notification_center.song_info.repeat_all)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -114,7 +120,7 @@ return function(s)
|
|||||||
resize = false,
|
resize = false,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
image = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Teal200"]),
|
image = gears.color.recolor_image(icondir .. "skip-prev.svg", Theme_config.notification_center.song_info.prev_enabled),
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +140,8 @@ return function(s)
|
|||||||
resize = false,
|
resize = false,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
image = gears.color.recolor_image(icondir .. "play-pause.svg", color["Teal200"]),
|
image = gears.color.recolor_image(icondir .. "play-pause.svg",
|
||||||
|
Theme_config.notification_center.song_info.play_enabled),
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +156,7 @@ return function(s)
|
|||||||
resize = false,
|
resize = false,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
image = gears.color.recolor_image(icondir .. "skip-next.svg", color["Teal200"]),
|
image = gears.color.recolor_image(icondir .. "skip-next.svg", Theme_config.notification_center.song_info.next_enabled),
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,13 +180,16 @@ return function(s)
|
|||||||
local loop_mode = stdout:gsub("\n", "")
|
local loop_mode = stdout:gsub("\n", "")
|
||||||
if loop_mode == "None" then
|
if loop_mode == "None" then
|
||||||
awful.spawn.with_shell("playerctl loop playlist")
|
awful.spawn.with_shell("playerctl loop playlist")
|
||||||
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Green200"])
|
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
|
||||||
|
Theme_config.notification_center.song_info.repeat_all)
|
||||||
elseif loop_mode == "Playlist" then
|
elseif loop_mode == "Playlist" then
|
||||||
awful.spawn.with_shell("playerctl loop track")
|
awful.spawn.with_shell("playerctl loop track")
|
||||||
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"), color["Green200"])
|
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat-once.svg"),
|
||||||
|
Theme_config.notification_center.song_info.repeat_single)
|
||||||
elseif loop_mode == "Track" then
|
elseif loop_mode == "Track" then
|
||||||
awful.spawn.with_shell("playerctl loop none")
|
awful.spawn.with_shell("playerctl loop none")
|
||||||
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"), color["Grey800"])
|
repeat_button.image = gears.color.recolor_image(gears.surface.load_uncached(icondir .. "repeat.svg"),
|
||||||
|
Theme_config.notification_center.song_info.repeat_disabled)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -187,9 +197,12 @@ return function(s)
|
|||||||
|
|
||||||
repeat_button:buttons(gears.table.join(awful.button({}, 1, loop_handler)))
|
repeat_button:buttons(gears.table.join(awful.button({}, 1, loop_handler)))
|
||||||
|
|
||||||
button_hover_effect(prev_button, "skip-prev.svg", color["Teal200"], color["Teal300"])
|
button_hover_effect(prev_button, "skip-prev.svg", Theme_config.notification_center.song_info.prev_enabled,
|
||||||
button_hover_effect(pause_play_button, "play-pause.svg", color["Teal200"], color["Teal300"])
|
Theme_config.notification_center.song_info.prev_hover)
|
||||||
button_hover_effect(next_button, "skip-next.svg", color["Teal200"], color["Teal300"])
|
button_hover_effect(pause_play_button, "play-pause.svg", Theme_config.notification_center.song_info.play_enabled,
|
||||||
|
Theme_config.notification_center.song_info.play_hover)
|
||||||
|
button_hover_effect(next_button, "skip-next.svg", Theme_config.notification_center.song_info.next_enabled,
|
||||||
|
Theme_config.notification_center.song_info.next_hover)
|
||||||
|
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
@@ -202,7 +215,7 @@ return function(s)
|
|||||||
{
|
{
|
||||||
{ -- Album art
|
{ -- Album art
|
||||||
{
|
{
|
||||||
image = "default image",
|
image = icondir .. "default_image.svg",
|
||||||
resize = true,
|
resize = true,
|
||||||
clip_shape = function(cr, width, height)
|
clip_shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
||||||
@@ -223,15 +236,16 @@ return function(s)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Title
|
{ --Title
|
||||||
halign = "center",
|
valign = "center",
|
||||||
align = "center",
|
align = "center",
|
||||||
widget = wibox.widget.textbox,
|
widget = wibox.widget.textbox,
|
||||||
id = "textbox4"
|
id = "textbox4"
|
||||||
},
|
},
|
||||||
fg = color["Pink200"],
|
fg = Theme_config.notification_center.song_info.title_fg,
|
||||||
id = "textbox5",
|
id = "textbox5",
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
|
id = "textbox_const",
|
||||||
strategy = "max",
|
strategy = "max",
|
||||||
width = dpi(400),
|
width = dpi(400),
|
||||||
widget = wibox.container.constraint
|
widget = wibox.container.constraint
|
||||||
@@ -250,7 +264,7 @@ return function(s)
|
|||||||
widget = wibox.widget.textbox,
|
widget = wibox.widget.textbox,
|
||||||
id = "textbox3"
|
id = "textbox3"
|
||||||
},
|
},
|
||||||
fg = color["Teal200"],
|
fg = Theme_config.notification_center.song_info.artist_fg,
|
||||||
id = "background",
|
id = "background",
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
@@ -301,7 +315,7 @@ return function(s)
|
|||||||
widget = wibox.widget.textbox,
|
widget = wibox.widget.textbox,
|
||||||
id = "textbox2"
|
id = "textbox2"
|
||||||
},
|
},
|
||||||
fg = color["Lime200"],
|
fg = Theme_config.notification_center.song_info.duration_fg,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
id = "background3"
|
id = "background3"
|
||||||
},
|
},
|
||||||
@@ -311,8 +325,8 @@ return function(s)
|
|||||||
},
|
},
|
||||||
{ -- Progressbar
|
{ -- Progressbar
|
||||||
{
|
{
|
||||||
color = color["Purple200"],
|
color = Theme_config.notification_center.song_info.progress_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.song_info.progress_background_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 50,
|
value = 50,
|
||||||
forced_height = dpi(5),
|
forced_height = dpi(5),
|
||||||
@@ -335,7 +349,7 @@ return function(s)
|
|||||||
id = "text1"
|
id = "text1"
|
||||||
},
|
},
|
||||||
id = "background2",
|
id = "background2",
|
||||||
fg = color["Lime200"],
|
fg = Theme_config.notification_center.song_info.duration_fg,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
id = "margin3",
|
id = "margin3",
|
||||||
@@ -354,11 +368,9 @@ return function(s)
|
|||||||
margins = dpi(10)
|
margins = dpi(10)
|
||||||
},
|
},
|
||||||
id = "background1",
|
id = "background1",
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.song_info.border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.notification_center.song_info.border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.notification_center.song_info.shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
id = "margin1",
|
id = "margin1",
|
||||||
@@ -427,9 +439,12 @@ return function(s)
|
|||||||
function(stdout2)
|
function(stdout2)
|
||||||
local length = stdout2:gsub("\n", "")
|
local length = stdout2:gsub("\n", "")
|
||||||
if length ~= "" then
|
if length ~= "" then
|
||||||
local length_formated = string.format("%02d:%02d", math.floor(tonumber(length or 1) / 60000000) or 0, (math.floor(tonumber(length or 1) / 1000000) % 60) or 0)
|
local length_formated = string.format("%02d:%02d", math.floor(tonumber(length or 1) / 60000000) or 0,
|
||||||
music_widget:get_children_by_id("progressbar1")[1].max_value = tonumber(math.floor(tonumber(length) / 1000000))
|
(math.floor(tonumber(length or 1) / 1000000) % 60) or 0)
|
||||||
music_widget:get_children_by_id("text1")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>", color["Teal200"], length_formated)
|
music_widget:get_children_by_id("progressbar1")[1].max_value = tonumber(math.floor(tonumber(length) /
|
||||||
|
1000000))
|
||||||
|
music_widget:get_children_by_id("text1")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>"
|
||||||
|
, Theme_config.notification_center.song_info.duration_fg, length_formated)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -442,7 +457,8 @@ return function(s)
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
-- Update track id
|
-- Update track id
|
||||||
trackid, artist, title = stdout, music_widget:get_children_by_id("textbox3")[1].text, music_widget:get_children_by_id("textbox4")[1].text
|
trackid, artist, title = stdout, music_widget:get_children_by_id("textbox3")[1].text,
|
||||||
|
music_widget:get_children_by_id("textbox4")[1].text
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
-- Always update the current song progression
|
-- Always update the current song progression
|
||||||
@@ -451,8 +467,10 @@ return function(s)
|
|||||||
function(stdout)
|
function(stdout)
|
||||||
local time = stdout:gsub("\n", "")
|
local time = stdout:gsub("\n", "")
|
||||||
if time ~= "" then
|
if time ~= "" then
|
||||||
local time_formated = string.format("%02d:%02d", math.floor(tonumber(time or "1") / 60), math.floor(tonumber(time or "1")) % 60)
|
local time_formated = string.format("%02d:%02d", math.floor(tonumber(time or "1") / 60),
|
||||||
music_widget:get_children_by_id("textbox2")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>", color["Teal200"], time_formated)
|
math.floor(tonumber(time or "1")) % 60)
|
||||||
|
music_widget:get_children_by_id("textbox2")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>"
|
||||||
|
, Theme_config.notification_center.song_info.duration_fg, time_formated)
|
||||||
music_widget:get_children_by_id("progressbar1")[1].value = tonumber(time)
|
music_widget:get_children_by_id("progressbar1")[1].value = tonumber(time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ return function()
|
|||||||
return wibox.widget {
|
return wibox.widget {
|
||||||
{
|
{
|
||||||
forced_height = dpi(2),
|
forced_height = dpi(2),
|
||||||
bg = color["Grey800"],
|
bg = Theme_config.notification_center.spacing_line.color,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
left = dpi(80),
|
left = dpi(80),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -32,12 +31,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Blue200"],
|
color = Theme_config.notification_center.status_bar.cpu_usage_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -56,7 +55,8 @@ return function()
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
image = gears.color.recolor_image(icondir .. "cpu/cpu.svg", color["Cyan200"]),
|
image = gears.color.recolor_image(icondir .. "cpu/cpu.svg",
|
||||||
|
Theme_config.notification_center.status_bar.cpu_usage_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
@@ -102,12 +102,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Blue200"],
|
color = Theme_config.notification_center.status_bar.cpu_temp_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -127,7 +127,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
id = "icon1",
|
id = "icon1",
|
||||||
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg", color["Cyan200"]),
|
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg",
|
||||||
|
Theme_config.notification_center.status_bar.cpu_temp_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -171,7 +172,8 @@ return function()
|
|||||||
elseif cpu_temp >= 80 then
|
elseif cpu_temp >= 80 then
|
||||||
temp_icon = icondir .. "cpu/thermometer-high.svg"
|
temp_icon = icondir .. "cpu/thermometer-high.svg"
|
||||||
end
|
end
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon, color["Blue200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon,
|
||||||
|
Theme_config.notification_center.status_bar.cpu_temp_color)
|
||||||
tooltip.text = "CPU Temp: " .. cpu_temp .. "°C"
|
tooltip.text = "CPU Temp: " .. cpu_temp .. "°C"
|
||||||
rubato_timer.target = cpu_temp
|
rubato_timer.target = cpu_temp
|
||||||
end
|
end
|
||||||
@@ -181,12 +183,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Red200"],
|
color = Theme_config.notification_center.status_bar.ram_usage_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -205,7 +207,8 @@ return function()
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
image = gears.color.recolor_image(icondir .. "cpu/ram.svg", color["Red200"]),
|
image = gears.color.recolor_image(icondir .. "cpu/ram.svg",
|
||||||
|
Theme_config.notification_center.status_bar.ram_usage_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -239,7 +242,10 @@ return function()
|
|||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::ram_widget",
|
"update::ram_widget",
|
||||||
function(MemTotal, MemFree, MemAvailable)
|
function(MemTotal, _, MemAvailable)
|
||||||
|
if not MemTotal or not MemAvailable then
|
||||||
|
return
|
||||||
|
end
|
||||||
local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5)
|
local ram_usage = math.floor(((MemTotal - MemAvailable) / MemTotal * 100) + 0.5)
|
||||||
tooltip.text = "RAM Usage: " .. ram_usage .. "%"
|
tooltip.text = "RAM Usage: " .. ram_usage .. "%"
|
||||||
rubato_timer.target = ram_usage
|
rubato_timer.target = ram_usage
|
||||||
@@ -250,12 +256,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Green200"],
|
color = Theme_config.notification_center.status_bar.gpu_usage_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -274,7 +280,8 @@ return function()
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
image = gears.color.recolor_image(icondir .. "cpu/gpu.svg", color["Green200"]),
|
image = gears.color.recolor_image(icondir .. "cpu/gpu.svg",
|
||||||
|
Theme_config.notification_center.status_bar.gpu_usage_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -318,12 +325,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Green200"],
|
color = Theme_config.notification_center.status_bar.gpu_temp_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -343,7 +350,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
id = "icon1",
|
id = "icon1",
|
||||||
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg", color["Green200"]),
|
image = gears.color.recolor_image(icondir .. "cpu/thermometer.svg",
|
||||||
|
Theme_config.notification_center.status_bar.gpu_temp_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -395,7 +403,8 @@ return function()
|
|||||||
temp_num = "NaN"
|
temp_num = "NaN"
|
||||||
temp_icon = icondir .. "cpu/thermometer-low.svg"
|
temp_icon = icondir .. "cpu/thermometer-low.svg"
|
||||||
end
|
end
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon, color["Green200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(temp_icon,
|
||||||
|
Theme_config.notification_center.status_bar.gpu_temp_color)
|
||||||
tooltip.text = "GPU Temp: " .. temp_num .. "°C"
|
tooltip.text = "GPU Temp: " .. temp_num .. "°C"
|
||||||
rubato_timer.target = temp_num
|
rubato_timer.target = temp_num
|
||||||
end
|
end
|
||||||
@@ -405,12 +414,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Yellow200"],
|
color = Theme_config.notification_center.status_bar.volume_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -430,7 +439,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
id = "icon1",
|
id = "icon1",
|
||||||
image = gears.color.recolor_image(icondir .. "audio/volume-high.svg", color["Yellow200"]),
|
image = gears.color.recolor_image(icondir .. "audio/volume-high.svg",
|
||||||
|
Theme_config.notification_center.status_bar.volume_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -464,10 +474,25 @@ return function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::volume_widget",
|
"audio::get",
|
||||||
function(volume, volume_icon)
|
function(muted, volume)
|
||||||
--w:get_children_by_id("progressbar1")[1].value = volume
|
local icon = icondir .. "audio/volume"
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(volume_icon, color["Yellow200"])
|
volume = tonumber(volume)
|
||||||
|
if muted then
|
||||||
|
icon = icon .. "-mute"
|
||||||
|
else
|
||||||
|
if volume < 1 then
|
||||||
|
icon = icon .. "-mute"
|
||||||
|
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
|
||||||
|
end
|
||||||
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(icon .. ".svg",
|
||||||
|
Theme_config.notification_center.status_bar.volume_color)
|
||||||
tooltip.text = "Volume: " .. volume .. "%"
|
tooltip.text = "Volume: " .. volume .. "%"
|
||||||
rubato_timer.target = volume
|
rubato_timer.target = volume
|
||||||
end
|
end
|
||||||
@@ -477,12 +502,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Purple200"],
|
color = Theme_config.notification_center.status_bar.microphone_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -502,7 +527,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
id = "icon1",
|
id = "icon1",
|
||||||
image = gears.color.recolor_image(icondir .. "audio/microphone.svg", color["Purple200"]),
|
image = gears.color.recolor_image(icondir .. "audio/microphone.svg",
|
||||||
|
Theme_config.notification_center.status_bar.microphone_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -536,12 +562,17 @@ return function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::microphone_widget",
|
"microphone::get",
|
||||||
function(microphone, microphone_icon)
|
function(muted, volume)
|
||||||
--w:get_children_by_id("progressbar1")[1].value = microphone
|
local icon = icondir .. "audio/microphone"
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(microphone_icon, color["Purple200"])
|
volume = tonumber(volume)
|
||||||
tooltip.text = "Microphone: " .. microphone .. "%"
|
if muted or (volume < 1) then
|
||||||
rubato_timer.target = microphone
|
icon = icon .. "-off"
|
||||||
|
end
|
||||||
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(icon .. ".svg",
|
||||||
|
Theme_config.notification_center.status_bar.microphone_color)
|
||||||
|
tooltip.text = "Microphone: " .. volume .. "%"
|
||||||
|
rubato_timer.target = volume
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif widget == "backlight" then
|
elseif widget == "backlight" then
|
||||||
@@ -549,12 +580,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Pink200"],
|
color = Theme_config.notification_center.status_bar.backlight_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -574,7 +605,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
id = "icon1",
|
id = "icon1",
|
||||||
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg", color["Pink200"]),
|
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg" .. ".svg",
|
||||||
|
Theme_config.notification_center.status_bar.backlight_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -610,8 +642,8 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::backlight",
|
"update::backlight",
|
||||||
function(backlight, backlight_icon)
|
function(backlight, backlight_icon)
|
||||||
--w:get_children_by_id("progressbar1")[1].value = backlight
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon,
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon, color["Pink200"])
|
Theme_config.notification_center.status_bar.backlight_color)
|
||||||
tooltip.text = "Backlight: " .. backlight .. "%"
|
tooltip.text = "Backlight: " .. backlight .. "%"
|
||||||
rubato_timer.target = backlight
|
rubato_timer.target = backlight
|
||||||
end
|
end
|
||||||
@@ -621,12 +653,12 @@ return function()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ --Bar
|
{ --Bar
|
||||||
color = color["Purple200"],
|
color = Theme_config.notification_center.status_bar.battery_color,
|
||||||
background_color = color["Grey800"],
|
background_color = Theme_config.notification_center.status_bar.bar_bg_color,
|
||||||
max_value = 100,
|
max_value = 100,
|
||||||
value = 0,
|
value = 0,
|
||||||
forced_height = dpi(8),
|
forced_height = dpi(8),
|
||||||
shape = function(cr, width, heigth)
|
shape = function(cr)
|
||||||
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
gears.shape.rounded_bar(cr, dpi(58), dpi(8))
|
||||||
end,
|
end,
|
||||||
id = "progressbar1",
|
id = "progressbar1",
|
||||||
@@ -646,7 +678,8 @@ return function()
|
|||||||
{
|
{
|
||||||
{ --Icon
|
{ --Icon
|
||||||
id = "icon1",
|
id = "icon1",
|
||||||
image = gears.color.recolor_image(icondir .. "battery/battery.svg", color["Purple200"]),
|
image = gears.color.recolor_image(icondir .. "battery/battery.svg",
|
||||||
|
Theme_config.notification_center.status_bar.battery_color),
|
||||||
halign = "center",
|
halign = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
@@ -682,8 +715,8 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::battery_widget",
|
"update::battery_widget",
|
||||||
function(battery, battery_icon)
|
function(battery, battery_icon)
|
||||||
--w:get_children_by_id("progressbar1")[1].value = battery
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon,
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon, color["Purple200"])
|
Theme_config.notification_center.status_bar.battery_color)
|
||||||
tooltip.text = "Battery: " .. battery .. "%"
|
tooltip.text = "Battery: " .. battery .. "%"
|
||||||
rubato_timer.target = battery
|
rubato_timer.target = battery
|
||||||
end
|
end
|
||||||
@@ -714,11 +747,9 @@ return function()
|
|||||||
},
|
},
|
||||||
forced_height = dpi(120),
|
forced_height = dpi(120),
|
||||||
forced_width = dpi(500),
|
forced_width = dpi(500),
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.status_bar.border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.notification_center.status_bar.border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.notification_center.status_bar.shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(10))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
top = dpi(10),
|
top = dpi(10),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -66,20 +65,21 @@ return function()
|
|||||||
widget = wibox.widget.textbox,
|
widget = wibox.widget.textbox,
|
||||||
id = "description"
|
id = "description"
|
||||||
},
|
},
|
||||||
fg = color["LightBlue200"],
|
fg = Theme_config.notification_center.weather.description_fg,
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
{ -- line
|
{ -- line
|
||||||
forced_height = dpi(4),
|
forced_height = dpi(4),
|
||||||
forced_width = dpi(10),
|
forced_width = dpi(10),
|
||||||
bg = color["Grey800"],
|
bg = Theme_config.notification_center.weather.line_bg,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
id = "line"
|
id = "line"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ -- Speed
|
{ -- Speed
|
||||||
{
|
{
|
||||||
image = gears.color.recolor_image(icondir .. "weather-windy.svg", color["OrangeA200"]),
|
image = gears.color.recolor_image(icondir .. "weather-windy.svg",
|
||||||
|
Theme_config.notification_center.weather.speed_icon_color),
|
||||||
resize = true,
|
resize = true,
|
||||||
forced_width = dpi(24),
|
forced_width = dpi(24),
|
||||||
forced_height = dpi(24),
|
forced_height = dpi(24),
|
||||||
@@ -111,7 +111,8 @@ return function()
|
|||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
image = gears.color.recolor_image(icondir .. "humidity.svg", color["OrangeA200"]),
|
image = gears.color.recolor_image(icondir .. "humidity.svg",
|
||||||
|
Theme_config.notification_center.weather.humidity_icon_color),
|
||||||
id = "humidity_icon"
|
id = "humidity_icon"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -142,11 +143,9 @@ return function()
|
|||||||
widget = wibox.container.place
|
widget = wibox.container.place
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "background",
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.notification_center.weather.border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.notification_center.weather.border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.notification_center.weather.shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
id = "margin",
|
id = "margin",
|
||||||
@@ -200,7 +199,7 @@ return function()
|
|||||||
weather_widget:get_children_by_id("city_country")[1].text = city .. ", " .. country
|
weather_widget:get_children_by_id("city_country")[1].text = city .. ", " .. country
|
||||||
weather_widget:get_children_by_id("description")[1].text = description:sub(1, 1):upper() ..
|
weather_widget:get_children_by_id("description")[1].text = description:sub(1, 1):upper() ..
|
||||||
description:sub(2)
|
description:sub(2)
|
||||||
weather_widget:get_children_by_id("line")[1].bg = color["Grey800"]
|
weather_widget:get_children_by_id("line")[1].bg = Theme_config.notification_center.weather.line_color
|
||||||
weather_widget:get_children_by_id("speed")[1].text = speed .. " m/s"
|
weather_widget:get_children_by_id("speed")[1].text = speed .. " m/s"
|
||||||
weather_widget:get_children_by_id("humidity")[1].text = humidity .. "%"
|
weather_widget:get_children_by_id("humidity")[1].text = humidity .. "%"
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ return function(s)
|
|||||||
-- TODO: using gears.color to recolor a SVG will make it look super low res
|
-- TODO: using gears.color to recolor a SVG will make it look super low res
|
||||||
-- currently I recolor it in the .svg file directly, but later implement
|
-- currently I recolor it in the .svg file directly, but later implement
|
||||||
-- a better way to recolor a SVG
|
-- a better way to recolor a SVG
|
||||||
-- image = gears.color.recolor_image(icon, color["Grey900"]),
|
|
||||||
image = icon,
|
image = icon,
|
||||||
resize = true,
|
resize = true,
|
||||||
forced_height = dpi(30),
|
forced_height = dpi(30),
|
||||||
|
|||||||
@@ -14,9 +14,12 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
|
|||||||
awful.titlebar.enable_tooltip = true
|
awful.titlebar.enable_tooltip = true
|
||||||
awful.titlebar.fallback_name = 'Client'
|
awful.titlebar.fallback_name = 'Client'
|
||||||
|
|
||||||
|
-- Normal AND Focus(active/inactive) have to be set or errors will appear in stdout
|
||||||
Theme.titlebar_close_button_normal = icondir .. "close.svg"
|
Theme.titlebar_close_button_normal = icondir .. "close.svg"
|
||||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
Theme.titlebar_close_button_focus = icondir .. "close.svg"
|
||||||
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"
|
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"
|
||||||
|
Theme.titlebar_minimize_button_focus = icondir .. "minimize.svg"
|
||||||
|
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||||
|
|
||||||
@@ -75,7 +78,9 @@ local create_titlebar = function(c, size)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
awful.titlebar.widget.closebutton(c),
|
{
|
||||||
|
widget = awful.titlebar.widget.closebutton(c),
|
||||||
|
},
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = Theme_config.titlebar.close_button_bg,
|
bg = Theme_config.titlebar.close_button_bg,
|
||||||
shape = function(cr, height, width)
|
shape = function(cr, height, width)
|
||||||
@@ -84,7 +89,9 @@ local create_titlebar = function(c, size)
|
|||||||
id = "closebutton"
|
id = "closebutton"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
awful.titlebar.widget.maximizedbutton(c),
|
{
|
||||||
|
widget = awful.titlebar.widget.maximizedbutton(c),
|
||||||
|
},
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = Theme_config.titlebar.minimize_button_bg,
|
bg = Theme_config.titlebar.minimize_button_bg,
|
||||||
shape = function(cr, height, width)
|
shape = function(cr, height, width)
|
||||||
@@ -93,7 +100,9 @@ local create_titlebar = function(c, size)
|
|||||||
id = "maximizebutton"
|
id = "maximizebutton"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
awful.titlebar.widget.minimizebutton(c),
|
{
|
||||||
|
widget = awful.titlebar.widget.minimizebutton(c),
|
||||||
|
},
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = Theme_config.titlebar.maximize_button_bg,
|
bg = Theme_config.titlebar.maximize_button_bg,
|
||||||
shape = function(cr, height, width)
|
shape = function(cr, height, width)
|
||||||
@@ -115,7 +124,7 @@ local create_titlebar = function(c, size)
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
widget = awful.widget.clienticon(c)
|
widget = awful.titlebar.widget.iconwidget(c),
|
||||||
},
|
},
|
||||||
margins = dpi(5),
|
margins = dpi(5),
|
||||||
widget = wibox.container.margin
|
widget = wibox.container.margin
|
||||||
@@ -200,7 +209,7 @@ client.connect_signal(
|
|||||||
create_titlebar(c, dpi(35))
|
create_titlebar(c, dpi(35))
|
||||||
end
|
end
|
||||||
|
|
||||||
if not c.floating then
|
if not c.floating or c.maximized or c.fullscreen then
|
||||||
awful.titlebar.hide(c, "left")
|
awful.titlebar.hide(c, "left")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -43,12 +42,10 @@ return function(s)
|
|||||||
widget = wibox.container.margin
|
widget = wibox.container.margin
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "background",
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.volume_controller.device_bg,
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.volume_controller.device_border_color,
|
||||||
border_width = dpi(2),
|
border_width = Theme_config.volume_controller.device_border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.volume_controller.device_shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
if sink == true then
|
if sink == true then
|
||||||
@@ -66,14 +63,14 @@ return function(s)
|
|||||||
function(new_node)
|
function(new_node)
|
||||||
if node == new_node then
|
if node == new_node then
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
||||||
color["Grey900"])
|
Theme_config.volume_controller.device_headphones_selected_icon_color)
|
||||||
device.bg = color["Purple200"]
|
device.bg = Theme_config.volume_controller.device_headphones_selected_bg
|
||||||
device.fg = color["Grey900"]
|
device.fg = Theme_config.volume_controller.device_headphones_selected_fg
|
||||||
else
|
else
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
||||||
color["Purple200"])
|
Theme_config.volume_controller.device_headphones_selected_icon_color)
|
||||||
device.bg = color["Grey900"]
|
device.bg = Theme_config.volume_controller.device_bg
|
||||||
device.fg = color["Purple200"]
|
device.fg = Theme_config.volume_controller.device_headphones_fg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -83,20 +80,19 @@ return function(s)
|
|||||||
local node_active = stdout:gsub("\n", "")
|
local node_active = stdout:gsub("\n", "")
|
||||||
if node == node_active then
|
if node == node_active then
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
||||||
color["Grey900"])
|
Theme_config.volume_controller.device_icon_color)
|
||||||
device.bg = color["Purple200"]
|
device.bg = Theme_config.volume_controller.device_headphones_selected_bg
|
||||||
device.fg = color["Grey900"]
|
device.fg = Theme_config.volume_controller.device_headphones_selected_fg
|
||||||
else
|
else
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg",
|
||||||
color["Purple200"])
|
Theme_config.volume_controller.device_headphones_selected_icon_color)
|
||||||
device.bg = color["Grey900"]
|
device.bg = Theme_config.volume_controller.device_bg
|
||||||
device.fg = color["Purple200"]
|
device.fg = Theme_config.volume_controller.device_headphones_fg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
awesome.emit_signal("update::bg_sink", node)
|
awesome.emit_signal("update::bg_sink", node)
|
||||||
else
|
else
|
||||||
|
|
||||||
device:connect_signal(
|
device:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function()
|
function()
|
||||||
@@ -111,14 +107,14 @@ return function(s)
|
|||||||
function(new_node)
|
function(new_node)
|
||||||
if node == new_node then
|
if node == new_node then
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
||||||
color["Grey900"])
|
Theme_config.volume_controller.device_icon_color)
|
||||||
device.bg = color["Blue200"]
|
device.bg = Theme_config.volume_controller.device_microphone_selected_bg
|
||||||
device.fg = color["Grey900"]
|
device.fg = Theme_config.volume_controller.device_microphone_selected_fg
|
||||||
else
|
else
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
||||||
color["Blue200"])
|
Theme_config.volume_controller.device_microphone_selected_icon_color)
|
||||||
device.bg = color["Grey900"]
|
device.bg = Theme_config.volume_controller.device_bg
|
||||||
device.fg = color["Blue200"]
|
device.fg = Theme_config.volume_controller.device_microphone_fg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -128,14 +124,14 @@ return function(s)
|
|||||||
local node_active = stdout:gsub("\n", "")
|
local node_active = stdout:gsub("\n", "")
|
||||||
if node == node_active then
|
if node == node_active then
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
||||||
color["Grey900"])
|
Theme_config.volume_controller.device_icon_color)
|
||||||
device.bg = color["Blue200"]
|
device.bg = Theme_config.volume_controller.device_microphone_selected_bg
|
||||||
device.fg = color["Grey900"]
|
device.fg = Theme_config.volume_controller.device_microphone_selected_fg
|
||||||
else
|
else
|
||||||
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg",
|
||||||
color["Blue200"])
|
Theme_config.volume_controller.device_microphone_selected_icon_color)
|
||||||
device.bg = color["Grey900"]
|
device.bg = Theme_config.volume_controller.device_bg
|
||||||
device.fg = color["Blue200"]
|
device.fg = Theme_config.volume_controller.device_microphone_fg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -165,12 +161,10 @@ return function(s)
|
|||||||
strategy = "max",
|
strategy = "max",
|
||||||
widget = wibox.container.constraint
|
widget = wibox.container.constraint
|
||||||
},
|
},
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.volume_controller.list_border_color,
|
||||||
border_width = dpi(2),
|
border_width = Theme_config.volume_controller.list_border_width,
|
||||||
id = "volume_device_background",
|
id = "volume_device_background",
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.volume_controller.list_shape,
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
left = dpi(10),
|
left = dpi(10),
|
||||||
@@ -200,11 +194,9 @@ return function(s)
|
|||||||
widget = wibox.container.constraint
|
widget = wibox.container.constraint
|
||||||
},
|
},
|
||||||
id = "volume_device_background",
|
id = "volume_device_background",
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.volume_controller.list_border_color,
|
||||||
border_width = dpi(2),
|
border_width = Theme_config.volume_controller.list_border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.volume_controller.list_shape,
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
left = dpi(10),
|
left = dpi(10),
|
||||||
@@ -222,7 +214,8 @@ return function(s)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
resize = false,
|
resize = false,
|
||||||
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]),
|
image = gears.color.recolor_image(icondir .. "menu-down.svg",
|
||||||
|
Theme_config.volume_controller.device_headphones_selected_icon_color),
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
@@ -246,11 +239,9 @@ return function(s)
|
|||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal
|
||||||
},
|
},
|
||||||
id = "audio_bg",
|
id = "audio_bg",
|
||||||
bg = color["Grey800"],
|
bg = Theme_config.volume_controller.list_bg,
|
||||||
fg = color["Purple200"],
|
fg = Theme_config.volume_controller.list_headphones_fg,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.volume_controller.list_shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
id = "audio_selector_margin",
|
id = "audio_selector_margin",
|
||||||
@@ -271,7 +262,8 @@ return function(s)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
resize = false,
|
resize = false,
|
||||||
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlueA200"]),
|
image = gears.color.recolor_image(icondir .. "menu-down.svg",
|
||||||
|
Theme_config.volume_controller.device_microphone_selected_icon_color),
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
@@ -295,11 +287,9 @@ return function(s)
|
|||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal
|
||||||
},
|
},
|
||||||
id = "mic_bg",
|
id = "mic_bg",
|
||||||
bg = color["Grey800"],
|
bg = Theme_config.volume_controller.list_bg,
|
||||||
fg = color["LightBlueA200"],
|
fg = Theme_config.volume_controller.list_microphone_fg,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.volume_controller.selector_shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
},
|
},
|
||||||
id = "mic_selector_margin",
|
id = "mic_selector_margin",
|
||||||
@@ -321,7 +311,7 @@ return function(s)
|
|||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
image = gears.color.recolor_image(icondir .. "volume-high.svg", color["Purple200"]),
|
image = gears.color.recolor_image(icondir .. "volume-high.svg", Theme_config.volume_controller.volume_fg),
|
||||||
id = "icon",
|
id = "icon",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -330,11 +320,11 @@ return function(s)
|
|||||||
gears.shape.rounded_rect(cr, width, height, dpi(5))
|
gears.shape.rounded_rect(cr, width, height, dpi(5))
|
||||||
end,
|
end,
|
||||||
bar_height = dpi(5),
|
bar_height = dpi(5),
|
||||||
bar_color = color["Grey800"],
|
bar_color = Theme_config.device_border_color,
|
||||||
bar_active_color = color["Purple200"],
|
bar_active_color = Theme_config.volume_controller.volume_fg,
|
||||||
handle_color = color["Purple200"],
|
handle_color = Theme_config.volume_controller.volume_fg,
|
||||||
handle_shape = gears.shape.circle,
|
handle_shape = gears.shape.circle,
|
||||||
handle_border_color = color["Purple200"],
|
handle_border_color = Theme_config.volume_controller.volume_fg,
|
||||||
handle_width = dpi(12),
|
handle_width = dpi(12),
|
||||||
maximum = 100,
|
maximum = 100,
|
||||||
forced_height = dpi(26),
|
forced_height = dpi(26),
|
||||||
@@ -362,7 +352,7 @@ return function(s)
|
|||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"]),
|
image = gears.color.recolor_image(icondir .. "microphone.svg", Theme_config.volume_controller.microphone_fg),
|
||||||
id = "icon"
|
id = "icon"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -371,11 +361,11 @@ return function(s)
|
|||||||
gears.shape.rounded_rect(cr, width, height, dpi(5))
|
gears.shape.rounded_rect(cr, width, height, dpi(5))
|
||||||
end,
|
end,
|
||||||
bar_height = dpi(5),
|
bar_height = dpi(5),
|
||||||
bar_color = color["Grey800"],
|
bar_color = Theme_config.volume_controller.device_border_color,
|
||||||
bar_active_color = color["Blue200"],
|
bar_active_color = Theme_config.volume_controller.microphone_fg,
|
||||||
handle_color = color["Blue200"],
|
handle_color = Theme_config.volume_controller.microphone_fg,
|
||||||
handle_shape = gears.shape.circle,
|
handle_shape = gears.shape.circle,
|
||||||
handle_border_color = color["Blue200"],
|
handle_border_color = Theme_config.volume_controller.microphone_fg,
|
||||||
handle_width = dpi(12),
|
handle_width = dpi(12),
|
||||||
maximum = 100,
|
maximum = 100,
|
||||||
forced_height = dpi(26),
|
forced_height = dpi(26),
|
||||||
@@ -402,12 +392,10 @@ return function(s)
|
|||||||
margins = dpi(10),
|
margins = dpi(10),
|
||||||
widget = wibox.container.margin
|
widget = wibox.container.margin
|
||||||
},
|
},
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.volume_controller.bg,
|
||||||
border_color = color["Grey800"],
|
border_color = Theme_config.volume_controller.border_color,
|
||||||
border_width = dpi(4),
|
border_width = Theme_config.volume_controller.border_width,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.volume_controller.shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
|
||||||
end,
|
|
||||||
forced_width = dpi(400),
|
forced_width = dpi(400),
|
||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
@@ -437,13 +425,15 @@ return function(s)
|
|||||||
audio_bg.shape = function(cr, width, height)
|
audio_bg.shape = function(cr, width, height)
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
||||||
end
|
end
|
||||||
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Purple200"]))
|
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
|
||||||
|
Theme_config.volume_controller.device_headphones_selected_icon_color))
|
||||||
else
|
else
|
||||||
rubato_timer.target = 0
|
rubato_timer.target = 0
|
||||||
audio_bg.shape = function(cr, width, height)
|
audio_bg.shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
||||||
end
|
end
|
||||||
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]))
|
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
|
||||||
|
Theme_config.volume_controller.device_headphones_selected_icon_color))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -473,26 +463,26 @@ return function(s)
|
|||||||
mic_selector_margin.mic_bg.shape = function(cr, width, height)
|
mic_selector_margin.mic_bg.shape = function(cr, width, height)
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
||||||
end
|
end
|
||||||
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Blue200"]))
|
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
|
||||||
|
Theme_config.volume_controller.device_microphone_selected_icon_color))
|
||||||
else
|
else
|
||||||
rubato_timer.target = 0
|
rubato_timer.target = 0
|
||||||
mic_bg.shape = function(cr, width, height)
|
mic_bg.shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
||||||
end
|
end
|
||||||
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Blue200"]))
|
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
|
||||||
|
Theme_config.volume_controller.device_microphone_selected_icon_color))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.
|
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.slider
|
||||||
slider
|
|
||||||
|
|
||||||
-- Volume slider change event
|
-- Volume slider change event
|
||||||
audio_slider_margin:connect_signal(
|
audio_slider_margin:connect_signal(
|
||||||
"property::value",
|
"property::value",
|
||||||
function()
|
function()
|
||||||
local volume = audio_slider_margin.value
|
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(audio_slider_margin.value) .. "%")
|
||||||
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%")
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -502,9 +492,7 @@ return function(s)
|
|||||||
mic_slider_margin:connect_signal(
|
mic_slider_margin:connect_signal(
|
||||||
"property::value",
|
"property::value",
|
||||||
function()
|
function()
|
||||||
local volume = mic_slider_margin.value
|
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(mic_slider_margin.value) .. "%")
|
||||||
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%")
|
|
||||||
awesome.emit_signal("get::mic_volume", volume)
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -512,16 +500,14 @@ return function(s)
|
|||||||
local volume_controller_container = awful.popup {
|
local volume_controller_container = awful.popup {
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
ontop = true,
|
ontop = true,
|
||||||
bg = color["Grey900"],
|
bg = Theme_config.volume_controller.bg,
|
||||||
stretch = false,
|
stretch = false,
|
||||||
visible = false,
|
visible = false,
|
||||||
screen = s,
|
screen = s,
|
||||||
placement = function(c) awful.placement.align(c,
|
placement = function(c) awful.placement.align(c,
|
||||||
{ position = "top_right", margins = { right = dpi(305), top = dpi(60) } })
|
{ position = "top_right", margins = { right = dpi(305), top = dpi(60) } })
|
||||||
end,
|
end,
|
||||||
shape = function(cr, width, height)
|
shape = Theme_config.volume_controller.shape,
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Get all source devices
|
-- Get all source devices
|
||||||
@@ -558,8 +544,6 @@ return function(s)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_source_devices()
|
|
||||||
|
|
||||||
-- Get all input devices
|
-- Get all input devices
|
||||||
local function get_input_devices()
|
local function get_input_devices()
|
||||||
awful.spawn.easy_async_with_shell(
|
awful.spawn.easy_async_with_shell(
|
||||||
@@ -595,64 +579,70 @@ return function(s)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"audio::device_changed",
|
||||||
|
function()
|
||||||
get_input_devices()
|
get_input_devices()
|
||||||
|
|
||||||
-- Event watcher, detects when device is addes/removed
|
|
||||||
awful.spawn.with_line_callback(
|
|
||||||
[[bash -c "LC_ALL=C pactl subscribe | grep --line-buffered 'on server'"]],
|
|
||||||
{
|
|
||||||
stdout = function(line)
|
|
||||||
get_input_devices()
|
|
||||||
get_source_devices()
|
|
||||||
awful.spawn.with_shell("pkill pactl && pkill grep")
|
|
||||||
end
|
end
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"exit",
|
"microphone::device_changed",
|
||||||
function()
|
function()
|
||||||
awful.spawn.with_shell("pkill pactl && pkill grep")
|
get_source_devices()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Set the volume and icon
|
||||||
|
awesome.connect_signal(
|
||||||
|
"audio::get",
|
||||||
|
function(muted, volume)
|
||||||
|
if muted then
|
||||||
|
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color
|
||||||
|
.recolor_image(icondir .. "volume-mute.svg", Theme_config.volume_controller.volume_fg))
|
||||||
|
else
|
||||||
|
volume = tonumber(volume)
|
||||||
|
local icon = icondir .. "volume"
|
||||||
|
if volume < 1 then
|
||||||
|
icon = icon .. "-mute"
|
||||||
|
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
|
||||||
|
|
||||||
|
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:
|
||||||
|
set_value(volume)
|
||||||
|
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color
|
||||||
|
.recolor_image(icon
|
||||||
|
.. ".svg", Theme_config.volume_controller.volume_fg))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Get microphone volume
|
-- Get microphone volume
|
||||||
local function get_mic_volume()
|
awesome.connect_signal(
|
||||||
awful.spawn.easy_async_with_shell(
|
"microphone::get",
|
||||||
"./.config/awesome/src/scripts/mic.sh volume",
|
function(muted, volume)
|
||||||
function(stdout)
|
if muted then
|
||||||
local volume = stdout:gsub("%%", ""):gsub("\n", "")
|
--volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
|
||||||
|
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
|
||||||
|
.. "microphone-off.svg", Theme_config.volume_controller.microphone_fg))
|
||||||
|
else
|
||||||
|
volume = tonumber(volume)
|
||||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(volume))
|
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(volume))
|
||||||
if volume > 0 then
|
if volume > 0 then
|
||||||
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
|
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
|
||||||
.. "microphone.svg", color["LightBlue200"]))
|
.. "microphone.svg", Theme_config.volume_controller.microphone_fg))
|
||||||
else
|
else
|
||||||
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
|
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
|
||||||
.. "microphone-off.svg", color["LightBlue200"]))
|
.. "microphone-off.svg", Theme_config.volume_controller.microphone_fg))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
get_mic_volume()
|
|
||||||
|
|
||||||
-- Check if microphone is muted
|
|
||||||
local function get_mic_mute()
|
|
||||||
awful.spawn.easy_async_with_shell(
|
|
||||||
"./.config/awesome/src/scripts/mic.sh mute",
|
|
||||||
function(stdout)
|
|
||||||
if stdout:match("yes") then
|
|
||||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
|
|
||||||
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
|
|
||||||
.. "microphone-off.svg", color["LightBlue200"]))
|
|
||||||
else
|
|
||||||
get_mic_volume()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
get_mic_mute()
|
|
||||||
|
|
||||||
-- When the mouse leaves the popup it stops the mousegrabber and hides the popup.
|
-- When the mouse leaves the popup it stops the mousegrabber and hides the popup.
|
||||||
volume_controller_container:connect_signal(
|
volume_controller_container:connect_signal(
|
||||||
@@ -693,57 +683,6 @@ return function(s)
|
|||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Set the volume and icon
|
|
||||||
awesome.connect_signal(
|
|
||||||
"get::volume",
|
|
||||||
function(volume)
|
|
||||||
volume = tonumber(volume)
|
|
||||||
local icon = icondir .. "volume"
|
|
||||||
if volume < 1 then
|
|
||||||
icon = icon .. "-mute"
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:
|
|
||||||
set_value(volume)
|
|
||||||
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.
|
|
||||||
recolor_image(icon .. ".svg", color["Purple200"]))
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Check if the volume is muted
|
|
||||||
awesome.connect_signal(
|
|
||||||
"get::volume_mute",
|
|
||||||
function(mute)
|
|
||||||
if mute then
|
|
||||||
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.
|
|
||||||
color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"]))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Set the microphone volume
|
|
||||||
awesome.connect_signal(
|
|
||||||
"get::mic_volume",
|
|
||||||
function(volume)
|
|
||||||
if volume > 0 then
|
|
||||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
|
|
||||||
.. "microphone.svg", color["LightBlue200"]))
|
|
||||||
awesome.emit_signal("update::microphone_widget", tonumber(volume), icondir .. "microphone.svg")
|
|
||||||
else
|
|
||||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
|
|
||||||
.. "microphone-off.svg", color["LightBlue200"]))
|
|
||||||
awesome.emit_signal("update::microphone_widget", tonumber(volume), icondir .. "microphone-off.svg")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Toggle container visibility
|
-- Toggle container visibility
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"volume_controller::toggle",
|
"volume_controller::toggle",
|
||||||
@@ -751,7 +690,6 @@ return function(s)
|
|||||||
if scr == s then
|
if scr == s then
|
||||||
volume_controller_container.visible = not volume_controller_container.visible
|
volume_controller_container.visible = not volume_controller_container.visible
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
@@ -71,41 +70,33 @@ return function(s)
|
|||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
local update_slider = function()
|
awesome.connect_signal(
|
||||||
awful.spawn.easy_async_with_shell(
|
"audio::get",
|
||||||
"./.config/awesome/src/scripts/vol.sh mute",
|
function(muted, volume)
|
||||||
function(stdout)
|
if muted then
|
||||||
if stdout:match("yes") then
|
|
||||||
volume_osd_widget:get_children_by_id("icon")[1]
|
volume_osd_widget:get_children_by_id("icon")[1]
|
||||||
:set_image(gears.color.recolor_image(
|
:set_image(gears.color.recolor_image(
|
||||||
icondir .. "volume-mute" .. ".svg", Theme_config.volume_osd.icon_color))
|
icondir .. "volume-mute" .. ".svg", Theme_config.volume_osd.icon_color))
|
||||||
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(0)
|
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(0)
|
||||||
else
|
else
|
||||||
awful.spawn.easy_async_with_shell(
|
volume = tonumber(volume)
|
||||||
"./.config/awesome/src/scripts/vol.sh volume",
|
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(volume)
|
||||||
function(stdout2)
|
|
||||||
local volume_level = stdout2:gsub("%%", ""):gsub("\n", "")
|
|
||||||
volume_osd_widget:get_children_by_id("progressbar1")[1].value = tonumber(volume_level)
|
|
||||||
local icon = icondir .. "volume"
|
local icon = icondir .. "volume"
|
||||||
if volume_level < 1 then
|
if volume < 1 then
|
||||||
icon = icon .. "-mute"
|
icon = icon .. "-mute"
|
||||||
elseif volume_level >= 1 and volume_level < 34 then
|
elseif volume >= 1 and volume < 34 then
|
||||||
icon = icon .. "-low"
|
icon = icon .. "-low"
|
||||||
elseif volume_level >= 34 and volume_level < 67 then
|
elseif volume >= 34 and volume < 67 then
|
||||||
icon = icon .. "-medium"
|
icon = icon .. "-medium"
|
||||||
elseif volume_level >= 67 then
|
elseif volume >= 67 then
|
||||||
icon = icon .. "-high"
|
icon = icon .. "-high"
|
||||||
end
|
end
|
||||||
volume_osd_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
|
volume_osd_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
|
||||||
Theme_config.volume_osd.icon_color))
|
Theme_config.volume_osd.icon_color))
|
||||||
end
|
end
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
update_slider()
|
|
||||||
|
|
||||||
local volume_container = awful.popup {
|
local volume_container = awful.popup {
|
||||||
widget = {},
|
widget = {},
|
||||||
@@ -138,10 +129,8 @@ return function(s)
|
|||||||
volume_container.visible = true
|
volume_container.visible = true
|
||||||
if hide_volume_osd.started then
|
if hide_volume_osd.started then
|
||||||
hide_volume_osd:again()
|
hide_volume_osd:again()
|
||||||
update_slider()
|
|
||||||
else
|
else
|
||||||
hide_volume_osd:start()
|
hide_volume_osd:start()
|
||||||
update_slider()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ local dpi = require("beautiful").xresources.apply_dpi
|
|||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
local naughty = require("naughty")
|
|
||||||
-- Icon directory path
|
|
||||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/window_switcher/"
|
|
||||||
|
|
||||||
return function(s)
|
return function(s)
|
||||||
|
|
||||||
-- Variable to check if client is selected
|
-- Variable to check if client is selected
|
||||||
@@ -44,6 +40,7 @@ return function(s)
|
|||||||
|
|
||||||
local selected = objects_sorted[1].pid
|
local selected = objects_sorted[1].pid
|
||||||
|
|
||||||
|
|
||||||
for _, object in ipairs(objects_sorted) do
|
for _, object in ipairs(objects_sorted) do
|
||||||
local window_element = wibox.widget {
|
local window_element = wibox.widget {
|
||||||
{
|
{
|
||||||
@@ -123,16 +120,13 @@ return function(s)
|
|||||||
local i = 1
|
local i = 1
|
||||||
local sel = nil
|
local sel = nil
|
||||||
|
|
||||||
awesome.connect_signal(
|
local function select_next()
|
||||||
"window_switcher::select_next",
|
|
||||||
function()
|
|
||||||
if not object.valid then
|
if not object.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if #objects_sorted >= i then
|
if #objects_sorted >= i then
|
||||||
selected = objects_sorted[i].pid
|
selected = objects_sorted[i].pid
|
||||||
sel = selected
|
sel = selected
|
||||||
|
|
||||||
if selected == object.pid then
|
if selected == object.pid then
|
||||||
window_element.border_color = Theme_config.window_switcher.selected_border_color
|
window_element.border_color = Theme_config.window_switcher.selected_border_color
|
||||||
window_element.fg = Theme_config.window_switcher.selected_fg
|
window_element.fg = Theme_config.window_switcher.selected_fg
|
||||||
@@ -149,39 +143,8 @@ return function(s)
|
|||||||
i = 1
|
i = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
|
||||||
|
|
||||||
object:connect_signal(
|
local function raise()
|
||||||
"unmanage",
|
|
||||||
function(c)
|
|
||||||
i = 1
|
|
||||||
objects_sorted[1] = objects_sorted[#objects_sorted]
|
|
||||||
objects_sorted[#objects_sorted] = nil
|
|
||||||
if objects_sorted[1] then
|
|
||||||
selected = objects_sorted[1].pid
|
|
||||||
end
|
|
||||||
-- remove object from table
|
|
||||||
if not object.valid then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for _, object in ipairs(objects) do
|
|
||||||
if object.pid == c.pid then
|
|
||||||
table.remove(objects, _)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for _, object in ipairs(objects_sorted) do
|
|
||||||
if object.pid == c.pid then
|
|
||||||
table.remove(objects_sorted, _)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
awesome.connect_signal(
|
|
||||||
"window_switcher::raise",
|
|
||||||
function()
|
|
||||||
if not object.valid then
|
if not object.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -208,6 +171,43 @@ return function(s)
|
|||||||
window_element.bg = Theme_config.window_switcher.selected_bg
|
window_element.bg = Theme_config.window_switcher.selected_bg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
awesome.disconnect_signal(
|
||||||
|
"window_switcher::select_next",
|
||||||
|
select_next
|
||||||
|
)
|
||||||
|
awesome.disconnect_signal(
|
||||||
|
"window_switcher::raise",
|
||||||
|
raise
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"window_switcher::select_next",
|
||||||
|
select_next
|
||||||
|
)
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"window_switcher::raise",
|
||||||
|
raise
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
object:connect_signal(
|
||||||
|
"unmanage",
|
||||||
|
function(c)
|
||||||
|
if object.valid then
|
||||||
|
i = 1
|
||||||
|
objects_sorted[1] = objects_sorted[#objects_sorted]
|
||||||
|
objects_sorted[#objects_sorted] = nil
|
||||||
|
for _, obj in ipairs(objects_sorted) do
|
||||||
|
if obj.valid then
|
||||||
|
if obj.pid == c.pid then
|
||||||
|
table.remove(objects_sorted, _)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,8 +288,10 @@ return function(s)
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"toggle_window_switcher",
|
"toggle_window_switcher",
|
||||||
function()
|
function()
|
||||||
|
if mouse.screen == s then
|
||||||
window_switcher_container.visible = not window_switcher_container.visible
|
window_switcher_container.visible = not window_switcher_container.visible
|
||||||
end
|
end
|
||||||
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
window_switcher_container:setup {
|
window_switcher_container:setup {
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SINK=$(LC_ALL=C pactl get-default-sink)
|
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
||||||
"volume")
|
"volume")
|
||||||
echo $(LC_ALL=C pactl get-sink-volume $SINK | awk '{print $5}')
|
echo $(LC_ALL=C pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}')
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"mute")
|
"mute")
|
||||||
echo $(LC_ALL=C pactl get-sink-mute $SINK)
|
echo $(LC_ALL=C pactl get-sink-mute @DEFAULT_SINK@)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"set_sink")
|
"set_sink")
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful.xresources").apply_dpi
|
|
||||||
|
|
||||||
Theme_path = awful.util.getdir("config") .. "/src/theme/"
|
Theme_path = awful.util.getdir("config") .. "/src/theme/"
|
||||||
Theme = {}
|
Theme = {}
|
||||||
@@ -21,37 +19,33 @@ Theme = {}
|
|||||||
Theme.font = User_config.font.bold
|
Theme.font = User_config.font.bold
|
||||||
|
|
||||||
--#region Client variables
|
--#region Client variables
|
||||||
Theme.useless_gap = dpi(5)
|
Theme.useless_gap = Theme_config.window.useless_gap
|
||||||
Theme.border_width = dpi(0)
|
Theme.border_width = Theme_config.window.border_width
|
||||||
Theme.border_normal = color["Grey800"]
|
Theme.border_normal = Theme_config.window.border_normal
|
||||||
Theme.border_marked = color["Red200"]
|
Theme.border_marked = Theme_config.window.border_marked
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
--#region Tooltip variables
|
--#region Tooltip variables
|
||||||
Theme.tooltip_border_color = color["Grey800"]
|
Theme.tooltip_border_color = Theme_config.tooltip.border_color
|
||||||
Theme.tooltip_bg = color["Grey900"]
|
Theme.tooltip_bg = Theme_config.tooltip.bg
|
||||||
Theme.tooltip_fg = color["CyanA200"]
|
Theme.tooltip_fg = Theme_config.tooltip.fg
|
||||||
Theme.tooltip_border_width = dpi(4)
|
Theme.tooltip_border_width = Theme_config.tooltip.border_width
|
||||||
Theme.tooltip_gaps = dpi(15)
|
Theme.tooltip_gaps = Theme_config.tooltip.gaps
|
||||||
Theme.tooltip_shape = function(cr, width, heigth)
|
Theme.tooltip_shape = Theme_config.tooltip.shape
|
||||||
gears.shape.rounded_rect(cr, width, heigth, dpi(4))
|
|
||||||
end
|
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
--#region Hotkeys variables
|
--#region Hotkeys variables
|
||||||
Theme.hotkeys_bg = color["Grey900"]
|
Theme.hotkeys_bg = Theme_config.hotkeys.bg
|
||||||
Theme.hotkeys_fg = color["White"]
|
Theme.hotkeys_fg = Theme_config.hotkeys.fg
|
||||||
Theme.hotkeys_border_width = dpi(4)
|
Theme.hotkeys_border_width = Theme_config.hotkeys.border_width
|
||||||
Theme.hotkeys_border_color = color["Grey800"]
|
Theme.hotkeys_border_color = Theme_config.hotkeys.border_color
|
||||||
Theme.hotkeys_shape = function(cr, width, height)
|
Theme.hotkeys_shape = Theme_config.hotkeys.shape
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
Theme.hotkeys_modifiers_fg = Theme_config.hotkeys.modifiers_fg
|
||||||
end
|
Theme.hotkeys_description_font = Theme_config.hotkeys.description_font
|
||||||
Theme.hotkeys_modifiers_fg = color["Cyan200"]
|
Theme.hotkeys_font = Theme_config.hotkeys.font
|
||||||
Theme.hotkeys_description_font = User_config.font.bold
|
Theme.hotkeys_group_margin = Theme_config.hotkeys.group_margin
|
||||||
Theme.hotkeys_font = User_config.font.bold
|
Theme.hotkeys_label_bg = Theme_config.hotkeys.label_bg
|
||||||
Theme.hotkeys_group_margin = dpi(20)
|
Theme.hotkeys_label_fg = Theme_config.hotkeys.label_fg
|
||||||
Theme.hotkeys_label_bg = color["Cyan200"]
|
|
||||||
Theme.hotkeys_label_fg = color["Grey900"]
|
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
Theme.awesome_icon = Theme_path .. "../assets/icons/ArchLogo.png"
|
Theme.awesome_icon = Theme_path .. "../assets/icons/ArchLogo.png"
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ Theme_config.cpu_freq = {
|
|||||||
|
|
||||||
Theme_config.cpu_temp = {
|
Theme_config.cpu_temp = {
|
||||||
fg = color["Grey900"],
|
fg = color["Grey900"],
|
||||||
|
bg_low = color["Green200"],
|
||||||
|
bg_mid = color["Orange200"],
|
||||||
|
bg_high = color["Red200"],
|
||||||
}
|
}
|
||||||
|
|
||||||
Theme_config.cpu_usage = {
|
Theme_config.cpu_usage = {
|
||||||
@@ -63,6 +66,9 @@ Theme_config.gpu_usage = {
|
|||||||
|
|
||||||
Theme_config.gpu_temp = {
|
Theme_config.gpu_temp = {
|
||||||
fg = color["Grey900"],
|
fg = color["Grey900"],
|
||||||
|
bg_low = color["Green200"],
|
||||||
|
bg_mid = color["Orange200"],
|
||||||
|
bg_high = color["Red200"],
|
||||||
}
|
}
|
||||||
|
|
||||||
Theme_config.kblayout = {
|
Theme_config.kblayout = {
|
||||||
@@ -137,8 +143,45 @@ Theme_config.tasklist = {
|
|||||||
|
|
||||||
]] --
|
]] --
|
||||||
|
|
||||||
|
--#region Module Settings
|
||||||
|
Theme_config.notification = {
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
bg = color["Grey900"],
|
||||||
|
spacing = dpi(10),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(10))
|
||||||
|
end,
|
||||||
|
shape_inside = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
||||||
|
end,
|
||||||
|
position = "bottom_right",
|
||||||
|
timeout = 3,
|
||||||
|
corner_spacing = dpi(20),
|
||||||
|
bg_urgent = color["Grey900"],
|
||||||
|
fg_urgent_title = color["RedA200"],
|
||||||
|
fg_urgent_message = color["Red200"],
|
||||||
|
fg_urgent_app_name = color["RedA400"],
|
||||||
|
fg_normal_title = color["Pink200"],
|
||||||
|
fg_normal_message = "#ffffffaa",
|
||||||
|
bg_normal = color["Grey900"],
|
||||||
|
spotify_button_icon_color = color["Cyan200"],
|
||||||
|
action_bg = color["Grey800"],
|
||||||
|
action_fg = color["Green200"],
|
||||||
|
icon_color = color["Teal200"],
|
||||||
|
fg_appname = color["Teal200"],
|
||||||
|
fg_time = color["Teal200"],
|
||||||
|
fg_close = color["Teal200"],
|
||||||
|
bg_close = color["Grey900"],
|
||||||
|
title_border_color = color["Grey800"],
|
||||||
|
title_border_width = dpi(2),
|
||||||
|
}
|
||||||
|
|
||||||
Theme_config.notification_center = {
|
Theme_config.notification_center = {
|
||||||
bg = color["Grey900"],
|
bg = color["Grey900"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
spacing_color = color["Grey800"],
|
||||||
|
|
||||||
-- Clear all button
|
-- Clear all button
|
||||||
clear_all_button = {
|
clear_all_button = {
|
||||||
@@ -148,31 +191,91 @@ Theme_config.notification_center = {
|
|||||||
|
|
||||||
-- DnD button
|
-- DnD button
|
||||||
dnd = {
|
dnd = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
fg = color["Pink200"],
|
||||||
|
disabled = color["Grey700"],
|
||||||
|
enabled = color["Purple200"],
|
||||||
|
border_disabled = color["Grey800"],
|
||||||
|
border_enabled = color["Purple200"],
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Notification_list
|
-- Notification_list
|
||||||
notification_list = {
|
notification_list = {
|
||||||
|
timer_fg = color["Teal200"],
|
||||||
|
close_color = color["Teal200"],
|
||||||
|
close_bg = color["Grey900"],
|
||||||
|
icon = color["Teal200"],
|
||||||
|
title_fg = color["Teal200"],
|
||||||
|
title_border_color = color["Grey800"],
|
||||||
|
title_border_width = dpi(2),
|
||||||
|
notification_border_color = color["Grey800"],
|
||||||
|
notification_bg = color["Grey900"],
|
||||||
|
notification_border_width = dpi(4),
|
||||||
|
notification_shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 8)
|
||||||
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Profile widget
|
-- Profile widget
|
||||||
profile = {
|
profile = {
|
||||||
|
username_icon_color = color["Blue200"],
|
||||||
|
os_prefix_icon_color = color["Blue200"],
|
||||||
|
kernel_icon_color = color["Blue200"],
|
||||||
|
uptime_icon_color = color["Blue200"],
|
||||||
|
fg = color["Green200"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
||||||
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Song info widget
|
-- Song info widget
|
||||||
song_info = {
|
song_info = {
|
||||||
|
shuffle_disabled = color["Grey800"],
|
||||||
|
shuffle_enabled = color["Green200"],
|
||||||
|
repeat_disabled = color["Grey800"],
|
||||||
|
repeat_single = color["Green200"],
|
||||||
|
repeat_all = color["Green200"],
|
||||||
|
prev_enabled = color["Teal200"],
|
||||||
|
next_enabled = color["Teal200"],
|
||||||
|
play_enabled = color["Teal200"],
|
||||||
|
prev_hover = color["Teal300"],
|
||||||
|
next_hover = color["Teal300"],
|
||||||
|
play_hover = color["Teal300"],
|
||||||
|
title_fg = color["Pink200"],
|
||||||
|
artist_fg = color["Teal200"],
|
||||||
|
duration_fg = color["Teal200"],
|
||||||
|
progress_color = color["Purple200"],
|
||||||
|
progress_background_color = color["Grey800"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
||||||
|
end
|
||||||
},
|
},
|
||||||
-- Spacing line widget
|
-- Spacing line widget
|
||||||
spacing_line = {
|
spacing_line = {
|
||||||
|
color = color["Grey800"],
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Status bar widgets
|
-- Status bar widgets
|
||||||
status_bar = {
|
status_bar = {
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(10))
|
||||||
|
end,
|
||||||
|
bar_bg_color = color["Grey800"],
|
||||||
|
cpu_usage_color = color["Cyan200"],
|
||||||
|
cpu_temp_color = color["Blue200"],
|
||||||
|
ram_usage_color = color["Red200"],
|
||||||
|
gpu_usage_color = color["Green200"],
|
||||||
|
gpu_temp_color = color["Green200"],
|
||||||
|
volume_color = color["Yellow200"],
|
||||||
|
microphone_color = color["Blue200"],
|
||||||
|
backlight_color = color["Pink200"],
|
||||||
|
battery_color = color["Purple200"],
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Time Date widget
|
-- Time Date widget
|
||||||
@@ -182,7 +285,15 @@ Theme_config.notification_center = {
|
|||||||
|
|
||||||
-- Weather widget
|
-- Weather widget
|
||||||
weather = {
|
weather = {
|
||||||
|
description_fg = color["LightBlue200"],
|
||||||
|
line_color = color["Grey800"],
|
||||||
|
speed_icon_color = color["OrangeA200"],
|
||||||
|
humidity_icon_color = color["OrangeA200"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
||||||
|
end
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +330,28 @@ Theme_config.brightness_osd = {
|
|||||||
icon_color = color["Blue200"],
|
icon_color = color["Blue200"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Theme_config.center_bar = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
}
|
||||||
|
|
||||||
|
Theme_config.dock = {
|
||||||
|
element_bg = color["Grey900"],
|
||||||
|
element_focused_bg = color["Grey800"],
|
||||||
|
element_focused_hover_bg = color["Grey800"],
|
||||||
|
element_focused_hover_fg = color["White"],
|
||||||
|
bg = color["Grey900"],
|
||||||
|
indicator_bg = color["Grey600"],
|
||||||
|
indicator_bg_focus = color["YellowA200"],
|
||||||
|
indicator_bg_urgent = color["RedA200"],
|
||||||
|
indicator_bg_maximized = color["GreenA200"],
|
||||||
|
indicator_bg_minimized = color["BlueA200"],
|
||||||
|
indicator_bg_fullscreen = color["PurpleA200"],
|
||||||
|
}
|
||||||
|
|
||||||
|
Theme_config.left_bar = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
}
|
||||||
|
|
||||||
Theme_config.powermenu = {
|
Theme_config.powermenu = {
|
||||||
container_bg = "#21212188",
|
container_bg = "#21212188",
|
||||||
button_fg = color["Grey900"],
|
button_fg = color["Grey900"],
|
||||||
@@ -229,6 +362,10 @@ Theme_config.powermenu = {
|
|||||||
logout_button_bg = color["Orange200"],
|
logout_button_bg = color["Orange200"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Theme_config.right_bar = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
}
|
||||||
|
|
||||||
Theme_config.titlebar = {
|
Theme_config.titlebar = {
|
||||||
bg = "#121212AA",
|
bg = "#121212AA",
|
||||||
close_button_bg = color["Red200"],
|
close_button_bg = color["Red200"],
|
||||||
@@ -241,7 +378,42 @@ Theme_config.titlebar = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Theme_config.volume_controller = {
|
Theme_config.volume_controller = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
||||||
|
end,
|
||||||
|
device_bg = color["Grey900"],
|
||||||
|
device_border_color = color["Grey800"],
|
||||||
|
device_border_width = dpi(2),
|
||||||
|
device_shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
||||||
|
end,
|
||||||
|
device_headphones_fg = color["Purple200"],
|
||||||
|
device_microphone_fg = color["Blue200"],
|
||||||
|
device_headphones_selected_bg = color["Purple200"],
|
||||||
|
device_headphones_selected_fg = color["Grey900"],
|
||||||
|
device_microphone_selected_bg = color["Blue200"],
|
||||||
|
device_microphone_selected_fg = color["Grey900"],
|
||||||
|
device_headphones_selected_border_color = color["Purple200"],
|
||||||
|
device_microphone_selected_border_color = color["Blue200"],
|
||||||
|
device_headphones_selected_icon_color = color["Purple200"],
|
||||||
|
device_microphone_selected_icon_color = color["Blue200"],
|
||||||
|
device_icon_color = color["Grey900"],
|
||||||
|
list_border_color = color["Grey800"],
|
||||||
|
list_border_width = dpi(2),
|
||||||
|
list_shape = function(cr, width, height)
|
||||||
|
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
|
||||||
|
end,
|
||||||
|
list_bg = color["Grey800"],
|
||||||
|
list_headphones_fg = color["Purple200"],
|
||||||
|
list_microphone_fg = color["Blue200"],
|
||||||
|
selector_shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
||||||
|
end,
|
||||||
|
volume_fg = color["Purple200"],
|
||||||
|
microphone_fg = color["Blue200"],
|
||||||
}
|
}
|
||||||
|
|
||||||
Theme_config.volume_osd = {
|
Theme_config.volume_osd = {
|
||||||
@@ -264,3 +436,67 @@ Theme_config.window_switcher = {
|
|||||||
selected_border_color = color["Purple200"],
|
selected_border_color = color["Purple200"],
|
||||||
selected_bg = "#313131"
|
selected_bg = "#313131"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Theme_config.application_launcher = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
application = {
|
||||||
|
|
||||||
|
},
|
||||||
|
searchbar = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
fg = color["Green200"],
|
||||||
|
fg_hint = color["Grey800"],
|
||||||
|
border_color = color["Red200"],
|
||||||
|
border_width = dpi(2),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--#endregion
|
||||||
|
|
||||||
|
--[[
|
||||||
|
========================
|
||||||
|
=== General Settings ===
|
||||||
|
========================
|
||||||
|
|
||||||
|
Here are some general settings for borders, tooltips etc
|
||||||
|
|
||||||
|
]] --
|
||||||
|
|
||||||
|
--#region General Settings
|
||||||
|
|
||||||
|
Theme_config.window = {
|
||||||
|
border_width = dpi(0),
|
||||||
|
border_normal = color["Grey800"],
|
||||||
|
border_marked = color["Red200"],
|
||||||
|
useless_gap = dpi(5)
|
||||||
|
}
|
||||||
|
|
||||||
|
Theme_config.tooltip = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
fg = color["CyanA200"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
gaps = dpi(15),
|
||||||
|
shape = function(cr, width, heigth)
|
||||||
|
gears.shape.rounded_rect(cr, width, heigth, dpi(4))
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
Theme_config.hotkeys = {
|
||||||
|
bg = color["Grey900"],
|
||||||
|
fg = color["White"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
shape = function(cr, width, heigth)
|
||||||
|
gears.shape.rounded_rect(cr, width, heigth, dpi(12))
|
||||||
|
end,
|
||||||
|
modifiers_fg = color["Cyan200"],
|
||||||
|
description_font = User_config.font.bold,
|
||||||
|
font = User_config.font.bold,
|
||||||
|
group_margin = dpi(20),
|
||||||
|
label_bg = color["Cyan200"],
|
||||||
|
label_fg = color["Grey900"],
|
||||||
|
}
|
||||||
|
|
||||||
|
--#endregion
|
||||||
|
|||||||
@@ -89,11 +89,11 @@ User_config = {
|
|||||||
"arduino-arduinoide.desktop",
|
"arduino-arduinoide.desktop",
|
||||||
"us.zoom.Zoom.desktop",
|
"us.zoom.Zoom.desktop",
|
||||||
"thunderbird.desktop",
|
"thunderbird.desktop",
|
||||||
"com.mattermost.Desktop.desktop",
|
"com.ultimaker.cura.desktop",
|
||||||
"blender.desktop",
|
"blender.desktop",
|
||||||
"freecad.desktop",
|
"freecad.desktop",
|
||||||
"The Witcher 3 Wild Hunt.desktop",
|
"The Witcher 3 Wild Hunt.desktop",
|
||||||
"windows_11.desktop"
|
--"windows_11.desktop"
|
||||||
},
|
},
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
|||||||
135
awesome/src/tools/dbus/bluetooth_dbus.lua
Normal file
135
awesome/src/tools/dbus/bluetooth_dbus.lua
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
|
local dbus_proxy = require("dbus_proxy")
|
||||||
|
local lgi = require("lgi")
|
||||||
|
local naughty = require("naughty")
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
awesome.emit_signal("bluetooth::scan")
|
||||||
|
if device.Name ~= nil or device.Alias ~= nil then
|
||||||
|
device_properties:connect_signal(function()
|
||||||
|
awesome.emit_signal("bluetooth::device_changed", device, battery)
|
||||||
|
end, "PropertiesChanged")
|
||||||
|
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)
|
||||||
|
awesome.emit_signal("device_removed", interface)
|
||||||
|
end,
|
||||||
|
"InterfacesRemoved"
|
||||||
|
)
|
||||||
|
|
||||||
|
Adapter:connect_signal(
|
||||||
|
function(data)
|
||||||
|
if data.Powered ~= nil then
|
||||||
|
awesome.emit_signal("state", data.Powered)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
"PropertiesChanged"
|
||||||
|
)
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"bluetooth::scan",
|
||||||
|
function()
|
||||||
|
Adapter:StartDiscovery()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
AdapterProperties:connect_signal(
|
||||||
|
function(data)
|
||||||
|
if data.Powered ~= nil then
|
||||||
|
if data.Powered then
|
||||||
|
Adapter:StartDiscovery()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
"PropertiesChanged"
|
||||||
|
)
|
||||||
|
|
||||||
|
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 }
|
||||||
|
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
|
||||||
|
|
||||||
|
awesome.emit_signal("state", Adapter.Powered)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
77
awesome/src/tools/helpers/audio.lua
Normal file
77
awesome/src/tools/helpers/audio.lua
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
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
|
||||||
|
awesome.emit_signal("audio::volume_changed")
|
||||||
|
awesome.emit_signal("microphone::volume_changed")
|
||||||
|
end
|
||||||
|
-- Device added/removed
|
||||||
|
if line:match("on server") then
|
||||||
|
awesome.emit_signal("audio::device_changed")
|
||||||
|
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")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"exit",
|
||||||
|
function()
|
||||||
|
awful.spawn.with_shell("pkill pactl && pkill grep")
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"audio::volume_changed",
|
||||||
|
function()
|
||||||
|
awful.spawn.easy_async_with_shell(
|
||||||
|
"./.config/awesome/src/scripts/vol.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/vol.sh volume",
|
||||||
|
function(stdout2)
|
||||||
|
awesome.emit_signal("audio::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
awesome.emit_signal("microphone::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
awesome.emit_signal("audio::volume_changed")
|
||||||
|
awesome.emit_signal("microphone::volume_changed")
|
||||||
|
awesome.emit_signal("audio::device_changed")
|
||||||
|
awesome.emit_signal("microphone::device_changed")
|
||||||
25
awesome/src/tools/helpers/backlight.lua
Normal file
25
awesome/src/tools/helpers/backlight.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
BACKLIGHT_MAX_BRIGHTNESS = 0
|
||||||
|
BACKLIGHT_SEPS = 0
|
||||||
|
awful.spawn.easy_async_with_shell(
|
||||||
|
"pkexec xfpm-power-backlight-helper --get-max-brightness",
|
||||||
|
function(stdout)
|
||||||
|
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
|
||||||
|
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
|
||||||
|
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"brightness::update",
|
||||||
|
function()
|
||||||
|
awful.spawn.easy_async_with_shell(
|
||||||
|
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||||
|
function(value)
|
||||||
|
awesome.emit_signal("brightness::get", math.floor((tonumber(value) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100))
|
||||||
|
awesome.emit_signal("brightness::rerun")
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
@@ -4,3 +4,5 @@ require("src.tools.helpers.cpu_freq")
|
|||||||
require("src.tools.helpers.ram")
|
require("src.tools.helpers.ram")
|
||||||
require("src.tools.helpers.gpu_usage")
|
require("src.tools.helpers.gpu_usage")
|
||||||
require("src.tools.helpers.gpu_temp")
|
require("src.tools.helpers.gpu_temp")
|
||||||
|
require("src.tools.helpers.audio")
|
||||||
|
--require("src.tools.helpers.backlight")
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ local function get_basedir()
|
|||||||
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
|
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
|
||||||
|
|
||||||
for _, value in ipairs(GLib.get_system_data_dirs()) do
|
for _, value in ipairs(GLib.get_system_data_dirs()) do
|
||||||
dir = GLib.build_filenamev({ value, ".icons" })
|
dir = GLib.build_filenamev({ value, "icons" })
|
||||||
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
|
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
|
||||||
end
|
end
|
||||||
|
|
||||||
local need_usr_share_pixmaps = true
|
local need_usr_share_pixmaps = true
|
||||||
for _, value in ipairs(GLib.get_system_data_dirs()) do
|
for _, value in ipairs(GLib.get_system_data_dirs()) do
|
||||||
dir = GLib.build_filenamev({ value, ".icons" })
|
dir = GLib.build_filenamev({ value, "icons" })
|
||||||
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
|
if gears.filesystem.dir_readable(dir) then table.insert(dirs, dir) end
|
||||||
if dir == "/usr/share/pixmaps" then
|
if dir == "/usr/share/pixmaps" then
|
||||||
need_usr_share_pixmaps = false
|
need_usr_share_pixmaps = false
|
||||||
@@ -38,8 +38,6 @@ local function get_basedir()
|
|||||||
table.insert(dirs, dir)
|
table.insert(dirs, dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(dirs, "/usr/share/icons")
|
|
||||||
|
|
||||||
return dirs
|
return dirs
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -186,6 +184,9 @@ local function find_icon_helper(self, icon, size)
|
|||||||
if filename then return filename end
|
if filename then return filename end
|
||||||
|
|
||||||
for _, parent in ipairs(self.theme_index:get_inherits()) do
|
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)
|
filename = find_icon_helper(xdg_icon_lookup(parent, self.base_directories), icon, size)
|
||||||
if filename then return filename end
|
if filename then return filename end
|
||||||
end
|
end
|
||||||
@@ -199,10 +200,10 @@ local iconcache = {}
|
|||||||
---@param size any
|
---@param size any
|
||||||
---@return string path_to_icon
|
---@return string path_to_icon
|
||||||
function xdg_icon_lookup:find_icon(icon, size)
|
function xdg_icon_lookup:find_icon(icon, size)
|
||||||
if iconcache[icon] then
|
|
||||||
return iconcache[icon]
|
if icon_cache[icon] == "" then return nil end
|
||||||
end
|
if iconcache[icon] then return iconcache[icon] end
|
||||||
size = size or 64
|
|
||||||
if not icon or icon == "" then return nil end
|
if not icon or icon == "" then return nil end
|
||||||
|
|
||||||
local filename = find_icon_helper(self, icon, size)
|
local filename = find_icon_helper(self, icon, size)
|
||||||
@@ -223,10 +224,8 @@ function xdg_icon_lookup:find_icon(icon, size)
|
|||||||
return filename
|
return filename
|
||||||
end
|
end
|
||||||
|
|
||||||
local fallback = gears.color.recolor_image(require("awful").util.getdir("config") .. "src/assets/icons/fallback.svg",
|
iconcache[icon] = ""
|
||||||
"#ffffff")
|
return nil
|
||||||
iconcache[icon] = fallback
|
|
||||||
return fallback
|
|
||||||
end
|
end
|
||||||
|
|
||||||
xdg_icon_lookup.mt.__call = function(_, ...)
|
xdg_icon_lookup.mt.__call = function(_, ...)
|
||||||
|
|||||||
@@ -55,15 +55,19 @@ return function(s)
|
|||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
local get_volume = function()
|
awesome.connect_signal(
|
||||||
awful.spawn.easy_async_with_shell(
|
"audio::get",
|
||||||
"./.config/awesome/src/scripts/vol.sh volume",
|
function(muted, volume)
|
||||||
function(stdout)
|
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"
|
local icon = icondir .. "volume"
|
||||||
stdout = stdout:gsub("%%", "")
|
|
||||||
local volume = tonumber(stdout) or 0
|
|
||||||
audio_widget.container.audio_layout.spacing = dpi(5)
|
audio_widget.container.audio_layout.spacing = dpi(5)
|
||||||
audio_widget.container.audio_layout.label.visible = true
|
audio_widget.container.audio_layout.label.visible = true
|
||||||
|
volume = tonumber(volume)
|
||||||
if volume < 1 then
|
if volume < 1 then
|
||||||
icon = icon .. "-mute"
|
icon = icon .. "-mute"
|
||||||
audio_widget.container.audio_layout.spacing = dpi(0)
|
audio_widget.container.audio_layout.spacing = dpi(0)
|
||||||
@@ -78,29 +82,9 @@ return function(s)
|
|||||||
audio_widget.container.audio_layout.label:set_text(volume .. "%")
|
audio_widget.container.audio_layout.label:set_text(volume .. "%")
|
||||||
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
|
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
|
||||||
gears.color.recolor_image(icon .. ".svg", Theme_config.audio.fg))
|
gears.color.recolor_image(icon .. ".svg", Theme_config.audio.fg))
|
||||||
awesome.emit_signal("get::volume", volume)
|
|
||||||
awesome.emit_signal("update::volume_widget", volume, icon .. ".svg")
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_muted = function()
|
|
||||||
awful.spawn.easy_async_with_shell(
|
|
||||||
"./.config/awesome/src/scripts/vol.sh mute",
|
|
||||||
function(stdout)
|
|
||||||
if stdout:match("yes") 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))
|
|
||||||
awesome.emit_signal("get::volume_mute", true)
|
|
||||||
else
|
|
||||||
audio_widget.container:set_right(10)
|
|
||||||
awesome.emit_signal("get::volume_mute", false)
|
|
||||||
get_volume()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
-- Signals
|
-- Signals
|
||||||
Hover_signal(audio_widget, Theme_config.audio.bg, Theme_config.audio.fg)
|
Hover_signal(audio_widget, Theme_config.audio.bg, Theme_config.audio.fg)
|
||||||
@@ -108,19 +92,10 @@ return function(s)
|
|||||||
audio_widget:connect_signal(
|
audio_widget:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function()
|
function()
|
||||||
awesome.emit_signal("module::slider:update")
|
|
||||||
awesome.emit_signal("volume_controller::toggle", s)
|
awesome.emit_signal("volume_controller::toggle", s)
|
||||||
awesome.emit_signal("volume_controller::toggle:keygrabber")
|
awesome.emit_signal("volume_controller::toggle:keygrabber")
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
gears.timer {
|
|
||||||
timeout = 0.5,
|
|
||||||
call_now = true,
|
|
||||||
autostart = true,
|
|
||||||
callback = check_muted
|
|
||||||
}
|
|
||||||
|
|
||||||
check_muted()
|
|
||||||
return audio_widget
|
return audio_widget
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,16 +4,14 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local watch = awful.widget.watch
|
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
|
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
|
||||||
|
|
||||||
--TODO: Add tooltip with more CPU and per core information
|
--TODO: Add tooltip with more CPU and per core information
|
||||||
return function(widget, clock_mode)
|
return function(widget, _)
|
||||||
|
|
||||||
local cpu_usage_widget = wibox.widget {
|
local cpu_usage_widget = wibox.widget {
|
||||||
{
|
{
|
||||||
@@ -93,7 +91,7 @@ return function(widget, clock_mode)
|
|||||||
right = dpi(8),
|
right = dpi(8),
|
||||||
widget = wibox.container.margin
|
widget = wibox.container.margin
|
||||||
},
|
},
|
||||||
bg = color["Green200"],
|
bg = Theme_config.cpu_temp.bg_low,
|
||||||
fg = Theme_config.cpu_temp.fg,
|
fg = Theme_config.cpu_temp.fg,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||||
@@ -157,13 +155,13 @@ return function(widget, clock_mode)
|
|||||||
local temp_icon
|
local temp_icon
|
||||||
local temp_color
|
local temp_color
|
||||||
if temp < 50 then
|
if temp < 50 then
|
||||||
temp_color = color["Green200"]
|
temp_color = Theme_config.cpu_temp.bg_low
|
||||||
temp_icon = icon_dir .. "thermometer-low.svg"
|
temp_icon = icon_dir .. "thermometer-low.svg"
|
||||||
elseif temp >= 50 and temp < 80 then
|
elseif temp >= 50 and temp < 80 then
|
||||||
temp_color = color["Orange200"]
|
temp_color = Theme_config.cpu_temp.bg_mid
|
||||||
temp_icon = icon_dir .. "thermometer.svg"
|
temp_icon = icon_dir .. "thermometer.svg"
|
||||||
elseif temp >= 80 then
|
elseif temp >= 80 then
|
||||||
temp_color = color["Red200"]
|
temp_color = Theme_config.cpu_temp.bg_high
|
||||||
temp_icon = icon_dir .. "thermometer-high.svg"
|
temp_icon = icon_dir .. "thermometer-high.svg"
|
||||||
end
|
end
|
||||||
Hover_signal(cpu_temp, temp_color, Theme_config.cpu_temp.fg)
|
Hover_signal(cpu_temp, temp_color, Theme_config.cpu_temp.fg)
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ return function()
|
|||||||
id = "label",
|
id = "label",
|
||||||
align = "center",
|
align = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
widget = wibox.widget.textbox
|
format = "%a, %b %d",
|
||||||
|
widget = wibox.widget.textclock
|
||||||
},
|
},
|
||||||
id = "date_layout",
|
id = "date_layout",
|
||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal
|
||||||
@@ -58,36 +59,8 @@ return function()
|
|||||||
widget = wibox.container.background
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
local set_date = function()
|
|
||||||
date_widget.container.date_layout.label:set_text(os.date("%a, %b %d"))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Updates the date every minute, dont blame me if you miss silvester
|
|
||||||
gears.timer {
|
|
||||||
timeout = 60,
|
|
||||||
autostart = true,
|
|
||||||
call_now = true,
|
|
||||||
callback = function()
|
|
||||||
set_date()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Signals
|
-- Signals
|
||||||
Hover_signal(date_widget, Theme_config.date.bg, Theme_config.date.fg)
|
Hover_signal(date_widget, Theme_config.date.bg, Theme_config.date.fg)
|
||||||
|
|
||||||
date_widget:connect_signal(
|
|
||||||
"mouse::enter",
|
|
||||||
function()
|
|
||||||
awesome.emit_signal("widget::calendar_osd:stop", true)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
date_widget:connect_signal(
|
|
||||||
"mouse::leave",
|
|
||||||
function()
|
|
||||||
awesome.emit_signal("widget::calendar_osd:rerun", true)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
return date_widget
|
return date_widget
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,10 +4,8 @@
|
|||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local color = require("src.theme.colors")
|
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local watch = awful.widget.watch
|
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
|
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
|
||||||
@@ -92,7 +90,7 @@ return function(widget)
|
|||||||
right = dpi(8),
|
right = dpi(8),
|
||||||
widget = wibox.container.margin
|
widget = wibox.container.margin
|
||||||
},
|
},
|
||||||
bg = color["Green200"],
|
bg = Theme_config.gpu_temp.bg_low,
|
||||||
fg = Theme_config.gpu_temp.fg,
|
fg = Theme_config.gpu_temp.fg,
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||||
@@ -120,18 +118,18 @@ return function(widget)
|
|||||||
if temp_num then
|
if temp_num then
|
||||||
|
|
||||||
if temp_num < 50 then
|
if temp_num < 50 then
|
||||||
temp_color = color["Green200"]
|
temp_color = Theme_config.gpu_temp.bg_low
|
||||||
temp_icon = icon_dir .. "thermometer-low.svg"
|
temp_icon = icon_dir .. "thermometer-low.svg"
|
||||||
elseif temp_num >= 50 and temp_num < 80 then
|
elseif temp_num >= 50 and temp_num < 80 then
|
||||||
temp_color = color["Orange200"]
|
temp_color = Theme_config.gpu_temp.bg_mid
|
||||||
temp_icon = icon_dir .. "thermometer.svg"
|
temp_icon = icon_dir .. "thermometer.svg"
|
||||||
elseif temp_num >= 80 then
|
elseif temp_num >= 80 then
|
||||||
temp_color = color["Red200"]
|
temp_color = Theme_config.gpu_temp.bg_high
|
||||||
temp_icon = icon_dir .. "thermometer-high.svg"
|
temp_icon = icon_dir .. "thermometer-high.svg"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
temp_num = "NaN"
|
temp_num = "NaN"
|
||||||
temp_color = color["Green200"]
|
temp_color = Theme_config.gpu_temp.bg_low
|
||||||
temp_icon = icon_dir .. "thermometer-low.svg"
|
temp_icon = icon_dir .. "thermometer-low.svg"
|
||||||
end
|
end
|
||||||
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
|
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ return function()
|
|||||||
Hover_signal(ram_widget, Theme_config.ram_info.bg, Theme_config.ram_info.fg)
|
Hover_signal(ram_widget, Theme_config.ram_info.bg, Theme_config.ram_info.fg)
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::ram",
|
"update::ram_widget",
|
||||||
function(MemTotal, MemFree, MemAvailable)
|
function(MemTotal, MemFree, MemAvailable)
|
||||||
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) ..
|
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) ..
|
||||||
"/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
|
"/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ local list_update = function(widget, buttons, _, _, objects)
|
|||||||
id = "icon_container",
|
id = "icon_container",
|
||||||
{
|
{
|
||||||
id = "icon",
|
id = "icon",
|
||||||
|
image = client.icon,
|
||||||
resize = true,
|
resize = true,
|
||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
@@ -94,7 +95,7 @@ local list_update = function(widget, buttons, _, _, objects)
|
|||||||
widget = wibox.container.margin
|
widget = wibox.container.margin
|
||||||
}
|
}
|
||||||
|
|
||||||
icon.icon_container.icon:set_image(xdg_icon_lookup:find_icon(client.class, 64))
|
icon.icon_container.icon:set_image(xdg_icon_lookup:find_icon(client.class, 64) or client.icon)
|
||||||
|
|
||||||
tag_widget.container:setup({
|
tag_widget.container:setup({
|
||||||
icon,
|
icon,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ local list_update = function(widget, buttons, label, _, objects)
|
|||||||
valign = "center",
|
valign = "center",
|
||||||
halign = "center",
|
halign = "center",
|
||||||
resize = true,
|
resize = true,
|
||||||
|
image = object.icon,
|
||||||
widget = wibox.widget.imagebox
|
widget = wibox.widget.imagebox
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
@@ -113,7 +114,8 @@ local list_update = function(widget, buttons, label, _, objects)
|
|||||||
task_widget:set_bg(Theme_config.tasklist.bg)
|
task_widget:set_bg(Theme_config.tasklist.bg)
|
||||||
task_widget.container.layout_it.title:set_text('')
|
task_widget.container.layout_it.title:set_text('')
|
||||||
end
|
end
|
||||||
task_widget.container.layout_it.margin.layout_icon.icon:set_image(xdg_icon_lookup:find_icon(object.class, 64))
|
task_widget:get_children_by_id("icon")[1]:set_image(xdg_icon_lookup:find_icon(object.class, 64) or
|
||||||
|
object.icon)
|
||||||
widget:add(task_widget)
|
widget:add(task_widget)
|
||||||
widget:set_spacing(dpi(6))
|
widget:set_spacing(dpi(6))
|
||||||
|
|
||||||
|
|||||||
282
awesome/wibox/widget/inputtextbox.lua
Normal file
282
awesome/wibox/widget/inputtextbox.lua
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- A widget to write text in
|
||||||
|
--@DOC_wibox_widget_defaults_inputtextbox_EXAMPLE@
|
||||||
|
--
|
||||||
|
-- @author Rene Kievits
|
||||||
|
-- @copyright 2022, Rene Kievits
|
||||||
|
-- @widgetmod wibox.widget.inputtextbox
|
||||||
|
-- @supermodule wibox.widget.base
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
local base = require("wibox.widget.base")
|
||||||
|
local gdebug = require("gears.debug")
|
||||||
|
local gfs = require("gears.filesystem")
|
||||||
|
local gobject = require("gears.object")
|
||||||
|
local gstring = require("gears.string")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local keygrabber = require("awful.keygrabber")
|
||||||
|
local lgi = require("lgi")
|
||||||
|
local gtable = require("gears.table")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
local setmetatable = setmetatable
|
||||||
|
|
||||||
|
local inputtextbox = { mt = {} }
|
||||||
|
|
||||||
|
--Private data
|
||||||
|
local data = {}
|
||||||
|
data.history = {}
|
||||||
|
|
||||||
|
local search_term = nil
|
||||||
|
local function itera(inc, a, i)
|
||||||
|
i = i + inc
|
||||||
|
local v = a[i]
|
||||||
|
if v then return i, v end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Load history file in history table
|
||||||
|
-- @param id The data.history identifier which is the path to the filename.
|
||||||
|
-- @param[opt] max The maximum number of entried in file.
|
||||||
|
local function history_check_load(id, max)
|
||||||
|
if id and id ~= "" and not data.history[id] then
|
||||||
|
data.history[id] = { max = 50, table = {} }
|
||||||
|
|
||||||
|
if max then
|
||||||
|
data.history[id].max = max
|
||||||
|
end
|
||||||
|
|
||||||
|
local f = io.open(id, "r")
|
||||||
|
if not f then return end
|
||||||
|
|
||||||
|
for line in f:lines() do
|
||||||
|
if gtable.hasitem(data.histroy[id].table, line) then
|
||||||
|
if #data.history[id].table >= data.history[id].max then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_word_char(c)
|
||||||
|
if string.find(c, "[{[(,.:;_-+=@/ ]") then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function cword_start(s, pos)
|
||||||
|
local i = pos
|
||||||
|
if i > 1 then
|
||||||
|
i = i - 1
|
||||||
|
end
|
||||||
|
while i >= 1 and not is_word_char(s:sub(i, i)) do
|
||||||
|
i = i - 1
|
||||||
|
end
|
||||||
|
while i >= 1 and is_word_char(s:sub(i, i)) do
|
||||||
|
i = i - 1
|
||||||
|
end
|
||||||
|
if i <= #s then
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
return i
|
||||||
|
end
|
||||||
|
|
||||||
|
local function cword_end(s, pos)
|
||||||
|
local i = pos
|
||||||
|
while i <= #s and not is_word_char(s:sub(i, i)) do
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
while i <= #s and is_word_char(s:sub(i, i)) do
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
return i
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Save history table in history file
|
||||||
|
-- @param id The data.history identifier
|
||||||
|
local function history_save(id)
|
||||||
|
if data.history[id] then
|
||||||
|
gfs.make_parent_directories(id)
|
||||||
|
local f = io.open(id, "w")
|
||||||
|
if not f then
|
||||||
|
gdebug.print_warning("Failed to write the history to " .. id)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for i = 1, math.min(#data.history[id].table, data.history[id].max) do
|
||||||
|
f:write(data.history[id].table[i] .. "\n")
|
||||||
|
end
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Return the number of items in history table regarding the id
|
||||||
|
-- @param id The data.history identifier
|
||||||
|
-- @return the number of items in history table, -1 if history is disabled
|
||||||
|
local function history_items(id)
|
||||||
|
if data.history[id] then
|
||||||
|
return #data.history[id].table
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Add an entry to the history file
|
||||||
|
-- @param id The data.history identifier
|
||||||
|
-- @param command The command to add
|
||||||
|
local function history_add(id, command)
|
||||||
|
if data.history[id] and command ~= "" then
|
||||||
|
local index = gtable.hasitem(data.history[id].table, command)
|
||||||
|
if index == nil then
|
||||||
|
table.insert(data.history[id].table, command)
|
||||||
|
|
||||||
|
-- Do not exceed our max_cmd
|
||||||
|
if #data.history[id].table > data.history[id].max then
|
||||||
|
table.remove(data.history[id].table, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
history_save(id)
|
||||||
|
else
|
||||||
|
-- Bump this command to the end of history
|
||||||
|
table.remove(data.history[id].table, index)
|
||||||
|
table.insert(data.history[id].table, command)
|
||||||
|
history_save(id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function have_multibyte_char_at(text, position)
|
||||||
|
return text:sub(position, position):wlen() == -1
|
||||||
|
end
|
||||||
|
|
||||||
|
local function text_with_cursor(args)
|
||||||
|
local char, spacer, text_start, text_end, ret
|
||||||
|
local text = args.text or ""
|
||||||
|
local hint = args.hint or ""
|
||||||
|
local cursor = args.cursor or ""
|
||||||
|
local indicator = args.indicator or "|"
|
||||||
|
|
||||||
|
if args.select_all then
|
||||||
|
if #text == 0 then char = " " else char = gstring.xml_escape(text) end
|
||||||
|
spacer = " "
|
||||||
|
text_start = ""
|
||||||
|
text_end = ""
|
||||||
|
elseif #text < args.cursor_pos then
|
||||||
|
char = " "
|
||||||
|
spacer = ""
|
||||||
|
text_start = gstring.xml_escape(text)
|
||||||
|
text_end = ""
|
||||||
|
else
|
||||||
|
local offset = 0
|
||||||
|
if have_multibyte_char_at(text, args.cursor_pos) then
|
||||||
|
offset = 1
|
||||||
|
end
|
||||||
|
char = gstring.xml_escape(text:sub(args.cursor_pos, args.cursor_pos + offset))
|
||||||
|
spacer = " "
|
||||||
|
text_start = gstring.xml_escape(text:sub(1, args.cursor_pos - 1))
|
||||||
|
text_end = gstring.xml_escape(text:sub(args.cursor_pos + offset + 1))
|
||||||
|
end
|
||||||
|
|
||||||
|
if args.highlighter then
|
||||||
|
text_start, text_end = args.highlighter(text_start, text_end)
|
||||||
|
end
|
||||||
|
|
||||||
|
if #text == 0 then
|
||||||
|
ret = hint .. spacer
|
||||||
|
else
|
||||||
|
ret = text_start .. indicator .. text_end .. spacer
|
||||||
|
end
|
||||||
|
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update(self)
|
||||||
|
self.textbox:set_font(self.font)
|
||||||
|
self.textbox:set_markup(text_with_cursor {
|
||||||
|
text = self.text,
|
||||||
|
hint = self.hint,
|
||||||
|
cursor = self.cursor,
|
||||||
|
cursor_pos = self.cursor_pos,
|
||||||
|
select_all = self.select_all,
|
||||||
|
indicator = self.indicator,
|
||||||
|
highlighter = self.highlighter,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function inputtextbox:start()
|
||||||
|
self.textbox:set_font(self.font)
|
||||||
|
self.textbox:set_markup(text_with_cursor {
|
||||||
|
text = self.text,
|
||||||
|
hint = self.hint,
|
||||||
|
cursor = self.cursor,
|
||||||
|
cursor_pos = self.cursor_pos,
|
||||||
|
select_all = self.select_all,
|
||||||
|
indicator = self.indicator,
|
||||||
|
highlighter = self.highlighter,
|
||||||
|
})
|
||||||
|
|
||||||
|
self._private.grabber = keygrabber.run(
|
||||||
|
function(modifierts, key, event)
|
||||||
|
local mod = {}
|
||||||
|
for _, v in ipairs(modifierts) do mod[v] = true end
|
||||||
|
|
||||||
|
|
||||||
|
--Get out cases
|
||||||
|
if (mod.Control and (key == "c" or key == "g")) or (not mod.Control and key == "Escape") then
|
||||||
|
self:stop()
|
||||||
|
return false
|
||||||
|
elseif (mod.Control and (key == "j" or key == "m")) then
|
||||||
|
--callback
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function inputtextbox:stop()
|
||||||
|
keygrabber.stop(self._private.grabber)
|
||||||
|
history_save(self.history_path)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Create a new inputtextbox
|
||||||
|
--
|
||||||
|
-- @tparam[opt=""] string text The hint text when there is no input
|
||||||
|
-- @treturn table A new inputtextbox widget
|
||||||
|
-- @constructorfct wibox.widget.inputtextbox
|
||||||
|
local function new(args)
|
||||||
|
args = args or {}
|
||||||
|
|
||||||
|
args.callback = args.callback or nil
|
||||||
|
args.hint = args.hint or ""
|
||||||
|
args.font = args.font or beautiful.inputtextbox_font or beautiful.font
|
||||||
|
args.bg = args.bg or beautiful.inputtextbox_bg or beautiful.bg_normal
|
||||||
|
args.fg_hint = args.fg_hint or beautiful.inputtextbox_fg_hint or beautiful.fg_normal or "#888888"
|
||||||
|
args.fg = args.fg or beautiful.inputtextbox_fg or beautiful.fg_normal
|
||||||
|
args.cursor = args.cursor or "fleur"
|
||||||
|
args.select_all = args.select_all or false
|
||||||
|
args.highlighter = args.highlighter or nil
|
||||||
|
|
||||||
|
local textbox = wibox.widget.textbox()
|
||||||
|
textbox:set_text(args.hint or "")
|
||||||
|
--textbox:set_fg(args.fg_hint or beautiful.fg_hint or "#888888")
|
||||||
|
--textbox:set_bg(args.bg_normal or beautiful.bg_normal or "#212121")
|
||||||
|
|
||||||
|
local ret = gobject({})
|
||||||
|
ret._private = {}
|
||||||
|
gtable.crush(ret, inputtextbox)
|
||||||
|
gtable.crush(ret, args)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
function inputtextbox.mt.__call(...)
|
||||||
|
return new(...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable(inputtextbox, inputtextbox.mt)
|
||||||
|
|
||||||
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
Reference in New Issue
Block a user