Update mprix and colors

This commit is contained in:
Hydroxycarbamide 2022-10-01 19:38:53 +02:00
parent b725dccade
commit e1aa18dbed
20 changed files with 389 additions and 85 deletions

30
bin/dominant-color.py Executable file
View file

@ -0,0 +1,30 @@
from __future__ import print_function
import binascii
from PIL import Image
import numpy as np
import scipy
import scipy.misc
import scipy.cluster
import sys
NUM_CLUSTERS = 5
# print('reading image')
im = Image.open(sys.argv[1])
im = im.resize((150, 150)) # optional, to reduce time
ar = np.asarray(im)
shape = ar.shape
ar = ar.reshape(np.product(shape[:2]), shape[2]).astype(float)
# print('finding clusters')
codes, dist = scipy.cluster.vq.kmeans(ar, NUM_CLUSTERS)
# print('cluster centres:\n', codes)
vecs, dist = scipy.cluster.vq.vq(ar, codes) # assign codes
counts, bins = np.histogram(vecs, len(codes)) # count occurrences
index_max = np.argmax(counts) # find most frequent
peak = codes[index_max]
colour = binascii.hexlify(bytearray(int(c) for c in peak)).decode('ascii')
# print('most frequent is %s (#%s)' % (peak, colour))
print(colour)

View file

@ -1,3 +1,18 @@
get_artUrl() {
artUrl=$(playerctl -p $1 metadata | grep artUrl | awk '{$1=$2=""; print $0}')
regex='(https?|ftp)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]'
if [[ $artUrl =~ $regex ]]
then
filename=/tmp/spotify-mpris/$(basename $artUrl)
if [ ! -f $filename ]
then
curl -sSL $artUrl --create-dirs -o $filename
fi
echo $filename
else
echo $artUrl
fi
}
read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)" read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)"
declare -a PAUSED declare -a PAUSED
@ -8,7 +23,7 @@ for player in "${PLAYERS[@]}"; do
# if we have one playing, we'll use it and EXIT # if we have one playing, we'll use it and EXIT
if [ "$p_status" = "Playing" ]; then if [ "$p_status" = "Playing" ]; then
echo $(playerctl -p $player metadata | grep artUrl | awk '{$1=$2=""; print $0}') get_artUrl $player
exit 0; exit 0;
fi fi
@ -17,6 +32,7 @@ done
# if we have a paused, show it otherwise assume there are no players or have all stopped # if we have a paused, show it otherwise assume there are no players or have all stopped
if [ -n "${PAUSED[0]}" ]; then if [ -n "${PAUSED[0]}" ]; then
echo $(playerctl -p ${PAUSED[0]} metadata | grep artUrl | awk '{$1=$2=""; print $0}') get_artUrl ${PAUSED[0]}
echo $(playerctl -p metadata | grep artUrl | awk '{$1=$2=""; print $0}')
fi fi

View file

