added powermenu

This commit is contained in:
Rene Kievits
2021-11-06 04:57:15 +01:00
parent 7843046d5b
commit b73cfe028a
35 changed files with 1060 additions and 251 deletions

View File

@@ -115,6 +115,7 @@ return function ()
audio_widget:connect_signal(
"button::press",
function ()
awesome.emit_signal("module::volume_osd:show", true)
audio_widget.bg = color.color["Yellow200"] .. "bb"
end
)
@@ -137,13 +138,6 @@ return function ()
end
)
audio_widget:connect_signal(
"button::press",
function ()
awesome.emit_signal("module::volume_osd:show", true)
end
)
awesome.connect_signal(
"widget::volume",
function (c)

View File

@@ -75,6 +75,7 @@ return function ()
date_widget:connect_signal(
"mouse::enter",
function ()
awesome.emit_signal("widget::calendar_osd:stop", true)
old_bg = date_widget.bg
date_widget.bg = color.color["Teal200"] .. "dd"
local w = mouse.current_wibox
@@ -102,6 +103,7 @@ return function ()
date_widget:connect_signal(
"mouse::leave",
function ()
awesome.emit_signal("widget::calendar_osd:rerun", true)
date_widget.bg = old_bg
if old_wibox then
old_wibox.cursor = old_cursor

View File

@@ -0,0 +1,121 @@
------------------------------
-- This is the audio widget --
------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("theme.crylia.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/kblayout/"
return function ()
local kblayout_widget = wibox.widget{
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
resize = false,
image = gears.color.recolor_image(icondir .. "keyboard.svg", color.color["Grey900"])
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(6),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "kblayout_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(5),
right = dpi(10),
widget = wibox.container.margin
},
bg = color.color["Green200"],
fg = color.color["Grey900"],
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
}
local layout = "";
local get_kblayout = function ()
awful.spawn.easy_async_with_shell(
[[ setxkbmap -query | grep layout | awk '{print $2}' ]],
function (stdout)
layout = stdout
kblayout_widget.container.kblayout_layout.label.text = stdout
return stdout
end
)
return layout
end
local set_kblayout = function (kblayout)
kblayout = "de"
if get_kblayout():gsub("\n", "") == "de" then
kblayout = "ru"
end
awful.spawn.easy_async_with_shell("setxkbmap -layout " .. kblayout)
get_kblayout()
end
-- Signals
local old_wibox, old_cursor, old_bg
kblayout_widget:connect_signal(
"mouse::enter",
function ()
old_bg = kblayout_widget.bg
kblayout_widget.bg = color.color["Green200"] .. "dd"
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
)
kblayout_widget:connect_signal(
"button::press",
function ()
set_kblayout()
kblayout_widget.bg = color.color["Green200"] .. "bb"
end
)
kblayout_widget:connect_signal(
"button::release",
function ()
kblayout_widget.bg = color.color["Green200"] .. "dd"
end
)
kblayout_widget:connect_signal(
"mouse::leave",
function ()
kblayout_widget.bg = old_bg
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)
get_kblayout()
return kblayout_widget
end

View File

@@ -131,7 +131,7 @@ return function ()
[[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]],
function (stdout)
local essid = stdout:match("SSID: (.-)\n") or "N/A"
local bitrate = stdout: match("tx bitrate: (.+/s)") or "N/A"
local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A"
local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
if healthy then
@@ -177,7 +177,7 @@ return function ()
return
end
wifi_strength = tonumber(stdout)
network_widget.container.network_layout.spacing = dpi(10)
network_widget.container.network_layout.spacing = dpi(8)
network_widget.container.network_layout.label.visible = true
network_widget.container.network_layout.label:set_text(tostring(wifi_strength))
local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5)
@@ -259,7 +259,7 @@ return function ()
end
network_widget.container.network_layout.label.visible = false
update_tooltip("Network unreachable")
network_widget.test.test2.spacing = dpi(0)
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color.color["Grey900"]))
end

View File

@@ -75,7 +75,8 @@ return function ()
"button::release",
function ()
power_widget.bg = color.color["Red200"] .. "dd"
awful.spawn("rofi -show power-menu -modi 'power-menu:~/.config/rofi/rofi-power-menu --choices=shutdown/reboot/logout/lockscreen' -theme ~/.config/rofi/powermenu/powermenu.rasi")
awesome.emit_signal("module::powermenu:show")
--awful.spawn("rofi -show power-menu -modi 'power-menu:~/.config/rofi/rofi-power-menu --choices=shutdown/reboot/logout/lockscreen' -theme ~/.config/rofi/powermenu/powermenu.rasi")
end
)

View File

