Some fixes
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
╰─────────────────────────────────────────────────────────────────╯
|
╰─────────────────────────────────────────────────────────────────╯
|
||||||
|
|
||||||
]]
|
]]
|
||||||
--#region prints
|
--#region s
|
||||||
io.stdout:write([[
|
io.stdout:write([[
|
||||||
]] .. '\n\27[32m' .. [[╭─────────────────────────────────────────────────────────────────╮
|
]] .. '\n\27[32m' .. [[╭─────────────────────────────────────────────────────────────────╮
|
||||||
]] .. '\27[32m' .. [[│]] .. '\27[1;36m' .. [[ ______ ___ ________ ]] .. '\27[32m' .. [[│
|
]] .. '\27[32m' .. [[│]] .. '\27[1;36m' .. [[ ______ ___ ________ ]] .. '\27[32m' .. [[│
|
||||||
@@ -35,16 +35,13 @@ io.stderr:write([[
|
|||||||
]] .. '\27[0m\n')
|
]] .. '\27[0m\n')
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
require('src.core.error_handling')
|
require('src.core.error_handling') {}
|
||||||
require('src.theme')
|
require('src.theme') {}
|
||||||
require('src.core.signals')
|
require('src.core.signals') {}
|
||||||
require('src.core.notifications')
|
require('src.core.notifications') {}
|
||||||
require('src.core.rules')
|
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')()
|
require('src.modules') {}
|
||||||
require('src.tools.auto_starter') {}
|
require('src.tools.auto_starter') {}
|
||||||
|
|
||||||
--require('src.core.setup')()
|
--require('src.core.setup')()
|
||||||
|
|
||||||
--require('src.tools.helpers.pulseaudio')()
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
local table = table
|
||||||
|
local ipairs = ipairs
|
||||||
|
|
||||||
-- Awesome libs
|
-- Awesome libs
|
||||||
local akeygrabber = require('awful.keygrabber')
|
local akeygrabber = require('awful.keygrabber')
|
||||||
local akey = require('awful.key')
|
local akey = require('awful.key')
|
||||||
@@ -15,8 +18,8 @@ local config = require('src.tools.config')
|
|||||||
local audio_helper = require('src.tools.helpers.audio')
|
local audio_helper = require('src.tools.helpers.audio')
|
||||||
local backlight_helper = require('src.tools.helpers.backlight')
|
local backlight_helper = require('src.tools.helpers.backlight')
|
||||||
local beautiful = require('beautiful')
|
local beautiful = require('beautiful')
|
||||||
local powermenu = require('src.modules.powermenu')
|
|
||||||
local kb_helper = require('src.tools.helpers.kb_helper')
|
local kb_helper = require('src.tools.helpers.kb_helper')
|
||||||
|
local window_switcher = require('src.modules.window_switcher')
|
||||||
|
|
||||||
local capi = {
|
local capi = {
|
||||||
awesome = awesome,
|
awesome = awesome,
|
||||||
@@ -26,13 +29,26 @@ local capi = {
|
|||||||
|
|
||||||
local modkey = beautiful.user_config['modkey']
|
local modkey = beautiful.user_config['modkey']
|
||||||
|
|
||||||
|
|
||||||
|
local awful = require('awful')
|
||||||
|
local f = 1
|
||||||
akeygrabber {
|
akeygrabber {
|
||||||
keybindings = {
|
keybindings = {
|
||||||
akey {
|
akey {
|
||||||
modifiers = { 'Mod1' },
|
modifiers = { 'Mod1' },
|
||||||
key = 'Tab',
|
key = 'Tab',
|
||||||
on_press = function()
|
on_press = function()
|
||||||
capi.awesome.emit_signal('window_switcher::select_next')
|
local clients = awful.screen.focused():get_all_clients()
|
||||||
|
if f == #clients then
|
||||||
|
f = 1
|
||||||
|
end
|
||||||
|
f = f + 1
|
||||||
|
clients[f].minimized = false
|
||||||
|
if not clients[f]:isvisible() and clients[f].first_tag then
|
||||||
|
clients[f].first_tag:view_only()
|
||||||
|
end
|
||||||
|
clients[f]:emit_signal('request::activate')
|
||||||
|
clients[f]:raise()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -47,11 +63,13 @@ akeygrabber {
|
|||||||
stop_key = 'Mod1',
|
stop_key = 'Mod1',
|
||||||
stop_event = 'release',
|
stop_event = 'release',
|
||||||
start_callback = function()
|
start_callback = function()
|
||||||
capi.awesome.emit_signal('toggle_window_switcher')
|
aclient.focus.history.disable_tracking()
|
||||||
|
window_switcher.popup.visible = true
|
||||||
end,
|
end,
|
||||||
stop_callback = function()
|
stop_callback = function()
|
||||||
capi.awesome.emit_signal('window_switcher::raise')
|
aclient.focus.history.enable_tracking()
|
||||||
capi.awesome.emit_signal('toggle_window_switcher')
|
window_switcher.popup.visible = false
|
||||||
|
collectgarbage('collect')
|
||||||
end,
|
end,
|
||||||
export_keybindings = true,
|
export_keybindings = true,
|
||||||
}
|
}
|
||||||
@@ -63,18 +81,6 @@ return gtable.join(
|
|||||||
hotkeys_popup.show_help,
|
hotkeys_popup.show_help,
|
||||||
{ description = 'Cheat sheet', group = 'Awesome' }
|
{ description = 'Cheat sheet', group = 'Awesome' }
|
||||||
),
|
),
|
||||||
--[[ akey(
|
|
||||||
{ modkey },
|
|
||||||
'#113',
|
|
||||||
atag.viewprev,
|
|
||||||
{ description = 'View previous tag', group = 'Tag' }
|
|
||||||
),
|
|
||||||
akey(
|
|
||||||
{ modkey },
|
|
||||||
'#114',
|
|
||||||
atag.viewnext,
|
|
||||||
{ description = 'View next tag', group = 'Tag' }
|
|
||||||
), ]]
|
|
||||||
akey(
|
akey(
|
||||||
{ modkey },
|
{ modkey },
|
||||||
'#66',
|
'#66',
|
||||||
@@ -201,7 +207,7 @@ return gtable.join(
|
|||||||
{ modkey },
|
{ modkey },
|
||||||
'#40',
|
'#40',
|
||||||
function()
|
function()
|
||||||
capi.awesome.emit_signal('application_launcher::show')
|
require('src.modules.app_launcher'):toggle(capi.mouse.screen)
|
||||||
end,
|
end,
|
||||||
{ descripton = 'Application launcher', group = 'Application' }
|
{ descripton = 'Application launcher', group = 'Application' }
|
||||||
),
|
),
|
||||||
@@ -217,7 +223,7 @@ return gtable.join(
|
|||||||
{ modkey, 'Shift' },
|
{ modkey, 'Shift' },
|
||||||
'#26',
|
'#26',
|
||||||
function()
|
function()
|
||||||
powermenu:toggle()
|
require('src.modules.powermenu'):toggle()
|
||||||
end,
|
end,
|
||||||
{ descripton = 'Session options', group = 'System' }
|
{ descripton = 'Session options', group = 'System' }
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,30 +1,32 @@
|
|||||||
----------------------------------------------------------------
|
local setmetatable = setmetatable
|
||||||
-- This class is to output an error if you fuck up the config --
|
local tostring = tostring
|
||||||
----------------------------------------------------------------
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local naughty = require('naughty')
|
|
||||||
local gfilesystem = require('gears.filesystem')
|
local gfilesystem = require('gears.filesystem')
|
||||||
|
local gtimer = require('gears.timer')
|
||||||
|
local naughty = require('naughty')
|
||||||
|
|
||||||
local capi = {
|
local capi = {
|
||||||
awesome = awesome,
|
awesome = awesome,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local instance = nil
|
||||||
|
if not instance then
|
||||||
|
instance = setmetatable({}, {
|
||||||
|
__call = function()
|
||||||
if capi.awesome.startup_errors then
|
if capi.awesome.startup_errors then
|
||||||
naughty.notify { preset = naughty.config.presets.critical,
|
naughty.notification {
|
||||||
title = 'Oops, there were errors during startup!',
|
preset = naughty.config.presets.critical,
|
||||||
text = capi.awesome.startup_errors,
|
title = 'ERROR!',
|
||||||
gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg',
|
app_name = 'System Notification',
|
||||||
|
message = capi.awesome.startup_errors,
|
||||||
|
icon = gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
|
||||||
local in_error = false
|
local in_error = false
|
||||||
capi.awesome.connect_signal(
|
capi.awesome.connect_signal('debug::error', function(err)
|
||||||
'debug::error',
|
if in_error then return end
|
||||||
function(err)
|
|
||||||
if in_error then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
in_error = true
|
in_error = true
|
||||||
|
|
||||||
naughty.notification {
|
naughty.notification {
|
||||||
@@ -34,7 +36,18 @@ do
|
|||||||
message = tostring(err),
|
message = tostring(err),
|
||||||
icon = gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg',
|
icon = gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Make sure an error is only put every 3 seconds to prevent spam
|
||||||
|
gtimer {
|
||||||
|
timeout = 3,
|
||||||
|
autostart = true,
|
||||||
|
single_shot = true,
|
||||||
|
callback = function()
|
||||||
in_error = false
|
in_error = false
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
)
|
return instance
|
||||||
end
|
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
-------------------------------
|
local setmetatable = setmetatable
|
||||||
-- The Notification defaults --
|
|
||||||
-------------------------------
|
|
||||||
-- Awesome Libs
|
|
||||||
|
|
||||||
|
-- Awesome Libs
|
||||||
|
local abutton = require('awful.button')
|
||||||
local aspawn = require('awful.spawn')
|
local aspawn = require('awful.spawn')
|
||||||
local beautiful = require('beautiful')
|
local beautiful = require('beautiful')
|
||||||
local dpi = require('beautiful').xresources.apply_dpi
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
local gcolor = require('gears.color')
|
local gcolor = require('gears.color')
|
||||||
local gfilesystem = require('gears.filesystem')
|
local gfilesystem = require('gears.filesystem')
|
||||||
|
local gtable = require('gears.table')
|
||||||
local naughty = require('naughty')
|
local naughty = require('naughty')
|
||||||
local wibox = require('wibox')
|
local wibox = require('wibox')
|
||||||
local abutton = require('awful.button')
|
|
||||||
local gtable = require('gears.table')
|
|
||||||
|
|
||||||
|
-- Third party libs
|
||||||
local rubato = require('src.lib.rubato')
|
local rubato = require('src.lib.rubato')
|
||||||
|
|
||||||
|
-- Local Libs
|
||||||
local hover = require('src.tools.hover')
|
local hover = require('src.tools.hover')
|
||||||
|
|
||||||
local capi = {
|
local capi = {
|
||||||
@@ -21,26 +22,30 @@ local capi = {
|
|||||||
screen = screen,
|
screen = screen,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local instance = nil
|
||||||
|
if not instance then
|
||||||
|
instance = setmetatable({}, {
|
||||||
|
__call = function()
|
||||||
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
|
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
|
||||||
|
|
||||||
|
naughty.config.defaults.border_color = beautiful.colorscheme.border_color
|
||||||
|
naughty.config.defaults.border_width = dpi(2)
|
||||||
|
naughty.config.defaults.icon_size = dpi(64)
|
||||||
|
naughty.config.defaults.margin = dpi(10)
|
||||||
naughty.config.defaults.ontop = true
|
naughty.config.defaults.ontop = true
|
||||||
naughty.config.defaults.icon_size = dpi(80)
|
naughty.config.defaults.position = 'bottom_right'
|
||||||
|
naughty.config.defaults.spacing = dpi(10)
|
||||||
naughty.config.defaults.timeout = 5
|
naughty.config.defaults.timeout = 5
|
||||||
naughty.config.defaults.title = 'System Notification'
|
naughty.config.defaults.title = 'System Notification'
|
||||||
naughty.config.defaults.margin = dpi(10)
|
|
||||||
naughty.config.defaults.position = 'bottom_right'
|
|
||||||
naughty.config.defaults.border_width = dpi(2)
|
|
||||||
naughty.config.defaults.border_color = beautiful.colorscheme.border_color
|
|
||||||
naughty.config.defaults.spacing = dpi(10)
|
|
||||||
|
|
||||||
naughty.connect_signal('request::display', function(n)
|
naughty.connect_signal('request::display', function(n)
|
||||||
if beautiful.user_config.dnd then
|
if beautiful.user_config.dnd then
|
||||||
n:destroy()
|
n:destroy()
|
||||||
else
|
else
|
||||||
if not n.icon then n.icon = gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg' end
|
n.app_name = n.app_name or 'System'
|
||||||
if not n.app_name then n.app_name = 'System' end
|
n.icon = n.icon or gfilesystem.get_configuration_dir() .. 'src/assets/CT.svg'
|
||||||
if not n.title then n.title = 'System Notification' end
|
n.message = n.message or 'No message provided'
|
||||||
if not n.message then n.message = 'No message provided' end
|
n.title = n.title or 'System Notification'
|
||||||
|
|
||||||
local color = beautiful.colorscheme.bg_blue
|
local color = beautiful.colorscheme.bg_blue
|
||||||
if n.urgency == 'critical' then
|
if n.urgency == 'critical' then
|
||||||
@@ -93,7 +98,7 @@ naughty.connect_signal('request::display', function(n)
|
|||||||
id = 'text_role',
|
id = 'text_role',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
halign = 'center',
|
halign = 'center',
|
||||||
font = 'JetBrainsMono Nerd Font, Bold 16',
|
font = beautiful.user_config.font .. ' bold 16',
|
||||||
},
|
},
|
||||||
widget = wibox.container.constraint,
|
widget = wibox.container.constraint,
|
||||||
height = dpi(35),
|
height = dpi(35),
|
||||||
@@ -172,8 +177,8 @@ naughty.connect_signal('request::display', function(n)
|
|||||||
notification = n,
|
notification = n,
|
||||||
widget = naughty.widget.title,
|
widget = naughty.widget.title,
|
||||||
markup = [[<span foreground="]] ..
|
markup = [[<span foreground="]] ..
|
||||||
beautiful.colorscheme.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or
|
beautiful.colorscheme.bg .. [[" font="]] .. beautiful.user_config.font .. ' bold 16' .. [[">]] .. (n.app_name or
|
||||||
'Unknown App') .. [[</span> | <span font="JetBrainsMono Nerd Font, Regular 16">]] .. (n.title or 'System Notification') .. [[</span>]],
|
'Unknown App') .. [[</span> | <span font="]] .. beautiful.user_config.font .. ' regular 16' .. [[">]] .. (n.title or 'System Notification') .. [[</span>]],
|
||||||
halign = 'left',
|
halign = 'left',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
},
|
},
|
||||||
@@ -194,7 +199,7 @@ naughty.connect_signal('request::display', function(n)
|
|||||||
{ -- Clock
|
{ -- Clock
|
||||||
widget = wibox.widget.textclock,
|
widget = wibox.widget.textclock,
|
||||||
format = '%H:%M',
|
format = '%H:%M',
|
||||||
font = 'JetBrainsMono Nerd Font, Bold 16',
|
font = beautiful.user_config.font .. ' bold 16',
|
||||||
fg = beautiful.colorscheme.bg,
|
fg = beautiful.colorscheme.bg,
|
||||||
halign = 'right',
|
halign = 'right',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
@@ -267,7 +272,7 @@ naughty.connect_signal('request::display', function(n)
|
|||||||
{
|
{
|
||||||
notification = n,
|
notification = n,
|
||||||
widget = naughty.widget.message,
|
widget = naughty.widget.message,
|
||||||
font = 'JetBrainsMono Nerd Font, Regular 10',
|
font = beautiful.user_config.font .. ' bold 10',
|
||||||
halign = 'left',
|
halign = 'left',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
},
|
},
|
||||||
@@ -376,27 +381,7 @@ naughty.connect_signal('request::display', function(n)
|
|||||||
n.buttons = {}
|
n.buttons = {}
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
--[[
|
end,
|
||||||
naughty.notification {
|
})
|
||||||
app_name = 'Spotify',
|
end
|
||||||
title = 'The Beatles - Here Comes The Sun',
|
return instance
|
||||||
message = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
|
|
||||||
icon = '/home/crylia/Bilder/57384097.jpg',
|
|
||||||
timeout = 30,
|
|
||||||
actions = {
|
|
||||||
naughty.action {
|
|
||||||
name = 'amet',
|
|
||||||
position = 1,
|
|
||||||
text = 'Test',
|
|
||||||
},
|
|
||||||
naughty.action {
|
|
||||||
name = 'Lorem ipsum dolor sit amet',
|
|
||||||
position = 2,
|
|
||||||
},
|
|
||||||
naughty.action {
|
|
||||||
name = 'Lorem',
|
|
||||||
position = 3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
-------------------------------------------------------------------------------------------------
|
local setmetatable = setmetatable
|
||||||
-- This class contains rules for float exceptions or special themeing for certain applications --
|
local ipairs = ipairs
|
||||||
-------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local aclient = require('awful.client')
|
local aclient = require('awful.client')
|
||||||
local aplacement = require('awful.placement')
|
local aplacement = require('awful.placement')
|
||||||
local ascreen = require('awful.screen')
|
local ascreen = require('awful.screen')
|
||||||
local beautiful = require('beautiful')
|
local beautiful = require('beautiful')
|
||||||
local dpi = require('beautiful').xresources.apply_dpi
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
local ruled = require('ruled')
|
local ruled = require('ruled')
|
||||||
|
|
||||||
local config = require('src.tools.config')
|
local config = require('src.tools.config')
|
||||||
|
|
||||||
awesome.register_xproperty('_NET_WM_BYPASS_COMPOSITOR', 'boolean')
|
local capi = {
|
||||||
|
awesome = awesome,
|
||||||
|
}
|
||||||
|
|
||||||
|
local instance = nil
|
||||||
|
if not instance then
|
||||||
|
instance = setmetatable({}, {
|
||||||
|
__call = function()
|
||||||
|
capi.awesome.register_xproperty('_NET_WM_BYPASS_COMPOSITOR', 'boolean')
|
||||||
|
|
||||||
ruled.client.connect_signal('request::rules', function()
|
ruled.client.connect_signal('request::rules', function()
|
||||||
ruled.client.append_rule {
|
ruled.client.append_rule {
|
||||||
@@ -89,7 +96,7 @@ ruled.client.connect_signal('request::rules', function()
|
|||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
do
|
|
||||||
local data = config.read_json('/home/crylia/.config/awesome/src/config/floating.json')
|
local data = config.read_json('/home/crylia/.config/awesome/src/config/floating.json')
|
||||||
for _, c in ipairs(data) do
|
for _, c in ipairs(data) do
|
||||||
ruled.client.append_rule {
|
ruled.client.append_rule {
|
||||||
@@ -99,4 +106,7 @@ do
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
return instance
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
--- A module to manage the first installation and setup the config without having to edit
|
local setmetatable = setmetatable
|
||||||
--- the config files manually.
|
local pairs = pairs
|
||||||
|
local ipairs = ipairs
|
||||||
|
local table = table
|
||||||
|
local math = math
|
||||||
|
|
||||||
--Awesome Libs
|
--Awesome Libs
|
||||||
local abutton = require('awful.button')
|
local abutton = require('awful.button')
|
||||||
@@ -10,20 +13,19 @@ local atooltip = require('awful.tooltip')
|
|||||||
local beautiful = require('beautiful')
|
local beautiful = require('beautiful')
|
||||||
local dpi = require('beautiful').xresources.apply_dpi
|
local dpi = require('beautiful').xresources.apply_dpi
|
||||||
local gcolor = require('gears.color')
|
local gcolor = require('gears.color')
|
||||||
|
local gfilesystem = require('gears.filesystem')
|
||||||
local gtable = require('gears.table')
|
local gtable = require('gears.table')
|
||||||
local wibox = require('wibox')
|
local wibox = require('wibox')
|
||||||
local gfilesystem = require('gears.filesystem')
|
|
||||||
local inputwidget = require('src.modules.inputbox')
|
|
||||||
|
|
||||||
--Own Libs
|
--Own Libs
|
||||||
local toggle_button = require('awful.widget.toggle_widget')
|
local toggle_button = require('awful.widget.toggle_widget')
|
||||||
|
local inputwidget = require('src.modules.inputbox')
|
||||||
|
|
||||||
local capi = {
|
local capi = {
|
||||||
screen = screen,
|
screen = screen,
|
||||||
}
|
}
|
||||||
|
|
||||||
local assets_dir = os.getenv('HOME') .. '/.config/awesome/src/assets/'
|
local assets_dir = os.getenv('HOME') .. '/.config/awesome/src/assets/'
|
||||||
local font_dir = os.getenv('HOME') .. '/.config/awesome/src/assets/fonts/'
|
|
||||||
local icon_dir = os.getenv('HOME') .. '/.config/awesome/src/assets/icons/setup/'
|
local icon_dir = os.getenv('HOME') .. '/.config/awesome/src/assets/icons/setup/'
|
||||||
|
|
||||||
local setup = { mt = {} }
|
local setup = { mt = {} }
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
---@diagnostic disable: undefined-field
|
local setmetatable = setmetatable
|
||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local aplacement = require('awful.placement')
|
local aplacement = require('awful.placement')
|
||||||
local gtimer = require('gears.timer')
|
|
||||||
local ascreen = require('awful.screen')
|
local ascreen = require('awful.screen')
|
||||||
local ruled = require('ruled')
|
local beautiful = require('beautiful')
|
||||||
|
local gtimer = require('gears.timer')
|
||||||
local config = require('src.tools.config')
|
|
||||||
|
|
||||||
local capi = {
|
local capi = {
|
||||||
awesome = awesome,
|
awesome = awesome,
|
||||||
@@ -15,6 +14,10 @@ local capi = {
|
|||||||
tag = tag,
|
tag = tag,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local instance = nil
|
||||||
|
if not instance then
|
||||||
|
instance = setmetatable({}, {
|
||||||
|
__call = function()
|
||||||
capi.screen.connect_signal('added', function()
|
capi.screen.connect_signal('added', function()
|
||||||
capi.awesome.restart()
|
capi.awesome.restart()
|
||||||
end)
|
end)
|
||||||
@@ -37,15 +40,6 @@ capi.client.connect_signal('manage', function(c)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
local data = config.read_json('/home/crylia/.config/awesome/src/config/floating.json')
|
|
||||||
for _, c in ipairs(data) do
|
|
||||||
ruled.client.append_rule {
|
|
||||||
rule = { class = c.WM_CLASS, instance = c.WM_INSTANCE },
|
|
||||||
properties = {
|
|
||||||
floating = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
capi.client.connect_signal('unmanage', function(c)
|
capi.client.connect_signal('unmanage', function(c)
|
||||||
@@ -54,6 +48,7 @@ capi.client.connect_signal('unmanage', function(c)
|
|||||||
raise = true,
|
raise = true,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
collectgarbage('collect')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
capi.tag.connect_signal('property::selected', function(c)
|
capi.tag.connect_signal('property::selected', function(c)
|
||||||
@@ -65,10 +60,16 @@ capi.tag.connect_signal('property::selected', function(c)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Sloppy focus
|
-- Sloppy focus
|
||||||
--[[ client.connect_signal('mouse::enter', function(c)
|
if beautiful.user_config.sloppy_focus then
|
||||||
|
client.connect_signal('mouse::enter', function(c)
|
||||||
c:emit_signal(
|
c:emit_signal(
|
||||||
'request::activate',
|
'request::activate',
|
||||||
'mouse_enter', {
|
'mouse_enter', {
|
||||||
raise = true,
|
raise = true,
|
||||||
})
|
})
|
||||||
end) ]]
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return instance
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local beautiful = require('beautiful')
|
|||||||
local cairo = require('lgi').cairo
|
local cairo = require('lgi').cairo
|
||||||
local dpi = require('beautiful').xresources.apply_dpi
|
local dpi = require('beautiful').xresources.apply_dpi
|
||||||
local gcolor = require('gears.color')
|
local gcolor = require('gears.color')
|
||||||
local gdk = require('lgi').Gdk
|
local gdk = require('lgi').require('Gdk', '3.0')
|
||||||
local gfilesystem = require('gears.filesystem')
|
local gfilesystem = require('gears.filesystem')
|
||||||
local gsurface = require('gears.surface')
|
local gsurface = require('gears.surface')
|
||||||
local gtimer = require('gears.timer')
|
local gtimer = require('gears.timer')
|
||||||
@@ -497,8 +497,6 @@ local function create_titlebar_items(c, group)
|
|||||||
return layout
|
return layout
|
||||||
end
|
end
|
||||||
|
|
||||||
---Adds the titlebar to the left of a client
|
|
||||||
---@param c client
|
|
||||||
function add_titlebar(c)
|
function add_titlebar(c)
|
||||||
if titlebar_position == 'top' then
|
if titlebar_position == 'top' then
|
||||||
atitlebar(c, {
|
atitlebar(c, {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ local gshape = require('gears.shape')
|
|||||||
local gobject = require('gears.object')
|
local gobject = require('gears.object')
|
||||||
local mousegrabber = mousegrabber
|
local mousegrabber = mousegrabber
|
||||||
|
|
||||||
|
local rubato = require('src.lib.rubato')
|
||||||
|
|
||||||
local overflow = { mt = {} }
|
local overflow = { mt = {} }
|
||||||
|
|
||||||
-- Determine the required space to draw the layout's children and, if necessary,
|
-- Determine the required space to draw the layout's children and, if necessary,
|
||||||
@@ -33,7 +35,7 @@ function overflow:fit(context, orig_width, orig_height)
|
|||||||
local scrollbar_width = self._private.scrollbar_width
|
local scrollbar_width = self._private.scrollbar_width
|
||||||
local scrollbar_enabled = self._private.scrollbar_enabled
|
local scrollbar_enabled = self._private.scrollbar_enabled
|
||||||
local used_in_dir, used_max = 0, 0
|
local used_in_dir, used_max = 0, 0
|
||||||
local is_y = self._private.dir == "y"
|
local is_y = self._private.dir == 'y'
|
||||||
local avail_in_dir = is_y and orig_height or orig_width
|
local avail_in_dir = is_y and orig_height or orig_width
|
||||||
|
|
||||||
-- Set the direction covered by scrolling to the maximum value
|
-- Set the direction covered by scrolling to the maximum value
|
||||||
@@ -81,7 +83,7 @@ end
|
|||||||
-- Only those widgets that are currently visible will be placed.
|
-- Only those widgets that are currently visible will be placed.
|
||||||
function overflow:layout(context, orig_width, orig_height)
|
function overflow:layout(context, orig_width, orig_height)
|
||||||
local result = {}
|
local result = {}
|
||||||
local is_y = self._private.dir == "y"
|
local is_y = self._private.dir == 'y'
|
||||||
local widgets = self._private.widgets
|
local widgets = self._private.widgets
|
||||||
local avail_in_dir = is_y and orig_height or orig_width
|
local avail_in_dir = is_y and orig_height or orig_width
|
||||||
local scrollbar_width = self._private.scrollbar_width
|
local scrollbar_width = self._private.scrollbar_width
|
||||||
@@ -140,9 +142,9 @@ function overflow:layout(context, orig_width, orig_height)
|
|||||||
bar_w, bar_h = base.fit_widget(self, context, scrollbar_widget, scrollbar_width, bar_length)
|
bar_w, bar_h = base.fit_widget(self, context, scrollbar_widget, scrollbar_width, bar_length)
|
||||||
bar_y = bar_pos
|
bar_y = bar_pos
|
||||||
|
|
||||||
if scrollbar_position == "left" then
|
if scrollbar_position == 'left' then
|
||||||
widget_x = widget_x + bar_w
|
widget_x = widget_x + bar_w
|
||||||
elseif scrollbar_position == "right" then
|
elseif scrollbar_position == 'right' then
|
||||||
bar_x = orig_width - bar_w
|
bar_x = orig_width - bar_w
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -153,9 +155,9 @@ function overflow:layout(context, orig_width, orig_height)
|
|||||||
bar_w, bar_h = base.fit_widget(self, context, scrollbar_widget, bar_length, scrollbar_width)
|
bar_w, bar_h = base.fit_widget(self, context, scrollbar_widget, bar_length, scrollbar_width)
|
||||||
bar_x = bar_pos
|
bar_x = bar_pos
|
||||||
|
|
||||||
if scrollbar_position == "top" then
|
if scrollbar_position == 'top' then
|
||||||
widget_y = widget_y + bar_h
|
widget_y = widget_y + bar_h
|
||||||
elseif scrollbar_position == "bottom" then
|
elseif scrollbar_position == 'bottom' then
|
||||||
bar_y = orig_height - bar_h
|
bar_y = orig_height - bar_h
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -305,6 +307,13 @@ end
|
|||||||
-- @tparam number scroll_factor The scroll factor.
|
-- @tparam number scroll_factor The scroll factor.
|
||||||
-- @propemits true false
|
-- @propemits true false
|
||||||
|
|
||||||
|
overflow.rubato_timed = rubato.timed {
|
||||||
|
duration = 0.5,
|
||||||
|
rate = 24,
|
||||||
|
clamp_position = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
local first_call = true
|
||||||
function overflow:set_scroll_factor(factor)
|
function overflow:set_scroll_factor(factor)
|
||||||
local current = self._private.scroll_factor
|
local current = self._private.scroll_factor
|
||||||
local interval = self._private.used_in_dir - self._private.avail_in_dir
|
local interval = self._private.used_in_dir - self._private.avail_in_dir
|
||||||
@@ -318,10 +327,22 @@ function overflow:set_scroll_factor(factor)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self._private.scroll_factor = math.min(1, math.max(factor, 0))
|
local function update_scroll()
|
||||||
|
self._private.scroll_factor = self.rubato_timed.pos
|
||||||
|
self:emit_signal('widget::layout_changed')
|
||||||
|
self:emit_signal('property::scroll_factor', factor)
|
||||||
|
end
|
||||||
|
|
||||||
self:emit_signal("widget::layout_changed")
|
if first_call then
|
||||||
self:emit_signal("property::scroll_factor", factor)
|
self.rubato_timed:subscribe(update_scroll)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.rubato_timed.target = math.min(1, math.max(factor + (self.rubato_timed.target - self.rubato_timed.pos), 0))
|
||||||
|
print(self.rubato_timed.target)
|
||||||
|
--self._private.scroll_factor = math.min(1, math.max(factor, 0))
|
||||||
|
|
||||||
|
--self:emit_signal('widget::layout_changed')
|
||||||
|
--self:emit_signal('property::scroll_factor', factor)
|
||||||
end
|
end
|
||||||
|
|
||||||
function overflow:get_scroll_factor()
|
function overflow:get_scroll_factor()
|
||||||
@@ -347,8 +368,8 @@ function overflow:set_scrollbar_width(width)
|
|||||||
|
|
||||||
self._private.scrollbar_width = width
|
self._private.scrollbar_width = width
|
||||||
|
|
||||||
self:emit_signal("widget::layout_changed")
|
self:emit_signal('widget::layout_changed')
|
||||||
self:emit_signal("property::scrollbar_width", width)
|
self:emit_signal('property::scrollbar_width', width)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- The scrollbar position.
|
--- The scrollbar position.
|
||||||
@@ -370,8 +391,8 @@ function overflow:set_scrollbar_position(position)
|
|||||||
|
|
||||||
self._private.scrollbar_position = position
|
self._private.scrollbar_position = position
|
||||||
|
|
||||||
self:emit_signal("widget::layout_changed")
|
self:emit_signal('widget::layout_changed')
|
||||||
self:emit_signal("property::scrollbar_position", position)
|
self:emit_signal('property::scrollbar_position', position)
|
||||||
end
|
end
|
||||||
|
|
||||||
function overflow:get_scrollbar_position()
|
function overflow:get_scrollbar_position()
|
||||||
@@ -396,8 +417,8 @@ function overflow:set_scrollbar_enabled(enabled)
|
|||||||
|
|
||||||
self._private.scrollbar_enabled = enabled
|
self._private.scrollbar_enabled = enabled
|
||||||
|
|
||||||
self:emit_signal("widget::layout_changed")
|
self:emit_signal('widget::layout_changed')
|
||||||
self:emit_signal("property::scrollbar_enabled", enabled)
|
self:emit_signal('property::scrollbar_enabled', enabled)
|
||||||
end
|
end
|
||||||
|
|
||||||
function overflow:get_scrollbar_enabled()
|
function overflow:get_scrollbar_enabled()
|
||||||
@@ -407,7 +428,7 @@ end
|
|||||||
-- Wraps a callback function for `mousegrabber` that is capable of
|
-- Wraps a callback function for `mousegrabber` that is capable of
|
||||||
-- updating the scroll factor.
|
-- updating the scroll factor.
|
||||||
local function build_grabber(container, initial_x, initial_y, geo)
|
local function build_grabber(container, initial_x, initial_y, geo)
|
||||||
local is_y = container._private.dir == "y"
|
local is_y = container._private.dir == 'y'
|
||||||
local bar_interval = container._private.avail_in_dir - container._private.bar_length
|
local bar_interval = container._private.avail_in_dir - container._private.bar_length
|
||||||
local start_pos = container._private.scroll_factor * bar_interval
|
local start_pos = container._private.scroll_factor * bar_interval
|
||||||
local start = is_y and initial_y or initial_x
|
local start = is_y and initial_y or initial_x
|
||||||
@@ -439,7 +460,7 @@ local function apply_scrollbar_mouse_signal(container, w)
|
|||||||
if button_id ~= 1 then
|
if button_id ~= 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
mousegrabber.run(build_grabber(container, x, y, geo), "fleur")
|
mousegrabber.run(build_grabber(container, x, y, geo), 'fleur')
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -461,8 +482,8 @@ function overflow:set_scrollbar_widget(widget)
|
|||||||
|
|
||||||
self._private.scrollbar_widget = w
|
self._private.scrollbar_widget = w
|
||||||
|
|
||||||
self:emit_signal("widget::layout_changed")
|
self:emit_signal('widget::layout_changed')
|
||||||
self:emit_signal("property::scrollbar_widget", widget)
|
self:emit_signal('property::scrollbar_widget', widget)
|
||||||
end
|
end
|
||||||
|
|
||||||
function overflow:get_scrollbar_widget()
|
function overflow:get_scrollbar_widget()
|
||||||
@@ -473,13 +494,13 @@ function overflow:reset()
|
|||||||
self._private.widgets = {}
|
self._private.widgets = {}
|
||||||
self._private.scroll_factor = 0
|
self._private.scroll_factor = 0
|
||||||
|
|
||||||
local scrollbar_widget = separator({ shape = gshape.rectangle })
|
local scrollbar_widget = separator { shape = gshape.rectangle }
|
||||||
apply_scrollbar_mouse_signal(self, scrollbar_widget)
|
apply_scrollbar_mouse_signal(self, scrollbar_widget)
|
||||||
self._private.scrollbar_widget = scrollbar_widget
|
self._private.scrollbar_widget = scrollbar_widget
|
||||||
|
|
||||||
self:emit_signal("widget::layout_changed")
|
self:emit_signal('widget::layout_changed')
|
||||||
self:emit_signal("widget::reset")
|
self:emit_signal('widget::reset')
|
||||||
self:emit_signal("widget::reseted")
|
self:emit_signal('widget::reseted')
|
||||||
end
|
end
|
||||||
|
|
||||||
local function new(dir, ...)
|
local function new(dir, ...)
|
||||||
@@ -500,9 +521,9 @@ local function new(dir, ...)
|
|||||||
ret._private.fill_space = true
|
ret._private.fill_space = true
|
||||||
ret._private.scrollbar_width = 5
|
ret._private.scrollbar_width = 5
|
||||||
ret._private.scrollbar_enabled = true
|
ret._private.scrollbar_enabled = true
|
||||||
ret._private.scrollbar_position = dir == "vertical" and "right" or "bottom"
|
ret._private.scrollbar_position = dir == 'vertical' and 'right' or 'bottom'
|
||||||
|
|
||||||
local scrollbar_widget = separator({ shape = gshape.rectangle })
|
local scrollbar_widget = separator { shape = gshape.rectangle }
|
||||||
apply_scrollbar_mouse_signal(ret, scrollbar_widget)
|
apply_scrollbar_mouse_signal(ret, scrollbar_widget)
|
||||||
ret._private.scrollbar_widget = scrollbar_widget
|
ret._private.scrollbar_widget = scrollbar_widget
|
||||||
|
|
||||||
@@ -525,7 +546,7 @@ end
|
|||||||
-- @tparam widget ... Widgets that should be added to the layout.
|
-- @tparam widget ... Widgets that should be added to the layout.
|
||||||
-- @constructorfct wibox.layout.overflow.horizontal
|
-- @constructorfct wibox.layout.overflow.horizontal
|
||||||
function overflow.horizontal(...)
|
function overflow.horizontal(...)
|
||||||
return new("horizontal", ...)
|
return new('horizontal', ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns a new vertical overflow layout.
|
--- Returns a new vertical overflow layout.
|
||||||
@@ -536,7 +557,7 @@ end
|
|||||||
-- @tparam widget ... Widgets that should be added to the layout.
|
-- @tparam widget ... Widgets that should be added to the layout.
|
||||||
-- @constructorfct wibox.layout.overflow.vertical
|
-- @constructorfct wibox.layout.overflow.vertical
|
||||||
function overflow.vertical(...)
|
function overflow.vertical(...)
|
||||||
return new("vertical", ...)
|
return new('vertical', ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(overflow, overflow.mt)
|
return setmetatable(overflow, overflow.mt)
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
local ipairs = ipairs
|
||||||
|
local math = math
|
||||||
|
local pairs = pairs
|
||||||
|
local setmetatable = setmetatable
|
||||||
|
local table = table
|
||||||
|
|
||||||
|
-- Awesome Libs
|
||||||
|
local Gio = require('lgi').Gio
|
||||||
local abutton = require('awful.button')
|
local abutton = require('awful.button')
|
||||||
local akey = require('awful.key')
|
local akey = require('awful.key')
|
||||||
local akeygrabber = require('awful.keygrabber')
|
local akeygrabber = require('awful.keygrabber')
|
||||||
@@ -5,22 +13,22 @@ local aplacement = require('awful.placement')
|
|||||||
local apopup = require('awful.popup')
|
local apopup = require('awful.popup')
|
||||||
local beautiful = require('beautiful')
|
local beautiful = require('beautiful')
|
||||||
local dpi = beautiful.xresources.apply_dpi
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
|
local gcolor = require('gears.color')
|
||||||
|
local gfilesystem = require('gears.filesystem')
|
||||||
|
local gobject = require('gears.object')
|
||||||
local gtable = require('gears.table')
|
local gtable = require('gears.table')
|
||||||
local gtimer = require('gears.timer')
|
local gtimer = require('gears.timer')
|
||||||
local wibox = require('wibox')
|
local wibox = require('wibox')
|
||||||
local gobject = require('gears.object')
|
|
||||||
local Gio = require('lgi').Gio
|
|
||||||
local gfilesystem = require('gears.filesystem')
|
|
||||||
local gcolor = require('gears.color')
|
|
||||||
|
|
||||||
|
-- Third Party Libs
|
||||||
local fzy = require('fzy')
|
local fzy = require('fzy')
|
||||||
|
|
||||||
local hover = require('src.tools.hover')
|
-- Local Libs
|
||||||
local inputbox = require('src.modules.inputbox')
|
|
||||||
local context_menu = require('src.modules.context_menu')
|
local context_menu = require('src.modules.context_menu')
|
||||||
local config = require('src.tools.config')
|
|
||||||
local icon_lookup = require('src.tools.gio_icon_lookup')
|
|
||||||
local dock = require('src.modules.crylia_bar.dock')
|
local dock = require('src.modules.crylia_bar.dock')
|
||||||
|
local hover = require('src.tools.hover')
|
||||||
|
local icon_lookup = require('src.tools.gio_icon_lookup')
|
||||||
|
local inputbox = require('src.modules.inputbox')
|
||||||
|
|
||||||
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/context_menu/'
|
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/context_menu/'
|
||||||
|
|
||||||
@@ -31,6 +39,12 @@ local capi = {
|
|||||||
|
|
||||||
local launcher = gobject {}
|
local launcher = gobject {}
|
||||||
|
|
||||||
|
--- Fetches all applications and their information from Gio.AppInfo.get_all()
|
||||||
|
--- and generates a wibox widget for each application, containing the application's icon, name and launch command.
|
||||||
|
--- The generated wibox widget also includes a context menu that allows the user to launch,
|
||||||
|
--- add to desktop, or pin the application to the dock.
|
||||||
|
--- @param self The launcher table.
|
||||||
|
---
|
||||||
function launcher:fetch_apps()
|
function launcher:fetch_apps()
|
||||||
for _, app in ipairs(Gio.AppInfo.get_all()) do
|
for _, app in ipairs(Gio.AppInfo.get_all()) do
|
||||||
local app_id = app:get_id()
|
local app_id = app:get_id()
|
||||||
@@ -190,54 +204,15 @@ function launcher:fetch_apps()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function levenshtein_distance(str1, str2)
|
---Reset the grid and add all apps that match to a filter using fzy scoring
|
||||||
local len1 = string.len(str1)
|
---@param filter string Filter for the name, category and keywords
|
||||||
local len2 = string.len(str2)
|
|
||||||
local matrix = {}
|
|
||||||
local cost = 0
|
|
||||||
|
|
||||||
if (len1 == 0) then
|
|
||||||
return len2
|
|
||||||
elseif (len2 == 0) then
|
|
||||||
return len1
|
|
||||||
elseif (str1 == str2) then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
for i = 0, len1, 1 do
|
|
||||||
matrix[i] = {}
|
|
||||||
matrix[i][0] = i
|
|
||||||
end
|
|
||||||
for j = 0, len2, 1 do
|
|
||||||
matrix[0][j] = j
|
|
||||||
end
|
|
||||||
|
|
||||||
for i = 1, len1, 1 do
|
|
||||||
for j = 1, len2, 1 do
|
|
||||||
if str1:byte(i) == str2:byte(j) then
|
|
||||||
cost = 0
|
|
||||||
else
|
|
||||||
cost = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
matrix[i][j] = math.min(
|
|
||||||
matrix[i - 1][j] + 1,
|
|
||||||
matrix[i][j - 1] + 1,
|
|
||||||
matrix[i - 1][j - 1] + cost
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return matrix[len1][len2]
|
|
||||||
end
|
|
||||||
|
|
||||||
function launcher:filter_apps(filter)
|
function launcher:filter_apps(filter)
|
||||||
filter = filter or ''
|
filter = filter or ''
|
||||||
self.grid:reset()
|
self.grid:reset()
|
||||||
local app_list = {}
|
local app_list = {}
|
||||||
for _, app in pairs(self.app_table) do
|
for _, app in pairs(self.app_table) do
|
||||||
if filter == ''
|
if filter == ''
|
||||||
or fzy.has_match(filter, app.name)
|
or fzy.has_match(filter, app.name or '')
|
||||||
or fzy.has_match(filter, app.category or '')
|
or fzy.has_match(filter, app.category or '')
|
||||||
or fzy.has_match(filter, app.keywords or '')
|
or fzy.has_match(filter, app.keywords or '')
|
||||||
then
|
then
|
||||||
@@ -245,17 +220,22 @@ function launcher:filter_apps(filter)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(app_list, function(a, b)
|
table.sort(app_list, function(a, b)
|
||||||
|
local score_a = fzy.score(filter, a.name)
|
||||||
|
local score_b = fzy.score(filter, b.name)
|
||||||
|
|
||||||
|
if score_a ~= score_b then
|
||||||
|
return score_a > score_b
|
||||||
|
else
|
||||||
return a.name < b.name
|
return a.name < b.name
|
||||||
end)
|
end
|
||||||
--sort by lowest levenshtein distance
|
|
||||||
table.sort(app_list, function(a, b)
|
|
||||||
return levenshtein_distance(filter, a.name) < levenshtein_distance(filter, b.name)
|
|
||||||
end)
|
end)
|
||||||
for _, app in ipairs(app_list) do
|
for _, app in ipairs(app_list) do
|
||||||
self.grid:add(app)
|
self.grid:add(app)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Toggle the visibility of the application launcher popup window.
|
||||||
|
--- @param screen number The screen where the launcher will be displayed.
|
||||||
function launcher:toggle(screen)
|
function launcher:toggle(screen)
|
||||||
if not self.popup.visible then
|
if not self.popup.visible then
|
||||||
self.popup.screen = screen
|
self.popup.screen = screen
|
||||||
@@ -268,13 +248,20 @@ function launcher:toggle(screen)
|
|||||||
x = 1, y = 1,
|
x = 1, y = 1,
|
||||||
}
|
}
|
||||||
self.popup.visible = false
|
self.popup.visible = false
|
||||||
|
collectgarbage('collect')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Reset the border color of a widget at x,y
|
||||||
|
---@param x number Grid column
|
||||||
|
---@param y number Grid row
|
||||||
function launcher:selection_remove(x, y)
|
function launcher:selection_remove(x, y)
|
||||||
self.grid:get_widgets_at(y, x)[1].border_color = beautiful.colorscheme.border_color
|
self.grid:get_widgets_at(y, x)[1].border_color = beautiful.colorscheme.border_color
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Update the border color of a widget at x,y
|
||||||
|
---@param x number Grid column
|
||||||
|
---@param y number Grid row
|
||||||
function launcher:selection_update(x, y)
|
function launcher:selection_update(x, y)
|
||||||
local w_old = self.grid:get_widgets_at(y, x)[1]
|
local w_old = self.grid:get_widgets_at(y, x)[1]
|
||||||
local w_new = self.grid:get_widgets_at(self.cursor.y, self.cursor.x)[1]
|
local w_new = self.grid:get_widgets_at(self.cursor.y, self.cursor.x)[1]
|
||||||
@@ -282,7 +269,10 @@ function launcher:selection_update(x, y)
|
|||||||
w_new.border_color = beautiful.colorscheme.bg_teal
|
w_new.border_color = beautiful.colorscheme.bg_teal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Offset to know when to scroll up/down
|
||||||
local up_offset = 0
|
local up_offset = 0
|
||||||
|
|
||||||
|
--- Move the cursor down
|
||||||
function launcher:move_down()
|
function launcher:move_down()
|
||||||
local row, _ = self.grid:get_dimension()
|
local row, _ = self.grid:get_dimension()
|
||||||
if self.cursor.y < row then
|
if self.cursor.y < row then
|
||||||
@@ -303,6 +293,7 @@ function launcher:move_down()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Move the cursor up
|
||||||
function launcher:move_up()
|
function launcher:move_up()
|
||||||
local row, _ = self.grid:get_dimension()
|
local row, _ = self.grid:get_dimension()
|
||||||
if self.cursor.y > 1 then
|
if self.cursor.y > 1 then
|
||||||
@@ -320,6 +311,7 @@ function launcher:move_up()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Move the cursor left
|
||||||
function launcher:move_left()
|
function launcher:move_left()
|
||||||
if self.cursor.x > 1 then
|
if self.cursor.x > 1 then
|
||||||
self.cursor.x = self.cursor.x - 1
|
self.cursor.x = self.cursor.x - 1
|
||||||
@@ -327,6 +319,7 @@ function launcher:move_left()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Move the cursor right
|
||||||
function launcher:move_right()
|
function launcher:move_right()
|
||||||
local _, col = self.grid:get_dimension()
|
local _, col = self.grid:get_dimension()
|
||||||
if self.cursor.x < col then
|
if self.cursor.x < col then
|
||||||
@@ -336,11 +329,13 @@ function launcher:move_right()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Wrapper to focus the searchbar
|
||||||
function launcher:focus_searchbar()
|
function launcher:focus_searchbar()
|
||||||
self.searchbar:focus()
|
self.searchbar:focus()
|
||||||
self.popup.widget:get_children_by_id('searchbar_bg')[1].border_color = beautiful.colorscheme.bg_teal
|
self.popup.widget:get_children_by_id('searchbar_bg')[1].border_color = beautiful.colorscheme.bg_teal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Wrapper to unfocus the searchbar
|
||||||
function launcher:unfocus_searchbar()
|
function launcher:unfocus_searchbar()
|
||||||
self.searchbar:unfocus()
|
self.searchbar:unfocus()
|
||||||
self.popup.widget:get_children_by_id('searchbar_bg')[1].border_color = beautiful.colorscheme.border_color
|
self.popup.widget:get_children_by_id('searchbar_bg')[1].border_color = beautiful.colorscheme.border_color
|
||||||
@@ -450,6 +445,7 @@ if not instance then
|
|||||||
self:toggle(capi.mouse.screen)
|
self:toggle(capi.mouse.screen)
|
||||||
self.grid:get_widgets_at(self.cursor.x, self.cursor.y)[1].execute()
|
self.grid:get_widgets_at(self.cursor.x, self.cursor.y)[1].execute()
|
||||||
self:filter_apps('')
|
self:filter_apps('')
|
||||||
|
self.searchbar:set_text('')
|
||||||
elseif key == 'Down' then
|
elseif key == 'Down' then
|
||||||
if not (self.keygrabber.running == akeygrabber.current_instance) then
|
if not (self.keygrabber.running == akeygrabber.current_instance) then
|
||||||
self:selection_update(1, 1)
|
self:selection_update(1, 1)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ local lgi = require('lgi')
|
|||||||
local wibox = require('wibox')
|
local wibox = require('wibox')
|
||||||
|
|
||||||
-- Own libs
|
-- Own libs
|
||||||
local context_menu = require('src.modules.context_menu.init')
|
local context_menu = require('src.modules.context_menu')
|
||||||
local hover = require('src.tools.hover')
|
local hover = require('src.tools.hover')
|
||||||
local input = require('src.modules.inputbox')
|
local input = require('src.modules.inputbox')
|
||||||
|
|
||||||
|
|||||||
@@ -413,84 +413,6 @@ function bluetooth.new(args)
|
|||||||
widget = wibox.container.margin,
|
widget = wibox.container.margin,
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(type(ret) == 'table', 'bluetooth_controller: ret is not a table')
|
|
||||||
|
|
||||||
-- Get a reference to the dnd button
|
|
||||||
local dnd = ret:get_children_by_id('dnd')[1]:get_widget()
|
|
||||||
|
|
||||||
-- Toggle bluetooth on or off
|
|
||||||
dnd:connect_signal('dnd::toggle', function()
|
|
||||||
ret:toggle()
|
|
||||||
end)
|
|
||||||
|
|
||||||
gtable.crush(ret, bluetooth, true)
|
|
||||||
|
|
||||||
--#region Bluetooth Proxies
|
|
||||||
-- Create a proxy for the freedesktop ObjectManager
|
|
||||||
ret._private.ObjectManager = dbus_proxy.Proxy:new {
|
|
||||||
bus = dbus_proxy.Bus.SYSTEM,
|
|
||||||
name = 'org.bluez',
|
|
||||||
interface = 'org.freedesktop.DBus.ObjectManager',
|
|
||||||
path = '/',
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Create a proxy for the bluez Adapter1 interface
|
|
||||||
ret._private.Adapter1 = dbus_proxy.Proxy:new {
|
|
||||||
bus = dbus_proxy.Bus.SYSTEM,
|
|
||||||
name = 'org.bluez',
|
|
||||||
interface = 'org.bluez.Adapter1',
|
|
||||||
path = '/org/bluez/hci0',
|
|
||||||
}
|
|
||||||
|
|
||||||
if not ret._private.Adapter1.Powered then return end
|
|
||||||
|
|
||||||
-- Create a proxy for the bluez Adapter1 Properties interface
|
|
||||||
ret._private.Adapter1Properties = dbus_proxy.Proxy:new {
|
|
||||||
bus = dbus_proxy.Bus.SYSTEM,
|
|
||||||
name = 'org.bluez',
|
|
||||||
interface = 'org.freedesktop.DBus.Properties',
|
|
||||||
path = '/org/bluez/hci0',
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Connect to the ObjectManager's InterfacesAdded signal
|
|
||||||
ret._private.ObjectManager:connect_signal(function(_, interface)
|
|
||||||
ret:get_device_info(interface)
|
|
||||||
end, 'InterfacesAdded')
|
|
||||||
|
|
||||||
-- Connect to the ObjectManager's InterfacesRemoved signal
|
|
||||||
ret._private.ObjectManager:connect_signal(function(_, interface)
|
|
||||||
ret:remove_device(interface)
|
|
||||||
end, 'InterfacesRemoved')
|
|
||||||
|
|
||||||
-- Connect to the Adapter1's PropertiesChanged signal
|
|
||||||
ret._private.Adapter1Properties:connect_signal(function(_, _, data)
|
|
||||||
if data.Powered ~= nil then
|
|
||||||
send_state_notification(data.Powered)
|
|
||||||
if data.Powered then
|
|
||||||
dnd:set_enabled()
|
|
||||||
ret:scan()
|
|
||||||
else
|
|
||||||
dnd:set_disabled()
|
|
||||||
end
|
|
||||||
ret:emit_signal('bluetooth::status', data.Powered)
|
|
||||||
end
|
|
||||||
end, 'PropertiesChanged')
|
|
||||||
|
|
||||||
gtimer.delayed_call(function()
|
|
||||||
for path, _ in pairs(ret._private.ObjectManager:GetManagedObjects()) do
|
|
||||||
ret:get_device_info(path)
|
|
||||||
end
|
|
||||||
if ret._private.Adapter1.Powered then
|
|
||||||
dnd:set_enabled()
|
|
||||||
ret:scan()
|
|
||||||
else
|
|
||||||
dnd:set_disabled()
|
|
||||||
end
|
|
||||||
ret:emit_signal('bluetooth::status', ret._private.Adapter1.Powered)
|
|
||||||
send_state_notification(ret._private.Adapter1.Powered)
|
|
||||||
end)
|
|
||||||
--#endregion
|
|
||||||
|
|
||||||
--#region Dropdown logic
|
--#region Dropdown logic
|
||||||
local connected_margin = ret:get_children_by_id('connected_margin')[1]
|
local connected_margin = ret:get_children_by_id('connected_margin')[1]
|
||||||
local connected_list = ret:get_children_by_id('connected_list')[1]
|
local connected_list = ret:get_children_by_id('connected_list')[1]
|
||||||
@@ -626,6 +548,14 @@ function bluetooth.new(args)
|
|||||||
end)
|
end)
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
|
-- Get a reference to the dnd button
|
||||||
|
local dnd = ret:get_children_by_id('dnd')[1]:get_widget()
|
||||||
|
|
||||||
|
-- Toggle bluetooth on or off
|
||||||
|
dnd:connect_signal('dnd::toggle', function()
|
||||||
|
ret:toggle()
|
||||||
|
end)
|
||||||
|
|
||||||
-- Add buttons to the scan button
|
-- Add buttons to the scan button
|
||||||
ret:get_children_by_id('scan')[1]:buttons {
|
ret:get_children_by_id('scan')[1]:buttons {
|
||||||
abutton({}, 1, function()
|
abutton({}, 1, function()
|
||||||
@@ -637,6 +567,74 @@ function bluetooth.new(args)
|
|||||||
hover.bg_hover { widget = connected_margin.connected_bg }
|
hover.bg_hover { widget = connected_margin.connected_bg }
|
||||||
hover.bg_hover { widget = discovered_bg }
|
hover.bg_hover { widget = discovered_bg }
|
||||||
|
|
||||||
|
gtable.crush(ret, bluetooth, true)
|
||||||
|
|
||||||
|
--#region Bluetooth Proxies
|
||||||
|
-- Create a proxy for the freedesktop ObjectManager
|
||||||
|
ret._private.ObjectManager = dbus_proxy.Proxy:new {
|
||||||
|
bus = dbus_proxy.Bus.SYSTEM,
|
||||||
|
name = 'org.bluez',
|
||||||
|
interface = 'org.freedesktop.DBus.ObjectManager',
|
||||||
|
path = '/',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Create a proxy for the bluez Adapter1 interface
|
||||||
|
ret._private.Adapter1 = dbus_proxy.Proxy:new {
|
||||||
|
bus = dbus_proxy.Bus.SYSTEM,
|
||||||
|
name = 'org.bluez',
|
||||||
|
interface = 'org.bluez.Adapter1',
|
||||||
|
path = '/org/bluez/hci0',
|
||||||
|
}
|
||||||
|
|
||||||
|
if not ret._private.Adapter1.Powered then return ret end
|
||||||
|
|
||||||
|
-- Create a proxy for the bluez Adapter1 Properties interface
|
||||||
|
ret._private.Adapter1Properties = dbus_proxy.Proxy:new {
|
||||||
|
bus = dbus_proxy.Bus.SYSTEM,
|
||||||
|
name = 'org.bluez',
|
||||||
|
interface = 'org.freedesktop.DBus.Properties',
|
||||||
|
path = '/org/bluez/hci0',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Connect to the Adapter1's PropertiesChanged signal
|
||||||
|
ret._private.Adapter1Properties:connect_signal(function(_, _, data)
|
||||||
|
if data.Powered ~= nil then
|
||||||
|
send_state_notification(data.Powered)
|
||||||
|
if data.Powered then
|
||||||
|
dnd:set_enabled()
|
||||||
|
ret:scan()
|
||||||
|
else
|
||||||
|
dnd:set_disabled()
|
||||||
|
end
|
||||||
|
ret:emit_signal('bluetooth::status', data.Powered)
|
||||||
|
end
|
||||||
|
end, 'PropertiesChanged')
|
||||||
|
|
||||||
|
-- Connect to the ObjectManager's InterfacesAdded signal
|
||||||
|
ret._private.ObjectManager:connect_signal(function(_, interface)
|
||||||
|
ret:get_device_info(interface)
|
||||||
|
end, 'InterfacesAdded')
|
||||||
|
|
||||||
|
-- Connect to the ObjectManager's InterfacesRemoved signal
|
||||||
|
ret._private.ObjectManager:connect_signal(function(_, interface)
|
||||||
|
ret:remove_device(interface)
|
||||||
|
end, 'InterfacesRemoved')
|
||||||
|
|
||||||
|
gtimer.delayed_call(function()
|
||||||
|
for path, _ in pairs(ret._private.ObjectManager:GetManagedObjects()) do
|
||||||
|
ret:get_device_info(path)
|
||||||
|
end
|
||||||
|
if ret._private.Adapter1.Powered then
|
||||||
|
dnd:set_enabled()
|
||||||
|
ret:scan()
|
||||||
|
else
|
||||||
|
dnd:set_disabled()
|
||||||
|
end
|
||||||
|
ret:emit_signal('bluetooth::status', ret._private.Adapter1.Powered)
|
||||||
|
send_state_notification(ret._private.Adapter1.Powered)
|
||||||
|
end)
|
||||||
|
--#endregion
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -478,12 +478,14 @@ function calendar:create_calendar_widget()
|
|||||||
task_popup.x = capi.mouse.coords().x
|
task_popup.x = capi.mouse.coords().x
|
||||||
task_popup.y = capi.mouse.coords().y
|
task_popup.y = capi.mouse.coords().y
|
||||||
task_popup.visible = not task_popup.visible
|
task_popup.visible = not task_popup.visible
|
||||||
|
collectgarbage('collect')
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
tw:connect_signal('mouse::leave', function()
|
tw:connect_signal('mouse::leave', function()
|
||||||
task_popup.visible = false
|
task_popup.visible = false
|
||||||
|
collectgarbage('collect')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hover.bg_hover { widget = tw }
|
hover.bg_hover { widget = tw }
|
||||||
@@ -754,7 +756,7 @@ function calendar.new(args)
|
|||||||
{
|
{
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
resize = false,
|
resize = false,
|
||||||
image = gcolor.recolor_image(icondir .. 'add_ical.svg', beautiful.colorscheme.bg_red),
|
image = gcolor.recolor_image(icondir .. 'add_ical.svg', beautiful.colorscheme.bg),
|
||||||
halign = 'center',
|
halign = 'center',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
},
|
},
|
||||||
@@ -883,7 +885,7 @@ function calendar.new(args)
|
|||||||
border_width = dpi(2),
|
border_width = dpi(2),
|
||||||
border_strategy = 'inner',
|
border_strategy = 'inner',
|
||||||
fg = beautiful.colorscheme.fg,
|
fg = beautiful.colorscheme.fg,
|
||||||
shape = beautiful.shape,
|
shape = beautiful.shape[12],
|
||||||
})
|
})
|
||||||
|
|
||||||
ret:get_tasks()
|
ret:get_tasks()
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ function context_menu:make_entries(wtemplate, entries, spacing)
|
|||||||
widget = wibox.container.margin,
|
widget = wibox.container.margin,
|
||||||
},
|
},
|
||||||
bg = beautiful.colorscheme.bg,
|
bg = beautiful.colorscheme.bg,
|
||||||
fg = beautiful.colorscheme.bg_red,
|
fg = beautiful.colorscheme.fg,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,27 +74,24 @@ function dock:toggle()
|
|||||||
self.popup.visible = not self.popup.visible
|
self.popup.visible = not self.popup.visible
|
||||||
end
|
end
|
||||||
|
|
||||||
function dock:write_elements_to_file_async(callback)
|
function dock:write_elements_to_file_async()
|
||||||
--create a local copy of the elements["pinned"] table and only set the desktop_file key from its children
|
--create a local copy of the elements["pinned"] table and only set the desktop_file key from its children
|
||||||
local elements_copy = { pinned = {} }
|
local elements_copy = { pinned = {} }
|
||||||
for _, element in ipairs(elements['pinned']) do
|
for _, element in ipairs(elements['pinned']) do
|
||||||
table.insert(elements_copy['pinned'], { desktop_file = element.desktop_file })
|
table.insert(elements_copy['pinned'], { desktop_file = element.desktop_file })
|
||||||
end
|
end
|
||||||
config.write_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json', elements_copy['pinned'], callback)
|
|
||||||
|
config.write_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json', elements_copy['pinned'])
|
||||||
end
|
end
|
||||||
|
|
||||||
---Read the content of dock.json and get the content as a table
|
---Read the content of dock.json and get the content as a table
|
||||||
---@param callback function Called after the elements have been set, no values are passed
|
function dock:read_elements_from_file_async()
|
||||||
function dock:read_elements_from_file_async(callback)
|
|
||||||
local data = config.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json')
|
local data = config.read_json(gfilesystem.get_configuration_dir() .. 'src/config/dock_' .. self.screen.index .. '.json')
|
||||||
-- Make sure to not set the running key to nil on accident
|
-- Make sure to not set the running key to nil on accident
|
||||||
for _, v in ipairs(data) do
|
for _, v in ipairs(data) do
|
||||||
local w = self:get_element_widget(v.desktop_file)
|
local w = self:get_element_widget(v.desktop_file)
|
||||||
table.insert(elements['pinned'], w)
|
table.insert(elements['pinned'], w)
|
||||||
end
|
end
|
||||||
if callback then
|
|
||||||
callback()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---Creates a pinned widget for the dock and adds it into the elements table
|
---Creates a pinned widget for the dock and adds it into the elements table
|
||||||
@@ -135,6 +132,7 @@ function dock:get_element_widget(desktop_file)
|
|||||||
bg = beautiful.colorscheme.bg1,
|
bg = beautiful.colorscheme.bg1,
|
||||||
shape = beautiful.shape[8],
|
shape = beautiful.shape[8],
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
|
desktop_file = desktop_file,
|
||||||
}
|
}
|
||||||
|
|
||||||
local action_entries = {}
|
local action_entries = {}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ local wibox = require('wibox')
|
|||||||
|
|
||||||
local config = require('src.tools.config')
|
local config = require('src.tools.config')
|
||||||
local element = require('src.modules.desktop.element')
|
local element = require('src.modules.desktop.element')
|
||||||
local cm = require('src.modules.context_menu.init')
|
local cm = require('src.modules.context_menu')
|
||||||
|
|
||||||
local capi = {
|
local capi = {
|
||||||
mouse = mouse,
|
mouse = mouse,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local tinsert = table.insert
|
|
||||||
local load = load
|
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
|
local load = load
|
||||||
|
local tinsert = table.insert
|
||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local awful = require('awful')
|
local awful = require('awful')
|
||||||
@@ -20,12 +20,16 @@ if not instance then
|
|||||||
awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, layouts[1])
|
awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, s, layouts[1])
|
||||||
|
|
||||||
require('src.modules.desktop.desktop') { screen = s }
|
require('src.modules.desktop.desktop') { screen = s }
|
||||||
|
if beautiful.user_config.crylia_bar then
|
||||||
require('src.modules.crylia_bar')(s)
|
require('src.modules.crylia_bar')(s)
|
||||||
--require('src.modules.crylia_wibox.init')(s)
|
else
|
||||||
|
require('src.modules.crylia_wibox.init')(s)
|
||||||
|
end
|
||||||
require('src.modules.notification-center') { screen = s }
|
require('src.modules.notification-center') { screen = s }
|
||||||
--require('src.modules.window_switcher.init') { screen = s }
|
require('src.modules.window_switcher')(s)
|
||||||
require('src.modules.application_launcher') { screen = s }
|
require('src.modules.app_launcher')(s)
|
||||||
end)
|
end)
|
||||||
|
require('src.modules.powermenu')()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ local dbus_proxy = require('src.lib.lua-dbus_proxy.src.dbus_proxy')
|
|||||||
|
|
||||||
-- Own libs
|
-- Own libs
|
||||||
local ap_form = require('src.modules.network_controller.ap_form')
|
local ap_form = require('src.modules.network_controller.ap_form')
|
||||||
local cm = require('src.modules.context_menu.init')
|
local cm = require('src.modules.context_menu')
|
||||||
local hover = require('src.tools.hover')
|
local hover = require('src.tools.hover')
|
||||||
|
|
||||||
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/network/'
|
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/network/'
|
||||||
@@ -268,7 +268,7 @@ function access_point.new(args)
|
|||||||
ret.NetworkManagerAccessPointProperties:connect_signal(function(_, properties, data)
|
ret.NetworkManagerAccessPointProperties:connect_signal(function(_, properties, data)
|
||||||
if data.Strength then
|
if data.Strength then
|
||||||
awesome.emit_signal('NM::AccessPointStrength', data.Strength)
|
awesome.emit_signal('NM::AccessPointStrength', data.Strength)
|
||||||
if ret.is_ap_active(ret.NetworkManagerAccessPoint.object_path) then
|
if ret.is_ap_active(ret.NetworkManagerAccessPoint) then
|
||||||
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
|
ret:get_children_by_id('icon')[1].image = gcolor.recolor_image(
|
||||||
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg',
|
icondir .. 'wifi-strength-' .. math.floor(data.Strength / 25) + 1 .. '.svg',
|
||||||
beautiful.colorscheme.bg)
|
beautiful.colorscheme.bg)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ function ap_form.new(args)
|
|||||||
{
|
{
|
||||||
widget = wibox.widget.textbox,
|
widget = wibox.widget.textbox,
|
||||||
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid),
|
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid),
|
||||||
font = beautiful.user_config.font.specify .. ',extra bold 16',
|
font = beautiful.user_config.font .. ' extra bold 16',
|
||||||
halign = 'center',
|
halign = 'center',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
-------------------------------------
|
local os = os
|
||||||
-- This is the notification-center --
|
local setmetatable = setmetatable
|
||||||
-------------------------------------
|
|
||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local dpi = require('beautiful').xresources.apply_dpi
|
local abutton = require('awful.button')
|
||||||
local wibox = require('wibox')
|
|
||||||
local naughty = require('naughty')
|
|
||||||
local gtimer = require('gears.timer')
|
|
||||||
local beautiful = require('beautiful')
|
local beautiful = require('beautiful')
|
||||||
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
local gcolor = require('gears.color')
|
local gcolor = require('gears.color')
|
||||||
local gfilesystem = require('gears.filesystem')
|
local gfilesystem = require('gears.filesystem')
|
||||||
local gtable = require('gears.table')
|
local gtable = require('gears.table')
|
||||||
local abutton = require('awful.button')
|
local gtimer = require('gears.timer')
|
||||||
|
local naughty = require('naughty')
|
||||||
|
local wibox = require('wibox')
|
||||||
|
|
||||||
|
-- Local Libs
|
||||||
local hover = require('src.tools.hover')
|
local hover = require('src.tools.hover')
|
||||||
|
|
||||||
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
|
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/notifications/'
|
||||||
|
|
||||||
return setmetatable({}, {
|
local instance = nil
|
||||||
|
instance = setmetatable({}, {
|
||||||
__call = function()
|
__call = function()
|
||||||
local ret = wibox.widget {
|
local ret = wibox.widget {
|
||||||
layout = require('src.lib.overflow_widget.overflow').vertical,
|
layout = require('src.lib.overflow_widget.overflow').vertical,
|
||||||
@@ -61,13 +62,13 @@ return setmetatable({}, {
|
|||||||
notification = n,
|
notification = n,
|
||||||
widget = naughty.widget.title,
|
widget = naughty.widget.title,
|
||||||
markup = [[<span foreground="]] ..
|
markup = [[<span foreground="]] ..
|
||||||
beautiful.colorscheme.bg .. [[" font="JetBrainsMono Nerd Font, Bold 16">]] .. (n.app_name or
|
beautiful.colorscheme.bg .. [[" font="]] .. beautiful.user_config.font .. ' bold 12' .. [[">]] .. (n.app_name or
|
||||||
'Unknown App') .. [[</span> | <span font="JetBrainsMono Nerd Font, Regular 16">]] .. (n.title or 'System Notification') .. [[</span>]],
|
'Unknown App') .. [[</span> | <span font="]] .. beautiful.user_config.font .. ' regular 12' .. [[">]] .. (n.title or 'System Notification') .. [[</span>]],
|
||||||
halign = 'left',
|
halign = 'left',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
},
|
},
|
||||||
widget = wibox.container.constraint,
|
widget = wibox.container.constraint,
|
||||||
width = dpi(430),
|
width = dpi(250),
|
||||||
height = dpi(35),
|
height = dpi(35),
|
||||||
strategy = 'max',
|
strategy = 'max',
|
||||||
},
|
},
|
||||||
@@ -83,7 +84,7 @@ return setmetatable({}, {
|
|||||||
{ -- Clock
|
{ -- Clock
|
||||||
widget = wibox.widget.textbox,
|
widget = wibox.widget.textbox,
|
||||||
test = 'now',
|
test = 'now',
|
||||||
font = 'JetBrainsMono Nerd Font, Bold 12',
|
font = beautiful.user_config.font .. ' bold 12',
|
||||||
fg = beautiful.colorscheme.bg,
|
fg = beautiful.colorscheme.bg,
|
||||||
halign = 'center',
|
halign = 'center',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
@@ -159,7 +160,7 @@ return setmetatable({}, {
|
|||||||
{
|
{
|
||||||
notification = n,
|
notification = n,
|
||||||
widget = naughty.widget.message,
|
widget = naughty.widget.message,
|
||||||
font = 'JetBrainsMono Nerd Font, Regular 10',
|
font = beautiful.user_config.font .. ' regular 10',
|
||||||
halign = 'left',
|
halign = 'left',
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
},
|
},
|
||||||
@@ -170,15 +171,6 @@ return setmetatable({}, {
|
|||||||
spacing = dpi(15),
|
spacing = dpi(15),
|
||||||
layout = wibox.layout.fixed.horizontal,
|
layout = wibox.layout.fixed.horizontal,
|
||||||
},
|
},
|
||||||
{ -- Spacer
|
|
||||||
{
|
|
||||||
widget = wibox.container.background,
|
|
||||||
bg = beautiful.colorscheme.bg,
|
|
||||||
},
|
|
||||||
widget = wibox.container.constraint,
|
|
||||||
strategy = 'exact',
|
|
||||||
height = dpi(2),
|
|
||||||
},
|
|
||||||
spacing = dpi(15),
|
spacing = dpi(15),
|
||||||
id = 'main_layout',
|
id = 'main_layout',
|
||||||
layout = wibox.layout.fixed.vertical,
|
layout = wibox.layout.fixed.vertical,
|
||||||
@@ -244,3 +236,4 @@ return setmetatable({}, {
|
|||||||
return ret
|
return ret
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
return instance
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
--------------------------------
|
local setmetatable = setmetatable
|
||||||
-- This is the network widget --
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
-- Awesome Libs
|
-- Awesome Libs
|
||||||
local abutton = require('awful.button')
|
local abutton = require('awful.button')
|
||||||
@@ -106,11 +104,13 @@ end
|
|||||||
|
|
||||||
function powermenu:toggle()
|
function powermenu:toggle()
|
||||||
self.keygrabber:start()
|
self.keygrabber:start()
|
||||||
self.visible = not self.visible
|
self.w.visible = not self.w.visible
|
||||||
end
|
end
|
||||||
|
|
||||||
function powermenu.new()
|
if instance == nil then
|
||||||
local w = wibox {
|
instance = setmetatable(powermenu, {
|
||||||
|
__call = function(self)
|
||||||
|
self.w = wibox {
|
||||||
widget = {
|
widget = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -167,16 +167,14 @@ function powermenu.new()
|
|||||||
y = capi.screen.primary.geometry.y,
|
y = capi.screen.primary.geometry.y,
|
||||||
}
|
}
|
||||||
|
|
||||||
gtable.crush(w, powermenu, true)
|
self.w:buttons { gtable.join(
|
||||||
|
|
||||||
w:buttons { gtable.join(
|
|
||||||
abutton({}, 3, function()
|
abutton({}, 3, function()
|
||||||
w:toggle()
|
self:toggle()
|
||||||
w.keygrabber:stop()
|
self.keygrabber:stop()
|
||||||
end)
|
end)
|
||||||
), }
|
), }
|
||||||
|
|
||||||
w.keygrabber = akeygrabber {
|
self.keygrabber = akeygrabber {
|
||||||
autostart = false,
|
autostart = false,
|
||||||
stop_event = 'release',
|
stop_event = 'release',
|
||||||
stop_key = 'Escape',
|
stop_key = 'Escape',
|
||||||
@@ -185,7 +183,7 @@ function powermenu.new()
|
|||||||
modifiers = {},
|
modifiers = {},
|
||||||
key = 'Escape',
|
key = 'Escape',
|
||||||
on_press = function()
|
on_press = function()
|
||||||
w:toggle()
|
self:toggle()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -196,20 +194,16 @@ function powermenu.new()
|
|||||||
-- TODO: If the user doesnt have AccountsService look into $HOME/.faces
|
-- TODO: If the user doesnt have AccountsService look into $HOME/.faces
|
||||||
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userPfp'", function(stdout)
|
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userPfp'", function(stdout)
|
||||||
if stdout then
|
if stdout then
|
||||||
w:get_children_by_id('icon_role')[1].image = stdout:gsub('\n', '')
|
self.w:get_children_by_id('icon_role')[1].image = stdout:gsub('\n', '')
|
||||||
else
|
else
|
||||||
w:get_children_by_id('icon_role')[1].image = icondir .. 'defaultpfp.svg'
|
self.w:get_children_by_id('icon_role')[1].image = icondir .. 'defaultpfp.svg'
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userName' '" .. beautiful.user_config.namestyle .. "'", function(stdout)
|
aspawn.easy_async_with_shell("./.config/awesome/src/scripts/pfp.sh 'userName' '" .. beautiful.user_config.namestyle .. "'", function(stdout)
|
||||||
w:get_children_by_id('text_role')[1].text = stdout:gsub('\n', '')
|
self.w:get_children_by_id('text_role')[1].text = stdout:gsub('\n', '')
|
||||||
end)
|
end)
|
||||||
|
end,
|
||||||
return w
|
})
|
||||||
end
|
|
||||||
|
|
||||||
if instance == nil then
|
|
||||||
instance = powermenu.new()
|
|
||||||
end
|
end
|
||||||
return instance
|
return instance
|
||||||
|
|||||||
@@ -17,88 +17,61 @@ local base = require('wibox.widget.base')
|
|||||||
local gtimer = require('gears.timer')
|
local gtimer = require('gears.timer')
|
||||||
local cairo = require('lgi').cairo
|
local cairo = require('lgi').cairo
|
||||||
local awidget = require('awful.widget')
|
local awidget = require('awful.widget')
|
||||||
|
local ascreenshot = require('awful.screenshot')
|
||||||
local capi = {
|
local wtemplate = require('wibox.template')
|
||||||
awesome = awesome,
|
local akeygrabber = require('awful.keygrabber')
|
||||||
client = client,
|
local akey = require('awful.key')
|
||||||
mouse = mouse,
|
local abutton = require('awful.button')
|
||||||
}
|
local aclient = require('awful.client')
|
||||||
|
local awful = require('awful')
|
||||||
--local window_elements = require("src.modules.window_switcher.window_elements")()
|
|
||||||
|
|
||||||
--[[ return function(s)
|
|
||||||
|
|
||||||
local window_switcher_list = wibox.widget {
|
|
||||||
window_elements,
|
|
||||||
margins = dpi(20),
|
|
||||||
widget = wibox.container.margin
|
|
||||||
}
|
|
||||||
|
|
||||||
local window_switcher_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 = beautiful.colorscheme.bg,
|
|
||||||
border_color = beautiful.colorscheme.border_color,
|
|
||||||
border_width = dpi(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
window_switcher_container:setup {
|
|
||||||
window_switcher_list,
|
|
||||||
layout = wibox.layout.fixed.vertical
|
|
||||||
}
|
|
||||||
|
|
||||||
capi.awesome.connect_signal(
|
|
||||||
"toggle_window_switcher",
|
|
||||||
function()
|
|
||||||
if capi.mouse.screen == s then
|
|
||||||
window_switcher_container.visible = not window_switcher_container.visible
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end ]]
|
|
||||||
|
|
||||||
local client_preview = {}
|
local client_preview = {}
|
||||||
|
|
||||||
|
local instance = nil
|
||||||
|
if not instance then
|
||||||
|
instance = setmetatable(client_preview, {
|
||||||
|
__call = function(self, s)
|
||||||
|
|
||||||
function client_preview:toggle()
|
self.popup = apopup {
|
||||||
self.visible = not self.visible
|
widget = awidget.tasklist {
|
||||||
end
|
|
||||||
|
|
||||||
return setmetatable(client_preview, {
|
|
||||||
__call = function(...)
|
|
||||||
local args = ...
|
|
||||||
|
|
||||||
local w = gobject {}
|
|
||||||
|
|
||||||
gtable.crush(w, client_preview, true)
|
|
||||||
|
|
||||||
--[[ local tl = awidget.tasklist {
|
|
||||||
screen = 1,
|
screen = 1,
|
||||||
layout = wibox.layout.fixed.horizontal,
|
layout = wibox.layout.fixed.horizontal,
|
||||||
filter = awidget.tasklist.filter.alltags,
|
filter = awidget.tasklist.filter.alltags,
|
||||||
update_function = function(widget, _, _, _, clients)
|
style = {
|
||||||
widget:reset()
|
font = beautiful.user_config.font .. ' regular 12',
|
||||||
|
},
|
||||||
for _, c in ipairs(clients) do
|
widget_template = wibox.template {
|
||||||
local tw = wibox.widget {
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{ -- icon and text
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
resize = true,
|
valign = 'center',
|
||||||
id = c.instance,
|
halign = 'center',
|
||||||
|
id = 'icon_role',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
widget = wibox.widget.textbox,
|
||||||
|
id = 'text_role',
|
||||||
|
},
|
||||||
|
spacing = dpi(10),
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
},
|
},
|
||||||
widget = wibox.container.constraint,
|
widget = wibox.container.constraint,
|
||||||
height = dpi(256),
|
height = dpi(32),
|
||||||
strategy = 'exact',
|
width = dpi(256),
|
||||||
|
},
|
||||||
|
{ -- preview
|
||||||
|
id = 'screenshot',
|
||||||
|
width = dpi(256),
|
||||||
|
widget = wibox.container.constraint,
|
||||||
|
},
|
||||||
|
spacing = dpi(10),
|
||||||
|
layout = wibox.layout.fixed.vertical,
|
||||||
},
|
},
|
||||||
widget = wibox.container.place,
|
widget = wibox.container.place,
|
||||||
},
|
},
|
||||||
@@ -106,50 +79,55 @@ return setmetatable(client_preview, {
|
|||||||
margins = dpi(20),
|
margins = dpi(20),
|
||||||
},
|
},
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = '#414141',
|
border_color = beautiful.colorscheme.border_color,
|
||||||
id = c.pid,
|
id = 'border',
|
||||||
shape = gshape.rounded_rect,
|
border_width = dpi(2),
|
||||||
|
bg = beautiful.colorscheme.bg1,
|
||||||
|
shape = beautiful.shape[8],
|
||||||
|
},
|
||||||
|
widget = wibox.container.margin,
|
||||||
|
margins = dpi(20),
|
||||||
|
},
|
||||||
|
bg = beautiful.colorscheme.bg,
|
||||||
|
widget = wibox.container.background,
|
||||||
|
create_callback = function(sself, c)
|
||||||
|
local ss = ascreenshot {
|
||||||
|
client = c,
|
||||||
}
|
}
|
||||||
|
ss:refresh()
|
||||||
gtimer {
|
local ib = ss.content_widget
|
||||||
timeout = 1 / 24,
|
ib.clip_shape = beautiful.shape[12]
|
||||||
autostart = true,
|
ib.valign = 'center'
|
||||||
callback = function()
|
ib.halign = 'center'
|
||||||
local content = gsurface(c.content)
|
sself:get_widget():get_children_by_id('screenshot')[1].widget = ib
|
||||||
local cr = cairo.Context(content)
|
end,
|
||||||
local x, y, w, h = cr:clip_extents()
|
update_callback = function(sself, c)
|
||||||
local img = cairo.ImageSurface.create(cairo.Format.ARGB32, w - x, h - y)
|
if c.active and self.popup.visible then
|
||||||
cr = cairo.Context(img)
|
local ss = ascreenshot {
|
||||||
cr:set_source_surface(content, 0, 0)
|
client = c,
|
||||||
cr.operator = cairo.Operator.SOURCE
|
}
|
||||||
cr:paint()
|
ss:refresh()
|
||||||
local cont = tw:get_children_by_id('icon_role')[1]
|
local ib = ss.content_widget
|
||||||
if cont then
|
ib.clip_shape = beautiful.shape[12]
|
||||||
cont.image = gsurface.load(img)
|
ib.valign = 'center'
|
||||||
return
|
ib.halign = 'center'
|
||||||
|
sself:get_widget():get_children_by_id('screenshot')[1].widget = ib
|
||||||
|
sself:get_widget():get_children_by_id('border')[1].border_color = beautiful.colorscheme.bg_purple
|
||||||
|
else
|
||||||
|
sself:get_widget():get_children_by_id('border')[1].border_color = beautiful.colorscheme.border_color
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
},
|
||||||
|
},
|
||||||
widget:add(tw)
|
|
||||||
end
|
|
||||||
|
|
||||||
return widget
|
|
||||||
end,
|
|
||||||
} ]]
|
|
||||||
|
|
||||||
w.popup = apopup {
|
|
||||||
widget = {},
|
|
||||||
ontop = true,
|
ontop = true,
|
||||||
visible = true,
|
visible = false,
|
||||||
screen = args.screen,
|
screen = s,
|
||||||
placement = aplacement.centered,
|
|
||||||
bg = beautiful.colorscheme.bg,
|
bg = beautiful.colorscheme.bg,
|
||||||
border_color = beautiful.colorscheme.border_color,
|
border_color = beautiful.colorscheme.border_color,
|
||||||
border_width = dpi(2),
|
border_width = dpi(2),
|
||||||
|
placement = aplacement.centered,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return w
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
return instance
|
||||||
|
|||||||
@@ -1,252 +0,0 @@
|
|||||||
---------------------------------
|
|
||||||
-- This is the window_switcher --
|
|
||||||
---------------------------------
|
|
||||||
|
|
||||||
-- Awesome Libs
|
|
||||||
local awful = require('awful')
|
|
||||||
local beautiful = require('beautiful')
|
|
||||||
local dpi = require('beautiful').xresources.apply_dpi
|
|
||||||
local gears = require('gears')
|
|
||||||
local wibox = require('wibox')
|
|
||||||
|
|
||||||
local color = require('src.lib.color')
|
|
||||||
local rubato = require('src.lib.rubato')
|
|
||||||
|
|
||||||
local capi = {
|
|
||||||
awesome = awesome,
|
|
||||||
client = client,
|
|
||||||
}
|
|
||||||
|
|
||||||
return function()
|
|
||||||
|
|
||||||
local elements = wibox.widget {
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
spacing = dpi(20),
|
|
||||||
id = 'switcher',
|
|
||||||
}
|
|
||||||
|
|
||||||
local selected = 0
|
|
||||||
|
|
||||||
local function create_elements(fn)
|
|
||||||
fn = fn or ''
|
|
||||||
|
|
||||||
elements:reset()
|
|
||||||
|
|
||||||
local clients = capi.client.get()
|
|
||||||
local clients_sorted = {}
|
|
||||||
|
|
||||||
if capi.client.focus then
|
|
||||||
clients_sorted[1] = capi.client.focus
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, client in ipairs(clients) do
|
|
||||||
if client ~= clients_sorted[1] then
|
|
||||||
table.insert(clients_sorted, client)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
selected = selected
|
|
||||||
|
|
||||||
for _, client in ipairs(clients_sorted) do
|
|
||||||
local window_element = wibox.widget {
|
|
||||||
{
|
|
||||||
{
|
|
||||||
{
|
|
||||||
{ -- Icon
|
|
||||||
{
|
|
||||||
id = 'icon',
|
|
||||||
--!ADD FALLBACK ICON!--
|
|
||||||
image = gears.surface(client.icon),
|
|
||||||
valign = 'center',
|
|
||||||
halign = 'center',
|
|
||||||
widget = wibox.widget.imagebox,
|
|
||||||
},
|
|
||||||
width = dpi(100),
|
|
||||||
height = dpi(100),
|
|
||||||
id = 'icon_const',
|
|
||||||
strategy = 'exact',
|
|
||||||
widget = wibox.container.constraint,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
{
|
|
||||||
text = client.name,
|
|
||||||
id = 'label',
|
|
||||||
widget = wibox.widget.textbox,
|
|
||||||
},
|
|
||||||
id = 'place',
|
|
||||||
valign = 'center',
|
|
||||||
halign = 'center',
|
|
||||||
widget = wibox.container.place,
|
|
||||||
},
|
|
||||||
id = 'layout1',
|
|
||||||
spacing = dpi(10),
|
|
||||||
layout = wibox.layout.fixed.vertical,
|
|
||||||
},
|
|
||||||
id = 'box',
|
|
||||||
width = dpi(150),
|
|
||||||
height = dpi(150),
|
|
||||||
strategy = 'exact',
|
|
||||||
widget = wibox.container.constraint,
|
|
||||||
},
|
|
||||||
id = 'margin',
|
|
||||||
margins = dpi(20),
|
|
||||||
widget = wibox.container.margin,
|
|
||||||
},
|
|
||||||
shape = beautiful.shape[12],
|
|
||||||
border_color = beautiful.colorscheme.border_color,
|
|
||||||
border_width = dpi(2),
|
|
||||||
bg = beautiful.colorscheme.bg,
|
|
||||||
fg = beautiful.colorscheme.bg_green,
|
|
||||||
widget = wibox.container.background,
|
|
||||||
}
|
|
||||||
|
|
||||||
elements:add(window_element)
|
|
||||||
end
|
|
||||||
|
|
||||||
if fn == 'next' then
|
|
||||||
if selected >= #clients_sorted then
|
|
||||||
selected = 1
|
|
||||||
else
|
|
||||||
selected = selected + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
for i, element in ipairs(elements.children) do
|
|
||||||
|
|
||||||
-- Background rubato init
|
|
||||||
local r_timed_bg = rubato.timed { duration = 0.5 }
|
|
||||||
local g_timed_bg = rubato.timed { duration = 0.5 }
|
|
||||||
local b_timed_bg = rubato.timed { duration = 0.5 }
|
|
||||||
|
|
||||||
-- starting color
|
|
||||||
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
|
|
||||||
|
|
||||||
|
|
||||||
-- Foreground rubato init
|
|
||||||
local r_timed_fg = rubato.timed { duration = 0.5 }
|
|
||||||
local g_timed_fg = rubato.timed { duration = 0.5 }
|
|
||||||
local b_timed_fg = rubato.timed { duration = 0.5 }
|
|
||||||
|
|
||||||
-- starting color
|
|
||||||
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
|
|
||||||
|
|
||||||
-- Border rubato init
|
|
||||||
local r_timed_border = rubato.timed { duration = 0.5 }
|
|
||||||
local g_timed_border = rubato.timed { duration = 0.5 }
|
|
||||||
local b_timed_border = rubato.timed { duration = 0.5 }
|
|
||||||
|
|
||||||
-- starting color
|
|
||||||
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme
|
|
||||||
.border_color)
|
|
||||||
|
|
||||||
local function set_bg(newbg)
|
|
||||||
r_timed_bg.target, g_timed_bg.target, b_timed_bg.target = color.utils.hex_to_rgba(newbg)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function set_fg(newfg)
|
|
||||||
r_timed_fg.target, g_timed_fg.target, b_timed_fg.target = color.utils.hex_to_rgba(newfg)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function set_border(newborder)
|
|
||||||
r_timed_border.target, g_timed_border.target, b_timed_border.target = color.utils.hex_to_rgba(newborder)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function update_bg()
|
|
||||||
element:set_bg('#' .. color.utils.rgba_to_hex { r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos })
|
|
||||||
end
|
|
||||||
|
|
||||||
local function update_fg()
|
|
||||||
element:set_fg('#' .. color.utils.rgba_to_hex { r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos })
|
|
||||||
end
|
|
||||||
|
|
||||||
local function update_border()
|
|
||||||
element.border_color = '#' ..
|
|
||||||
color.utils.rgba_to_hex { r_timed_border.pos, g_timed_border.pos, b_timed_border.pos }
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Subscribe to the function bg and fg
|
|
||||||
r_timed_bg:subscribe(update_bg)
|
|
||||||
g_timed_bg:subscribe(update_bg)
|
|
||||||
b_timed_bg:subscribe(update_bg)
|
|
||||||
r_timed_fg:subscribe(update_fg)
|
|
||||||
g_timed_fg:subscribe(update_fg)
|
|
||||||
b_timed_fg:subscribe(update_fg)
|
|
||||||
r_timed_border:subscribe(update_border)
|
|
||||||
g_timed_border:subscribe(update_border)
|
|
||||||
b_timed_border:subscribe(update_border)
|
|
||||||
|
|
||||||
if i == selected then
|
|
||||||
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
|
|
||||||
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
|
|
||||||
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.border_color)
|
|
||||||
set_border(beautiful.colorscheme.bg_purple)
|
|
||||||
set_fg(beautiful.colorscheme.fg)
|
|
||||||
set_bg(beautiful.colorscheme.bg1)
|
|
||||||
elseif i == selected - 1 or (selected == 1 and i == #clients_sorted) then
|
|
||||||
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg1)
|
|
||||||
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.fg)
|
|
||||||
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_purple)
|
|
||||||
set_border(beautiful.colorscheme.border_color)
|
|
||||||
set_fg(beautiful.colorscheme.bg_green)
|
|
||||||
set_bg(beautiful.colorscheme.bg)
|
|
||||||
else
|
|
||||||
r_timed_bg.pos, g_timed_bg.pos, b_timed_bg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg)
|
|
||||||
r_timed_fg.pos, g_timed_fg.pos, b_timed_fg.pos = color.utils.hex_to_rgba(beautiful.colorscheme.bg_green)
|
|
||||||
r_timed_border.pos, g_timed_border.pos, b_timed_border.pos = color.utils.hex_to_rgba(beautiful.colorscheme.border_color)
|
|
||||||
set_border(beautiful.colorscheme.border_color)
|
|
||||||
set_fg(beautiful.colorscheme.bg_green)
|
|
||||||
set_bg(beautiful.colorscheme.bg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif fn == 'raise' then
|
|
||||||
local c = clients_sorted[selected]
|
|
||||||
if not c:isvisible() and c.first_tag then
|
|
||||||
c.first_tag:view_only()
|
|
||||||
end
|
|
||||||
c:emit_signal('request::activate')
|
|
||||||
c:raise()
|
|
||||||
|
|
||||||
--reset selected
|
|
||||||
selected = 0
|
|
||||||
end
|
|
||||||
return elements
|
|
||||||
end
|
|
||||||
|
|
||||||
elements = create_elements()
|
|
||||||
|
|
||||||
capi.awesome.connect_signal(
|
|
||||||
'window_switcher::select_next',
|
|
||||||
function()
|
|
||||||
elements = create_elements('next')
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
capi.awesome.connect_signal(
|
|
||||||
'window_switcher::raise',
|
|
||||||
function()
|
|
||||||
elements = create_elements('raise')
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
capi.client.connect_signal(
|
|
||||||
'manage',
|
|
||||||
function()
|
|
||||||
elements = create_elements()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
capi.client.connect_signal(
|
|
||||||
'unmanage',
|
|
||||||
function()
|
|
||||||
elements = create_elements()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
capi.awesome.connect_signal(
|
|
||||||
'window_switcher::update',
|
|
||||||
function()
|
|
||||||
elements = create_elements()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
return elements
|
|
||||||
end
|
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
local setmetatable = setmetatable
|
||||||
|
local print = print
|
||||||
|
local type = type
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
-- ██████╗██████╗ ██╗ ██╗██╗ ██╗ █████╗ --
|
-- ██████╗██████╗ ██╗ ██╗██╗ ██╗ █████╗ --
|
||||||
-- ██╔════╝██╔══██╗╚██╗ ██╔╝██║ ██║██╔══██╗ --
|
-- ██╔════╝██╔══██╗╚██╗ ██╔╝██║ ██║██╔══██╗ --
|
||||||
@@ -6,6 +10,7 @@
|
|||||||
-- ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ --
|
-- ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ --
|
||||||
-- ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ --
|
-- ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ --
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
local awful = require('awful')
|
local awful = require('awful')
|
||||||
local beautiful = require('beautiful')
|
local beautiful = require('beautiful')
|
||||||
local dpi = beautiful.xresources.apply_dpi
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
@@ -19,6 +24,10 @@ local capi = {
|
|||||||
screen = screen,
|
screen = screen,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local instance = nil
|
||||||
|
if not instance then
|
||||||
|
instance = setmetatable({}, {
|
||||||
|
__call = function()
|
||||||
local function get_userconfig()
|
local function get_userconfig()
|
||||||
local data = config.read_json(gfilesystem.get_xdg_config_home() .. 'crylia_theme/crylia_theme.json')
|
local data = config.read_json(gfilesystem.get_xdg_config_home() .. 'crylia_theme/crylia_theme.json')
|
||||||
if not data then
|
if not data then
|
||||||
@@ -60,7 +69,7 @@ for i = 2, 30, 2 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Default font, change it in user_config, not here.
|
-- Default font, change it in user_config, not here.
|
||||||
theme.font = theme.user_config.font .. ' bold ' .. dpi(16)
|
theme.font = theme.user_config.font .. ' bold ' .. 16
|
||||||
|
|
||||||
--#region Client variables
|
--#region Client variables
|
||||||
theme.useless_gap = dpi(5)
|
theme.useless_gap = dpi(5)
|
||||||
@@ -92,7 +101,6 @@ theme.hotkeys_label_fg = theme.colorscheme.bg
|
|||||||
|
|
||||||
--#region Layout icons
|
--#region Layout icons
|
||||||
local layout_path = gfilesystem.get_configuration_dir() .. 'src/assets/layout/'
|
local layout_path = gfilesystem.get_configuration_dir() .. 'src/assets/layout/'
|
||||||
|
|
||||||
theme.layout_cornerne = layout_path .. 'cornerne.png'
|
theme.layout_cornerne = layout_path .. 'cornerne.png'
|
||||||
theme.layout_cornernw = layout_path .. 'cornernw.png'
|
theme.layout_cornernw = layout_path .. 'cornernw.png'
|
||||||
theme.layout_cornerse = layout_path .. 'cornerse.png'
|
theme.layout_cornerse = layout_path .. 'cornerse.png'
|
||||||
@@ -112,7 +120,6 @@ theme.layout_tiletop = layout_path .. 'tiletop.png'
|
|||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
theme.notification_spacing = dpi(20)
|
theme.notification_spacing = dpi(20)
|
||||||
-- Systray theme variables
|
|
||||||
theme.bg_systray = theme.colorscheme.bg1
|
theme.bg_systray = theme.colorscheme.bg1
|
||||||
theme.systray_icon_spacing = dpi(10)
|
theme.systray_icon_spacing = dpi(10)
|
||||||
|
|
||||||
@@ -131,4 +138,8 @@ end)
|
|||||||
beautiful.init(theme)
|
beautiful.init(theme)
|
||||||
|
|
||||||
-- Load titlebar
|
-- Load titlebar
|
||||||
--require('src.core.titlebar')()
|
require('src.core.titlebar')()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return instance
|
||||||
|
|||||||
@@ -8,18 +8,17 @@ local ical_calendar_cache = {}
|
|||||||
local date_time = {}
|
local date_time = {}
|
||||||
|
|
||||||
setmetatable(date_time, {
|
setmetatable(date_time, {
|
||||||
__call = function(args)
|
__call = function(self, args)
|
||||||
local dt = table.copy(date_time)
|
|
||||||
|
|
||||||
dt.day = args.day or 1
|
self.day = args.day or 1
|
||||||
dt.month = args.month or 1
|
self.month = args.month or 1
|
||||||
dt.year = args.year or 1970
|
self.year = args.year or 1970
|
||||||
|
|
||||||
dt.hour = args.hour or 0
|
self.hour = args.hour or 0
|
||||||
dt.minute = args.minute or 0
|
self.minute = args.minute or 0
|
||||||
dt.second = args.second or 0
|
self.second = args.second or 0
|
||||||
|
|
||||||
return dt
|
return self
|
||||||
end,
|
end,
|
||||||
__newindex = function(self, ...)
|
__newindex = function(self, ...)
|
||||||
if ... == 'weeknum' then
|
if ... == 'weeknum' then
|
||||||
@@ -29,53 +28,135 @@ setmetatable(date_time, {
|
|||||||
return self.weeknum
|
return self.weeknum
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
__add = function(a, b)
|
__tostring = function(self)
|
||||||
local dt = table.copy(date_time)
|
return string.format('%d-%d-%d %d:%d:%d', self.year, self.month, self.day, self.hour, self.minute, self.second)
|
||||||
if type(a) == 'table' and type(b) == 'table' then
|
|
||||||
|
|
||||||
elseif type(a) == 'table' and type(b) == 'number' then
|
|
||||||
|
|
||||||
else
|
|
||||||
error('Cannot add number with date')
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
__sub = function(a, b)
|
|
||||||
|
|
||||||
end,
|
|
||||||
__mul = function(a, b)
|
|
||||||
|
|
||||||
end,
|
|
||||||
__div = function(a, b)
|
|
||||||
|
|
||||||
end,
|
end,
|
||||||
});
|
});
|
||||||
|
|
||||||
local parser = {}
|
local parser = {}
|
||||||
|
|
||||||
local instance = nil
|
function parser.VCALENDAR(handler)
|
||||||
|
local parse = {}
|
||||||
function parser:VEVENT()
|
local line
|
||||||
|
while true do
|
||||||
|
line = handler:read('*l')
|
||||||
|
if not line then break end
|
||||||
|
local key, value = line:match('^(%w+):(.*)$')
|
||||||
|
|
||||||
|
if key == 'END' then
|
||||||
|
return parse
|
||||||
end
|
end
|
||||||
|
|
||||||
---Start parsing a new calendar
|
if key == 'BEGIN' then
|
||||||
---@param path string path to .ical file
|
if value == 'VEVENT' then
|
||||||
function parser.parse(path)
|
parse[value] = parser.VEVENT(handler)
|
||||||
|
elseif value == 'VTIMEZONE' then
|
||||||
local ical_name = path
|
parse[value] = parser.VTIMEZONE(handler)
|
||||||
|
end
|
||||||
-- Check if the calendar has been parsed previously
|
elseif key == 'VERSION' then
|
||||||
if ical_calendar_cache[ical_name] then
|
parse[key] = value
|
||||||
return ical_calendar_cache[ical_name]
|
elseif key == 'PRODID' then
|
||||||
else
|
parse[key] = value
|
||||||
-- If not create a new one in the cache
|
elseif key == 'CALSCALE' then
|
||||||
ical_calendar_cache[ical_name] = {}
|
parse[key] = value
|
||||||
|
elseif key == 'METHOD' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'X-WR-CALNAME' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'X-WR-TIMEZONE' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'X-WR-CALDESC' then
|
||||||
|
parse[key] = value
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return ical_calendar_cache[ical_name]
|
function parser.VTIMEZONE(handler)
|
||||||
|
local parse = {}
|
||||||
|
local line
|
||||||
|
while true do
|
||||||
|
line = handler:read('*l')
|
||||||
|
if not line then break end
|
||||||
|
local key, value = line:match('^(%w+):(.*)$')
|
||||||
|
|
||||||
|
if key == 'END' then
|
||||||
|
return parse
|
||||||
|
end
|
||||||
|
|
||||||
|
if key == 'BEGIN' then
|
||||||
|
if value == 'DAYLIGHT' or value == 'STANDARD' then
|
||||||
|
parse[value] = parser.TZ(handler)
|
||||||
|
end
|
||||||
|
elseif key == 'TZID' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'LAST-MODIFIED' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'X-LIC-LOCATION' then
|
||||||
|
parse[key] = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function parser.TZ(handler)
|
||||||
|
local parse = {}
|
||||||
|
local line
|
||||||
|
while true do
|
||||||
|
line = handler:read('*l')
|
||||||
|
if not line then break end
|
||||||
|
local key, value = line:match('^(%w+):(.*)$')
|
||||||
|
|
||||||
|
if key == 'END' then
|
||||||
|
return parse
|
||||||
|
end
|
||||||
|
|
||||||
|
if key == 'TZNAME' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'TZOFFSETFROM' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'TZOFFSETTO' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'DTSTART' then
|
||||||
|
parse[key] = parse.DT(value)
|
||||||
|
elseif key == 'RRULE' then
|
||||||
|
parse[key] = parse.RRULE(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function parser.VEVENT(handler)
|
||||||
|
local parse = {}
|
||||||
|
local line
|
||||||
|
|
||||||
|
while true do
|
||||||
|
line = handler:read('*l')
|
||||||
|
if not line then break end
|
||||||
|
local key, value = line:match('^(%w+):(.*)$')
|
||||||
|
|
||||||
|
if key == 'END' then
|
||||||
|
return parse
|
||||||
|
end
|
||||||
|
|
||||||
|
if key == 'UID' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'SEQUENCE' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'SUMMARY' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'LOCATION' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'STATUS' then
|
||||||
|
parse[key] = value
|
||||||
|
elseif key == 'RRULE' then
|
||||||
|
parse[key] = parser.RRULE(value)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function parser.new(path)
|
function parser.new(path)
|
||||||
|
local cal = {}
|
||||||
|
|
||||||
-- Get the file from the path
|
-- Get the file from the path
|
||||||
local ical_name = path
|
local ical_name = path
|
||||||
@@ -85,12 +166,27 @@ function parser.new(path)
|
|||||||
return ical_calendar_cache[ical_name]
|
return ical_calendar_cache[ical_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If not create a new one in the cache
|
local handler = io.open(path, 'r')
|
||||||
ical_calendar_cache[ical_name] = { mt = {} }
|
if not handler then return end
|
||||||
|
|
||||||
|
while true do
|
||||||
|
local line = handler:read('*l')
|
||||||
|
if not line then break end
|
||||||
|
|
||||||
|
local key, value = line:match('^(%w+):(.*)$')
|
||||||
|
if key and value then
|
||||||
|
if key == 'BEGIN' and value == 'VCALENDAR' then
|
||||||
|
cal[value] = parser.VCALENDAR(handler)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
handler:close()
|
||||||
|
|
||||||
return ical_calendar_cache[ical_name]
|
return ical_calendar_cache[ical_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local instance = nil
|
||||||
if not instance then
|
if not instance then
|
||||||
instance = setmetatable(parser, {
|
instance = setmetatable(parser, {
|
||||||
-- If this module is called load all cached calendars from the cache
|
-- If this module is called load all cached calendars from the cache
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ return setmetatable({}, { __call = function(_, screen)
|
|||||||
calendar_popup.x = geo.x - (calendar_popup.width / 2)
|
calendar_popup.x = geo.x - (calendar_popup.width / 2)
|
||||||
end
|
end
|
||||||
calendar_popup.visible = not calendar_popup.visible
|
calendar_popup.visible = not calendar_popup.visible
|
||||||
|
collectgarbage('collect')
|
||||||
end)
|
end)
|
||||||
), }
|
), }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user