@ -0,0 +1,98 @@
#!/bin/bash
# The name of polybar bar which houses the main spotify module and the control modules.
PARENT_BAR="${1:-music}"
PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1)
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
send_hook() {
[ -z "$1" ] && echo "send_hook: missing arg" && exit 1
polybar-msg hook mpris-play-pause "$1" 1>/dev/null 2>&1
}
extract_meta() {
grep "$1\W" <<< "$meta" | awk '{$1=$2=""; print $0}' | sed 's/^ *//; s/; */;/g' | paste -s -d/ -
}
# if "icon" given, determine icon. otherwise, print metadata
get_info() {
if [ -z "$1" ]; then
echo "Usage: get_info PLAYER [icon]"
exit 1
fi
meta=$(playerctl -p "$1" metadata)
# get title
title=$(extract_meta title)
# if no title, try url e.g. vlc
if [ -z "$title" ]; then
title=$(extract_meta url)
title=$(urldecode "${title##*/}")
fi
# if not "icon", display information and return
if [ "$2" != "icon" ]; then
artist=$(extract_meta artist)
[ -z "$artist" ] && artist=$(extract_meta albumArtist)
if [ -n "$artist" ]; then
album=$(extract_meta album)
[ -n "$album" ] && printf "from $album\n"
printf "by $artist"
fi
return 0
fi
# determine icon:
# if player name is recognised, use it
case "$1" in
spotify* | vlc | mpv) echo "$1";;
kdeconnect*) echo "kdeconnect";;
chromium*)
# if a browser, search window titles:
# this tries to avoid title messing up the regex
regex_title=$(echo "$title" | tr "[:punct:]" ".")
windowname=$(xdotool search --name --class --classname "$regex_title" getwindowname 2>/dev/null)
case $windowname in
"") ;; # ignore if empty
*Netflix*) echo "netflix";;
*YouTube*) echo "youtube";;
*"Prime Video"*) echo "prime";;
*"Corridor Digital"*) echo "corridor";;
*) echo "browser";;
esac;;
*) echo "none";;
esac
}
# manually go through players
read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)"
declare -a PAUSED
for player in "${PLAYERS[@]}"; do
[ "$player" = "playerctld" ] && continue;
p_status=$(playerctl -p "$player" status 2>/dev/null)
# if we have one playing, we'll use it and EXIT
if [ "$p_status" = "Playing" ]; then
send_hook 1
get_info "$player" "$2"
exit 0;
fi
[ "$p_status" = "Paused" ] && PAUSED+=("$player")
done
# if we have a paused, show it otherwise assume there are no players or have all stopped
if [ -n "${PAUSED[0]}" ]; then
send_hook 2
get_info "${PAUSED[0]}" "$2"
else
[ "$2" = icon ] && echo "none" || echo " 鈴 no players "
fi

View file

@ -0,0 +1,89 @@
#!/bin/bash
# The name of polybar bar which houses the main spotify module and the control modules.
PARENT_BAR="${1:-music}"
PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1)
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
send_hook() {
[ -z "$1" ] && echo "send_hook: missing arg" && exit 1
polybar-msg hook mpris-play-pause "$1" 1>/dev/null 2>&1
}
extract_meta() {
grep "$1\W" <<< "$meta" | awk '{$1=$2=""; print $0}' | sed 's/^ *//; s/; */;/g' | paste -s -d/ -
}
# if "icon" given, determine icon. otherwise, print metadata
get_info() {
if [ -z "$1" ]; then
echo "Usage: get_info PLAYER [icon]"
exit 1
fi
meta=$(playerctl -p "$1" metadata)
# get title
title=$(extract_meta title)
# if no title, try url e.g. vlc
if [ -z "$title" ]; then
title=$(extract_meta url)
title=$(urldecode "${title##*/}")
fi
# if not "icon", display information and return
if [ "$2" != "icon" ]; then
printf "$title"
return 0
fi
# determine icon:
# if player name is recognised, use it
case "$1" in
spotify* | vlc | mpv) echo "$1";;
kdeconnect*) echo "kdeconnect";;
chromium*)
# if a browser, search window titles:
# this tries to avoid title messing up the regex
regex_title=$(echo "$title" | tr "[:punct:]" ".")
windowname=$(xdotool search --name --class --classname "$regex_title" getwindowname 2>/dev/null)
case $windowname in
"") ;; # ignore if empty
*Netflix*) echo "netflix";;
*YouTube*) echo "youtube";;
*"Prime Video"*) echo "prime";;
*"Corridor Digital"*) echo "corridor";;
*) echo "browser";;
esac;;
*) echo "none";;
esac
}
# manually go through players
read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)"
declare -a PAUSED
for player in "${PLAYERS[@]}"; do
[ "$player" = "playerctld" ] && continue;
p_status=$(playerctl -p "$player" status 2>/dev/null)
# if we have one playing, we'll use it and EXIT
if [ "$p_status" = "Playing" ]; then
send_hook 1
get_info "$player" "$2"
exit 0;
fi
[ "$p_status" = "Paused" ] && PAUSED+=("$player")
done
# if we have a paused, show it otherwise assume there are no players or have all stopped
if [ -n "${PAUSED[0]}" ]; then
send_hook 2
get_info "${PAUSED[0]}" "$2"
else
[ "$2" = icon ] && echo "none" || echo " 鈴 no players "
fi