@@ -3,6 +3,7 @@ local awful = require("awful")
local gears = require("gears")
local dpi = require("beautiful").xresources.apply_dpi
local color = require("theme.crylia.colors")
local naughty = require("naughty")
local list_update = function (widget, buttons, label, data, objects)
widget:reset()
@@ -63,7 +64,31 @@ local list_update = function (widget, buttons, label, data, objects)
widget = wibox.widget.background
}
tag_widget:buttons(buttons, object)
local function create_buttons(buttons, object)
if buttons then
local btns = {}
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 {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
end,
on_release = function()
b:emit_signal('release', object)
end
}
btns[#btns + 1] = btn
end
return btns
end
end
tag_widget:buttons(create_buttons(buttons, object))
local text, bg_color, bg_image, icon, args = label(object, tag_label)
@@ -94,7 +119,7 @@ local list_update = function (widget, buttons, label, data, objects)
margins = dpi(6),
widget = wibox.container.margin
}
icon.icon_container.icon:set_image(client.icon)
icon.icon_container.icon:set_image(client:get_icon(1))
tag_widget.widget_margin.container:setup({
icon,
layout = wibox.layout.align.horizontal
@@ -110,7 +135,12 @@ local list_update = function (widget, buttons, label, data, objects)
"mouse::enter",
function ()
old_bg = tag_widget.bg
tag_widget.bg = "#3A475C" .. "dd"
--naughty.notify({title = tostring(old_bg)})
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
@@ -122,14 +152,22 @@ local list_update = function (widget, buttons, label, data, objects)
tag_widget:connect_signal(
"button::press",
function ()
tag_widget.bg = "#3A475C" .. "bb"
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#bbbbbb' .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
end
end
)
tag_widget:connect_signal(
"button::release",
function ()
tag_widget.bg = "#3A475C" .. "dd"
if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd'
else
tag_widget.bg = '#3A475C' .. 'dd'
end
end
)
@@ -147,7 +185,6 @@ local list_update = function (widget, buttons, label, data, objects)
widget:add(tag_widget)
widget:set_spacing(dpi(6))
end
end
local tag_list = function (s)

View File

@@ -62,7 +62,31 @@ local list_update = function (widget, buttons, label, data, objects)
delay_show = 1
}
task_widget:buttons(buttons, object)
local function create_buttons(buttons, object)
if buttons then
local btns = {}
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 {
modifiers = b.modifiers,
button = b.button,
on_press = function()
b:emit_signal('press', object)
end,
on_release = function()
b:emit_signal('release', object)
end
}
btns[#btns + 1] = btn
end
return btns
end
end
task_widget:buttons(create_buttons(buttons, object))
local text, bg, bg_image, icon, args = label(object, task_title)
@@ -72,7 +96,7 @@ local list_update = function (widget, buttons, label, data, objects)
else
local text_full = text:match('>(.-)<')
if text_full then
text = text_full
text = object.class:sub(1,20)
task_tool_tip:set_text(text_full)
task_tool_tip:add_to_object(task_widget)
else
@@ -88,7 +112,7 @@ local list_update = function (widget, buttons, label, data, objects)
end
if icon then
task_icon.icon:set_image(icon)
task_icon.icon:set_image(object:get_icon(1))
else
task_icon_margin:set_margins(0)
end
@@ -101,7 +125,11 @@ local list_update = function (widget, buttons, label, data, objects)
"mouse::enter",
function ()
old_bg = task_widget.bg
task_widget.bg = "#ffffff" .. "bb"
if object == client.focus then
task_widget.bg = '#dddddddd'
else
task_widget.bg = '#3A475Cdd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
@@ -113,14 +141,22 @@ local list_update = function (widget, buttons, label, data, objects)
task_widget:connect_signal(
"button::press",
function ()
task_widget.bg = "#ffffff" .. "aa"
if object == client.focus then
task_widget.bg = "#ffffffaa"
else
task_widget.bg = '#3A475Caa'
end
end
)
task_widget:connect_signal(
"button::release",
function ()
task_widget.bg = "#ffffff" .. "bb"
if object == client.focus then
task_widget.bg = "#ffffffdd"
else
task_widget.bg = '#3A475Cdd'
end
end
)
@@ -148,21 +184,33 @@ return function(s)
return awful.widget.tasklist(
s,
awful.widget.tasklist.filter.currenttags,
gears.table.join(
awful.util.table.join(
awful.button(
{},
1,
function (c)
function(c)
if c == client.focus then
c.minimized = true
else
-- Without this, the following
-- :isvisible() makes no sense
c.minimized = false
if not c.invisible() and c.first_tag then
c:emit_signal("request::activate")
c:raise()
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
-- This will also un-minimize
-- the client, if needed
c:emit_signal('request::activate')
c:raise()
end
end
),
awful.button(
{},
3,
function(c)
c:kill()
end
)
),
{},