diff --git a/.gitmodules b/.gitmodules index 8a4eed4..99fda9b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,9 @@ [submodule "awesome/src/lib/color"] path = awesome/src/lib/color url = https://github.com/andOrlando/color -[submodule "awesome/src/lib/dbus_proxy"] - path = awesome/src/lib/dbus_proxy - url = https://github.com/stefano-m/lua-dbus_proxy +[submodule "awesome/src/lib/nice"] + path = awesome/src/lib/nice + url = https://github.com/Crylia/awesome-wm-nice +[submodule "awesome/src/lib/lua-dbus_proxy"] + path = awesome/src/lib/lua-dbus_proxy + url = https://github.com/Crylia/lua-dbus_proxy diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml deleted file mode 100644 index 6d70e17..0000000 --- a/alacritty/alacritty.yml +++ /dev/null @@ -1,109 +0,0 @@ -################################################ -# ██████╗██████╗ ██╗ ██╗██╗ ██╗ █████╗ # -# ██╔════╝██╔══██╗╚██╗ ██╔╝██║ ██║██╔══██╗ # -# ██║ ██████╔╝ ╚████╔╝ ██║ ██║███████║ # -# ██║ ██╔══██╗ ╚██╔╝ ██║ ██║██╔══██║ # -# ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ # -# ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ # -################################################ - -# Set the window Width and Height in console columns. -# The window size will change if the font size changes. -window: - padding: - x: 24 - y: 24 - dimensions: - columns: 110 - lines: 30 - decorations: full - startup_mode: Windowed - title: "Alacritty Terminal" - dynamic_title: true -# Scrolling history and multiplier -scrolling: - history: 10000 - multiplier: 3 -# Font family and style -font: - normal: - family: "JetBrains Mono Nerd Font" - style: Regular - bold: - family: "JetBrains Mono Nerd Font" - style: Bold - italic: - family: "JetBrains Mono Nerd Font" - style: italic - bold_italic: - family: "JetBrains Mono Nerd Font" - style: Bold Italic - size: 14.0 - offset: - y: 0 - glyph_offset: - y: 0 -# Background opacity from 0.0 transparent, 1.0 Opaque -window: - opacity: 0.4 -# Terminal colors -colors: - primary: - background: '0x131621' - foreground: '0xa6accd' - cursor: - text: CellBackground - cursor: CellForeground - search: - matches: - foreground: '0x1b1e28' - background: '0xadd7ff' - focus_match: - foreground: '0x1b1e28' - background: '0xadd7ff' - selection: - text: CellForeground - background: '0x303340' - normal: - black: '0x1b1e28' - red: '0xd0679d' - green: '0x5de4c7' - yellow: '0xfffac2' - blue: '#435c89' - magenta: '0xfcc5e9' - cyan: '0xadd7ff' - white: '0xffffff' - bright: - black: '0xa6accd' - red: '0xd0679d' - green: '0x5de4c7' - yellow: '0xfffac2' - blue: '0xadd7ff' - magenta: '0xfae4fc' - cyan: '0x89ddff' - white: '0xffffff' -# Cursor styling -cursor: - style: Beam - thickness: 0.2 - unfocused_hollow: false - blink_interval: 750 - -################################################################################ -# ███████╗██╗ ██╗ ██████╗ ██████╗ ████████╗ ██████╗██╗ ██╗████████╗███████╗ # -# ██╔════╝██║ ██║██╔═══██╗██╔══██╗╚══██╔══╝██╔════╝██║ ██║╚══██╔══╝██╔════╝ # -# ███████╗███████║██║ ██║██████╔╝ ██║ ██║ ██║ ██║ ██║ ███████╗ # -# ╚════██║██╔══██║██║ ██║██╔══██╗ ██║ ██║ ██║ ██║ ██║ ╚════██║ # -# ███████║██║ ██║╚██████╔╝██║ ██║ ██║ ╚██████╗╚██████╔╝ ██║ ███████║ # -# ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝ # -################################################################################ - -# Mouse -mouse_bindings: - - { mouse: Right, action: Paste } - -# Keyboard -key_bindings: - - { key: C, mods: Control|Shift, action: Copy } - - { key: V, mods: Control|Shift, action: Paste } - - { key: C, mods: Control, mode: Vi, action: ClearSelection } diff --git a/awesome/src/assets/icons/network/delete.svg b/awesome/src/assets/icons/network/delete.svg new file mode 100644 index 0000000..0f0c936 --- /dev/null +++ b/awesome/src/assets/icons/network/delete.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/src/assets/icons/network/edit.svg b/awesome/src/assets/icons/network/edit.svg new file mode 100644 index 0000000..2e90a4f --- /dev/null +++ b/awesome/src/assets/icons/network/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/src/assets/icons/network/link copy.svg b/awesome/src/assets/icons/network/link copy.svg new file mode 100644 index 0000000..1121413 --- /dev/null +++ b/awesome/src/assets/icons/network/link copy.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/awesome/src/assets/icons/network/link-off.svg b/awesome/src/assets/icons/network/link-off.svg new file mode 100644 index 0000000..6a83a3e --- /dev/null +++ b/awesome/src/assets/icons/network/link-off.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/awesome/src/lib/dbus_proxy b/awesome/src/lib/dbus_proxy deleted file mode 160000 index c9253bd..0000000 --- a/awesome/src/lib/dbus_proxy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c9253bde3fa5a64261953d1b196c57fabf9f8561 diff --git a/awesome/src/lib/lgi-async-extra b/awesome/src/lib/lgi-async-extra deleted file mode 160000 index 45281ce..0000000 --- a/awesome/src/lib/lgi-async-extra +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 45281ceaf42140f131861ca6d1717912f94f0bfd diff --git a/awesome/src/lib/lua-dbus_proxy b/awesome/src/lib/lua-dbus_proxy new file mode 160000 index 0000000..011306f --- /dev/null +++ b/awesome/src/lib/lua-dbus_proxy @@ -0,0 +1 @@ +Subproject commit 011306f859457865d3d289c49b640ac848d8fb1a diff --git a/awesome/src/lib/lua_libpulse_glib/lua_libpulse_glib.so b/awesome/src/lib/lua_libpulse_glib/lua_libpulse_glib.so deleted file mode 100755 index 1704cde..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/lua_libpulse_glib.so and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/callback.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/callback.o deleted file mode 100644 index 8fce60e..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/callback.o and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/context.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/context.o deleted file mode 100644 index 9f46e33..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/context.o and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/convert.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/convert.o deleted file mode 100644 index 0bf6dff..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/convert.o and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/init.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/init.o deleted file mode 100644 index 603064e..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/init.o and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/introspection.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/introspection.o deleted file mode 100644 index b33323b..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/introspection.o and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/proplist.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/proplist.o deleted file mode 100644 index eecf23d..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/proplist.o and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/pulseaudio.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/pulseaudio.o deleted file mode 100644 index d94b4cd..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/pulseaudio.o and /dev/null differ diff --git a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/volume.o b/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/volume.o deleted file mode 100644 index 2521be6..0000000 Binary files a/awesome/src/lib/lua_libpulse_glib/src/lua_libpulse_glib/volume.o and /dev/null differ diff --git a/awesome/src/lib/nice b/awesome/src/lib/nice new file mode 160000 index 0000000..8ee083f --- /dev/null +++ b/awesome/src/lib/nice @@ -0,0 +1 @@ +Subproject commit 8ee083f18caaebeba50ba03def840a73673caee6 diff --git a/awesome/src/modules/bluetooth/device.lua b/awesome/src/modules/bluetooth/device.lua index 3f0746a..dc846ec 100644 --- a/awesome/src/modules/bluetooth/device.lua +++ b/awesome/src/modules/bluetooth/device.lua @@ -134,7 +134,7 @@ function device.new(args) inputbox, widget = wibox.container.constraint, strategy = "exact", - width = dpi(400), + width = dpi(300), id = "const" }, spacing = dpi(10), diff --git a/awesome/src/modules/bluetooth/init.lua b/awesome/src/modules/bluetooth/init.lua index 980a680..ee9f414 100644 --- a/awesome/src/modules/bluetooth/init.lua +++ b/awesome/src/modules/bluetooth/init.lua @@ -6,7 +6,7 @@ local abutton = require("awful.button") local aspawn = require("awful.spawn") local base = require("wibox.widget.base") -local dbus_proxy = require("dbus_proxy") +local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy") local dpi = require("beautiful").xresources.apply_dpi local gcolor = require("gears").color local gfilesystem = require("gears").filesystem @@ -249,167 +249,159 @@ end function bluetooth.new(args) args = args or {} - local ret = base.make_widget_from_value(wibox.widget { + -- For some reason the first widget isn't read so the first container is a duplicate + local ret = base.make_widget_from_value({ { { { { { { - { - resize = false, - image = gcolor.recolor_image(icondir .. "menu-down.svg", - Theme_config.bluetooth_controller.connected_icon_color), - widget = wibox.widget.imagebox, - valign = "center", - halign = "center", - id = "icon" - }, - { - { - text = "Paired Devices", - valign = "center", - halign = "center", - widget = wibox.widget.textbox, - }, - margins = dpi(5), - widget = wibox.container.margin - }, - id = "connected", - layout = wibox.layout.fixed.horizontal - }, - bg = Theme_config.bluetooth_controller.connected_bg, - fg = Theme_config.bluetooth_controller.connected_fg, - shape = Theme_config.bluetooth_controller.connected_shape, - widget = wibox.container.background - }, - id = "connected_margin", - widget = wibox.container.margin - }, - { - { - { - step = dpi(50), - spacing = dpi(10), - layout = require("src.lib.overflow_widget.overflow").vertical, - scrollbar_width = 0, - id = "connected_device_list" - }, - id = "margin", - margins = dpi(10), - widget = wibox.container.margin - }, - border_color = Theme_config.bluetooth_controller.con_device_border_color, - border_width = Theme_config.bluetooth_controller.con_device_border_width, - shape = Theme_config.bluetooth_controller.con_device_shape, - widget = wibox.container.background, - forced_height = 0, - id = "connected_list", - }, - { - { - { - { - resize = false, - image = gcolor.recolor_image(icondir .. "menu-down.svg", - Theme_config.bluetooth_controller.discovered_icon_color), - widget = wibox.widget.imagebox, - valign = "center", - halign = "center", - id = "icon", - }, - { - { - text = "Nearby Devices", - valign = "center", - halign = "center", - widget = wibox.widget.textbox, - }, - margins = dpi(5), - widget = wibox.container.margin - }, - id = "discovered", - layout = wibox.layout.fixed.horizontal - }, - id = "discovered_bg", - bg = Theme_config.bluetooth_controller.discovered_bg, - fg = Theme_config.bluetooth_controller.discovered_fg, - shape = Theme_config.bluetooth_controller.discovered_shape, - widget = wibox.container.background - }, - id = "discovered_margin", - top = dpi(10), - widget = wibox.container.margin - }, - { - { - { - id = "discovered_device_list", - spacing = dpi(10), - step = dpi(50), - layout = require("src.lib.overflow_widget.overflow").vertical, - scrollbar_width = 0, - }, - margins = dpi(10), - widget = wibox.container.margin - }, - border_color = Theme_config.bluetooth_controller.con_device_border_color, - border_width = Theme_config.bluetooth_controller.con_device_border_width, - shape = Theme_config.bluetooth_controller.con_device_shape, - widget = wibox.container.background, - forced_height = 0, - id = "discovered_list", - }, - { - { -- action buttons - { - dnd_widget { - color = Theme_config.bluetooth_controller.power_bg, - size = dpi(40) - }, - id = "dnd", - widget = wibox.container.place, + resize = false, + image = gcolor.recolor_image(icondir .. "menu-down.svg", + Theme_config.bluetooth_controller.connected_icon_color), + widget = wibox.widget.imagebox, valign = "center", - halign = "center" + halign = "center", + id = "connected_icon" }, - nil, - { -- refresh + { { - { - image = gcolor.recolor_image(icondir .. "refresh.svg", - Theme_config.bluetooth_controller.refresh_icon_color), - resize = false, - valign = "center", - halign = "center", - widget = wibox.widget.imagebox, - }, - widget = wibox.container.margin, - margins = dpi(5), + text = "Paired Devices", + valign = "center", + halign = "center", + widget = wibox.widget.textbox, }, - shape = Theme_config.bluetooth_controller.refresh_shape, - bg = Theme_config.bluetooth_controller.refresh_bg, - id = "scan", - widget = wibox.container.background + margins = dpi(5), + widget = wibox.container.margin }, - layout = wibox.layout.align.horizontal + layout = wibox.layout.fixed.horizontal }, - widget = wibox.container.margin, - top = dpi(10), + bg = Theme_config.bluetooth_controller.connected_bg, + fg = Theme_config.bluetooth_controller.connected_fg, + shape = Theme_config.bluetooth_controller.connected_shape, + widget = wibox.container.background, + id = "connected_bg" }, - layout = wibox.layout.fixed.vertical + id = "connected_margin", + widget = wibox.container.margin }, - margins = dpi(15), - widget = wibox.container.margin + { + { + { + step = dpi(50), + spacing = dpi(10), + layout = require("src.lib.overflow_widget.overflow").vertical, + scrollbar_width = 0, + id = "connected_device_list" + }, + id = "margin", + margins = dpi(10), + widget = wibox.container.margin + }, + border_color = Theme_config.bluetooth_controller.con_device_border_color, + border_width = Theme_config.bluetooth_controller.con_device_border_width, + shape = Theme_config.bluetooth_controller.con_device_shape, + widget = wibox.container.background, + forced_height = 0, + id = "connected_list", + }, + { + { + { + { + resize = false, + image = gcolor.recolor_image(icondir .. "menu-down.svg", + Theme_config.bluetooth_controller.discovered_icon_color), + widget = wibox.widget.imagebox, + valign = "center", + halign = "center", + id = "discovered_icon", + }, + { + { + text = "Nearby Devices", + valign = "center", + halign = "center", + widget = wibox.widget.textbox, + }, + margins = dpi(5), + widget = wibox.container.margin + }, + layout = wibox.layout.fixed.horizontal + }, + id = "discovered_bg", + bg = Theme_config.bluetooth_controller.discovered_bg, + fg = Theme_config.bluetooth_controller.discovered_fg, + shape = Theme_config.bluetooth_controller.discovered_shape, + widget = wibox.container.background + }, + id = "discovered_margin", + top = dpi(10), + widget = wibox.container.margin + }, + { + { + { + id = "discovered_device_list", + spacing = dpi(10), + step = dpi(50), + layout = require("src.lib.overflow_widget.overflow").vertical, + scrollbar_width = 0, + }, + margins = dpi(10), + widget = wibox.container.margin + }, + border_color = Theme_config.bluetooth_controller.con_device_border_color, + border_width = Theme_config.bluetooth_controller.con_device_border_width, + shape = Theme_config.bluetooth_controller.con_device_shape, + widget = wibox.container.background, + forced_height = 0, + id = "discovered_list", + }, + { + { -- action buttons + { + dnd_widget { + color = Theme_config.bluetooth_controller.power_bg, + size = dpi(40) + }, + id = "dnd", + widget = wibox.container.place, + valign = "center", + halign = "center" + }, + nil, + { -- refresh + { + { + image = gcolor.recolor_image(icondir .. "refresh.svg", + Theme_config.bluetooth_controller.refresh_icon_color), + resize = false, + valign = "center", + halign = "center", + widget = wibox.widget.imagebox, + }, + widget = wibox.container.margin, + margins = dpi(5), + }, + shape = Theme_config.bluetooth_controller.refresh_shape, + bg = Theme_config.bluetooth_controller.refresh_bg, + id = "scan", + widget = wibox.container.background + }, + layout = wibox.layout.align.horizontal + }, + widget = wibox.container.margin, + top = dpi(10), + }, + layout = wibox.layout.fixed.vertical }, - shape = Theme_config.bluetooth_controller.shape, - border_color = Theme_config.bluetooth_controller.container_border_color, - border_width = Theme_config.bluetooth_controller.container_border_width, - bg = Theme_config.bluetooth_controller.container_bg, - widget = wibox.container.background + margins = dpi(15), + widget = wibox.container.margin, }, - width = dpi(400), - strategy = "exact", - widget = wibox.container.constraint + margins = dpi(15), + widget = wibox.container.margin, }) -- Get a reference to the dnd button @@ -489,7 +481,7 @@ function bluetooth.new(args) --#region Dropdown logic local connected_margin = ret:get_children_by_id("connected_margin")[1] local connected_list = ret:get_children_by_id("connected_list")[1] - local connected = ret:get_children_by_id("connected")[1].center + local connected_icon = ret:get_children_by_id("connected_icon")[1] connected_margin:connect_signal( "button::press", @@ -503,21 +495,23 @@ function bluetooth.new(args) end } if connected_list.forced_height == 0 then - local size = (#ret:get_paired_devices() * 60) + 1 + local size = (#ret:get_paired_devices() * 60) if size < 210 then rubato_timer.target = dpi(size) end - connected_margin.connected_bg.shape = function(cr, width, height) - gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4)) + if size > 0 then + connected_margin.connected_bg.shape = function(cr, width, height) + gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4)) + end + connected_icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg", + Theme_config.bluetooth_controller.connected_icon_color)) end - connected.icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg", - Theme_config.bluetooth_controller.connected_icon_color)) else rubato_timer.target = 0 connected_margin.connected_bg.shape = function(cr, width, height) gshape.rounded_rect(cr, width, height, 4) end - connected.icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg", + connected_icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg", Theme_config.bluetooth_controller.connected_icon_color)) end end @@ -526,7 +520,7 @@ function bluetooth.new(args) local discovered_margin = ret:get_children_by_id("discovered_margin")[1] local discovered_list = ret:get_children_by_id("discovered_list")[1] local discovered_bg = ret:get_children_by_id("discovered_bg")[1] - local discovered = ret:get_children_by_id("discovered")[1].center + local discovered_icon = ret:get_children_by_id("discovered_icon")[1] discovered_margin:connect_signal( "button::press", @@ -541,22 +535,24 @@ function bluetooth.new(args) } if discovered_list.forced_height == 0 then - local size = (#ret:get_discovered_devices() * 60) + 1 + local size = (#ret:get_discovered_devices() * 60) if size > 210 then size = 210 end - rubato_timer.target = dpi(size) - discovered_margin.discovered_bg.shape = function(cr, width, height) - gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4)) + if size > 0 then + rubato_timer.target = dpi(size) + discovered_margin.discovered_bg.shape = function(cr, width, height) + gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4)) + end + discovered_icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg", + Theme_config.bluetooth_controller.discovered_icon_color)) end - discovered.icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg", - Theme_config.bluetooth_controller.discovered_icon_color)) else rubato_timer.target = 0 discovered_bg.shape = function(cr, width, height) gshape.rounded_rect(cr, width, height, 4) end - discovered.icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg", + discovered_icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg", Theme_config.bluetooth_controller.discovered_icon_color)) end end diff --git a/awesome/src/modules/crylia_bar/init.lua b/awesome/src/modules/crylia_bar/init.lua index 2066cb2..d8a412e 100644 --- a/awesome/src/modules/crylia_bar/init.lua +++ b/awesome/src/modules/crylia_bar/init.lua @@ -15,7 +15,7 @@ return function(s) elseif widget == "Battery" then table.insert(widget_table, require("src.widgets.battery")(User_config.battery_kind)) elseif widget == "Bluetooth" then - table.insert(widget_table, require("src.widgets.bluetooth")()) + table.insert(widget_table, require("src.widgets.bluetooth")(s)) elseif widget == "Clock" then table.insert(widget_table, require("src.widgets.clock")()) elseif widget == "Cpu Frequency" then diff --git a/awesome/src/modules/desktop/desktop.lua b/awesome/src/modules/desktop/desktop.lua index 658c8c0..d2e5fa5 100644 --- a/awesome/src/modules/desktop/desktop.lua +++ b/awesome/src/modules/desktop/desktop.lua @@ -16,7 +16,8 @@ local cm = require("src.modules.context_menu.init") local capi = { mouse = mouse, - awesome = awesome + awesome = awesome, + screen = screen, } local icondir = gfilesystem.get_configuration_dir() .. "src/assets/icons/desktop/" @@ -46,7 +47,7 @@ function desktop:save_layout() } end - local dir = gfilesystem.get_configuration_dir() .. "src/config" + dir = gfilesystem.get_configuration_dir() .. "src/config" gfilesystem.make_directories(dir) if not gfilesystem.file_readable(dir .. "/desktop.json") then os.execute("touch " .. dir .. "/desktop.json") @@ -214,6 +215,9 @@ function desktop:add_element(args, pos) cm_popup.visible = false end) + local cols = math.floor(self.args.screen.geometry.width / (args.icon_size * 1.75 * (4 / 3))) + local rows = math.floor((self.args.screen.geometry.height - 75 + 95) / (args.icon_size * 1.75)) + print(cols, rows) -- While the mouse is down, remove the element from the grid and add it to manual then move it -- until the mouse is released and then add it back to the grid. e:connect_signal("button::press", function(_, _, _, b) @@ -221,8 +225,8 @@ function desktop:add_element(args, pos) if not mousegrabber.isrunning() then - local width = args.icon_size * 1.75 * (4 / 3) - local height = args.icon_size * 1.75 + local width = (self.args.screen.geometry.width - 20 - ((cols - 1) * 10)) / cols + local height = (self.args.screen.geometry.height - 170 - 20) / rows local dnd_widget = element { icon = args.icon, @@ -291,33 +295,39 @@ function desktop:add_element(args, pos) end function desktop:draw_selector() - local start_pos = mouse.coords() + local start_pos = capi.mouse.coords() if not mousegrabber.isrunning() then local selector = wibox.widget { widget = wibox.container.background, bg = gcolor("#0ffff088"), border_color = gcolor("#0ffff0"), border_width = dpi(2), - width = 100, - height = 100, + forced_width = 0, + forced_height = 0, + x = start_pos.x, + y = start_pos.y, visible = true, shape = function(cr, w, h) gshape.rounded_rect(cr, w, h, dpi(10)) end } - - local coords = capi.mouse.coords() - selector.point = { x = coords.x, y = coords.y } + selector.point = { x = start_pos.x, y = start_pos.y } self.widget.manual:add(selector) mousegrabber.run(function(m) if m.buttons[1] then selector.visible = true end if not m.buttons[1] then + print("stop") mousegrabber.stop() selector.visible = false self.widget.manual:reset() end + selector.forced_width = selector.forced_width + ((start_pos.x - m.x) * -1) + selector.forced_height = selector.forced_width + ((start_pos.y - m.y) * -1) + + print(selector.forced_width, selector.forced_height) + return m.buttons[1] end, "left_ptr") end end @@ -341,18 +351,10 @@ end function desktop.new(args) args = args or {} - args.screen = args.screen or awful.screen.focused() - local icon_size = args.icon_size or dpi(96) - -- calculate the row and column count based on the screen size and icon size and aspect ratio of 16:9 - local screen_width = awful.screen.focused().geometry.width - local screen_height = awful.screen.focused().geometry.height - local aspect_ratio = 4 / 3 - - local cols = math.floor(screen_width / (icon_size * 1.75 * aspect_ratio)) - local rows = math.floor((screen_height - (dpi(75 + 95))) / (icon_size * 1.75)) - + local cols = math.floor(args.screen.geometry.width / (icon_size * 1.75 * (4 / 3))) + local rows = math.floor((args.screen.geometry.height - 75 + 95) / (icon_size * 1.75)) --[[ The wibox has a stacked layout with a manual layout over a grid. @@ -371,15 +373,15 @@ function desktop.new(args) x = 0, y = 0, bg = gcolor.transparent, - width = 1920, - height = 1080, + width = args.screen.geometry.width, + height = args.screen.geometry.height, screen = args.screen, widget = wibox.widget { { { layout = grid, homogeneous = true, - spacing = dpi(10), + spacing = 10, expand = true, orientation = "horizontal", forced_num_cols = cols, @@ -401,6 +403,8 @@ function desktop.new(args) } } + w.args = args + local cm_popup = cm { widget_template = wibox.widget { { @@ -563,29 +567,19 @@ function desktop.new(args) } } - w.widget.manual:buttons( - gtable.join( - awful.button( - {}, - 1, - function() - cm_popup.visible = false - if capi.mouse.current_widgets[4] == w.widget.manual then - --w:draw_selector() - end - end - ), - awful.button( - {}, - 3, - function() - if capi.mouse.current_widgets[4] == w.widget.manual then - cm_popup:toggle() - end - end - ) - ) - ) + w.widget.manual:buttons(gtable.join( + awful.button({}, 1, function() + cm_popup.visible = false + if capi.mouse.current_widgets[4] == w.widget.manual then + w:draw_selector() + end + end), + awful.button({}, 3, function() + if capi.mouse.current_widgets[4] == w.widget.manual then + cm_popup:toggle() + end + end) + )) gtable.crush(w, desktop, true) diff --git a/awesome/src/modules/desktop/element.lua b/awesome/src/modules/desktop/element.lua index 569f320..17e24be 100644 --- a/awesome/src/modules/desktop/element.lua +++ b/awesome/src/modules/desktop/element.lua @@ -39,10 +39,10 @@ function element:on_hover() self.border_color = "#0ffff099" end) - self:connect_signal("mouse::leave", function() + --[[ self:connect_signal("mouse::leave", function() self.bg = gcolor.transparent self.border_color = gcolor.transparent - end) + end) ]] self:connect_signal("button::press", function() self.bg = "#0ffff088" diff --git a/awesome/src/modules/init.lua b/awesome/src/modules/init.lua index 6dfce6f..dc4cf92 100644 --- a/awesome/src/modules/init.lua +++ b/awesome/src/modules/init.lua @@ -4,31 +4,22 @@ -- Awesome Libs local awful = require("awful") -awful.screen.connect_for_each_screen( --- For each screen this function is called once --- If you want to change the modules per screen use the indices --- e.g. 1 would be the primary screen and 2 the secondary screen. - function(s) - -- Create 9 tags - awful.layout.append_default_layouts(User_config.layouts) - awful.tag( - { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, - s, - User_config.layouts[1] - ) +awful.screen.connect_for_each_screen(function(s) + -- Create 9 tags + awful.layout.append_default_layouts(User_config.layouts) + awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, User_config.layouts[1]) - require("src.modules.desktop.desktop") { screen = s } - require("src.modules.powermenu.powermenu")(s) - require("src.modules.audio.volume_osd") { screen = s } - --require("src.modules.audio.volume_controller") { screen = s } - require("src.modules.brightness.brightness_osd")(s) - require("src.modules.titlebar.titlebar") - require("src.modules.crylia_bar.init")(s) - --require("src.modules.crylia_wibox.init")(s) - require("src.modules.notification-center.init")(s) - require("src.modules.window_switcher.init")(s) - require("src.modules.application_launcher.init") { screen = s } - --require("src.modules.calendar.init") { screen = s } - require("src.modules.network_controller.init") { screen = s } - end -) + require("src.modules.desktop.desktop") { screen = s } + require("src.modules.powermenu.powermenu")(s) + require("src.modules.audio.volume_osd") { screen = s } + --require("src.modules.audio.volume_controller") { screen = s } + require("src.modules.brightness.brightness_osd") { screen = s } + require("src.lib.nice") { titlebar_font = User_config.font.bold, + titlebar_items = { left = { "icon" }, right = { "minimize", "maximize", "close" } } } + require("src.modules.crylia_bar.init")(s) + --require("src.modules.crylia_wibox.init")(s) + require("src.modules.notification-center.init")(s) + require("src.modules.window_switcher.init")(s) + require("src.modules.application_launcher.init") { screen = s } + require("src.modules.network_controller.init") { screen = s } +end) diff --git a/awesome/src/modules/network_controller/access_point.lua b/awesome/src/modules/network_controller/access_point.lua index 6f6f3de..e63c1b8 100644 --- a/awesome/src/modules/network_controller/access_point.lua +++ b/awesome/src/modules/network_controller/access_point.lua @@ -3,22 +3,152 @@ ------------------------------------ -- Awesome Libs -local awful = require("awful") +local abutton = require("awful.button") +local awidget = require("awful.widget") local dpi = require("beautiful").xresources.apply_dpi local gtable = require("gears").table local gfilesystem = require("gears").filesystem -local gobject = require("gears").object local gcolor = require("gears").color +local lgi = require("lgi") local wibox = require("wibox") local base = require("wibox.widget.base") -local NM = require("lgi").NM +local NM = lgi.NM +-- Third party libs +local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy") + +-- Own libs local ap_form = require("src.modules.network_controller.ap_form") +local cm = require("src.modules.context_menu.init") local icondir = gfilesystem.get_configuration_dir() .. "src/assets/icons/network/" local access_point = { mt = {} } +local function flags_to_security(flags, wpa_flags, rsn_flags) + local str = "" + if flags == 1 and wpa_flags == 0 and rsn_flags == 0 then + str = str .. " WEP" + end + if wpa_flags ~= 0 then + str = str .. " WPA1" + end + if not rsn_flags ~= 0 then + str = str .. " WPA2" + end + if wpa_flags == 512 or rsn_flags == 512 then + str = str .. " 802.1X" + end + + return (str:gsub("^%s", "")) +end + +function access_point:get_access_point_connections(ssid) + local cn = {} + + local connections = self.NetworkManagerSettings:ListConnections() + for _, connection_path in ipairs(connections) do + local NetworkManagerSettingsConnection = dbus_proxy.Proxy:new { + bus = dbus_proxy.Bus.SYSTEM, + name = "org.freedesktop.NetworkManager", + interface = "org.freedesktop.NetworkManager.Settings.Connection", + path = connection_path + } + + if NetworkManagerSettingsConnection.Filename:find(ssid) then + table.insert(cn, NetworkManagerSettingsConnection) + end + end + + return cn +end + +function access_point:create_profile(ap, password, auto_connect) + local s_wsec = {} + local security = flags_to_security(ap.Flags, ap.WpaFlags, ap.RsnFlags) + if security ~= "" then + if security:match("WPA") then + s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "wpa-psk") + s_wsec["auth-alg"] = lgi.GLib.Variant("s", "open") + s_wsec["psk"] = lgi.GLib.Variant("s", password) + else + s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "None") + s_wsec["wep-key-type"] = lgi.GLib.Variant("s", NM.WepKeyType.PASSPHRASE) + s_wsec["wep-key0"] = lgi.GLib.Variant("s", password) + end + end + + return { + ["connection"] = { + -- ["interface-name"] = lgi.GLib.Variant("s", ap.device_interface), + ["uuid"] = lgi.GLib.Variant("s", string.gsub('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx', '[xy]', function(c) + local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb) + return string.format('%x', v) + end)), + ["id"] = lgi.GLib.Variant("s", NM.utils_ssid_to_utf8(ap.Ssid)), + ["type"] = lgi.GLib.Variant("s", "802-11-wireless"), + ["autoconnect"] = lgi.GLib.Variant("b", auto_connect), + }, + ["ipv4"] = { + ["method"] = lgi.GLib.Variant("s", "auto") + }, + ["ipv6"] = { + ["method"] = lgi.GLib.Variant("s", "auto"), + }, + ["802-11-wireless"] = { + ["mode"] = lgi.GLib.Variant("s", "infrastructure"), + }, + ["802-11-wireless-security"] = s_wsec + } +end + +function access_point:disconnect_ap() + self.NetworkManager:DeactivateConnection(self.NetworkManagerDevice.ActiveConnection) +end + +function access_point:connect(ap, password, auto_connect) + local connections = self:get_access_point_connections(NM.utils_ssid_to_utf8(ap.Ssid)) + local profile = self:create_profile(self.NetworkManagerAccessPoint, password, auto_connect) + + if #connections == 0 then + self.NetworkManager:AddAndActivateConnectionAsync(function(proxy, context, success, fail) + if fail ~= nil then + print("Error: " .. tostring(fail), tostring(fail.code)) + self:emit_signal("NetworkManager::failed", tostring(fail), tostring(fail.code)) + return + end + + self:emit_signal("NetworkManager::connected", success) + end, { call_id = "my-id" }, profile, self.NetworkManagerDevice.object_path, + self.NetworkManagerAccessPoint.object_path) + --88ALYLNxo9Kk*RwRxMfN + else + connections[1]:Update(profile) + self.NetworkManager:ActivateConnectionAsync(function(proxy, context, success, failure) + if failure then + self:emit_signal("NM::AccessPointFailed", tostring(failure)) + return + end + + self:emit_signal("NM::AccessPointConnected", NM.utils_ssid_to_utf8(ap.Ssid)) + end, + { call_id = "my-id" }, connections[1].object_path, self.NetworkManagerDevice.object_path, + self.NetworkManagerAccessPoint.object_path) + end +end + +function access_point:toggle_access_point(ap, password, auto_connect) + if self:is_ap_active(ap) then + self:disconnect_ap() + else + self:connect_ap(ap, password, auto_connect) + end +end + +function access_point:is_ap_active(ap) + return ap.path == self.NetworkManagerDeviceWireless.ActiveAccessPoint +end + function access_point.new(args) args = args or {} @@ -32,6 +162,13 @@ function access_point.new(args) Theme_config.network_manager.access_point.icon_color2 end ]] + local ssid_text = awidget.inputbox { + text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid) or + args.NetworkManagerAccessPoint.hw_address or "Unknown", + halign = "left", + valign = "center", + } + local ret = base.make_widget_from_value(wibox.widget { { { @@ -57,21 +194,11 @@ function access_point.new(args) }, { { - { - text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid) or - args.NetworkManagerAccessPoint.hw_address or "Unknown", - id = "alias", - widget = wibox.widget.textbox - }, - { - text = "Connecting...", - id = "connecting", - visible = false, - font = User_config.font.specify .. ", regular 10", - widget = wibox.widget.textbox - }, - id = "alias_container", - layout = wibox.layout.fixed.horizontal + ssid_text, + widget = wibox.container.constraint, + strategy = "exact", + width = dpi(300), + id = "alias" }, width = dpi(260), height = dpi(40), @@ -130,21 +257,92 @@ function access_point.new(args) gtable.crush(ret, access_point, true) ret.NetworkManagerAccessPoint = args.NetworkManagerAccessPoint + ret.NetworkManagerSettings = args.NetworkManagerSettings + ret.NetworkManagerDeviceWireless = args.NetworkManagerDeviceWireless + ret.NetworkManagerDevice = args.NetworkManagerDevice + ret.NetworkManager = args.NetworkManager - ret.ap_form = ap_form { screen = args.screen, ssid = NM.utils_ssid_to_utf8(ret.NetworkManagerAccessPoint.Ssid) } + ret.ap_form = ap_form { + screen = args.screen, + NetworkManagerAccessPoint = args.NetworkManagerAccessPoint, + ap = ret + } - ret:buttons( - gtable.join( - awful.button( - {}, - 1, - nil, - function() - ret.ap_form:popup_toggle() + ret.cm = cm { + widget_template = wibox.widget { + { + { + { + { + widget = wibox.widget.imagebox, + resize = true, + valign = "center", + halign = "center", + id = "icon_role", + }, + widget = wibox.container.constraint, + stragety = "exact", + width = dpi(24), + height = dpi(24), + id = "const" + }, + { + widget = wibox.widget.textbox, + valign = "center", + halign = "left", + id = "text_role" + }, + layout = wibox.layout.fixed.horizontal + }, + widget = wibox.container.margin + }, + widget = wibox.container.background, + }, spacing = dpi(10), + entries = { + { -- Connect/Disconnect a device + name = "ret.device.Connected" and "Disconnect" or "Connect", + icon = gcolor.recolor_image("ret.device.Connected" and icondir .. "link-off.svg" or + icondir .. "link.svg", + Theme_config.network_manager.access_point.icon_color), + callback = function() + ret:toggle_access_point() + end, + id = "connected" + }, + { -- Rename a device + name = "Rename", + icon = gcolor.recolor_image(icondir .. "edit.svg", Theme_config.network_manager.icon_color), + callback = function() + ssid_text:focus() + ssid_text:connect_signal("submit", function(text) + text = text:get_text() + ssid_text.markup = ret:rename(text) + end) end - ) + }, + { -- Remove a device + name = "Remove", + icon = gcolor.recolor_image(icondir .. "delete.svg", Theme_config.network_manager.icon_color), + callback = function() + + end + } + } + } + + ret:buttons(gtable.join( + abutton({}, 1, nil, + function() + --TODO:Check if there are any connection details, else open the popup + ret.ap_form:popup_toggle() + end + ), + abutton({}, 3, nil, + function() + ret.cm:toggle() + end ) - ) + )) ret:get_children_by_id("con")[1].image = gcolor.recolor_image( icondir .. "link.svg", icon_color) diff --git a/awesome/src/modules/network_controller/ap_form.lua b/awesome/src/modules/network_controller/ap_form.lua index dc4be7c..40ece1a 100644 --- a/awesome/src/modules/network_controller/ap_form.lua +++ b/awesome/src/modules/network_controller/ap_form.lua @@ -1,16 +1,20 @@ -local awful = require("awful") +local abutton = require("awful.button") +local aplacement = require("awful.placement") +local apopup = require("awful.popup") +local awidget = require("awful.widget") local dpi = require("beautiful").xresources.apply_dpi local gtable = require("gears.table") -local gobject = require("gears.object") local gcolor = require("gears.color") local gshape = require("gears.shape") local gfilesystem = require("gears.filesystem") +local NM = require("lgi").NM local wibox = require("wibox") local icondir = gfilesystem.get_configuration_dir() .. "src/assets/icons/network/" local capi = { awesome = awesome, + mouse = mouse, mousegrabber = mousegrabber } @@ -22,47 +26,11 @@ end function ap_form.new(args) args = args or {} - args.screen = args.screen or awful.screen.preferred() + args.screen = args.screen - local settigns_form = { - password = awful.widget.inputbox { - widget_template = wibox.template { - widget = wibox.widget { - { - { - { - widget = wibox.widget.textbox, - halign = "left", - valign = "center", - id = "text_role", - }, - widget = wibox.container.margin, - margins = 5, - id = "marg" - }, - widget = wibox.container.constraint, - strategy = "exact", - width = 400, - height = 50, - id = "const" - }, - widget = wibox.container.background, - bg = "#212121", - fg = "#F0F0F0", - border_color = "#414141", - border_width = 2, - shape = gshape.rounded_rect, - forced_width = 300, - forced_height = 50, - }, - update_callback = function(template_widget, args) - template_widget.widget.const.marg.text_role.markup = args.text - end - } - }, - } + local password = awidget.inputbox { hint_text = "Password..." } - local ret = awful.popup { + local ret = apopup { widget = { { { -- Header @@ -71,7 +39,7 @@ function ap_form.new(args) { { widget = wibox.widget.textbox, - text = args.ssid, + text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid), font = User_config.font.specify .. ",extra bold 16", halign = "center", valign = "center", @@ -115,7 +83,30 @@ function ap_form.new(args) right = dpi(20), }, -- Change to inputtextbox container - settigns_form.password, + { + { + { + password, + widget = wibox.container.margin, + margins = 5, + id = "marg" + }, + widget = wibox.container.constraint, + strategy = "exact", + width = 400, + height = 50, + id = "const" + }, + widget = wibox.container.background, + bg = "#212121", + fg = "#F0F0F0", + border_color = "#414141", + border_width = 2, + shape = gshape.rounded_rect, + forced_width = 300, + forced_height = 50, + id = "password_container" + }, layout = wibox.layout.align.horizontal }, { -- Actions @@ -181,7 +172,7 @@ function ap_form.new(args) widget = wibox.container.margin, margins = dpi(10) }, - placement = awful.placement.centered, + placement = aplacement.centered, ontop = true, visible = false, width = dpi(600), @@ -195,6 +186,30 @@ function ap_form.new(args) screen = args.screen, } + local password_container = ret.widget:get_children_by_id("password_container")[1] + + -- Focus the searchbar when its left clicked + password_container:buttons(gtable.join { + abutton({}, 1, function() + password:focus() + end) + }) + + --#region Hover signals to change the cursor to a text cursor + local old_cursor, old_wibox + password_container:connect_signal("mouse::enter", function() + local wid = capi.mouse.current_wibox + if wid then + old_cursor, old_wibox = wid.cursor, wid + wid.cursor = "xterm" + end + end) + password_container:connect_signal("mouse::leave", function() + old_wibox.cursor = old_cursor + old_wibox = nil + end) + --#endregion + gtable.crush(ret, ap_form, true) local checkbox = ret.widget:get_children_by_id("checkbox")[1] @@ -210,13 +225,10 @@ function ap_form.new(args) local connect_button = ret.widget:get_children_by_id("connect_button")[1] connect_button:connect_signal("button::press", function() - ret:emit_signal("ap_form::connect", { - ssid = args.ssid, - password = settigns_form.password:get_text(), - auto_connect = ret.widget:get_children_by_id("checkbox")[1].checked - }) - print("Connect to " .. args.ssid:get_text(), "\nPassword: " .. settigns_form.password:get_text(), - "\nAuto connect: " .. tostring(ret.widget:get_children_by_id("checkbox")[1].checked)) + password:stop() + args.ap:connect(args.NetworkManagerAccessPoint, password:get_text(), + ret.widget:get_children_by_id("checkbox")[1].checked) + ret:popup_toggle() end) Hover_signal(connect_button) diff --git a/awesome/src/modules/network_controller/init.lua b/awesome/src/modules/network_controller/init.lua index 7732c4e..f8339c2 100644 --- a/awesome/src/modules/network_controller/init.lua +++ b/awesome/src/modules/network_controller/init.lua @@ -4,12 +4,11 @@ -- Awesome Libs local awful = require("awful") -local dbus_proxy = require("dbus_proxy") +local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy") local dpi = require("beautiful").xresources.apply_dpi local gtable = require("gears").table local gtimer = require("gears").timer local gshape = require("gears").shape -local gobject = require("gears").object local gcolor = require("gears").color local gears = require("gears") local lgi = require("lgi") @@ -24,11 +23,6 @@ local dnd_widget = require("awful.widget.toggle_widget") local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/network/" - -local capi = { - awesome = awesome, -} - local network = { mt = {} } network.NMState = { @@ -63,31 +57,6 @@ network.DeviceState = { FAILED = 120 } -local function flags_to_security(flags, wpa_flags, rsn_flags) - local str = "" - if flags == 1 and wpa_flags == 0 and rsn_flags == 0 then - str = str .. " WEP" - end - if wpa_flags ~= 0 then - str = str .. " WPA1" - end - if not rsn_flags ~= 0 then - str = str .. " WPA2" - end - if wpa_flags == 512 or rsn_flags == 512 then - str = str .. " 802.1X" - end - - return (str:gsub("^%s", "")) -end - -local function generate_uuid() - return string.gsub('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx', '[xy]', function(c) - local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb) - return string.format('%x', v) - end) -end - function network:get_wifi_proxy() local devices = self._private.NetworkManager:GetDevices() for _, path in ipairs(devices) do @@ -146,74 +115,16 @@ function network.device_state_to_string(state) return device_state_to_string[state] end -function network:get_access_point_connections(ssid) - local cn = {} - - local connections = self._private.NetworkManagerSettings:ListConnections() - for _, connection_path in ipairs(connections) do - local NetworkManagerSettingsConnection = dbus_proxy.Proxy:new { - bus = dbus_proxy.Bus.SYSTEM, - name = "org.freedesktop.NetworkManager", - interface = "org.freedesktop.NetworkManager.Settings.Connection", - path = connection_path - } - - if NetworkManagerSettingsConnection.Filename:find(ssid) then - table.insert(cn, NetworkManagerSettingsConnection) - end - end - - return cn -end - -function network:create_profile(ap, password, auto_connect) - local s_wsec = {} - if ap.security ~= "" then - if ap.security:match("WPA") then - s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "wpa-psk") - s_wsec["auth-alg"] = lgi.GLib.Variant("s", "open") - --s_wsec["psk"] = lgi.GLib.Variant("s", helpers.string.trim(password)) - else - s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "None") - s_wsec["wep-key-type"] = lgi.GLib.Variant("s", NM.WepKeyType.PASSPHRASE) - --s_wsec["wep-key0"] = lgi.GLib.Variant("s", helpers.string.trim(password)) - end - end - - return { - ["connection"] = { - -- ["interface-name"] = lgi.GLib.Variant("s", ap.device_interface), - ["uuid"] = lgi.GLib.Variant("s", generate_uuid()), - ["id"] = lgi.GLib.Variant("s", ap.ssid), - ["type"] = lgi.GLib.Variant("s", "802-11-wireless"), - ["autoconnect"] = lgi.GLib.Variant("b", auto_connect), - }, - ["ipv4"] = { - ["method"] = lgi.GLib.Variant("s", "auto") - }, - ["ipv6"] = { - ["method"] = lgi.GLib.Variant("s", "auto"), - }, - ["802-11-wireless"] = { - ["mode"] = lgi.GLib.Variant("s", "infrastructure"), - }, - ["802-11-wireless-security"] = s_wsec - } -end - ---Scan for access points and create a widget for each one. function network:scan_access_points() local ap_list = self:get_children_by_id("wifi_ap_list")[1] - + ap_list:reset() self._private.NetworkManagerDeviceWireless:RequestScanAsync(function(proxy, context, success, failure) if failure then - -- Send an error notification - print("AP Scan failed: ", failure) return end -- Get every access point even those who hide their ssid - print(#self._private.NetworkManagerDeviceWireless:GetAllAccessPoints()) for _, ap in ipairs(self._private.NetworkManagerDeviceWireless:GetAllAccessPoints()) do -- Create a new proxy for every ap @@ -223,69 +134,27 @@ function network:scan_access_points() interface = "org.freedesktop.NetworkManager.AccessPoint", path = ap } - --[[ for _, ap2 in ipairs(ap_list.children) do - if ap2.NetworkManagerAccessPoint.HwAddress:match(ap.HwAddress or "") then - goto continue - end - end ]] - - print("AP Found: ", NetworkManagerAccessPoint.HwAddress, NM.utils_ssid_to_utf8(NetworkManagerAccessPoint.Ssid), - NetworkManagerAccessPoint.Strength) - -- We are only interested in those with a ssid if NetworkManagerAccessPoint.Ssid then - ap_list:add(access_point { NetworkManagerAccessPoint = NetworkManagerAccessPoint }) + ap_list:add(access_point { + NetworkManagerAccessPoint = NetworkManagerAccessPoint, + NetworkManagerDevice = self._private.NetworkManagerDevice, + NetworkManagerSettings = self._private.NetworkManagerSettings, + NetworkManager = self._private.NetworkManager, + NetworkManagerDeviceWireless = self._private.NetworkManagerDeviceWireless + }) end end table.sort(ap_list, function(a, b) return a.NetworkManagerAccessPoint.Strength > b.NetworkManagerAccessPoint.Strength end) - print("AP_Anzahl: ", #ap_list.children) end, { call_id = "my-id" }, {}) end function network:is_ap_active(ap) - return ap.path == self._private.wifi_proxy.ActiveAccessPoint -end - -function network:disconnect_ap() - self._private.NetworkManager:DeactivateConnection(self._private.NetworkManagerDevice.ActiveConnection) -end - -function network:connect_ap(ap, pw, auto_connect) - local connections = self:get_access_point_connections(ap.ssid) - local profile = self:create_profile(ap, pw, auto_connect) - - if #connections == 0 then - self._private.NetworkManager:AddAndActivateConnectionAsync(function(proxy, context, success, failure) - if failure then - self:emit_signal("NM::AccessPointFailed", tostring(failure)) - return - end - - self:emit_signal("NM::AccessPointConnected", ap.ssid) - end, { call_id = "my-id", profile, ap.device_proxy_path, ap.path }) - else - connections[1]:Update(profile) - self._private.NetworkManager:ActivateConnectionAsync(function(proxy, context, success, failure) - if failure then - self:emit_signal("NM::AccessPointFailed", tostring(failure)) - return - end - - self:emit_signal("NM::AccessPointConnected", ap.ssid) - end, { call_id = "my-id", connections[1].object_path, ap.device_proxy_path, ap.path }) - end -end - -function network:toggle_access_point(ap, password, auto_connect) - if self:is_ap_active(ap) then - self:disconnect_ap() - else - self:connect_ap(ap, password, auto_connect) - end + return ap.path == self._private.NetworkManagerDeviceWireless.ActiveAccessPoint end ---Toggles networking on or off diff --git a/awesome/src/modules/titlebar/titlebar.lua b/awesome/src/modules/titlebar/titlebar.lua deleted file mode 100644 index 68a1b7e..0000000 --- a/awesome/src/modules/titlebar/titlebar.lua +++ /dev/null @@ -1,447 +0,0 @@ ------------------------------------ --- This is the titlebar module -- ------------------------------------ - --- Awesome Libs -local awful = require("awful") -local dpi = require("beautiful").xresources.apply_dpi -local gears = require("gears") -local wibox = require("wibox") - -local capi = { - awesome = awesome, - client = client -} - --- Icon directory path -local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/titlebar/" - -awful.titlebar.enable_tooltip = true -awful.titlebar.fallback_name = 'Client' - --- Normal AND Focus(active/inactive) have to be set or errors will appear in stdout -Theme.titlebar_close_button_normal = icondir .. "close.svg" -Theme.titlebar_close_button_focus = icondir .. "close.svg" -Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg" -Theme.titlebar_minimize_button_focus = icondir .. "minimize.svg" -Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg" -Theme.titlebar_maximized_button_active = icondir .. "maximize.svg" -Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg" - -local create_buttons = function(c) - local buttons = gears.table.join( - awful.button( - {}, - 1, - function() - c:activate { context = 'titlebar', action = 'mouse_move' } - end - ), - awful.button( - {}, - 3, - function() - c:activate { context = 'titlebar', action = 'mouse_resize' } - end - ) - ) - return buttons -end - -local create_titlebar = function(c, size, position) - local close_button = awful.titlebar.widget.closebutton(c) - local minimize_button = awful.titlebar.widget.minimizebutton(c) - local maximize_button = awful.titlebar.widget.maximizedbutton(c) - - local tb - - if position == "left" then - local titlebar = awful.titlebar(c, { - position = "left", - bg = Theme_config.titlebar.bg, - size = size - }) - - tb = wibox.widget { - { - { - { - close_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.close_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "closebutton" - }, - { - maximize_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.maximize_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "maximizebutton" - }, - { - minimize_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.minimize_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "minimizebutton" - }, - spacing = dpi(10), - layout = wibox.layout.fixed.vertical, - id = "spacing" - }, - margins = dpi(5), - widget = wibox.container.margin, - id = "margin" - }, - { - buttons = create_buttons(c), - layout = wibox.layout.flex.vertical - }, - { - awful.titlebar.widget.iconwidget(c), - margins = dpi(5), - widget = wibox.container.margin - }, - layout = wibox.layout.align.vertical, - id = "main" - } - - titlebar:setup { tb, layout = wibox.layout.fixed.horizontal } - - elseif position == "top" then - local titlebar = awful.titlebar(c, { - position = "top", - bg = Theme_config.titlebar.bg, - size = size - }) - - tb = wibox.widget { - { - awful.titlebar.widget.iconwidget(c), - margins = dpi(5), - widget = wibox.container.margin - }, - { - { - awful.titlebar.widget.titlewidget(c), - valign = "center", - halign = "center", - layout = wibox.container.place, - }, - buttons = create_buttons(c), - fill_space = true, - layout = wibox.layout.stack - }, - { - { - { - minimize_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.minimize_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "minimizebutton" - }, - { - maximize_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.maximize_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "maximizebutton" - }, - { - close_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.close_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "closebutton" - }, - spacing = dpi(10), - layout = wibox.layout.fixed.horizontal, - id = "spacing" - }, - margins = dpi(5), - widget = wibox.container.margin, - id = "margin" - }, - layout = wibox.layout.align.horizontal, - id = "main" - } - - titlebar:setup { tb, layout = wibox.layout.fixed.vertical } - end - - if not tb then return end - - close_button:connect_signal( - "mouse::enter", - function() - c.border_color = Theme_config.titlebar.close_button.hover_border - local cb = tb:get_children_by_id("closebutton")[1] - cb.border_color = Theme_config.titlebar.close_button.hover_border - cb.bg = Theme_config.titlebar.close_button.hover_bg - end - ) - - close_button:connect_signal( - "mouse::leave", - function() - c.border_color = Theme_config.window.border_normal - local cb = tb:get_children_by_id("closebutton")[1] - cb.border_color = Theme_config.titlebar.close_button.border_color - cb.bg = Theme_config.titlebar.close_button.bg - end - ) - - minimize_button:connect_signal( - "mouse::enter", - function() - c.border_color = Theme_config.titlebar.minimize_button.hover_border - local mb = tb:get_children_by_id("minimizebutton")[1] - mb.border_color = Theme_config.titlebar.minimize_button.hover_border - mb.bg = Theme_config.titlebar.minimize_button.hover_bg - end - ) - - minimize_button:connect_signal( - "mouse::leave", - function() - c.border_color = Theme_config.window.border_normal - local mb = tb:get_children_by_id("minimizebutton")[1] - mb.border_color = Theme_config.titlebar.minimize_button.border_color - mb.bg = Theme_config.titlebar.minimize_button.bg - end - ) - - maximize_button:connect_signal( - "mouse::enter", - function() - c.border_color = Theme_config.titlebar.maximize_button.hover_border - local mb = tb:get_children_by_id("maximizebutton")[1] - mb.border_color = Theme_config.titlebar.maximize_button.hover_border - mb.bg = Theme_config.titlebar.maximize_button.hover_bg - end - ) - - maximize_button:connect_signal( - "mouse::leave", - function() - c.border_color = Theme_config.window.border_normal - local mb = tb:get_children_by_id("maximizebutton")[1] - mb.border_color = Theme_config.titlebar.maximize_button.border_color - mb.bg = Theme_config.titlebar.maximize_button.bg - end - ) -end - -local create_titlebar_dialog_modal = function(c, size, position) - local close_button = awful.titlebar.widget.closebutton(c) - local minimize_button = awful.titlebar.widget.minimizebutton(c) - local maximize_button = awful.titlebar.widget.maximizedbutton(c) - - local tb - - if position == "left" then - local titlebar = awful.titlebar(c, { - position = "left", - bg = Theme_config.titlebar.bg, - size = size - }) - - tb = wibox.widget { - { - { - close_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.close_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "closebutton" - }, - margins = dpi(5), - widget = wibox.container.margin, - id = "margin" - }, - { - buttons = create_buttons(c), - layout = wibox.layout.flex.vertical - }, - { - awful.titlebar.widget.iconwidget(c), - margins = dpi(5), - widget = wibox.container.margin - }, - layout = wibox.layout.align.vertical, - id = "main" - } - - titlebar:setup { tb, layout = wibox.layout.fixed.horizontal } - - elseif position == "top" then - local titlebar = awful.titlebar(c, { - position = "top", - bg = Theme_config.titlebar.bg, - size = size - }) - - tb = wibox.widget { - { - awful.titlebar.widget.iconwidget(c), - margins = dpi(5), - widget = wibox.container.margin - }, - { - { - awful.titlebar.widget.titlewidget(c), - valign = "center", - halign = "center", - layout = wibox.container.place, - }, - buttons = create_buttons(c), - fill_space = true, - layout = wibox.layout.stack - }, - { - { - close_button, - widget = wibox.container.background, - border_color = Theme_config.titlebar.close_button.border_color, - border_width = dpi(2), - shape = function(cr, height, width) - gears.shape.rounded_rect(cr, width, height, dpi(6)) - end, - id = "closebutton" - }, - margins = dpi(5), - widget = wibox.container.margin, - id = "margin" - }, - layout = wibox.layout.align.horizontal, - id = "main" - } - - titlebar:setup { tb, layout = wibox.layout.fixed.vertical } - end - - if not tb then return end - - close_button:connect_signal( - "mouse::enter", - function() - c.border_color = Theme_config.titlebar.close_button.hover_border - local cb = tb:get_children_by_id("closebutton")[1] - cb.border_color = Theme_config.titlebar.close_button.hover_border - cb.bg = Theme_config.titlebar.close_button.hover_bg - end - ) - - close_button:connect_signal( - "mouse::leave", - function() - c.border_color = Theme_config.window.border_normal - local cb = tb:get_children_by_id("closebutton")[1] - cb.border_color = Theme_config.titlebar.close_button.border_color - cb.bg = Theme_config.titlebar.close_button.bg - end - ) - - minimize_button:connect_signal( - "mouse::enter", - function() - c.border_color = Theme_config.titlebar.minimize_button.hover_border - local mb = tb:get_children_by_id("minimizebutton")[1] - mb.border_color = Theme_config.titlebar.minimize_button.hover_border - mb.bg = Theme_config.titlebar.minimize_button.hover_bg - end - ) - - minimize_button:connect_signal( - "mouse::leave", - function() - c.border_color = Theme_config.window.border_normal - local mb = tb:get_children_by_id("minimizebutton")[1] - mb.border_color = Theme_config.titlebar.minimize_button.border_color - mb.bg = Theme_config.titlebar.minimize_button.bg - end - ) - - maximize_button:connect_signal( - "mouse::enter", - function() - c.border_color = Theme_config.titlebar.maximize_button.hover_border - local mb = tb:get_children_by_id("maximizebutton")[1] - mb.border_color = Theme_config.titlebar.maximize_button.hover_border - mb.bg = Theme_config.titlebar.maximize_button.hover_bg - end - ) - - maximize_button:connect_signal( - "mouse::leave", - function() - c.border_color = Theme_config.window.border_normal - local mb = tb:get_children_by_id("maximizebutton")[1] - mb.border_color = Theme_config.titlebar.maximize_button.border_color - mb.bg = Theme_config.titlebar.maximize_button.bg - end - ) -end - -capi.client.connect_signal( - "request::titlebars", - function(c) - if c.type == "dialog" then - create_titlebar_dialog_modal(c, dpi(35), User_config.titlebar_position) - elseif c.type == "modal" then - create_titlebar_dialog_modal(c, dpi(35), User_config.titlebar_position) - else - create_titlebar(c, dpi(35), User_config.titlebar_position) - end - - if not c.floating or c.maximized or c.fullscreen then - if User_config.titlebar_position == "left" then - awful.titlebar.hide(c, "left") - elseif User_config.titlebar_position == "top" then - awful.titlebar.hide(c, "top") - end - end - end -) - -capi.client.connect_signal( - "property::floating", - function(c) - if c.floating and not (c.maximized or c.fullscreen) then - if User_config.titlebar_position == "left" then - awful.titlebar.show(c, "left") - elseif User_config.titlebar_position == "top" then - awful.titlebar.show(c, "top") - end - else - if User_config.titlebar_position == "left" then - awful.titlebar.hide(c, "left") - elseif User_config.titlebar_position == "top" then - awful.titlebar.hide(c, "top") - end - end - end -) diff --git a/awesome/src/scripts/backlight.sh b/awesome/src/scripts/backlight.sh deleted file mode 100755 index 47bbb54..0000000 --- a/awesome/src/scripts/backlight.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -case $1 in - "get") - echo $(xfpm-power-backlight-helper --get-brightness) - ;; - "set") - echo $(pkexec xfpm-power-backlight-helper --set-brightness $2) - ;; -esac diff --git a/awesome/src/scripts/wifi.sh b/awesome/src/scripts/wifi.sh deleted file mode 100755 index e69de29..0000000 diff --git a/awesome/src/theme/theme_config.lua b/awesome/src/theme/theme_config.lua index 0b73b60..30b383a 100644 --- a/awesome/src/theme/theme_config.lua +++ b/awesome/src/theme/theme_config.lua @@ -515,8 +515,13 @@ Theme_config.right_bar = { Theme_config.titlebar = { bg = "#121212AA", + size = dpi(38), close_button = { border_color = "#00000000", + border_width = dpi(2), + shape = function(cr, width, height) + gshape.rounded_rect(cr, width, height, dpi(6)) + end, bg = "#00000000", fg = color["Grey100"], hover_border = color["Red800"], @@ -525,6 +530,10 @@ Theme_config.titlebar = { }, minimize_button = { border_color = "#00000000", + border_width = dpi(2), + shape = function(cr, width, height) + gshape.rounded_rect(cr, width, height, dpi(6)) + end, fg = color["Grey100"], bg = "#00000000", hover_border = color["Orange800"], @@ -533,6 +542,10 @@ Theme_config.titlebar = { }, maximize_button = { border_color = "#00000000", + border_width = dpi(2), + shape = function(cr, width, height) + gshape.rounded_rect(cr, width, height, dpi(6)) + end, fg = color["Grey100"], bg = "#00000000", hover_border = color["Green800"], diff --git a/awesome/src/theme/user_config.lua b/awesome/src/theme/user_config.lua index a21871c..ff2dc1d 100644 --- a/awesome/src/theme/user_config.lua +++ b/awesome/src/theme/user_config.lua @@ -55,6 +55,14 @@ User_config = { ]] -- battery_path = nil, + --[[ + The brightness increase/decrease step in percent. + Example: + brightness_step = 5 + Will increase the brightness by 5% at a time + ]] + brightness_step = 2, + --[[ DnD or 'Do not Disturb' will prevent notifications from poping up. This is just a default value, you can toggle it in the notification-center, but it won't be saved. @@ -213,7 +221,7 @@ User_config = { --[[ This is the default terminal, Alacritty is the default. ]] -- - terminal = "alacritty", + terminal = "kitty", text_editor = "code", diff --git a/awesome/src/tools/color_helper.lua b/awesome/src/tools/color_helper.lua new file mode 100644 index 0000000..c3251d9 --- /dev/null +++ b/awesome/src/tools/color_helper.lua @@ -0,0 +1,87 @@ +local cairo = require("lgi").cairo +local gcolor = require("gears.color") +local gdk = require("lgi").Gdk +local gsurface = require("gears.surface") +local gtable = require("gears.table") + +local color_helper = { mt = {} } +color_helper.color_rules = {} + +function color_helper.set_color_rule(c, color) + color_helper.color_rules[c.instance] = color +end + +function color_helper.get_color_rule(c) + return color_helper.color_rules[c.instance] +end + +function color_helper.lighten(color, amount) + local r, g, b + r, g, b = gcolor.parse_color(color) + r = 255 * r + g = 255 * g + b = 255 * b + r = r + math.floor(2.55 * amount) + g = g + math.floor(2.55 * amount) + b = b + math.floor(2.55 * amount) + r = r > 255 and 255 or r + g = g > 255 and 255 or g + b = b > 255 and 255 or b + return ("#%02x%02x%02x"):format(r, g, b) +end + +function color_helper.duotone_gradient_vertical(color_1, color_2, height, offset_1, offset_2) + local fill_pattern = cairo.Pattern.create_linear(0, 0, 0, height) + local r, g, b, a + r, g, b, a = gcolor.parse_color(color_1) + fill_pattern:add_color_stop_rgba(offset_1 or 0, r, g, b, a) + r, g, b, a = gcolor.parse_color(color_2) + fill_pattern:add_color_stop_rgba(offset_2 or 1, r, g, b, a) + return fill_pattern +end + +function color_helper.get_dominant_color(client) + local color, pb, bytes + local tally, content, cgeo = {}, gsurface(client.content), client:geometry() + local x_offset, y_offset, x_lim = 2, 2, math.floor(cgeo.width / 2) + + for x_pos = 0, x_lim, 2 do + for y_pos = 0, 8, 1 do + pb = gdk.pixbuf_get_from_surface(content, x_offset + x_pos, y_offset + y_pos, 1, 1) + bytes = pb:get_pixels() + color = "#" .. bytes:gsub(".", function(c) + return ("%02x"):format(c:byte()) + end) + if not tally[color] then + tally[color] = 1 + else + tally[color] = tally[color] + 1 + end + end + end + local mode + local mode_c = 0 + for k, v in pairs(tally) do + if v > mode_c then + mode_c = v + mode = k + end + end + color = mode + color_helper.set_color_rule(client, color) + return color +end + +function color_helper.new(args) + local ret = {} + + gtable.crush(ret, color_helper, true) + + return ret +end + +function color_helper.mt:__call(...) + return color_helper.new(...) +end + +return setmetatable(color_helper, color_helper.mt) diff --git a/awesome/src/tools/dbus/bluetooth_dbus.lua b/awesome/src/tools/dbus/bluetooth_dbus.lua index 78574cb..8a1d5af 100644 --- a/awesome/src/tools/dbus/bluetooth_dbus.lua +++ b/awesome/src/tools/dbus/bluetooth_dbus.lua @@ -1,6 +1,6 @@ local awful = require("awful") local gears = require("gears") -local dbus_proxy = require("dbus_proxy") +local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy") local lgi = require("lgi") local capi = { diff --git a/awesome/src/widgets/bluetooth.lua b/awesome/src/widgets/bluetooth.lua index ae65ddf..f062cb4 100644 --- a/awesome/src/widgets/bluetooth.lua +++ b/awesome/src/widgets/bluetooth.lua @@ -2,14 +2,18 @@ -- This is the bluetooth widget -- ---------------------------------- --- Awesome Libs +-- Awesome libs local awful = require("awful") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") +-- Own libs +local bt_module = require("src.modules.bluetooth.init") + local capi = { awesome = awesome, + mouse = mouse } -- Icon directory path @@ -18,21 +22,9 @@ local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/bl -- Returns the bluetooth widget return function(s) - local bt_widget = require("src.modules.bluetooth.init") { screen = s } - - local bluetooth_container = awful.popup { - widget = bt_widget:get_widget(), - ontop = true, - bg = Theme_config.bluetooth_controller.container_bg, - stretch = false, - visible = false, - forced_width = dpi(400), - screen = s, - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, dpi(12)) - end - } - + -- Get the bluetooth module + local bt_widget = bt_module { screen = s } + -- Create the bluetooth widget local bluetooth_widget = wibox.widget { { { @@ -60,6 +52,25 @@ return function(s) widget = wibox.container.background } + -- If bt_widget is nil then there is no bluetooth adapter and there shouldn't be done + -- anything besides returning the widget without any logic behind + if not bt_widget then + return bluetooth_widget + end + + -- Create the awful.popup container for the module + local bluetooth_container = awful.popup { + widget = bt_widget, + ontop = true, + stretch = false, + visible = false, + screen = s, + border_color = Theme_config.bluetooth_controller.container_border_color, + border_width = Theme_config.bluetooth_controller.container_border_width, + bg = Theme_config.bluetooth_controller.container_bg + } + + -- When the status changes update the icon bt_widget:connect_signal("bluetooth::status", function(status) bluetooth_widget:get_children_by_id("icon")[1].image = gears.color.recolor_image(status._private.Adapter1.Powered and icondir .. "bluetooth-on.svg" or icondir .. "bluetooth-off.svg", Theme_config.bluetooth.fg) @@ -68,19 +79,17 @@ return function(s) -- Hover signal to change color when mouse is over Hover_signal(bluetooth_widget) - bluetooth_widget:connect_signal( - "button::press", - function(_, _, _, key) - if key == 1 then - local geo = mouse.current_wibox:geometry() - bluetooth_container.x = geo.x - bluetooth_container.y = geo.y + dpi(55) - bluetooth_container.visible = not bluetooth_container.visible - else - capi.awesome.emit_signal("toggle_bluetooth") - end + -- On left click toggle the bluetooth container else toggle the bluetooth on/off + bluetooth_widget:connect_signal("button::press", function(_, _, _, key) + if key == 1 then + local geo = capi.mouse.current_wibox:geometry() + bluetooth_container.x = geo.x + bluetooth_container.y = geo.y + dpi(55) + bluetooth_container.visible = not bluetooth_container.visible + else + capi.awesome.emit_signal("toggle_bluetooth") end - ) + end) return bluetooth_widget end diff --git a/awesome/todo.md b/awesome/todo.md index 85658b3..30a330b 100644 --- a/awesome/todo.md +++ b/awesome/todo.md @@ -16,6 +16,14 @@ - Algorithm to select the best search match - Keep track of most launched applications and serve them over others +### Backlight [100% Done] + +#### Features + +- Change backlight with your backlight keys +- See the change on a OSD that pops up +- Works with all devices by writing into /usr/class/backlight/`device` + ### Bluetooth [95% Done] #### Features @@ -37,4 +45,42 @@ - Getting and asking for a passcode - "Greying out" non avaiable options in the dropdown +### Calendar [60% Done] + +#### Features + +- Read .ical files and put them into the calendar +- Create tasks for every day +- Month/Year switcher +- Saved accross restarts +- Popup with the task informations + +#### TODO + +- Create a new task for a calendar +- Create an alert that notifies the user +- Week numbers +- Remove a calendar +- Remove a task + +### Desktop [40% Done] + +- Create desktop icons, folders or files +- Drag and drop desktop icons +- Context menu +- Saves accross restart +- Desktop context menu + +TODO + +- Actions for the context menu +- Open width in context menu +- Drag across multiple screens +- Proper size calculation for desktop icons and desktop +- Multiscreen support in general +- MIME types for files +- xdg folder types +- Drag-select +- Cross-DE support (e.g. use the same desktop icons as used in KDE or Mate ...) + ## Widgets diff --git a/i3/config b/i3/config deleted file mode 100644 index f0f6307..0000000 --- a/i3/config +++ /dev/null @@ -1,142 +0,0 @@ -################################################################# -# ██╗██████╗ ██████╗██████╗ ██╗ ██╗██╗ ██╗ █████╗ # -# ██║╚════██╗ ██╔════╝██╔══██╗╚██╗ ██╔╝██║ ██║██╔══██╗ # -# ██║ █████╔╝█████╗██║ ██████╔╝ ╚████╔╝ ██║ ██║███████║ # -# ██║ ╚═══██╗╚════╝██║ ██╔══██╗ ╚██╔╝ ██║ ██║██╔══██║ # -# ██║██████╔╝ ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ # -# ╚═╝╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ # -################################################################# - -# Modifier - set $mod Mod4 - floating_modifier $mod - -# Client theme - client.focused #a6bcfa #a6bcfa #a6bcfa #a6bcfa - client.unfocused #585f75 #585f75 #585f75 #585f75 - client.focused_inactive #585f75 #585f75 #585f75 #585f75 - client.urgent #fbdf91 #fbdf91 #fbdf91 #fbdf91 - font pango:JetBrainsNerd Font Mono 10 - for_window [class="^.*"] border pixel 2 - gaps inner 10 - hide_edge_borders smart - -# Window modes - bindsym $mod+f fullscreen toggle - bindsym $mod+Shift+space floating toggle - -# Set screen - set $primary_screen DP-0 - set $second_screen HDMI-0 - -# Set workspaces - set $ws1 "1" - set $ws2 "2" - set $ws3 "3" - set $ws4 "4" - set $ws5 "5" - set $ws6 "6" - set $ws7 "7" - set $ws8 "8" - set $ws9 "9" - set $ws10 "SecondScreen" - -# Assign workspace to screen - workspace $ws10 output $second_screen - -# Globalkeys - bindsym Print exec flameshot gui - bindsym $mod+e exec nautilus - bindsym $mod+Return exec alacritty - bindsym $mod+d exec --no-startup-id rofi -show drun -theme ~/.config/rofi/appmenu/rofi.rasi - bindsym $mod+Control+c reload - bindsym $mod+Control+r restart - bindsym $mod+Shift+e exec --no-startup-id "rofi -show power-menu -modi 'power-menu:~/.config/rofi/rofi-power-menu --choices=shutdown/reboot/logout/lockscreen' -theme ~/.config/rofi/powermenu/powermenu.rasi" - -# Clientkeys - bindsym $mod+q kill - bindsym $mod+Left focus left - bindsym $mod+Down focus down - bindsym $mod+Up focus up - bindsym $mod+Right focus right - bindsym $mod+Shift+Left move left - bindsym $mod+Shift+Down move down - bindsym $mod+Shift+Up move up - bindsym $mod+Shift+Right move right - bindsym $mod+h split h - bindsym $mod+v split v - bindsym $mod+a focus parent - # Switch to workspace - bindsym $mod+1 workspace number $ws1 - bindsym $mod+2 workspace number $ws2 - bindsym $mod+3 workspace number $ws3 - bindsym $mod+4 workspace number $ws4 - bindsym $mod+5 workspace number $ws5 - bindsym $mod+6 workspace number $ws6 - bindsym $mod+7 workspace number $ws7 - bindsym $mod+8 workspace number $ws8 - bindsym $mod+9 workspace number $ws9 - bindsym $mod+0 workspace number $ws10 - # Move window to workspace x - bindsym $mod+Shift+1 move container to workspace number $ws1 - bindsym $mod+Shift+2 move container to workspace number $ws2 - bindsym $mod+Shift+3 move container to workspace number $ws3 - bindsym $mod+Shift+4 move container to workspace number $ws4 - bindsym $mod+Shift+5 move container to workspace number $ws5 - bindsym $mod+Shift+6 move container to workspace number $ws6 - bindsym $mod+Shift+7 move container to workspace number $ws7 - bindsym $mod+Shift+8 move container to workspace number $ws8 - bindsym $mod+Shift+9 move container to workspace number $ws9 - bindsym $mod+Shift+0 move container to workspace number $ws10 - # Function Keys - bindsym XF86AudioPlay exec playerctl play-pause - bindsym XF86AudioStop exec playerctl stop - bindsym XF86AudioNext exec playerctl next - bindsym XF86AudioPrev exec playerctl previous - bindsym XF86AudioRaiseVolume exec --no-startup-id pactl -- set-sink-volume @DEFAULT_SINK@ +5% #increase sound volume - bindsym XF86AudioLowerVolume exec --no-startup-id pactl -- set-sink-volume @DEFAULT_SINK@ -5% #decrease sound volume - bindsym XF86AudioMute exec --no-startup-id pactl -- set-sink-mute @DEFAULT_SINK@ toggle # mute sound - bindsym XF86MonBrightnessUp exec xbacklight -inc 10 # increase screen brightness - bindsym XF86MonBrightnessDown exec xbacklight -dec 10 # decrease screen brightnessR - -# Modes - mode "resize" { - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" - } - -# Modekeys - bindsym $mod+r mode "resize" - -# Floating exceptions - for_window [title="Lautstärkeregler"] floating enable - for_window [class="Arandr"] floating enable - for_window [class="Grub-customizer"] floating enable - for_window [class="Gnome-control-center"] floating enable - for_window [class="Xfce4-power-manager-settings"] floating enable - for_window [class="Lutris" id=63012046 instance="lutris" title="Läufer verwalten"] floating enable - for_window [class="zoom" title="Chat"] floating enable - -# Autostart - exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork - exec --no-startup-id picom --experimental-backends - exec --no-startup-id setxkbmap -layout us - exec_always --no-startup-id $HOME/.config/polybar/scripts/launch.sh - exec_always --no-startup-id picom --experimental-backends - exec_always --no-startup-id nitrogen --restore - exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 & - exec --no-startup-id power-manager-plugins - exec --no-startup-id ~/.screenlayout/i3.sh - exec --no-startup-id /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd - exec discord - exec spotify - -# Automove window to workspace - for_window [class="Spotify"] move container to workspace $ws10 - for_window [class="discord"] move container to workspace $ws10 \ No newline at end of file diff --git a/polybar/config.ini b/polybar/config.ini deleted file mode 100644 index 815f017..0000000 --- a/polybar/config.ini +++ /dev/null @@ -1,63 +0,0 @@ -;============================================================; -; ; -; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ ; -; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ ; -; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ ; -; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ ; -; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ ; -; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ; -; ; -;=============================================================; - -[colors] -background = #212121 -foreground = #ffffff -primay-900 = #0D47A1 -primay-800 = #1565C0 -primay-700 = #1976D2 -primay-600 = #1E88E5 -primay-500 = #2196F3 -primay-400 = #42A5F5 -primay-300 = #64B5F6 -primay-200 = #90CAF9 -primay-100 = #BBDEFB -primay-50 = #E3F2FD - -[global/wm] -margin-top = 5 -margin-bottom = 5 -include-file = ~/.config/polybar/modules/modules.ini - -[bar/crylia] -monitor = ${env:MONITOR:} -width = 100% -height = 25 -fixed-center = true -line-size = 2 -background = ${colors.background} -foreground = ${colors.foreground} -padding-left = 0 -padding-right = 0 - -;Default Font -font-0 = "JetBrainsMono Nerd Font Mono:size=18:antialias=true;4" -font-1 = "JetBrainsMono Nerd Font Mono:size=12:antialias=true;3" -; Separator Font -font-2 = "Ubuntu Nerd Font:size=25:antialias=true;2" -; Bluetooth Icon Font -font-3 = "JetBrainsMonoExtraBold Nerd Font Mono:size=12:antialias=true;3" - -modules-left = i3 xwindow -modules-center = date -modules-right = separator6 sound separator5 memory separator4 gpu-nvidia separator3 cpu separator2 eth separator1 powermenu - -scroll-up = i3wm-wsnext -scroll-down = i3wm-wsprev - -[settings] -screenchange-reload = true -;compositing-background = xor -;compositing-background = screen -;compositing-foreground = source -;compositing-border = over -;pseudo-transparency = true diff --git a/polybar/modules/battery.ini b/polybar/modules/battery.ini deleted file mode 100644 index f3cf9f1..0000000 --- a/polybar/modules/battery.ini +++ /dev/null @@ -1,6 +0,0 @@ -[module/battery] -type = custom/script -exec = $HOME/.config/polybar/scripts/battery.sh -format-font = 1 -interval = 10 -click-right = xfce4-power-manager-settings \ No newline at end of file diff --git a/polybar/modules/bluetooth.ini b/polybar/modules/bluetooth.ini deleted file mode 100644 index e444220..0000000 --- a/polybar/modules/bluetooth.ini +++ /dev/null @@ -1,9 +0,0 @@ -[module/bluetooth] -type = custom/script -exec = $HOME/.config/polybar/scripts/bluetooth.sh -format-font = 4 -format-background = ${colors.background} -format-foreground = ${colors.cyan} -format-padding = 1 -click-left = $HOME/.config/polybar/scripts/bluetooth_toogle.sh -click-right = blueman-manager \ No newline at end of file diff --git a/polybar/modules/cpu.ini b/polybar/modules/cpu.ini deleted file mode 100644 index 4d51803..0000000 --- a/polybar/modules/cpu.ini +++ /dev/null @@ -1,10 +0,0 @@ -[module/cpu] -type = internal/cpu -interval = 2 -format =