View file

@ -0,0 +1,22 @@
#!/bin/bash
cmd="${0%/*}/get_mpris_status_title_only.sh $1"
zscroll -l 50 \
--scroll-padding "$(printf ' %.0s' {1..8})" \
-d 0.5 \
-M "$cmd icon" \
-m "none" "-b ''" \
-m "browser" "-b ' '" \
-m "netflix" "-b 'ﱄ '" \
-m "youtube" "-b ' '" \
-m "prime" "-b ' '" \
-m "spotify" "-b ' '" \
-m "spotifyd" "-b ' '" \
-m "vlc" "-b '嗢 '" \
-m "mpv" "-b ' '" \
-m "kdeconnect" "-b ' '" \
-m "corridor" "-b ' '" \
-U 1 -u t "$cmd" &
wait

View file

@ -14,10 +14,10 @@ return function(s, widgets)
local bottom_right = awful.popup { local bottom_right = awful.popup {
widget = wibox.container.background, widget = wibox.container.background,
ontop = false, ontop = false,
bg = cat["Crust"], bg = color["Grey900"],
visible = true, visible = true,
screen = s, screen = s,
maximum_height = dpi(80), maximum_height = dpi(60),
placement = function(c) awful.placement.bottom_left(c, { margins = dpi(5) }) end, placement = function(c) awful.placement.bottom_left(c, { margins = dpi(5) }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
@ -25,7 +25,7 @@ return function(s, widgets)
} }
bottom_right:struts { bottom_right:struts {
bottom = 85 bottom = 65
} }
local function prepare_widgets(widgets) local function prepare_widgets(widgets)

View file

@ -47,11 +47,11 @@ return function(screen, programs)
for _, c in ipairs(client.get()) do for _, c in ipairs(client.get()) do
if string.lower(c.class):match(program) and c == client.focus then if string.lower(c.class):match(program) and c == client.focus then
dock_element.background.bg = color["Grey800"] dock_element.background.bg = cat["Surface0"]
end end
end end
Hover_signal(dock_element.background, color["Grey800"], cat["Text"]) Hover_signal(dock_element.background, cat["Surface0"], cat["Text"])
dock_element:connect_signal( dock_element:connect_signal(
"button::press", "button::press",

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><path d="M500,10C229.4,10,10,229.4,10,500c0,270.6,219.4,490,490,490c270.6,0,490-219.4,490-490C990,229.4,770.6,10,500,10z M500,683c-101.1,0-183-81.9-183-183c0-101.1,81.9-183,183-183c101.1,0,183,81.9,183,183S601.1,683,500,683z"/><path d="M500,342.5c-87,0-157.5,70.5-157.5,157.5c0,87,70.5,157.5,157.5,157.5c87,0,157.5-70.5,157.5-157.5C657.5,413,587,342.5,500,342.5z M500,593.9c-51.9,0-93.9-42-93.9-93.9s42-93.9,93.9-93.9c51.9,0,93.9,42,93.9,93.9S551.9,593.9,500,593.9z"/></g>
</svg>

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -1 +1 @@
Steam; Steam;watchdogs2.exe;

View file

@ -19,12 +19,12 @@ naughty.config.defaults.icon_size = dpi(32)
naughty.config.defaults.timeout = 3 naughty.config.defaults.timeout = 3
naughty.config.defaults.title = "System Notification" naughty.config.defaults.title = "System Notification"
naughty.config.defaults.margin = dpi(10) naughty.config.defaults.margin = dpi(10)
naughty.config.defaults.position = "bottom_right" naughty.config.defaults.position = "top_right"
naughty.config.defaults.shape = function(cr, width, height) naughty.config.defaults.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(10)) gears.shape.rounded_rect(cr, width, height, dpi(10))
end end
naughty.config.defaults.border_width = dpi(4) naughty.config.defaults.border_width = dpi(4)
naughty.config.defaults.border_color = color["Grey800"] naughty.config.defaults.border_color = cat["Surface0"]
naughty.config.defaults.spacing = dpi(10) naughty.config.defaults.spacing = dpi(10)
naughty.connect_signal( naughty.connect_signal(
@ -51,7 +51,7 @@ naughty.connect_signal(
n.bg = cat["Surface0"] n.bg = cat["Surface0"]
else else
n.title = string.format("<span foreground='%s' font='Ubuntu, ExtraBold 12'>%s</span>", n.title = string.format("<span foreground='%s' font='Ubuntu, ExtraBold 12'>%s</span>",
cat["Text"], n.title) or "" color["White"], n.title) or ""
n.message = string.format("<span foreground='%s' font='Ubuntu 12'>%s</span>", cat['Text'], n.message) or "" n.message = string.format("<span foreground='%s' font='Ubuntu 12'>%s</span>", cat['Text'], n.message) or ""
n.bg = cat["Surface0"] n.bg = cat["Surface0"]
n.timeout = n.timeout or 5 n.timeout = n.timeout or 5
@ -63,15 +63,15 @@ naughty.connect_signal(
n.actions = { naughty.action { n.actions = { naughty.action {
program = "Spotify", program = "Spotify",
id = "skip-prev", id = "skip-prev",
icon = gears.color.recolor_image(icondir .. "skip-prev.svg", cat["Lavender"]) icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"])
}, naughty.action { }, naughty.action {
program = "Spotify", program = "Spotify",
id = "play-pause", id = "play-pause",
icon = gears.color.recolor_image(icondir .. "play-pause.svg", cat["Lavender"]) icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"])
}, naughty.action { }, naughty.action {
program = "Spotify", program = "Spotify",
id = "skip-next", id = "skip-next",
icon = gears.color.recolor_image(icondir .. "skip-next.svg", cat["Lavender"]) icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"])
} } } }
use_image = true use_image = true
end end
@ -97,7 +97,7 @@ naughty.connect_signal(
}, },
forced_height = dpi(35), forced_height = dpi(35),
forced_width = dpi(35), forced_width = dpi(35),
fg = cat["Lavender"], fg = color["Cyan200"],
bg = cat["Surface0"], bg = cat["Surface0"],
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6)) gears.shape.rounded_rect(cr, width, height, dpi(6))
@ -300,7 +300,7 @@ naughty.connect_signal(
border_color = cat["Surface1"], border_color = cat["Surface1"],
border_width = dpi(0), border_width = dpi(0),
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12) gears.shape.rounded_rect(cr, width, height, 20)
end, end,
widget = wibox.container.background widget = wibox.container.background
} }
@ -374,7 +374,7 @@ naughty.connect_signal(
type = "notification", type = "notification",
screen = awful.screen.focused(), screen = awful.screen.focused(),
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10) gears.shape.rounded_rect(cr, width, height, 20)
end, end,
widget_template = w_template widget_template = w_template
} }

