feat: notif-center & more stuff
32
.github/README.md
vendored
|
@ -13,7 +13,7 @@
|
|||
<br>
|
||||
|
||||
<a href="https://awesomewm.org/"><img alt="AwesomeWM Logo" height="160" align = "left" src="https://awesomewm.org/doc/api/images/AUTOGEN_wibox_logo_logo_and_name.svg"></a>
|
||||
<b> AwesomeWM Dotfiles </b>
|
||||
<b> Aesthetic AwesomeWM Dotfiles </b>
|
||||
|
||||
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.
|
|||
|
||||
<h2></h2><br>
|
||||
|
||||
<details open>
|
||||
<details>
|
||||
<summary><strong>S E T U P</strong></summary>
|
||||
|
||||
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.
|
|||
|
||||
<br>
|
||||
|
||||
<details open>
|
||||
<details>
|
||||
<summary><strong>F E A T U R E S</strong></summary>
|
||||
|
||||
<b>These are the features included in my AwesomeWM setups!</b>
|
||||
|
@ -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.
|
|||
|
||||
<br>
|
||||
|
||||
<details open>
|
||||
<details>
|
||||
<summary><strong>K E Y B I N D S</strong></summary>
|
||||
|
||||
I use <kbd>super</kbd> AKA Windows key as my main modifier.
|
||||
|
@ -179,7 +185,7 @@ also with <kbd>alt, shift, and ctrl</kbd>
|
|||
| `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`*
|
||||
|
||||
</details>
|
||||
|
||||
|
|
BIN
.github/assets/awesome.png
vendored
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 295 KiB |
BIN
config/awesome/theme/assets/icons/brightness.png
Normal file
After Width: | Height: | Size: 12 KiB |
|
@ -1,57 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="240"
|
||||
height="240"
|
||||
viewBox="0 0 240 240"
|
||||
id="svg4"
|
||||
sodipodi:docname="brightness-7.svg"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs8" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1321"
|
||||
inkscape:window-height="740"
|
||||
id="namedview6"
|
||||
showgrid="false"
|
||||
inkscape:pagecheckerboard="true"
|
||||
inkscape:zoom="0.98333333"
|
||||
inkscape:cx="-267.45763"
|
||||
inkscape:cy="120"
|
||||
inkscape:window-x="45"
|
||||
inkscape:window-y="28"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
d="M 120,84.6331 A 35.366932,35.366932 0 0 0 84.6331,120 35.366932,35.366932 0 0 0 120,155.3669 35.366932,35.366932 0 0 0 155.3669,120 35.366932,35.366932 0 0 0 120,84.6331 m 0,88.4173 A 53.050398,53.050398 0 0 1 66.9496,120 53.050398,53.050398 0 0 1 120,66.9496 53.050398,53.050398 0 0 1 173.0504,120 53.050398,53.050398 0 0 1 120,173.0504 M 190.7339,90.7339 V 49.2661 H 149.2661 L 120,20 90.7339,49.2661 H 49.2661 V 90.7339 L 20,120 49.2661,149.2661 v 41.4678 H 90.7339 L 120,220 149.2661,190.7339 h 41.4678 V 149.2661 L 220,120 Z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#ffffff;stroke-width:8.84173298" />
|
||||
</svg>
|
Before Width: | Height: | Size: 2.1 KiB |
BIN
config/awesome/theme/assets/icons/mute.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
config/awesome/theme/assets/icons/notification-bell.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 12 KiB |
BIN
config/awesome/theme/assets/icons/volume.png
Normal file
After Width: | Height: | Size: 12 KiB |
|
@ -1,57 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="240"
|
||||
height="240"
|
||||
viewBox="0 0 240 240"
|
||||
id="svg4"
|
||||
sodipodi:docname="volume-high.svg"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs8" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1321"
|
||||
inkscape:window-height="740"
|
||||
id="namedview6"
|
||||
showgrid="false"
|
||||
inkscape:pagecheckerboard="true"
|
||||
inkscape:zoom="0.98333333"
|
||||
inkscape:cx="-267.45763"
|
||||
inkscape:cy="120"
|
||||
inkscape:window-x="45"
|
||||
inkscape:window-y="28"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
d="m 142.22222,22.555558 v 22.88889 c 32.11111,9.55555 55.55556,39.33333 55.55556,74.555552 0,35.22222 -23.44445,64.88888 -55.55556,74.44444 v 23 C 186.66667,207.33333 220,167.55555 220,120 220,72.444448 186.66667,32.666668 142.22222,22.555558 M 170,120 C 170,100.33333 158.88889,83.444448 142.22222,75.222228 V 164.44444 C 158.88889,156.55555 170,139.55555 170,120 M 20,86.666668 V 153.33333 H 64.444444 L 120,208.88888 V 31.111118 l -55.555556,55.55555 z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#ffffff;stroke-width:11.11111164" />
|
||||
</svg>
|
Before Width: | Height: | Size: 2.1 KiB |
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -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)})
|
|
@ -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
|
|
@ -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
|
58
config/awesome/ui/notifs/notif-center/clear-all/init.lua
Normal file
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
false
|
120
config/awesome/ui/notifs/notif-center/dont-disturb/init.lua
Normal file
|
@ -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
|
39
config/awesome/ui/notifs/notif-center/init.lua
Normal file
|
@ -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
|
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
|
|
59
config/awesome/ui/widgets/button.lua
Normal file
|
@ -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
|