diff --git a/.github/README.md b/.github/README.md index 7274049..d2475e2 100644 --- a/.github/README.md +++ b/.github/README.md @@ -13,7 +13,7 @@
AwesomeWM Logo - AwesomeWM Dotfiles + Aesthetic AwesomeWM Dotfiles Welcome to my AwesomeWM configuration files! @@ -31,7 +31,7 @@ These dotfiles are made with love, for sure. | Programs | Using | | ---------- | ----------------- | -| WM | awesome-git | +| WM | awesome | | OS | arch linux | | Terminal | alacritty | | Shell | zsh | @@ -41,7 +41,7 @@ These dotfiles are made with love, for sure.


-
+
S E T U P 1. Install dependencies and enable services @@ -53,7 +53,7 @@ These dotfiles are made with love, for sure. *Assuming your AUR helper is* `yay` ```shell - yay -S awesome-git picom-ibhagwan-git alacritty rofi todo-bin acpi acpid \ + yay -Sy awesome-git picom-jonaburg-fix alacritty rofi todo-bin acpi acpid \ wireless_tools jq inotify-tools polkit-gnome xdotool xclip maim \ brightnessctl alsa-utils alsa-tools pulseaudio lm_sensors \ mpd mpc mpdris2 ncmpcpp playerctl --needed @@ -86,16 +86,22 @@ These dotfiles are made with love, for sure. > Clone this repository ```shell - git clone https://github.com/rxyhn/AwesomeWM-Dotfiles.git - cd AwesomeWM-Dotfiles + git clone https://github.com/rxyhn/dotfiles.git + cd dotfiles ``` > Copy config and binaries files ```shell - cp -r ./config/* ~/.config/ - cp -r ./bin/* ~/.local/bin/ - cp -r ./misc/. ~/ + cp -r config/* ~/.config/ + cp -r bin/* ~/.local/bin/ + cp -r misc/. ~/ + ``` + + > You have to add `TODO_PATH` in your env variable + + ```shell + export TODO_PATH="path/to/todo" ``` 4. Configure stuff @@ -115,7 +121,7 @@ These dotfiles are made with love, for sure.
-
+
F E A T U R E S These are the features included in my AwesomeWM setups! @@ -128,7 +134,7 @@ These dotfiles are made with love, for sure. + PopUp Notifications + Applications Launcher + Custom mouse-friendly `ncmpcpp` UI with album art ofc. - + Word Clock Lockscreen with PAM Integration + + `Word Clock Lockscreen` with PAM Integration + Some Tooltip Widget + Hardware Monitor + Beautiful `colorscheme` ikr, named `night` and created by [ner0z](https://github.com/ner0z) @@ -137,7 +143,7 @@ These dotfiles are made with love, for sure.
-
+
K E Y B I N D S I use super AKA Windows key as my main modifier. @@ -179,7 +185,7 @@ also with alt, shift, and ctrl | `middle click` | Toggle Dashboard | | `scroll up/down` | Cycle through tags | -*... And many many more! for more information, you can check awesome/configuration/keys.lua* +*... And many many more! for more information check `awesome/configuration/keys.lua`*
diff --git a/.github/assets/awesome.png b/.github/assets/awesome.png index 9aef974..7fe804a 100644 Binary files a/.github/assets/awesome.png and b/.github/assets/awesome.png differ diff --git a/config/awesome/theme/assets/icons/brightness.png b/config/awesome/theme/assets/icons/brightness.png new file mode 100644 index 0000000..ff6a6a3 Binary files /dev/null and b/config/awesome/theme/assets/icons/brightness.png differ diff --git a/config/awesome/theme/assets/icons/brightness.svg b/config/awesome/theme/assets/icons/brightness.svg deleted file mode 100644 index 862549e..0000000 --- a/config/awesome/theme/assets/icons/brightness.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - diff --git a/config/awesome/theme/assets/icons/mute.png b/config/awesome/theme/assets/icons/mute.png new file mode 100644 index 0000000..4933ab1 Binary files /dev/null and b/config/awesome/theme/assets/icons/mute.png differ diff --git a/config/awesome/theme/assets/icons/notification-bell.png b/config/awesome/theme/assets/icons/notification-bell.png new file mode 100644 index 0000000..d66a633 Binary files /dev/null and b/config/awesome/theme/assets/icons/notification-bell.png differ diff --git a/config/awesome/theme/assets/icons/notification.png b/config/awesome/theme/assets/icons/notification.png index 204aeda..c7e5677 100644 Binary files a/config/awesome/theme/assets/icons/notification.png and b/config/awesome/theme/assets/icons/notification.png differ diff --git a/config/awesome/theme/assets/icons/volume.png b/config/awesome/theme/assets/icons/volume.png new file mode 100644 index 0000000..2c02d4a Binary files /dev/null and b/config/awesome/theme/assets/icons/volume.png differ diff --git a/config/awesome/theme/assets/icons/volume.svg b/config/awesome/theme/assets/icons/volume.svg deleted file mode 100644 index 7a59aa1..0000000 --- a/config/awesome/theme/assets/icons/volume.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - diff --git a/config/awesome/theme/picom.conf b/config/awesome/theme/picom.conf index ee45f35..d62dd15 100644 --- a/config/awesome/theme/picom.conf +++ b/config/awesome/theme/picom.conf @@ -9,6 +9,7 @@ shadow-exclude = [ "class_g = 'slop'", "window_type = 'menu'", "window_type = 'desktop'", + "class_g = 'Firefox' && window_type *= 'utility'", "_GTK_FRAME_EXTENTS@:c" ]; @@ -26,7 +27,7 @@ fade-exclude = [ ] #========================= Corners =========================# -corner-radius: 12; +corner-radius = 12; rounded-corners-exclude = [ # "!window_type = 'normal'", # "class_g ?= 'rofi'", @@ -38,35 +39,17 @@ round-borders-exclude = [ ]; #========================= Opacity =========================# -inactive-opacity = 1; -frame-opacity = 1.0; -inactive-opacity-override = false; -active-opacity = 1.0; - -focus-exclude = [ - "class_g = 'Cairo-clock'", - "class_g = 'Bar'", # lemonbar - "class_g = 'slop'" # maim -]; - opacity-rule = [ - "100:class_g = 'Alacritty'", - "100:class_g = 'URxvt'", - "100:class_g = 'kitty'", - "100:class_g = 'Code'", - "100:class_g = 'discord'", - "100:class_g = 'firefox'", + "85:class_g = 'splash'" ]; #========================= Blurring =========================# -blur: { - kern = "11x11gaussian"; - method = "dual_kawase"; - strength = 8.0; - background = false; - background-frame = false; - background-fixed = false; -} +blur-kern = "11x11gaussian"; +blur-method = "dual_kawase"; +blur-strength = 8.0; +blur-background = false; +blur-background-frame = true; +blur-background-fixed = true; blur-background-exclude = [ "!window_type = 'splash'", @@ -74,6 +57,7 @@ blur-background-exclude = [ ]; #========================= General Settings =========================# +experimental-backends = true; backend = "glx"; vsync = true; daemon = false; diff --git a/config/awesome/theme/theme.lua b/config/awesome/theme/theme.lua index 8c7b561..b35455e 100644 --- a/config/awesome/theme/theme.lua +++ b/config/awesome/theme/theme.lua @@ -50,10 +50,16 @@ theme.wallpaper = gears.surface.load_uncached(gfs.get_configuration_dir() .. "th -- Awesome Logo theme.awesome_logo = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/awesome.png") +-- Notifications bell icon +theme.notification_bell_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/notification-bell.png") + -- Notifications icon theme.notification_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/notification.png") -theme.volume_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/volume.svg") -theme.brightness_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/brightness.svg") + +-- Popup notifications icon +theme.volume_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/volume.png") +theme.volume_muted_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/mute.png") +theme.brightness_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/brightness.png") -- Fonts theme.font_name = "Iosevka " @@ -127,7 +133,7 @@ theme.titlebar_size = dpi(45) theme.titlebar_unfocused = theme.xcolor0 -- Pop up notifications -theme.pop_size = dpi(200) +theme.pop_size = dpi(180) theme.pop_bg = theme.xbackground theme.pop_bar_bg = theme.xcolor0 theme.pop_vol_color = theme.xcolor4 @@ -164,7 +170,7 @@ theme.playerctl_update_on_activity = true theme.playerctl_position_update_interval = 1 -- Mainmenu -theme.menu_font = theme.font_name .. "10" +theme.menu_font = theme.font_name .. "medium 10" theme.menu_height = dpi(30) theme.menu_width = dpi(150) theme.menu_bg_normal = theme.xbackground @@ -218,10 +224,14 @@ theme.tabbar_size = 40 theme.mstab_bar_ontop = true -- Notifications -theme.notification_spacing = 19 +theme.notification_spacing = 24 theme.notification_border_radius = dpi(6) theme.notification_border_width = dpi(0) +-- Notif center +theme.notif_center_radius = theme.border_radius +theme.notif_center_box_radius = theme.notif_center_radius / 2 + -- Swallowing theme.dont_swallow_classname_list = { "firefox", "gimp", "Google-chrome", "Thunar" diff --git a/config/awesome/ui/bar/init.lua b/config/awesome/ui/bar/init.lua index b44995f..3c705ce 100644 --- a/config/awesome/ui/bar/init.lua +++ b/config/awesome/ui/bar/init.lua @@ -33,162 +33,224 @@ local wrap_widget = function(widget) end --- Launcher -------------- +-- Wibar +----------- -local awesome_icon = wibox.widget { - { - widget = wibox.widget.imagebox, - image = beautiful.awesome_logo, - resize = true - }, - margins = dpi(4), - widget = wibox.container.margin -} +screen.connect_signal("request::desktop_decoration", function(s) -helpers.add_hover_cursor(awesome_icon, "hand2") + -- Launcher + ------------- - --- Battery -------------- - -local charge_icon = wibox.widget{ - bg = beautiful.xcolor8, - widget = wibox.container.background, - visible = false -} - -local batt = wibox.widget{ - charge_icon, - color = {beautiful.xcolor2}, - bg = beautiful.xcolor8 .. "88", - value = 50, - min_value = 0, - max_value = 100, - thickness = dpi(4), - padding = dpi(2), - -- rounded_edge = true, - start_angle = math.pi * 3 / 2, - widget = wibox.container.arcchart -} - -awesome.connect_signal("signal::battery", function(value) - local fill_color = beautiful.xcolor2 - - if value >= 11 and value <= 30 then - fill_color = beautiful.xcolor3 - elseif value <= 10 then - fill_color = beautiful.xcolor1 - end - - batt.colors = {fill_color} - batt.value = value -end) - -awesome.connect_signal("signal::charger", function(state) - if state then - charge_icon.visible = true - else - charge_icon.visible = false - end -end) - - --- Time ----------- - -local hour = wibox.widget{ - font = beautiful.font_name .. "bold 14", - format = "%H", - align = "center", - valign = "center", - widget = wibox.widget.textclock -} - -local min = wibox.widget{ - font = beautiful.font_name .. "bold 14", - format = "%M", - align = "center", - valign = "center", - widget = wibox.widget.textclock -} - -local clock = wibox.widget{ - { + local awesome_icon = wibox.widget { { - hour, - min, + widget = wibox.widget.imagebox, + image = beautiful.awesome_logo, + resize = true + }, + margins = dpi(4), + widget = wibox.container.margin + } + + helpers.add_hover_cursor(awesome_icon, "hand2") + + + -- Battery + ------------- + + local charge_icon = wibox.widget{ + bg = beautiful.xcolor8, + widget = wibox.container.background, + visible = false + } + + local batt = wibox.widget{ + charge_icon, + color = {beautiful.xcolor2}, + bg = beautiful.xcolor8 .. "88", + value = 50, + min_value = 0, + max_value = 100, + thickness = dpi(4), + padding = dpi(2), + -- rounded_edge = true, + start_angle = math.pi * 3 / 2, + widget = wibox.container.arcchart + } + + awesome.connect_signal("signal::battery", function(value) + local fill_color = beautiful.xcolor2 + + if value >= 11 and value <= 30 then + fill_color = beautiful.xcolor3 + elseif value <= 10 then + fill_color = beautiful.xcolor1 + end + + batt.colors = {fill_color} + batt.value = value + end) + + awesome.connect_signal("signal::charger", function(state) + if state then + charge_icon.visible = true + else + charge_icon.visible = false + end + end) + + + -- Time + ---------- + + local hour = wibox.widget{ + font = beautiful.font_name .. "bold 14", + format = "%H", + align = "center", + valign = "center", + widget = wibox.widget.textclock + } + + local min = wibox.widget{ + font = beautiful.font_name .. "bold 14", + format = "%M", + align = "center", + valign = "center", + widget = wibox.widget.textclock + } + + local clock = wibox.widget{ + { + { + hour, + min, + spacing = dpi(5), + layout = wibox.layout.fixed.vertical + }, + top = dpi(5), + bottom = dpi(5), + widget = wibox.container.margin + }, + bg = beautiful.lighter_bg, + shape = helpers.rrect(beautiful.bar_radius), + widget = wibox.container.background + } + + + -- Stats + ----------- + + local stats = wibox.widget{ + { + wrap_widget(batt), + clock, spacing = dpi(5), layout = wibox.layout.fixed.vertical }, - top = dpi(5), - bottom = dpi(5), - widget = wibox.container.margin - }, - bg = beautiful.lighter_bg, - shape = helpers.rrect(beautiful.bar_radius), - widget = wibox.container.background -} + bg = beautiful.xcolor0, + shape = helpers.rrect(beautiful.bar_radius), + widget = wibox.container.background + } - --- Stats ------------ - -local stats = wibox.widget{ - { - wrap_widget(batt), - clock, - spacing = dpi(5), - layout = wibox.layout.fixed.vertical - }, - bg = beautiful.xcolor0, - shape = helpers.rrect(beautiful.bar_radius), - widget = wibox.container.background -} - -stats:connect_signal("mouse::enter", function() - stats.bg = beautiful.xcolor8 - stats_tooltip_show() -end) - -stats:connect_signal("mouse::leave", function() - stats.bg = beautiful.xcolor0 - stats_tooltip_hide() -end) - - --- Notification center -------------------------- - -local notifs = wibox.widget{ - markup = helpers.colorize_text("", beautiful.xcolor3), - font = beautiful.font_name .. "18", - align = "center", - valign = "center", - widget = wibox.widget.textbox -} - -notifs:connect_signal("mouse::enter", function() - notifs.markup = helpers.colorize_text(notifs.text, beautiful.xcolor3 .. 55) -end) - -notifs:connect_signal("mouse::leave", function() - notifs.markup = helpers.colorize_text(notifs.text, beautiful.xcolor3) -end) - -notifs:buttons(gears.table.join( - awful.button({}, 1, function() - notifs_toggle() + stats:connect_signal("mouse::enter", function() + stats.bg = beautiful.xcolor8 + stats_tooltip_show() end) -)) - helpers.add_hover_cursor(notifs, "hand2") + + stats:connect_signal("mouse::leave", function() + stats.bg = beautiful.xcolor0 + stats_tooltip_hide() + end) + + + -- Notification center + ------------------------- + + notif_center = wibox({ + type = "dock", + screen = screen.primary, + height = screen_height - dpi(50), + width = dpi(300), + shape = helpers.rrect(beautiful.notif_center_radius), + ontop = true, + visible = false + }) + notif_center.y = dpi(25) + + -- Rubato + local slide = rubato.timed{ + pos = dpi(-300), + rate = 60, + intro = 0.3, + duration = 0.8, + easing = rubato.quadratic, + awestore_compat = true, + subscribed = function(pos) notif_center.x = pos end + } + + local notif_center_status = false + + slide.ended:subscribe(function() + if notif_center_status then + notif_center.visible = false + end + end) + + -- Make toogle button + local notif_center_show = function() + notif_center.visible = true + slide:set(dpi(100)) + notif_center_status = false + end + + local notif_center_hide = function() + slide:set(dpi(-375)) + notif_center_status = true + end + + local notif_center_toggle = function() + if notif_center.visible then + notif_center_hide() + else + notif_center_show() + end + end + + -- notif_center setup + s.notif_center = require('ui.notifs.notif-center')(s) + + notif_center:setup { + s.notif_center, + margins = dpi(15), + widget = wibox.container.margin + } + + local notif_center_button = wibox.widget{ + markup = helpers.colorize_text("", beautiful.xcolor4), + font = beautiful.font_name .. "18", + align = "center", + valign = "center", + widget = wibox.widget.textbox + } + + notif_center_button:connect_signal("mouse::enter", function() + notif_center_button.markup = helpers.colorize_text(notif_center_button.text, beautiful.xcolor4 .. 55) + end) + + notif_center_button:connect_signal("mouse::leave", function() + notif_center_button.markup = helpers.colorize_text(notif_center_button.text, beautiful.xcolor4) + end) + + notif_center_button:buttons(gears.table.join( + awful.button({}, 1, function() + notif_center_toggle() + end) + )) + helpers.add_hover_cursor(notif_center_button, "hand2") -- Setup wibar ----------------- -screen.connect_signal("request::desktop_decoration", function(s) - -- Create a promptbox for each screen s.mypromptbox = awful.widget.prompt() @@ -280,7 +342,7 @@ screen.connect_signal("request::desktop_decoration", function(s) { layout = wibox.layout.align.vertical, expand = "none", - { -- left + { -- top awesome_icon, taglist, spacing = dpi(10), @@ -288,9 +350,9 @@ screen.connect_signal("request::desktop_decoration", function(s) }, -- middle nil, - { -- right + { -- bottom stats, - notifs, + notif_center_button, layoutbox, spacing = dpi(8), layout = wibox.layout.fixed.vertical diff --git a/config/awesome/ui/dashboard/notifs.lua b/config/awesome/ui/dashboard/notifs.lua index 2bc71e1..91fd924 100644 --- a/config/awesome/ui/dashboard/notifs.lua +++ b/config/awesome/ui/dashboard/notifs.lua @@ -200,7 +200,7 @@ naughty.connect_signal("request::display", function(n) notif_color = beautiful.xcolor1 .. '66' end local appicon = n.icon or n.app_icon - if not appicon then appicon = beautiful.notification_icon end + if not appicon then appicon = gears.color.recolor_image(beautiful.notification_icon, beautiful.xcolor4) end notifs_container:insert(1, create_notif(appicon, n, width)) end) diff --git a/config/awesome/ui/notifs/init.lua b/config/awesome/ui/notifs/init.lua index be1e4f2..2f0cfe9 100644 --- a/config/awesome/ui/notifs/init.lua +++ b/config/awesome/ui/notifs/init.lua @@ -8,6 +8,7 @@ local helpers = require("helpers") local ruled = require("ruled") local menubar = require("menubar") +local button_container = require('ui.widgets.button') naughty.connect_signal("request::icon", function(n, context, hints) if context ~= "app_icon" then return end @@ -20,7 +21,6 @@ naughty.connect_signal("request::icon", function(n, context, hints) end) require("ui.notifs.popup") -require("ui.notifs.notifications-center") naughty.config.defaults.ontop = true naughty.config.defaults.screen = awful.screen.focused() @@ -33,19 +33,19 @@ naughty.config.presets.low.timeout = 3 naughty.config.presets.critical.timeout = 0 naughty.config.presets.normal = { - font = beautiful.font_name .. "medium 8", + font = beautiful.font_name .. "medium 10", fg = beautiful.fg_normal, bg = beautiful.bg_normal } naughty.config.presets.low = { - font = beautiful.font_name .. "medium 8", + font = beautiful.font_name .. "medium 10", fg = beautiful.fg_normal, bg = beautiful.bg_normal } naughty.config.presets.critical = { - font = beautiful.font_name .. "medium 8", + font = beautiful.font_name .. "medium 10", fg = beautiful.xcolor1, bg = beautiful.bg_normal, timeout = 0 @@ -65,7 +65,7 @@ end) naughty.connect_signal("request::display", function(n) - local appicon = beautiful.notification_icon + local appicon = gears.color.recolor_image(beautiful.notification_icon, beautiful.xcolor4) local time = os.date("%H:%M") local action_widget = { @@ -74,7 +74,7 @@ naughty.connect_signal("request::display", function(n) id = "text_role", align = "center", valign = "center", - font = beautiful.font_name .. "medium 8", + font = beautiful.font_name .. "medium 10", widget = wibox.widget.textbox }, left = dpi(6), @@ -84,7 +84,7 @@ naughty.connect_signal("request::display", function(n) bg = beautiful.xcolor0, forced_height = dpi(25), forced_width = dpi(20), - shape = helpers.rrect(dpi(6)), + shape = gears.shape.rounded_rect, widget = wibox.container.background } @@ -94,7 +94,27 @@ naughty.connect_signal("request::display", function(n) spacing = dpi(8), layout = wibox.layout.flex.horizontal }, - widget_template = action_widget, + widget_template = { + { + { + { + { + id = 'text_role', + font = beautiful.font_name .. 'medium 10', + widget = wibox.widget.textbox + }, + widget = wibox.container.place + }, + widget = button_container + }, + bg = beautiful.lighter_bg, + shape = gears.shape.rounded_rect, + forced_height = dpi(30), + widget = wibox.container.background + }, + margins = 4, + widget = wibox.container.margin + }, style = {underline_normal = false, underline_selected = true}, widget = naughty.list.actions } @@ -116,8 +136,6 @@ naughty.connect_signal("request::display", function(n) { image = appicon, resize = true, - clip_shape = helpers.rrect( - dpi(6)), widget = wibox.widget.imagebox }, strategy = "max", @@ -130,13 +148,13 @@ naughty.connect_signal("request::display", function(n) { markup = n.app_name, align = "left", - font = beautiful.font_name .. "medium 9", + font = beautiful.font_name .. "Bold 12", widget = wibox.widget.textbox }, { markup = time, align = "right", - font = beautiful.font_name .. "medium 9", + font = beautiful.font_name .. "medium 10", widget = wibox.widget.textbox }, layout = wibox.layout.align.horizontal @@ -162,23 +180,28 @@ naughty.connect_signal("request::display", function(n) speed = 50, { markup = n.title, - font = beautiful.font_name .. "medium 9", + font = beautiful.font_name .. "Bold 12", align = "left", widget = wibox.widget.textbox }, - forced_width = dpi(205), + forced_width = dpi(250), widget = wibox.container.scroll .horizontal }, { + step_function = wibox.container.scroll + .step_functions + .waiting_nonlinear_back_and_forth, + speed = 50, { markup = n.message, align = "left", - font = beautiful.font_name .. "medium 8", + font = beautiful.font_name .. "medium 10", widget = wibox.widget.textbox }, - right = 10, - widget = wibox.container.margin + forced_width = dpi(250), + widget = wibox.container.scroll + .horizontal }, spacing = 0, layout = wibox.layout.flex.vertical @@ -197,12 +220,11 @@ naughty.connect_signal("request::display", function(n) { image = n.icon, resize = true, - clip_shape = helpers.rrect( - dpi(6)), + clip_shape = helpers.rrect(beautiful.notification_border_radius), widget = wibox.widget.imagebox }, strategy = "max", - height = 40, + height = dpi(50), widget = wibox.container.constraint }, nil, @@ -234,4 +256,13 @@ naughty.connect_signal("request::display", function(n) widget = wibox.container.background } } + + -- Destroy popups if dont_disturb mode is on + -- Or if the notif_center is visible + if _G.dont_disturb or + (notif_center and notif_center.visible) then + naughty.destroy_all_notifications(nil, 1) + end + + end) diff --git a/config/awesome/ui/notifs/notif-center/build-notifbox/empty-notifbox.lua b/config/awesome/ui/notifs/notif-center/build-notifbox/empty-notifbox.lua new file mode 100644 index 0000000..3e51187 --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/build-notifbox/empty-notifbox.lua @@ -0,0 +1,55 @@ +local wibox = require('wibox') +local gears = require('gears') + +local beautiful = require('beautiful') +local dpi = require('beautiful').xresources.apply_dpi + +local empty_notifbox = wibox.widget { + { + layout = wibox.layout.fixed.vertical, + spacing = dpi(20), + { + expand = 'none', + layout = wibox.layout.align.horizontal, + nil, + { + image = gears.color.recolor_image(beautiful.notification_bell_icon, beautiful.xcolor4), + resize = true, + forced_height = dpi(90), + forced_width = dpi(90), + widget = wibox.widget.imagebox, + }, + nil + }, + { + text = "No Notifications? :(", + font = beautiful.font_name .. 'medium 12', + align = 'center', + valign = 'center', + widget = wibox.widget.textbox + }, + }, + margins = dpi(20), + widget = wibox.container.margin + +} + + +local separator_for_empty_msg = wibox.widget +{ + orientation = 'vertical', + opacity = 0.0, + widget = wibox.widget.separator +} + +-- Make empty_notifbox center +local centered_empty_notifbox = wibox.widget { + expand = 'none', + layout = wibox.layout.align.vertical, + separator_for_empty_msg, + empty_notifbox, + separator_for_empty_msg +} + +return centered_empty_notifbox + diff --git a/config/awesome/ui/notifs/notif-center/build-notifbox/init.lua b/config/awesome/ui/notifs/notif-center/build-notifbox/init.lua new file mode 100644 index 0000000..512dace --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/build-notifbox/init.lua @@ -0,0 +1,77 @@ +local wibox = require('wibox') +local awful = require('awful') +local gears = require('gears') +local naughty = require('naughty') +local beautiful = require('beautiful') +local dpi = beautiful.xresources.apply_dpi + +local empty_notifbox = require('ui.notifs.notif-center.build-notifbox.empty-notifbox') +local notifbox_scroller = require('ui.notifs.notif-center.build-notifbox.notifbox-scroller') + +local notif_core = {} + +notif_core.remove_notifbox_empty = true + +notif_core.notifbox_layout = wibox.widget { + layout = wibox.layout.fixed.vertical, + spacing = dpi(7), + empty_notifbox +} + +notifbox_scroller(notif_core.notifbox_layout) + +notif_core.reset_notifbox_layout = function() + notif_core.notifbox_layout:reset() + notif_core.notifbox_layout:insert(1, empty_notifbox) + notif_core.remove_notifbox_empty = true +end + +local notifbox_add = function(n, notif_icon, notifbox_color) + if #notif_core.notifbox_layout.children == 1 and notif_core.remove_notifbox_empty then + notif_core.notifbox_layout:reset(notif_core.notifbox_layout) + notif_core.remove_notifbox_empty = false + end + + local notifbox_box = require('ui.notifs.notif-center.build-notifbox.notifbox-builder') + notif_core.notifbox_layout:insert( + 1, + notifbox_box( + n, + notif_icon, + n.title, + n.message, + n.app_name, + notifbox_color + ) + ) +end + +local notifbox_add_expired = function(n, notif_icon, notifbox_color) + n:connect_signal( + 'destroyed', + function(self, reason, keep_visble) + if reason == 1 then + notifbox_add(n, notif_icon, notifbox_color) + end + end + ) +end + +naughty.connect_signal( + 'request::display', + function(n) + local notifbox_color = beautiful.xcolor0 + if n.urgency == 'critical' then + notifbox_color = n.bg .. '66' + end + + local notif_icon = n.icon or n.app_icon + if not notif_icon then + notif_icon = gears.color.recolor_image(beautiful.notification_icon, beautiful.xcolor4) + end + + notifbox_add_expired(n, notif_icon, notifbox_color) + end +) + +return notif_core diff --git a/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-builder.lua b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-builder.lua new file mode 100644 index 0000000..bc8d8b2 --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-builder.lua @@ -0,0 +1,177 @@ +local wibox = require('wibox') +local awful = require('awful') +local gears = require('gears') +local beautiful = require('beautiful') + +local dpi = beautiful.xresources.apply_dpi + +local builder = require('ui.notifs.notif-center.build-notifbox.notifbox-ui-elements') +local notifbox_core = require('ui.notifs.notif-center.build-notifbox') + +local notifbox_layout = notifbox_core.notifbox_layout +local remove_notifbox_empty = notifbox_core.remove_notifbox_empty +local reset_notifbox_layout = notifbox_core.reset_notifbox_layout + +local return_date_time = function(format) + return os.date(format) +end + +local parse_to_seconds = function(time) + local hourInSec = tonumber(string.sub(time, 1, 2)) * 3600 + local minInSec = tonumber(string.sub(time, 4, 5)) * 60 + local getSec = tonumber(string.sub(time, 7, 8)) + return (hourInSec + minInSec + getSec) +end + +notifbox_box = function(notif, icon, title, message, app, bgcolor) + + local time_of_pop = return_date_time('%H:%M:%S') + local exact_time = return_date_time('%I:%M %p') + local exact_date_time = return_date_time('%b %d, %I:%M %p') + + local notifbox_timepop = wibox.widget { + id = 'time_pop', + markup = nil, + font = beautiful.font_name .. 'medium 10', + align = 'left', + valign = 'center', + visible = true, + widget = wibox.widget.textbox + } + + local notifbox_dismiss = builder.notifbox_dismiss() + + local time_of_popup = gears.timer { + timeout = 60, + call_now = true, + autostart = true, + callback = function() + + local time_difference = nil + + time_difference = parse_to_seconds(return_date_time('%H:%M:%S')) - parse_to_seconds(time_of_pop) + time_difference = tonumber(time_difference) + + if time_difference < 60 then + notifbox_timepop:set_markup('now') + + elseif time_difference >= 60 and time_difference < 3600 then + local time_in_minutes = math.floor(time_difference / 60) + notifbox_timepop:set_markup(time_in_minutes .. 'm ago') + + elseif time_difference >= 3600 and time_difference < 86400 then + notifbox_timepop:set_markup(exact_time) + + elseif time_difference >= 86400 then + notifbox_timepop:set_markup(exact_date_time) + return false + + end + + collectgarbage('collect') + end + } + + local notifbox_template = wibox.widget { + id = 'notifbox_template', + expand = 'none', + { + { + layout = wibox.layout.fixed.vertical, + spacing = dpi(5), + { + expand = 'none', + layout = wibox.layout.align.horizontal, + { + layout = wibox.layout.fixed.horizontal, + spacing = dpi(5), + builder.notifbox_icon(icon), + builder.notifbox_appname(app), + }, + nil, + { + notifbox_timepop, + notifbox_dismiss, + layout = wibox.layout.fixed.horizontal + } + }, + { + layout = wibox.layout.fixed.vertical, + spacing = dpi(5), + { + builder.notifbox_title(title), + builder.notifbox_message(message), + layout = wibox.layout.fixed.vertical + }, + builder.notifbox_actions(notif), + }, + + }, + margins = dpi(10), + widget = wibox.container.margin + }, + bg = bgcolor, + shape = function(cr, width, height) + gears.shape.partially_rounded_rect(cr, width, height, true, true, true, true, beautiful.notif_center_box_radius) + end, + widget = wibox.container.background, + } + + -- Put the generated template to a container + local notifbox = wibox.widget { + notifbox_template, + shape = function(cr, width, height) + gears.shape.partially_rounded_rect(cr, width, height, true, true, true, true, beautiful.notif_center_box_radius) + end, + widget = wibox.container.background + } + + -- Delete notification box + local notifbox_delete = function() + notifbox_layout:remove_widgets(notifbox, true) + end + + -- Delete notifbox on LMB + notifbox:buttons( + awful.util.table.join( + awful.button( + {}, + 1, + function() + if #notifbox_layout.children == 1 then + reset_notifbox_layout() + else + notifbox_delete() + end + collectgarbage('collect') + end + ) + ) + ) + + -- Add hover, and mouse leave events + notifbox_template:connect_signal( + 'mouse::enter', + function() + notifbox.bg = beautiful.xcolor8 + notifbox_timepop.visible = false + notifbox_dismiss.visible = true + end + ) + + notifbox_template:connect_signal( + 'mouse::leave', + function() + notifbox.bg = beautiful.tranparent + notifbox_timepop.visible = true + notifbox_dismiss.visible = false + end + ) + + collectgarbage('collect') + + return notifbox +end + + +return notifbox_box \ No newline at end of file diff --git a/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-geometry.lua b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-geometry.lua new file mode 100644 index 0000000..3fe79da --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-geometry.lua @@ -0,0 +1,33 @@ +local wibox = require('wibox') +local awful = require('awful') +local naughty = require('naughty') + +local find_widget_in_wibox = function(wb, widget) + local function find_widget_in_hierarchy(h, widget) + if h:get_widget() == widget then + return h + end + local result + + for _, ch in ipairs(h:get_children()) do + result = result or find_widget_in_hierarchy(ch, widget) + end + return result + end + local h = wb._drawable._widget_hierarchy + return h and find_widget_in_hierarchy(h, widget) +end + + +local focused = awful.screen.focused() +local h = find_widget_in_wibox(focused.top_panel, focused.music) +local x, y, width, height = h:get_matrix_to_device():transform_rectangle(0, 0, h:get_size()) +-- local geo = focused.mywibox:geometry() + + +-- x, y = x + geo.x, y + geo.y + +-- print(string.format("The widget is inside of the rectangle (%d, %d, %d, %d) on the screen", x, y, width, height) + + +naughty.notification({message=tostring(height)}) \ No newline at end of file diff --git a/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-scroller.lua b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-scroller.lua new file mode 100644 index 0000000..f05d323 --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-scroller.lua @@ -0,0 +1,37 @@ +local awful = require('awful') +local gears = require('gears') + +local add_button_event = function(widget) + + widget:buttons( + gears.table.join( + awful.button( + {}, + 4, + nil, + function() + if #widget.children == 1 then + return + end + widget:insert(1, widget.children[#widget.children]) + widget:remove(#widget.children) + end + ), + awful.button( + {}, + 5, + nil, + function() + if #widget.children == 1 then + return + end + widget:insert(#widget.children + 1, widget.children[1]) + widget:remove(1) + end + ) + ) + ) + +end + +return add_button_event \ No newline at end of file diff --git a/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-ui-elements.lua b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-ui-elements.lua new file mode 100644 index 0000000..c1efe9d --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/build-notifbox/notifbox-ui-elements.lua @@ -0,0 +1,135 @@ +local wibox = require('wibox') +local beautiful = require('beautiful') +local naughty = require('naughty') +local gears = require('gears') + +local dpi = beautiful.xresources.apply_dpi +local helpers = require('helpers') + +local button_container = require('ui.widgets.button') + +local ui_noti_builder = {} + +-- Notification icon container +ui_noti_builder.notifbox_icon = function(ico_image) + local noti_icon = wibox.widget { + { + id = 'icon', + resize = true, + forced_height = dpi(25), + forced_width = dpi(25), + widget = wibox.widget.imagebox + }, + layout = wibox.layout.fixed.horizontal + } + noti_icon.icon:set_image(ico_image) + return noti_icon +end + +-- Notification title container +ui_noti_builder.notifbox_title = function(title) + return wibox.widget { + markup = title, + font = beautiful.font_name .. 'Bold 12', + align = 'left', + valign = 'center', + widget = wibox.widget.textbox + } +end + +-- Notification message container +ui_noti_builder.notifbox_message = function(msg) + return wibox.widget { + markup = msg, + font = beautiful.font_name .. 'medium 10', + align = 'left', + valign = 'center', + widget = wibox.widget.textbox + } +end + +-- Notification app name container +ui_noti_builder.notifbox_appname = function(app) + return wibox.widget { + markup = app, + font = beautiful.font_name .. 'Bold 12', + align = 'left', + valign = 'center', + widget = wibox.widget.textbox + } +end + +-- Notification actions container +ui_noti_builder.notifbox_actions = function(n) + actions_template = wibox.widget { + notification = n, + base_layout = wibox.widget { + spacing = dpi(0), + layout = wibox.layout.flex.horizontal + }, + widget_template = { + { + { + { + { + id = 'text_role', + font = beautiful.font_name .. 'medium 10', + widget = wibox.widget.textbox + }, + widget = wibox.container.place + }, + widget = button_container + }, + bg = beautiful.lighter_bg, + shape = gears.shape.rounded_rect, + forced_height = dpi(30), + widget = wibox.container.background + }, + margins = 4, + widget = wibox.container.margin + }, + style = { underline_normal = false, underline_selected = true }, + widget = naughty.list.actions, + } + + return actions_template +end + + +-- Notification dismiss button +ui_noti_builder.notifbox_dismiss = function() + + local dismiss_imagebox = wibox.widget { + { + id = 'dismiss_icon', + markup = helpers.colorize_text("", beautiful.xcolor1), + font = beautiful.icon_font_name .. "Round 10", + align = "center", + valign = "center", + widget = wibox.widget.textbox + }, + layout = wibox.layout.fixed.horizontal + } + + local dismiss_button = wibox.widget { + { + dismiss_imagebox, + margins = dpi(5), + widget = wibox.container.margin + }, + widget = button_container + } + + local notifbox_dismiss = wibox.widget { + dismiss_button, + visible = false, + bg = beautiful.lighter_bg, + shape = gears.shape.circle, + widget = wibox.container.background + } + + return notifbox_dismiss +end + + +return ui_noti_builder \ No newline at end of file diff --git a/config/awesome/ui/notifs/notif-center/clear-all/init.lua b/config/awesome/ui/notifs/notif-center/clear-all/init.lua new file mode 100644 index 0000000..a99993f --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/clear-all/init.lua @@ -0,0 +1,58 @@ +local awful = require('awful') +local wibox = require('wibox') +local gears = require('gears') +local beautiful = require('beautiful') + +local dpi = beautiful.xresources.apply_dpi +local button_container = require('ui.widgets.button') + +local notifbox_core = require('ui.notifs.notif-center.build-notifbox') +local reset_notifbox_layout = notifbox_core.reset_notifbox_layout + +local clear_all_imagebox = wibox.widget { + { + markup = "", + font = beautiful.icon_font_name .. "Round 16", + align = "center", + valign = "center", + widget = wibox.widget.textbox + }, + layout = wibox.layout.fixed.horizontal +} + +local clear_all_button = wibox.widget { + { + clear_all_imagebox, + margins = dpi(7), + widget = wibox.container.margin + }, + widget = button_container +} + +clear_all_button:buttons( + gears.table.join( + awful.button( + {}, + 1, + nil, + function() + reset_notifbox_layout() + end + ) + ) +) + +local clear_all_button_wrapped = wibox.widget { + nil, + { + clear_all_button, + bg = beautiful.xcolor0, + shape = gears.shape.circle, + widget = wibox.container.background + }, + nil, + expand = 'none', + layout = wibox.layout.align.vertical +} + +return clear_all_button_wrapped \ No newline at end of file diff --git a/config/awesome/ui/notifs/notif-center/dont-disturb/disturb_status b/config/awesome/ui/notifs/notif-center/dont-disturb/disturb_status new file mode 100644 index 0000000..c508d53 --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/dont-disturb/disturb_status @@ -0,0 +1 @@ +false diff --git a/config/awesome/ui/notifs/notif-center/dont-disturb/init.lua b/config/awesome/ui/notifs/notif-center/dont-disturb/init.lua new file mode 100644 index 0000000..e869056 --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/dont-disturb/init.lua @@ -0,0 +1,120 @@ +local awful = require('awful') +local naughty = require('naughty') +local wibox = require('wibox') +local gears = require('gears') +local beautiful = require('beautiful') + +local dpi = beautiful.xresources.apply_dpi +local button_container = require('ui.widgets.button') + +local config_dir = gears.filesystem.get_configuration_dir() +local widget_dir = config_dir .. 'ui/notifs/notif-center/dont-disturb/' + +_G.dont_disturb = false + +local dont_disturb_icon = wibox.widget { + { + id = 'icon', + markup = "", + font = beautiful.icon_font_name .. "Round 16", + align = "center", + valign = "center", + widget = wibox.widget.textbox + }, + layout = wibox.layout.fixed.horizontal +} + +local function update_icon() + + local widget_icon_name = nil + local dd_icon = dont_disturb_icon.icon + + if dont_disturb then + widget_icon_name = 'toggled-on' + dd_icon:set_markup_silently("") + else + widget_icon_name = 'toggled-off' + dd_icon:set_markup_silently("") + end +end + +local check_disturb_status = function() + + awful.spawn.easy_async_with_shell( + 'cat ' .. widget_dir .. 'disturb_status', + function(stdout) + + local status = stdout + + if status:match('true') then + dont_disturb = true + elseif status:match('false') then + dont_disturb = false + else + dont_disturb = false + awful.spawn.with_shell('echo "false" > ' .. widget_dir .. 'disturb_status') + end + + update_icon() + end + ) +end + +check_disturb_status() + +local toggle_disturb = function() + if dont_disturb then + dont_disturb = false + else + dont_disturb = true + end + awful.spawn.with_shell('echo "' .. tostring(dont_disturb) .. '" > ' .. widget_dir .. 'disturb_status') + update_icon() +end + +local dont_disturb_button = wibox.widget { + { + dont_disturb_icon, + margins = dpi(7), + widget = wibox.container.margin + }, + widget = button_container +} + +dont_disturb_button:buttons( + gears.table.join( + awful.button( + {}, + 1, + nil, + function() + toggle_disturb() + end + ) + ) +) + +local dont_disturb_wrapped = wibox.widget { + nil, + { + dont_disturb_button, + bg = beautiful.xcolor0, + shape = gears.shape.circle, + widget = wibox.container.background + }, + nil, + expand = 'none', + layout = wibox.layout.align.vertical +} + +-- Create a notification sound +naughty.connect_signal( + 'request::display', + function(n) + if not dont_disturb then + awful.spawn.with_shell('canberra-gtk-play -i message') + end + end +) + +return dont_disturb_wrapped \ No newline at end of file diff --git a/config/awesome/ui/notifs/notif-center/init.lua b/config/awesome/ui/notifs/notif-center/init.lua new file mode 100644 index 0000000..1710f0f --- /dev/null +++ b/config/awesome/ui/notifs/notif-center/init.lua @@ -0,0 +1,39 @@ +local wibox = require('wibox') +local beautiful = require('beautiful') +local dpi = require('beautiful').xresources.apply_dpi + +local notif_header = wibox.widget { + text = 'Notification Center', + font = beautiful.font_name .. 'Bold 14', + align = 'left', + valign = 'center', + widget = wibox.widget.textbox +} + +local notif_center = function(s) + + s.dont_disturb = require('ui.notifs.notif-center.dont-disturb') + s.clear_all = require('ui.notifs.notif-center.clear-all') + s.notifbox_layout = require('ui.notifs.notif-center.build-notifbox').notifbox_layout + + return wibox.widget { + expand = 'none', + layout = wibox.layout.fixed.vertical, + spacing = dpi(10), + { + expand = 'none', + layout = wibox.layout.align.horizontal, + notif_header, + nil, + { + layout = wibox.layout.fixed.horizontal, + spacing = dpi(5), + s.dont_disturb, + s.clear_all + }, + }, + s.notifbox_layout + } +end + +return notif_center \ No newline at end of file diff --git a/config/awesome/ui/notifs/notifications-center/init.lua b/config/awesome/ui/notifs/notifications-center/init.lua deleted file mode 100644 index a32067e..0000000 --- a/config/awesome/ui/notifs/notifications-center/init.lua +++ /dev/null @@ -1,398 +0,0 @@ --- Standard awesome library -local gears = require("gears") -local awful = require("awful") - --- Theme handling library -local beautiful = require("beautiful") -local dpi = beautiful.xresources.apply_dpi - --- Notification library -local naughty = require("naughty") - --- Widget library -local wibox = require("wibox") - --- rubato -local rubato = require("module.rubato") - --- Helpers -local helpers = require("helpers") - - --- Notification center ------------------------- - --- Header -local notif_header = wibox.widget { - markup = "Notifications Center", - font = beautiful.font_name .. "Bold 12", - align = 'center', - valign = 'center', - widget = wibox.widget.textbox -} - --- Clear button -local clear = wibox.widget { - markup = "", - font = beautiful.icon_font_name .. "Round 16", - align = "center", - valign = "center", - widget = wibox.widget.textbox -} - -clear:buttons(gears.table.join( - awful.button({}, 1, function() - _G.reset_notif_container() - end) -)) - -helpers.add_hover_cursor(clear, "hand2") - --- Empty notifs -local empty = wibox.widget { - { - { - expand = 'none', - layout = wibox.layout.align.horizontal, - nil, - { - image = beautiful.notification_icon, - forced_width = dpi(60), - forced_height = dpi(60), - halign = "center", - valign = "center", - widget = wibox.widget.imagebox - }, - nil - }, - { - markup = 'You have no notifs!', - font = beautiful.font_name .. 'medium 10', - align = 'center', - valign = 'center', - widget = wibox.widget.textbox - }, - layout = wibox.layout.fixed.vertical, - spacing = dpi(10) - }, - top = dpi(100), - widget = wibox.container.margin -} - --- Mouse scroll -local notif_container = wibox.layout.fixed.vertical() -notif_container.spacing = dpi(15) -notif_container.forced_width = dpi(270) - -local remove_notif_empty = true - -reset_notif_container = function() - notif_container:reset(notif_container) - notif_container:insert(1, empty) - remove_notif_empty = true -end - -remove_notifbox = function(box) - notif_container:remove_widgets(box) - - if #notif_container.children == 0 then - notif_container:insert(1, empty) - remove_notif_empty = true - end -end - -local return_date_time = function(format) - return os.date(format) -end - -local parse_to_seconds = function(time) - local hourInSec = tonumber(string.sub(time, 1, 2)) * 3600 - local minInSec = tonumber(string.sub(time, 4, 5)) * 60 - local getSec = tonumber(string.sub(time, 7, 8)) - return (hourInSec + minInSec + getSec) -end - -local create_notif = function(icon, n, width) - - --Time - local time_of_pop = return_date_time('%H:%M:%S') - local exact_time = return_date_time('%I:%M %p') - local exact_date_time = return_date_time('%b %d, %I:%M %p') - - local timepop = wibox.widget { - id = 'time_pop', - markup = nil, - font = beautiful.font_name .. "medium 8", - align = "center", - valign = "center", - visible = true, - widget = wibox.widget.textbox - } - - local time_of_popup = gears.timer { - timeout = 60, - call_now = true, - autostart = true, - callback = function() - - local time_difference = nil - - time_difference = parse_to_seconds(return_date_time('%H:%M:%S')) - parse_to_seconds(time_of_pop) - time_difference = tonumber(time_difference) - - if time_difference < 60 then - timepop:set_markup('now') - - elseif time_difference >= 60 and time_difference < 3600 then - local time_in_minutes = math.floor(time_difference / 60) - timepop:set_markup(time_in_minutes .. 'm ago') - - elseif time_difference >= 3600 and time_difference < 86400 then - timepop:set_markup(exact_time) - - elseif time_difference >= 86400 then - timepop:set_markup(exact_date_time) - return false - - end - - collectgarbage('collect') - end - } - - local box = {} - - -- Dismiss button - local dismiss= wibox.widget { - { - { - markup = helpers.colorize_text("", beautiful.xcolor1), - font = beautiful.icon_font_name .. "Round 10", - align = "center", - valign = "center", - widget = wibox.widget.textbox - }, - margins = dpi(2), - widget = wibox.container.margin - }, - shape = gears.shape.circle, - widget = wibox.container.background - } - - dismiss:connect_signal("mouse::enter", function() - dismiss.bg = beautiful.xcolor8 - end) - - dismiss:connect_signal("mouse::leave", function() - dismiss.bg = beautiful.xcolor0 - end) - - dismiss:buttons(gears.table.join( - awful.button({}, 1, function() - _G.remove_notifbox(box) - end) - )) - - helpers.add_hover_cursor(dismiss, "hand2") - - - -- Create notifs - box = wibox.widget { - { - { - { - { - image = icon, - resize = true, - clip_shape = helpers.rrect(dpi(6)), - halign = "center", - valign = "center", - widget = wibox.widget.imagebox - }, - strategy = 'exact', - height = dpi(50), - width = dpi(50), - widget = wibox.container.constraint - }, - { - { - nil, - { - { - { - step_function = wibox.container.scroll - .step_functions - .waiting_nonlinear_back_and_forth, - speed = 50, - { - markup = n.title, - font = beautiful.font_name .. "medium 10", - align = "left", - widget = wibox.widget.textbox - }, - forced_width = dpi(140), - widget = wibox.container.scroll.horizontal - }, - nil, - { - timepop, - layout = wibox.layout.fixed.horizontal - }, - expand = "none", - layout = wibox.layout.align.horizontal - }, - { - { - step_function = wibox.container.scroll - .step_functions - .waiting_nonlinear_back_and_forth, - speed = 50, - { - markup = n.message, - font = beautiful.font_name .. "medium 8", - align = "left", - widget = wibox.widget.textbox - }, - forced_width = dpi(165), - widget = wibox.container.scroll.horizontal - }, - nil, - { - dismiss, - layout = wibox.layout.fixed.horizontal - }, - expand = "none", - layout = wibox.layout.align.horizontal - }, - spacing = dpi(2), - layout = wibox.layout.fixed.vertical - }, - expand = "none", - layout = wibox.layout.align.vertical - }, - left = dpi(12), - widget = wibox.container.margin - }, - layout = wibox.layout.align.horizontal - }, - margins = dpi(8), - widget = wibox.container.margin - }, - bg = beautiful.xcolor0, - shape = helpers.rrect(dpi(6)), - widget = wibox.container.background - } - - return box -end - -notif_container:buttons(gears.table.join( - awful.button({}, 4, nil, function() - if #notif_container.children == 1 then return end - notif_container:insert(1, notif_container.children[#notif_container.children]) - notif_container:remove(#notif_container.children) - end), - - awful.button({}, 5, nil, function() - if #notif_container.children == 1 then return end - notif_container:insert(#notif_container.children + 1, notif_container.children[1]) - notif_container:remove(1) - end) -)) - -notif_container:insert(1, empty) - -naughty.connect_signal("request::display", function(n) - - if #notif_container.children == 1 and remove_notif_empty then - notif_container:reset(notif_container) - remove_notif_empty = false - end - - local notif_color = beautiful.groups_bg - if n.urgency == 'critical' then - notif_color = beautiful.xcolor1 .. '66' - end - local appicon = n.icon or n.app_icon - if not appicon then appicon = beautiful.notification_icon end - - notif_container:insert(1, create_notif(appicon, n, width)) -end) - --- Init widgets -local notif_center = wibox.widget { - { - { - notif_header, - nil, - clear, - expand = "none", - spacing = dpi(10), - layout = wibox.layout.align.horizontal - }, - left = dpi(5), - right = dpi(5), - layout = wibox.container.margin - }, - notif_container, - - spacing = dpi(20), - layout = wibox.layout.fixed.vertical -} - -notifs = wibox({ - type = "dock", - screen = screen.primary, - height = dpi(380), - width = dpi(300), - shape = helpers.rrect(beautiful.border_radius), - ontop = true, - visible = false -}) -notifs.y = dpi(365) - --- Rubato -local slide = rubato.timed{ - pos = dpi(-300), - rate = 60, - intro = 0.3, - duration = 0.8, - easing = rubato.quadratic, - awestore_compat = true, - subscribed = function(pos) notifs.x = pos end -} - -local notifs_status = false - -slide.ended:subscribe(function() - if notifs_status then - notifs.visible = false - end -end) - --- Make toogle button -notifs_show = function() - notifs.visible = true - slide:set(dpi(100)) - notifs_status = false -end - -notifs_hide = function() - slide:set(dpi(-375)) - notifs_status = true -end - -notifs_toggle = function() - if notifs.visible then - notifs_hide() - else - notifs_show() - end -end - --- notifs setup -notifs:setup { - notif_center, - margins = dpi(15), - widget = wibox.container.margin -} diff --git a/config/awesome/ui/notifs/popup.lua b/config/awesome/ui/notifs/popup.lua index 6f52cbf..a05807c 100644 --- a/config/awesome/ui/notifs/popup.lua +++ b/config/awesome/ui/notifs/popup.lua @@ -22,9 +22,8 @@ local pop_icon = wibox.widget{ resize = true, widget = wibox.widget.imagebox }, - forced_height = dpi(150), - top = dpi(12), - bottom = dpi(12), + forced_height = dpi(100), + top = dpi(28), widget = wibox.container.margin } @@ -35,7 +34,6 @@ local pop_bar = wibox.widget { color = beautiful.bg_accent, shape = gears.shape.rounded_bar, bar_shape = gears.shape.rounded_bar, - forced_height = dpi(24), widget = wibox.widget.progressbar } @@ -64,9 +62,7 @@ pop:setup { }, { pop_bar, - left = dpi(24), - right = dpi(24), - bottom = dpi(24), + margins = dpi(28), widget = wibox.container.margin }, layout = wibox.layout.align.vertical @@ -101,19 +97,18 @@ awesome.connect_signal("signal::volume", function(value, muted) if vol_first_time then vol_first_time = false else - local vol_icon = gears.color.recolor_image(icon, beautiful.xforeground) - icon = vol_icon - pop_bar.value = value if muted then - local muted_icon = gears.color.recolor_image(icon, beautiful.xcolor8) + local muted_icon = gears.color.recolor_image(beautiful.volume_muted_icon, beautiful.xcolor8) icon = muted_icon pop_bar.color = beautiful.xcolor8 else + local vol_icon = gears.color.recolor_image(icon, beautiful.pop_vol_color) + icon = vol_icon pop_bar.color = beautiful.pop_vol_color end - + pop_bar.value = value pop_icon.icon.image = icon toggle_pop() end @@ -123,6 +118,8 @@ awesome.connect_signal("signal::brightness", function(value) local icon = beautiful.brightness_icon if value ~= 0 then + local bri_icon = gears.color.recolor_image(icon, beautiful.pop_brightness_color) + icon = bri_icon pop_bar.color = beautiful.pop_brightness_color else local bri_icon = gears.color.recolor_image(icon, beautiful.xcolor8) diff --git a/config/awesome/ui/widgets/button.lua b/config/awesome/ui/widgets/button.lua new file mode 100644 index 0000000..a6311da --- /dev/null +++ b/config/awesome/ui/widgets/button.lua @@ -0,0 +1,59 @@ +local wibox = require('wibox') +local beautiful = require('beautiful') + +local create_click_events = function(widget) + + local container = wibox.widget { + widget, + widget = wibox.container.background + } + + -- Old and new widget + local old_cursor, old_wibox + + -- Mouse hovers on the widget + container:connect_signal( + 'mouse::enter', + function() + container.bg = beautiful.xcolor8 + -- Hm, no idea how to get the wibox from this signal's arguments... + local w = mouse.current_wibox + if w then + old_cursor, old_wibox = w.cursor, w + w.cursor = 'hand1' + end + end + ) + + -- Mouse leaves the widget + container:connect_signal( + 'mouse::leave', + function() + container.bg = beautiful.transparent + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end + end + ) + + -- Mouse pressed the widget + container:connect_signal( + 'button::press', + function() + container.bg = beautiful.xcolor4 + end + ) + + -- Mouse releases the widget + container:connect_signal( + 'button::release', + function() + container.bg = beautiful.xcolor8 + end + ) + + return container +end + +return create_click_events