View file

@ -75,7 +75,7 @@ return function(s)
id = "brightness_slider", id = "brightness_slider",
bar_shape = gears.shape.rounded_rect, bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10), bar_height = dpi(10),
bar_color = color["Grey800"] .. "88", bar_color = cat["Surface0"] .. "88",
bar_active_color = "#ffffff", bar_active_color = "#ffffff",
handle_color = "#ffffff", handle_color = "#ffffff",
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,

View file

@ -39,12 +39,12 @@ return function(s)
layout = wibox.layout.align.horizontal layout = wibox.layout.align.horizontal
}, },
id = "device_margin", id = "device_margin",
margins = dpi(5), margins = dpi(10),
widget = wibox.container.margin widget = wibox.container.margin
}, },
id = "background", id = "background",
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4) gears.shape.rounded_rect(cr, width, height, 20)
end, end,
widget = wibox.container.background widget = wibox.container.background
}, },
@ -158,9 +158,9 @@ return function(s)
device.background:set_fg(cat["Crust"]) device.background:set_fg(cat["Crust"])
else else
fg = color["Purple200"] fg = color["Purple200"]
bg = color["Grey700"] bg = cat["Surface1"]
device.background:set_fg(color["Purple200"]) device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(cat["Surface1"])
end end
end end
) )
@ -175,9 +175,9 @@ return function(s)
device.background:set_fg(cat["Crust"]) device.background:set_fg(cat["Crust"])
else else
fg = color["Purple200"] fg = color["Purple200"]
bg = color["Grey700"] bg = cat["Surface1"]
device.background:set_fg(color["Purple200"]) device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(cat["Surface1"])
end end
end end
) )
@ -288,9 +288,9 @@ return function(s)
device.background:set_fg(cat["Crust"]) device.background:set_fg(cat["Crust"])
else else
fg = color["Blue200"] fg = color["Blue200"]
bg = color["Grey700"] bg = cat["Surface1"]
device.background:set_fg(color["Blue200"]) device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(cat["Surface1"])
end end
end end
) )
@ -305,9 +305,9 @@ return function(s)
device.background:set_fg(cat["Crust"]) device.background:set_fg(cat["Crust"])
else else
fg = color["Blue200"] fg = color["Blue200"]
bg = color["Grey700"] bg = cat["Surface1"]
device.background:set_fg(color["Blue200"]) device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(cat["Surface1"])
end end
end end
) )
@ -323,9 +323,9 @@ return function(s)
id = "volume_device_list" id = "volume_device_list"
}, },
id = "volume_device_background", id = "volume_device_background",
bg = color["Grey800"], bg = cat["Surface0"],
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4) gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 20)
end, end,
widget = wibox.container.background widget = wibox.container.background
}, },
@ -342,9 +342,9 @@ return function(s)
id = "volume_device_list" id = "volume_device_list"
}, },
id = "volume_device_background", id = "volume_device_background",
bg = color["Grey800"], bg = cat["Surface0"],
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4) gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 20)
end, end,
widget = wibox.container.background widget = wibox.container.background
}, },
@ -385,10 +385,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
}, },
id = "audio_bg", id = "audio_bg",
bg = color["Grey800"], bg = cat["Surface0"],
fg = color["Purple200"], fg = color["Purple200"],
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4) gears.shape.rounded_rect(cr, width, height, 20)
end, end,
widget = wibox.container.background widget = wibox.container.background
}, },
@ -432,10 +432,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
}, },
id = "mic_bg", id = "mic_bg",
bg = color["Grey800"], bg = cat["Surface0"],
fg = color["LightBlueA200"], fg = color["LightBlueA200"],
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4) gears.shape.rounded_rect(cr, width, height, 20)
end, end,
widget = wibox.container.background widget = wibox.container.background
}, },
@ -465,7 +465,7 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
end, end,
bar_height = dpi(5), bar_height = dpi(5),
bar_color = color["Grey800"], bar_color = cat["Surface0"],
bar_active_color = color["Purple200"], bar_active_color = color["Purple200"],
handle_color = color["Purple200"], handle_color = color["Purple200"],
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,
@ -505,7 +505,7 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
end, end,
bar_height = dpi(5), bar_height = dpi(5),
bar_color = color["Grey800"], bar_color = cat["Surface0"],
bar_active_color = color["Blue200"], bar_active_color = color["Blue200"],
handle_color = color["Blue200"], handle_color = color["Blue200"],
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,
@ -536,10 +536,10 @@ return function(s)
widget = wibox.container.margin widget = wibox.container.margin
}, },
bg = cat["Crust"], bg = cat["Crust"],
border_color = color["Grey800"], border_color = cat["Surface0"],
border_width = dpi(4), border_width = dpi(4),
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12) gears.shape.rounded_rect(cr, width, height, 20)
end, end,
forced_width = dpi(400), forced_width = dpi(400),
widget = wibox.container.background widget = wibox.container.background
@ -558,12 +558,12 @@ return function(s)
volume_list.visible = not volume_list.visible volume_list.visible = not volume_list.visible
if volume_list.visible then if volume_list.visible then
audio_bg.shape = function(cr, width, height) audio_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 20)
end end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
else else
audio_bg.shape = function(cr, width, height) audio_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4) gears.shape.rounded_rect(cr, width, height, 20)
end end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
end end
@ -583,12 +583,12 @@ return function(s)
mic_list.visible = not mic_list.visible mic_list.visible = not mic_list.visible
if mic_list.visible then if mic_list.visible then
mic_selector_margin.mic_bg.shape = function(cr, width, height) mic_selector_margin.mic_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 20)
end end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
else else
mic_bg.shape = function(cr, width, height) mic_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4) gears.shape.rounded_rect(cr, width, height, 20)
end end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
end end
@ -628,7 +628,7 @@ return function(s)
screen = s, screen = s,
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(305), top = dpi(60) } }) end, placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(305), top = dpi(60) } }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 12) gears.shape.rounded_rect(cr, width, height, 25)
end end
} }

