fixed bluetooth and taskbar, tasklist icons

This commit is contained in:
Kievits Rene
2022-04-18 03:05:43 +02:00
parent 1ceec3a7d9
commit f8c31d19f2
17 changed files with 182 additions and 271 deletions

View File

@@ -10,32 +10,32 @@ return function()
local globalkeys = gears.table.join( local globalkeys = gears.table.join(
awful.key( awful.key(
{ modkey }, { modkey },
"s", "#39",
hotkeys_popup.show_help, hotkeys_popup.show_help,
{ description = "Cheat sheet", group = "Awesome" } { description = "Cheat sheet", group = "Awesome" }
), ),
-- Tag browsing -- Tag browsing
awful.key( awful.key(
{ modkey }, { modkey },
"Left", "#113",
awful.tag.viewprev, awful.tag.viewprev,
{ description = "View previous tag", group = "Tag" } { description = "View previous tag", group = "Tag" }
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"Right", "#114",
awful.tag.viewnext, awful.tag.viewnext,
{ description = "View next tag", group = "Tag" } { description = "View next tag", group = "Tag" }
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"Escape", "#66",
awful.tag.history.restore, awful.tag.history.restore,
{ description = "Go back to last tag", group = "Tag" } { description = "Go back to last tag", group = "Tag" }
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"j", "#44",
function() function()
awful.client.focus.byidx(1) awful.client.focus.byidx(1)
end, end,
@@ -43,7 +43,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"k", "#45",
function() function()
awful.client.focus.byidx(-1) awful.client.focus.byidx(-1)
end, end,
@@ -51,7 +51,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"w", "#25",
function() function()
user_vars.main_menu:show() user_vars.main_menu:show()
end, end,
@@ -59,7 +59,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Shift" }, { modkey, "Shift" },
"j", "#44",
function() function()
awful.client.swap.byidx(1) awful.client.swap.byidx(1)
end, end,
@@ -67,7 +67,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Shift" }, { modkey, "Shift" },
"k", "#45",
function() function()
awful.client.swap.byidx(-1) awful.client.swap.byidx(-1)
end, end,
@@ -75,7 +75,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Control" }, { modkey, "Control" },
"j", "#44",
function() function()
awful.screen.focus_relative(1) awful.screen.focus_relative(1)
end, end,
@@ -83,7 +83,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Control" }, { modkey, "Control" },
"k", "#45",
function() function()
awful.screen.focus_relative(-1) awful.screen.focus_relative(-1)
end, end,
@@ -91,13 +91,13 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"u", "#30",
awful.client.urgent.jumpto, awful.client.urgent.jumpto,
{ description = "Jump to urgent client", group = "Client" } { description = "Jump to urgent client", group = "Client" }
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"Return", "#36",
function() function()
awful.spawn(user_vars.vars.terminal) awful.spawn(user_vars.vars.terminal)
end, end,
@@ -105,13 +105,13 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Control" }, { modkey, "Control" },
"r", "#27",
awesome.restart, awesome.restart,
{ description = "Reload awesome", group = "Awesome" } { description = "Reload awesome", group = "Awesome" }
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"l", "#46",
function() function()
awful.tag.incmwfact(0.05) awful.tag.incmwfact(0.05)
end, end,
@@ -119,7 +119,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"h", "#43",
function() function()
awful.tag.incmwfact(-0.05) awful.tag.incmwfact(-0.05)
end, end,
@@ -127,7 +127,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Control" }, { modkey, "Control" },
"h", "#43",
function() function()
awful.tag.incncol(1, nil, true) awful.tag.incncol(1, nil, true)
end, end,
@@ -135,7 +135,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Control" }, { modkey, "Control" },
"l", "#46",
function() function()
awful.tag.incncol(-1, nil, true) awful.tag.incncol(-1, nil, true)
end, end,
@@ -143,7 +143,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Shift" }, { modkey, "Shift" },
"space", "#65",
function() function()
awful.layout.inc(-1) awful.layout.inc(-1)
end, end,
@@ -151,7 +151,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Shift" }, { modkey, "Shift" },
"Return", "#36",
function() function()
awful.layout.inc(1) awful.layout.inc(1)
end, end,
@@ -159,7 +159,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"d", "#40",
function() function()
awful.spawn("rofi -show drun -theme ~/.config/rofi/rofi.rasi") awful.spawn("rofi -show drun -theme ~/.config/rofi/rofi.rasi")
end, end,
@@ -167,7 +167,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"Tab", "#23",
function() function()
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi") awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
end, end,
@@ -175,7 +175,7 @@ return function()
), ),
awful.key( awful.key(
{ "Mod1" }, { "Mod1" },
"Tab", "#23",
function() function()
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi") awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
end, end,
@@ -183,7 +183,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"e", "#26",
function() function()
awful.spawn(user_vars.vars.file_manager) awful.spawn(user_vars.vars.file_manager)
end, end,
@@ -191,7 +191,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey, "Shift" }, { modkey, "Shift" },
"e", "#26",
function() function()
awesome.emit_signal("module::powermenu:show") awesome.emit_signal("module::powermenu:show")
end, end,
@@ -199,7 +199,7 @@ return function()
), ),
awful.key( awful.key(
{}, {},
"Print", "#107",
function() function()
awful.spawn(user_vars.vars.screenshot_program) awful.spawn(user_vars.vars.screenshot_program)
end, end,
@@ -297,7 +297,7 @@ return function()
), ),
awful.key( awful.key(
{ modkey }, { modkey },
"space", "#65",
function() function()
awesome.emit_signal("kblayout::toggle") awesome.emit_signal("kblayout::toggle")
end, end,

View File

@@ -31,17 +31,26 @@ return function(s, widgets)
{ {
{ {
widgets[1], widgets[1],
margins = dpi(6), left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin widget = wibox.container.margin
}, },
{ {
widgets[2], widgets[2],
margins = dpi(6), left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin widget = wibox.container.margin
}, },
{ {
widgets[3], widgets[3],
margins = dpi(6), left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin widget = wibox.container.margin
}, },
forced_height = 45, forced_height = 45,

View File

@@ -7,7 +7,7 @@ local naughty = require("naughty")
if awesome.startup_errors then if awesome.startup_errors then
naughty.notify({ naughty.notify({
preset = naughty.config.presets.critical, preset = naughty.config.presets.critical,
title = "ERROR in Awesome config!", title = "! Not so Awesome ERROR !",
text = awesome.startup_errors text = awesome.startup_errors
}) })
end end
@@ -16,7 +16,7 @@ do
local in_error = false local in_error = false
awesome.connect_signal( awesome.connect_signal(
"debug::error", "debug::error",
function (err) function(err)
if in_error then if in_error then
return return
end end

View File

@@ -4,10 +4,11 @@
-- Awesome Libs -- Awesome Libs
local awful = require("awful") local awful = require("awful")
return function () return function()
local layouts = { local layouts = {
awful.layout.suit.tile, awful.layout.suit.tile,
awful.layout.suit.floating, awful.layout.suit.floating,
awful.layout.suit.fair,
} }
return layouts return layouts

View File

@@ -15,8 +15,19 @@ end
-- If you want different default programs, wallpaper path or modkey; edit this file. -- If you want different default programs, wallpaper path or modkey; edit this file.
local _M = { local _M = {
-- Write the terminal command to start anything here
autostart = {
"picom --experimental-backends",
"xfce4-power-manager",
"light-locker --lock-on-suspend --lock-on-lid &",
"flatpak run com.spotify.Client",
"discord",
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
},
-- Type 'ip a' and check your wlan and ethernet name
network = { network = {
wlan = "", wlan = "wlo1",
ethernet = "eno1" ethernet = "eno1"
}, },

View File

@@ -6,31 +6,19 @@
-- ██║ ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗╚███╔███╔╝██║ ╚═╝ ██║ -- -- ██║ ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗╚███╔███╔╝██║ ╚═╝ ██║ --
-- ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ -- -- ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ --
----------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------
if os.getenv "LOCAL_LUA_DEBUGGER_VSCODE" == "1" then
require("lldebugger").start()
end
-- Default Awesome Libs
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 menubar = require("menubar")
-- Global Namespace
user_vars = {} user_vars = {}
user_vars.vars = require("main.user_variables") user_vars.vars = require("main.user_variables")
-- Error Handling
require("main.error_handling") require("main.error_handling")
-- Default Theme and Custom Wallpaper
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
beautiful.wallpaper = user_vars.vars.wallpaper
modkey = user_vars.vars.modkey
require("main.theme") require("main.theme")
-- Load Local User Libs
local main = { local main = {
layouts = require("main.layouts"), layouts = require("main.layouts"),
tags = require("main.tags"), tags = require("main.tags"),
@@ -38,7 +26,6 @@ local main = {
rules = require("main.rules") rules = require("main.rules")
} }
-- Load all Shortcuts from Local User Libs
local bindings = { local bindings = {
global_buttons = require("bindings.global_buttons"), global_buttons = require("bindings.global_buttons"),
client_buttons = require("bindings.client_buttons"), client_buttons = require("bindings.client_buttons"),
@@ -48,37 +35,23 @@ local bindings = {
} }
user_vars.Layouts = main.layouts() user_vars.Layouts = main.layouts()
awful.layout.layouts = main.layouts() awful.layout.layouts = main.layouts()
user_vars.tags = main.tags() user_vars.tags = main.tags()
user_vars.main_menu = awful.menu({ user_vars.main_menu = awful.menu({
items = main.menu() items = main.menu()
}) })
--[[ -- A Variable needed in Statusbar (helper)
user_vars.launcher = awful.widget.launcher({
image = beautiful.awesome_icon,
menu = user_vars.main_menu
}) ]]
-- Menubar configuration
menubar.utils.terminal = user_vars.vars.terminal
-- Set root
root.buttons(bindings.global_buttons()) root.buttons(bindings.global_buttons())
root.keys(bindings.bind_to_tags(bindings.global_keys())) root.keys(bindings.bind_to_tags(bindings.global_keys()))
-- Default statusbar
require("crylia_bar.init") require("crylia_bar.init")
-- Rules to apply to new clients
awful.rules.rules = main.rules( awful.rules.rules = main.rules(
bindings.client_keys(), bindings.client_keys(),
bindings.client_buttons() bindings.client_buttons()
) )
-- Signals
require("main.signals") require("main.signals")
require("theme.crylia.tools.auto_starter") require("theme.crylia.tools.auto_starter")
--Autostarter(user_vars.vars.autostart)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

View File

@@ -1 +0,0 @@
<?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="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>

Before

Width:  |  Height:  |  Size: 336 B

View File

@@ -13,9 +13,9 @@ local wibox = require("wibox")
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/brightness/" local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/brightness/"
-- TODO: fix backlight keys and osd not working correctly -- TODO: fix backlight keys and osd not working correctly
return function (s) return function(s)
local brightness_osd_widget = wibox.widget{ local brightness_osd_widget = wibox.widget {
{ {
{ {
{ {
@@ -101,7 +101,7 @@ return function (s)
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal( brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal(
"property::value", "property::value",
function () function()
local brightness_value = brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:get_value() local brightness_value = brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:get_value()
-- Performance is horrible, or it overrides and executes at the same time as the keybindings -- Performance is horrible, or it overrides and executes at the same time as the keybindings
--awful.spawn("xbacklight -set " .. brightness_value, false) --awful.spawn("xbacklight -set " .. brightness_value, false)
@@ -131,11 +131,11 @@ return function (s)
end end
) )
local update_slider = function () local update_slider = function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ sleep 0.1 && xbacklight -get ]], [[ sleep 0.1 && xbacklight -get ]],
function (stdout) function(stdout)
stdout = stdout:sub(1,-9) stdout = stdout:sub(1, -9)
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(stdout)) brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(stdout))
end end
) )
@@ -143,48 +143,49 @@ return function (s)
awesome.connect_signal( awesome.connect_signal(
"module::brightness_slider:update", "module::brightness_slider:update",
function () function()
update_slider() update_slider()
end end
) )
awesome.connect_signal( awesome.connect_signal(
"widget::brightness:update", "widget::brightness:update",
function (value) function(value)
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value)) brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
end end
) )
update_slider() update_slider()
local brightness_container = awful.popup{ local brightness_container = awful.popup {
widget = wibox.container.background, widget = wibox.container.background,
ontop = true, ontop = true,
bg = color.color["Grey900"] .. "00", bg = color.color["Grey900"] .. "00",
stretch = false, stretch = false,
visible = false, visible = false,
placement = function (c) awful.placement.centered(c, {margins = {top = dpi(200)}}) end, screen = s,
shape = function (cr, width, height) placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15) gears.shape.rounded_rect(cr, width, height, 15)
end end
} }
local hide_brightness_osd = gears.timer{ local hide_brightness_osd = gears.timer {
timeout = 2, timeout = 2,
autostart = true, autostart = true,
callback = function () callback = function()
brightness_container.visible = false brightness_container.visible = false
end end
} }
brightness_container:setup{ brightness_container:setup {
brightness_osd_widget, brightness_osd_widget,
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
} }
awesome.connect_signal( awesome.connect_signal(
"widget::brightness_osd:rerun", "widget::brightness_osd:rerun",
function () function()
if hide_brightness_osd.started then if hide_brightness_osd.started then
hide_brightness_osd:again() hide_brightness_osd:again()
else else
@@ -195,14 +196,16 @@ return function (s)
awesome.connect_signal( awesome.connect_signal(
"module::brightness_osd:show", "module::brightness_osd:show",
function () function()
if s == mouse.screen then
brightness_container.visible = true brightness_container.visible = true
end end
end
) )
brightness_container:connect_signal( brightness_container:connect_signal(
"mouse::enter", "mouse::enter",
function () function()
brightness_container.visible = true brightness_container.visible = true
hide_brightness_osd:stop() hide_brightness_osd:stop()
end end
@@ -210,7 +213,7 @@ return function (s)
brightness_container:connect_signal( brightness_container:connect_signal(
"mouse::leave", "mouse::leave",
function () function()
brightness_container.visible = true brightness_container.visible = true
hide_brightness_osd:again() hide_brightness_osd:again()
end end

View File

@@ -195,7 +195,7 @@ local create_titlebar_borderhack = function(c, bg, position)
local borderhack = awful.titlebar(c, { local borderhack = awful.titlebar(c, {
position = position, position = position,
bg = bg, bg = bg,
size = "2" size = "4"
}) })
borderhack:setup { borderhack:setup {
{ {

View File

@@ -184,6 +184,7 @@ echo $(pacmd list-sinks | awk '/^\s+name: /{indefault = $2 == "<'$SINK'>"} /^\s+
bg = color.color["Grey900"] .. "00", bg = color.color["Grey900"] .. "00",
stretch = false, stretch = false,
visible = false, visible = false,
screen = s,
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end, placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15) gears.shape.rounded_rect(cr, width, height, 15)
@@ -206,8 +207,10 @@ echo $(pacmd list-sinks | awk '/^\s+name: /{indefault = $2 == "<'$SINK'>"} /^\s+
awesome.connect_signal( awesome.connect_signal(
"module::volume_osd:show", "module::volume_osd:show",
function() function()
if s == mouse.screen then
volume_container.visible = true volume_container.visible = true
end end
end
) )
volume_container:connect_signal( volume_container:connect_signal(

View File

@@ -1,7 +1,7 @@
local awful = require("awful") local awful = require("awful")
-- Autostart programs function Autostarter(table)
--awful.spawn.with_shell("~/.screenlayout/single_screen.sh") for i, t in ipairs(table) do
awful.spawn.with_shell("picom --experimental-backends") awful.spawn.with_shell(t);
awful.spawn.with_shell("xfce4-power-manager") end
awful.spawn.with_shell("light-locker --lock-on-suspend --lock-on-lid &") end

View File

@@ -1,39 +1,40 @@
----------------------------------------------------- -----------------------------------------------------
-- Helper to get icons from a program/program name -- -- Helper to get icons from a program/program name --
----------------------------------------------------- -----------------------------------------------------
local naughty = require("naughty")
-- tries to find a matching file name in /usr/share/icons/THEME/RESOLUTION/apps/ and if not found tried with first letter -- tries to find a matching file name in /usr/share/icons/THEME/RESOLUTION/apps/ and if not found tried with first letter
-- as uppercase, this should get almost all icons to work with the papirus theme atleast -- as uppercase, this should get almost all icons to work with the papirus theme atleast
-- TODO: try with more icon themes -- TODO: try with more icon themes
function Get_icon(theme, c, is_steam) function Get_icon(theme, c, is_steam)
if theme and c then if theme ~= nil and c ~= nil then
local clientName local clientName = c.name
-- TODO: Access steamdb api to fetch the clienticon if there is no icon found in this theme -- TODO: Access steamdb api to fetch the clienticon if there is no icon found in this theme
if is_steam then if is_steam then
clientName = "steam_icon_" .. tostring(c) .. ".svg" clientName = "steam_icon_" .. tostring(c) .. ".svg"
else else
if type(c) == type("") then if c.class ~= nil then
clientName = string.lower(c) .. ".svg"
else
clientName = string.lower(c.class) .. ".svg" clientName = string.lower(c.class) .. ".svg"
elseif clientName ~= nil then
clientName = string.lower(c.name) .. ".svg"
else
return
end end
end end
local resolutions = {"128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16"} local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" }
for i, res in ipairs(resolutions) do for i, res in ipairs(resolutions) do
local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .."/apps/" local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
local ioStream = io.open(iconDir .. clientName, "r") local ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then if ioStream ~= nil then
return iconDir .. clientName return iconDir .. clientName
else else
clientName = clientName:gsub("^%l", string.upper) clientName = clientName:gsub("^%l", string.upper)
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .."/apps/" iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
ioStream = io.open(iconDir .. clientName, "r") ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then if ioStream ~= nil then
return iconDir .. clientName return iconDir .. clientName
elseif type(c) ~= type("") then elseif type(c) ~= type("") then
local naughty = require("naughty")
if pcall( if pcall(
function () function()
if c:Get_icon(1) then if c:Get_icon(1) then
error("icon error") error("icon error")
else else
@@ -43,11 +44,13 @@ function Get_icon(theme, c, is_steam)
) then ) then
return nil return nil
end end
return "/usr/share/icons/Papirus-Dark/128x128/apps/Zoom.svg"
end end
end end
end end
end end
return nil if c.icon == nil then
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
else
return c.icon
end
end end

View File

@@ -1,93 +0,0 @@
-------------------------------------------------------------
-- This is a button widget to add a new tag to the taglist --
-------------------------------------------------------------
-- !!! THIS WIDGET IS OBSCOLETE !!!
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
-- User Libs
local color = require("theme.crylia.colors")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/addtag/"
-- Returns the add tag button widget
return function()
-- This is the widget that gets dispayed
local add_tag_button = wibox.widget {
{
{
image = gears.color.recolor_image(icondir .. "plus.svg", color.color["White"]),
widget = wibox.widget.imagebox,
resize = false
},
margins = dpi(4),
widget = wibox.container.margin
},
bg = color.color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
-- Keybindings and Mouse click bindings
add_tag_button:buttons(
gears.table.join(
-- Add a new tag
awful.button(
{},
1,
nil,
function()
awful.tag.add()
end
)
)
)
-- Signals
local old_wibox, old_cursor, old_bg
add_tag_button:connect_signal(
"mouse::enter",
function()
old_bg = add_tag_button.bg
add_tag_button.bg = "#ffffff" .. "12"
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
)
add_tag_button:connect_signal(
"button::press",
function()
add_tag_button.bg = "#ffffff" .. "24"
end
)
add_tag_button:connect_signal(
"button::release",
function()
add_tag_button.bg = "#ffffff" .. "12"
end
)
add_tag_button:connect_signal(
"mouse::leave",
function()
add_tag_button.bg = old_bg
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)
return add_tag_button
end

View File

@@ -7,6 +7,7 @@ local awful = require("awful")
local color = require("theme.crylia.colors") local color = require("theme.crylia.colors")
local dpi = require("beautiful").xresources.apply_dpi local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox") local wibox = require("wibox")
require("main.signals") require("main.signals")
@@ -51,54 +52,34 @@ return function()
local bluetooth_state = "off" local bluetooth_state = "off"
local connected_device = "nothing" local connected_device = "nothing"
-- ! if you don't have a bluetooth device then this function will awful.widget.watch(
-- ! spawn hundereds of processes of bluetoothctl, this will be bad "rfkill list bluetooth",
-- TODO: Check for a bluetooth controller first, maybe use a different program 5,
local get_bluetooth_information = function()
-- awful.spawn.easy_async_with_shell(
-- [[ bluetoothctl show | grep Powered | awk '{print $2}' ]],
-- function(stdout)
-- local icon = icondir .. "bluetooth"
-- stdout = stdout:gsub("\n", "")
-- if stdout == "yes" then
-- icon = icon .. "-on"
-- bluetooth_state = "on"
-- awful.spawn.easy_async_with_shell(
-- [[ bluetoothctl info | grep Name: | awk '{ first = $1; $1 = ""; print $0 }' ]],
-- function(stdout2)
-- if stdout2 == nil or stdout2:gsub("\n", "") == "" then
-- bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected")
-- else
-- bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:" .. connected_device)
-- connected_device = stdout2
-- end
-- end
-- )
-- else
-- icon = icon .. "-off"
-- bluetooth_state = "off"
-- bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n")
-- end
-- bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color.color["Grey900"]))
-- end
-- )
end
local bluetooth_update = gears.timer {
timeout = 5,
autostart = true,
call_now = true,
callback = function()
--[[ awful.spawn.easy_async_with_shell(
"bluetoothctl list",
function(stdout) function(stdout)
if stdout ~= nil or stdout:gsub("\n", ""):match("") then local icon = icondir .. "bluetooth"
get_bluetooth_information() if stdout:match('Soft blocked: yes') or stdout:gsub("\n", "") == '' then
icon = icon .. "-off"
bluetooth_state = "off"
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n")
else
icon = icon .. "-on"
bluetooth_state = "on"
awful.spawn.easy_async_with_shell(
[[ bluetoothctl info | grep Name: | awk '{ first = $1; $1 = ""; print $0 }' ]],
function(stdout2)
if stdout2 == nil or stdout2:gsub("\n", "") == "" then
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected")
else
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:" .. connected_device)
connected_device = stdout2
end end
end end
) ]] )
end end
} bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color.color["Grey900"]))
end,
bluetooth_widget
)
-- Signals -- Signals
Hover_signal(bluetooth_widget, color.color["Blue200"]) Hover_signal(bluetooth_widget, color.color["Blue200"])
@@ -106,24 +87,45 @@ return function()
bluetooth_widget:connect_signal( bluetooth_widget:connect_signal(
"button::press", "button::press",
function() function()
awful.spawn.easy_async_with_shell(
"rfkill list bluetooth",
function(stdout)
if stdout:gsub("\n", "") == '' then
if bluetooth_state == "on" then if bluetooth_state == "on" then
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"bluetoothctl power off", [[
function(stdout) rfkill unblock bluetooth
get_bluetooth_information() sleep 1
bluetoothctl power on
]],
function()
naughty.notify({
Title = "System Notification",
app_name = "Bluetooth",
message = "Bluetooth activated"
})
end end
) )
else else
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"bluetoothctl power on", [[
function(stdout) bluetoothctl power off
get_bluetooth_information() rfkill block bluetooth
]],
function()
naughty.notify({
Title = "System Notification",
app_name = "Bluetooth",
message = "Bluetooth deactivated"
})
end end
) )
end end
end end
end
)
end
) )
get_bluetooth_information()
return bluetooth_widget return bluetooth_widget
end end

View File

@@ -84,7 +84,6 @@ local list_update = function(widget, buttons, label, data, objects)
tag_widget:buttons(create_buttons(buttons, object)) tag_widget:buttons(create_buttons(buttons, object))
local text, bg_color, bg_image, icon, args = label(object, tag_label) local text, bg_color, bg_image, icon, args = label(object, tag_label)
local naughty = require("naughty")
tag_label:set_text(object.index) tag_label:set_text(object.index)
if object.urgent == true then if object.urgent == true then
tag_widget:set_bg(color.color["RedA200"]) tag_widget:set_bg(color.color["RedA200"])

View File

@@ -64,10 +64,6 @@ local list_update = function(widget, buttons, label, data, objects)
if buttons then if buttons then
local btns = {} local btns = {}
for _, b in ipairs(buttons) do for _, b in ipairs(buttons) do
-- Create a proxy button object: it will receive the real
-- press and release events, and will propagate them to the
-- button object the user provided, but with the object as
-- argument.
local btn = awful.button { local btn = awful.button {
modifiers = b.modifiers, modifiers = b.modifiers,
button = b.button, button = b.button,
@@ -93,7 +89,11 @@ local list_update = function(widget, buttons, label, data, objects)
else else
local text_full = text:match('>(.-)<') local text_full = text:match('>(.-)<')
if text_full then if text_full then
if object.class == nil then
text = object.name
else
text = object.class:sub(1, 20) text = object.class:sub(1, 20)
end
task_tool_tip:set_text(text_full) task_tool_tip:set_text(text_full)
task_tool_tip:add_to_object(task_widget) task_tool_tip:add_to_object(task_widget)
else else
@@ -110,6 +110,7 @@ local list_update = function(widget, buttons, label, data, objects)
task_widget.container.layout_it.margin.layout_icon.icon:set_image(Get_icon("Papirus-Dark", object)) task_widget.container.layout_it.margin.layout_icon.icon:set_image(Get_icon("Papirus-Dark", object))
widget:add(task_widget) widget:add(task_widget)
widget:set_spacing(dpi(6)) widget:set_spacing(dpi(6))
local old_wibox, old_cursor, old_bg local old_wibox, old_cursor, old_bg
task_widget:connect_signal( task_widget:connect_signal(
"mouse::enter", "mouse::enter",