View file

@ -66,7 +66,7 @@ return function(s)
id = "volume_slider", id = "volume_slider",
bar_shape = gears.shape.rounded_rect, bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10), bar_height = dpi(10),
bar_color = color["Grey800"] .. "88", bar_color = cat["Surface0"] .. "88",
bar_active_color = "#ffffff", bar_active_color = "#ffffff",
handle_color = "#ffffff", handle_color = "#ffffff",
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,
@ -200,7 +200,7 @@ return function(s)
screen = s, screen = s,
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(700) } }) end, placement = function(c) awful.placement.centered(c, { margins = { top = dpi(700) } }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15) gears.shape.rounded_rect(cr, width, height, 20)
end end
} }

View file

@ -34,10 +34,11 @@ user_vars = {
autostart = { autostart = {
"killall -9 gwe", "killall -9 gwe",
"gwe --hide-window &", "gwe --hide-window &",
"nautilus --gapplication-service &", -- "nautilus --gapplication-service &",
"setxkbmap -option compose:ralt", "setxkbmap -option compose:ralt",
"setxkbmap -option caps:escape", "setxkbmap -option caps:escape",
"emacs --daemon=instance1", "emacs --daemon=instance1",
"nvidia-settings",
"bash -c \"[[ ! $(pgrep picom) ]] && picom &\"", "bash -c \"[[ ! $(pgrep picom) ]] && picom &\"",
"bash -c \"[[ ! -s ~/.config/mpd/pid ]] && mpd &\"", "bash -c \"[[ ! -s ~/.config/mpd/pid ]] && mpd &\"",
"bash -c \"[[ ! $(pgrep ulauncher) ]] && ulauncher --hide-window &\"", "bash -c \"[[ ! $(pgrep ulauncher) ]] && ulauncher --hide-window &\"",

View file

@ -209,7 +209,7 @@ return function(s)
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 8) gears.shape.rounded_rect(cr, width, height, 8)
end, end,
bg = color["Grey800"], bg = cat["Surface0"],
fg = cat["Text"], fg = cat["Text"],
widget = wibox.container.background, widget = wibox.container.background,
id = "background", id = "background",
@ -229,7 +229,7 @@ return function(s)
kb_layout_item:get_children_by_id("background2")[1].fg = cat["Crust"] kb_layout_item:get_children_by_id("background2")[1].fg = cat["Crust"]
kb_layout_item:get_children_by_id("background1")[1].fg = cat["Crust"] kb_layout_item:get_children_by_id("background1")[1].fg = cat["Crust"]
else else
kb_layout_item.bg = color["Grey800"] kb_layout_item.bg = cat["Surface0"]
kb_layout_item:get_children_by_id("background2")[1].fg = cat["Maroon"] kb_layout_item:get_children_by_id("background2")[1].fg = cat["Maroon"]
kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"] kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"]
end end
@ -284,7 +284,7 @@ return function(s)
bg = cat["Crust"], bg = cat["Crust"],
fg = cat["Text"], fg = cat["Text"],
border_width = dpi(4), border_width = dpi(4),
border_color = color["Grey800"], border_color = cat["Surface0"],
width = dpi(100), width = dpi(100),
max_height = dpi(600), max_height = dpi(600),
visible = false, visible = false,

View file

@ -4,6 +4,7 @@
-- Awesome Libs -- Awesome Libs
local awful = require("awful") local awful = require("awful")
local naughty = require("naughty")
local color = require("src.theme.colors") local color = require("src.theme.colors")
local cat = require("src.theme.catppuccin") local cat = require("src.theme.catppuccin")
local dpi = require("beautiful").xresources.apply_dpi local dpi = require("beautiful").xresources.apply_dpi
@ -25,13 +26,11 @@ return function()
{ {
{ {
id = "icon", id = "icon",
image = gears.color.recolor_image(icon_dir .. "disc" .. ".png", cat["Crust"]),
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
resize = true resize = true
}, },
id = "icon_layout", id = "icon_layout",
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 2)
end,
widget = wibox.container.place widget = wibox.container.place
}, },
widget = wibox.container.margin, widget = wibox.container.margin,
@ -39,17 +38,31 @@ return function()
}, },
spacing = dpi(10), spacing = dpi(10),
{ {
id = "label", {
{
id = "title",
font = "UbuntuMono Nerd Font, Bold 11",
align = "left",
widget = wibox.widget.textbox
},
{
id = "desc",
font = "UbuntuMono Nerd Font, Bold 8", font = "UbuntuMono Nerd Font, Bold 8",
align = "left", align = "left",
valign = "center",
widget = wibox.widget.textbox widget = wibox.widget.textbox
}, },
id = "label",
layout = wibox.layout.fixed.vertical
},
id = "label_margin",
top = dpi(2),
widget = wibox.container.margin
},
id = "mpris_layout", id = "mpris_layout",
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
}, },
id = "container", id = "container",
right = dpi(8), right = dpi(10),
widget = wibox.container.margin widget = wibox.container.margin
}, },
bg = cat["Lavender"], bg = cat["Lavender"],
@ -57,25 +70,53 @@ return function()
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
end, end,
forced_height = 65,
widget = wibox.container.background widget = wibox.container.background
} }
Hover_signal(mpris_widget, cat["Lavender"], cat["Crust"]) --Hover_signal(mpris_widget, cat["Lavender"], cat["Crust"])
watch( watch(
[[ bash -c "$HOME/.config/awesome/bin/get_mpris_status.sh" ]], [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status_desc_only.sh" ]],
5, 10,
function(_, stdout) function(_, stdout)
mpris_widget.container.mpris_layout.label.text = stdout mpris_widget.container.mpris_layout.label_margin.label.desc.text = stdout
awesome.emit_signal("update::mpris_widget", tostring(stdout)) awesome.emit_signal("update::mpris_widget", tostring(stdout))
end end
) )
awful.spawn.with_line_callback(
[[ bash -c "$HOME/.config/awesome/bin/scroll_mpris_status_title_only.sh" ]], {
stdout = function(line)
mpris_widget.container.mpris_layout.label_margin.label.title.text = line
end,
}
)
watch( watch(
[[ bash -c "$HOME/.config/awesome/bin/get_mpris_art.sh" ]], [[ bash -c "$HOME/.config/awesome/bin/get_mpris_art.sh" ]],
5, 10,
function(_, stdout) function(_, stdout)
mpris_widget.container.mpris_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(stdout:gsub("\n", ""):gsub("file://", ""))) local file = stdout:gsub("\n", ""):gsub("file://", "")
if #file <= 0 then
return
end
local command = string.format([[ bash -c "python3 $HOME/.config/awesome/bin/dominant-color.py %s" ]], file)
awful.spawn.easy_async(
command,
function(stdout, stderr, reason, exit_code)
local hex = stdout:gsub("\n", "")
local r, g, b = tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))
local brightness = (r * 0.299) + (g * 0.587) + (b * 0.114);
mpris_widget.bg = "#" .. hex
if brightness > 186 then
mpris_widget.fg = cat["Crust"]
else
mpris_widget.fg = cat["Text"]
end
end
)
mpris_widget.container.mpris_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(file))
awesome.emit_signal("update::mpris_widget", tostring(stdout)) awesome.emit_signal("update::mpris_widget", tostring(stdout))
end end
) )

View file

@ -43,7 +43,7 @@ return function()
widget = wibox.container.margin widget = wibox.container.margin
}, },
bg = cat["Maroon"], bg = cat["Maroon"],
fg = color["Grey800"], fg = cat["Surface0"],
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
end, end,

View file

@ -109,7 +109,7 @@ local list_update = function(widget, buttons, label, data, objects)
function() function()
old_bg = tag_widget.bg old_bg = tag_widget.bg
if object == awful.screen.focused().selected_tag then if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd' tag_widget.bg = cat["Subtext0"]
else else
tag_widget.bg = '#3A475C' .. 'dd' tag_widget.bg = '#3A475C' .. 'dd'
end end
@ -125,7 +125,7 @@ local list_update = function(widget, buttons, label, data, objects)
"button::press", "button::press",
function() function()
if object == awful.screen.focused().selected_tag then if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#bbbbbb' .. 'dd' tag_widget.bg = cat["Subtext0"]
else else
tag_widget.bg = '#3A475C' .. 'dd' tag_widget.bg = '#3A475C' .. 'dd'
end end
@ -136,7 +136,7 @@ local list_update = function(widget, buttons, label, data, objects)
"button::release", "button::release",
function() function()
if object == awful.screen.focused().selected_tag then if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd' tag_widget.bg = cat["Text"]
else else
tag_widget.bg = '#3A475C' .. 'dd' tag_widget.bg = '#3A475C' .. 'dd'
end end

View file

@ -57,15 +57,15 @@ local list_update = function(widget, buttons, label, data, objects)
widget = wibox.container.background widget = wibox.container.background
} }
local task_tool_tip = awful.tooltip { --local task_tool_tip = awful.tooltip {
objects = { task_widget }, -- objects = { task_widget },
mode = "inside", -- mode = "inside",
preferred_alignments = "middle", -- preferred_alignments = "middle",
preferred_positions = "bottom", -- preferred_positions = "bottom",
margins = dpi(10), -- margins = dpi(10),
gaps = 0, -- gaps = 0,
delay_show = 1 -- delay_show = 1
} --}
local function create_buttons(buttons, object) local function create_buttons(buttons, object)
if buttons then if buttons then
@ -101,10 +101,10 @@ local list_update = function(widget, buttons, label, data, objects)
else else
text = object.class:sub(1, 20) text = object.class:sub(1, 20)
end end
task_tool_tip:set_text(text_full) --task_tool_tip:set_text(text_full)
task_tool_tip:add_to_object(task_widget) --task_tool_tip:add_to_object(task_widget)
else else
task_tool_tip:remove_from_object(task_widget) --task_tool_tip:remove_from_object(task_widget)
end end
end end
task_widget:set_bg(cat["Text"]) task_widget:set_bg(cat["Text"])
@ -125,7 +125,7 @@ local list_update = function(widget, buttons, label, data, objects)
function() function()
old_bg = task_widget.bg old_bg = task_widget.bg
if object == client.focus then if object == client.focus then
task_widget.bg = '#dddddddd' task_widget.bg = cat["Subtext1"]
else else
task_widget.bg = '#3A475Cdd' task_widget.bg = '#3A475Cdd'
end end
@ -141,7 +141,7 @@ local list_update = function(widget, buttons, label, data, objects)
"button::press", "button::press",
function() function()
if object == client.focus then if object == client.focus then
task_widget.bg = "#ffffffaa" task_widget.bg = cat["Subtext1"]
else else
task_widget.bg = '#3A475Caa' task_widget.bg = '#3A475Caa'
end end
@ -152,7 +152,7 @@ local list_update = function(widget, buttons, label, data, objects)
"button::release", "button::release",
function() function()
if object == client.focus then if object == client.focus then
task_widget.bg = "#ffffffdd" task_widget.bg = cat["Text"]
else else
task_widget.bg = '#3A475Cdd' task_widget.bg = '#3A475Cdd'
end end