diff --git a/bin/dominant-color.py b/bin/dominant-color.py new file mode 100755 index 0000000..84cc746 --- /dev/null +++ b/bin/dominant-color.py @@ -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) diff --git a/bin/get_mpris_art.sh b/bin/get_mpris_art.sh index ad0dbf8..07a1f3d 100755 --- a/bin/get_mpris_art.sh +++ b/bin/get_mpris_art.sh @@ -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)" declare -a PAUSED @@ -8,7 +23,7 @@ for player in "${PLAYERS[@]}"; do # if we have one playing, we'll use it and EXIT if [ "$p_status" = "Playing" ]; then - echo $(playerctl -p $player metadata | grep artUrl | awk '{$1=$2=""; print $0}') + get_artUrl $player exit 0; fi @@ -17,6 +32,7 @@ done # if we have a paused, show it otherwise assume there are no players or have all stopped 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 diff --git a/bin/get_mpris_status_desc_only.sh b/bin/get_mpris_status_desc_only.sh new file mode 100755 index 0000000..105bf73 --- /dev/null +++ b/bin/get_mpris_status_desc_only.sh @@ -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 diff --git a/bin/get_mpris_status_title_only.sh b/bin/get_mpris_status_title_only.sh new file mode 100755 index 0000000..e20ddc0 --- /dev/null +++ b/bin/get_mpris_status_title_only.sh @@ -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 diff --git a/bin/scroll_mpris_status_title_only.sh b/bin/scroll_mpris_status_title_only.sh new file mode 100755 index 0000000..6fd4d8a --- /dev/null +++ b/bin/scroll_mpris_status_title_only.sh @@ -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 diff --git a/crylia_bar/bottom_right_bar.lua b/crylia_bar/bottom_right_bar.lua index 3758d7d..1aa6aec 100644 --- a/crylia_bar/bottom_right_bar.lua +++ b/crylia_bar/bottom_right_bar.lua @@ -14,10 +14,10 @@ return function(s, widgets) local bottom_right = awful.popup { widget = wibox.container.background, ontop = false, - bg = cat["Crust"], + bg = color["Grey900"], visible = true, screen = s, - maximum_height = dpi(80), + maximum_height = dpi(60), placement = function(c) awful.placement.bottom_left(c, { margins = dpi(5) }) end, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) @@ -25,7 +25,7 @@ return function(s, widgets) } bottom_right:struts { - bottom = 85 + bottom = 65 } local function prepare_widgets(widgets) diff --git a/crylia_bar/dock.lua b/crylia_bar/dock.lua index 504c89f..c93be7e 100644 --- a/crylia_bar/dock.lua +++ b/crylia_bar/dock.lua @@ -47,11 +47,11 @@ return function(screen, programs) for _, c in ipairs(client.get()) do 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 - Hover_signal(dock_element.background, color["Grey800"], cat["Text"]) + Hover_signal(dock_element.background, cat["Surface0"], cat["Text"]) dock_element:connect_signal( "button::press", diff --git a/src/assets/icons/mpris/cd-hi-res.svg b/src/assets/icons/mpris/cd-hi-res.svg new file mode 100644 index 0000000..89b200e --- /dev/null +++ b/src/assets/icons/mpris/cd-hi-res.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/src/assets/icons/mpris/disc.png b/src/assets/icons/mpris/disc.png new file mode 100644 index 0000000..caa7bfa Binary files /dev/null and b/src/assets/icons/mpris/disc.png differ diff --git a/src/assets/rules.txt b/src/assets/rules.txt index 49e195a..cfe5840 100644 --- a/src/assets/rules.txt +++ b/src/assets/rules.txt @@ -1 +1 @@ -Steam; \ No newline at end of file +Steam;watchdogs2.exe; \ No newline at end of file diff --git a/src/core/notifications.lua b/src/core/notifications.lua index 9dd4ec4..af35076 100644 --- a/src/core/notifications.lua +++ b/src/core/notifications.lua @@ -19,12 +19,12 @@ naughty.config.defaults.icon_size = dpi(32) naughty.config.defaults.timeout = 3 naughty.config.defaults.title = "System Notification" 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) gears.shape.rounded_rect(cr, width, height, dpi(10)) end 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.connect_signal( @@ -51,7 +51,7 @@ naughty.connect_signal( n.bg = cat["Surface0"] else n.title = string.format("%s", - cat["Text"], n.title) or "" + color["White"], n.title) or "" n.message = string.format("%s", cat['Text'], n.message) or "" n.bg = cat["Surface0"] n.timeout = n.timeout or 5 @@ -63,15 +63,15 @@ naughty.connect_signal( n.actions = { naughty.action { program = "Spotify", 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 { program = "Spotify", 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 { program = "Spotify", 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 end @@ -97,7 +97,7 @@ naughty.connect_signal( }, forced_height = dpi(35), forced_width = dpi(35), - fg = cat["Lavender"], + fg = color["Cyan200"], bg = cat["Surface0"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, dpi(6)) @@ -300,7 +300,7 @@ naughty.connect_signal( border_color = cat["Surface1"], border_width = dpi(0), shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 12) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background } @@ -374,7 +374,7 @@ naughty.connect_signal( type = "notification", screen = awful.screen.focused(), shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 10) + gears.shape.rounded_rect(cr, width, height, 20) end, widget_template = w_template } diff --git a/src/modules/brightness_osd.lua b/src/modules/brightness_osd.lua index e50e790..177b3af 100644 --- a/src/modules/brightness_osd.lua +++ b/src/modules/brightness_osd.lua @@ -75,7 +75,7 @@ return function(s) id = "brightness_slider", bar_shape = gears.shape.rounded_rect, bar_height = dpi(10), - bar_color = color["Grey800"] .. "88", + bar_color = cat["Surface0"] .. "88", bar_active_color = "#ffffff", handle_color = "#ffffff", handle_shape = gears.shape.circle, diff --git a/src/modules/volume_controller.lua b/src/modules/volume_controller.lua index e362796..e9f6bf2 100644 --- a/src/modules/volume_controller.lua +++ b/src/modules/volume_controller.lua @@ -39,12 +39,12 @@ return function(s) layout = wibox.layout.align.horizontal }, id = "device_margin", - margins = dpi(5), + margins = dpi(10), widget = wibox.container.margin }, id = "background", shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background }, @@ -158,9 +158,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Purple200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Purple200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -175,9 +175,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Purple200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Purple200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -288,9 +288,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Blue200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Blue200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -305,9 +305,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Blue200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Blue200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -323,9 +323,9 @@ return function(s) id = "volume_device_list" }, id = "volume_device_background", - bg = color["Grey800"], + bg = cat["Surface0"], 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, widget = wibox.container.background }, @@ -342,9 +342,9 @@ return function(s) id = "volume_device_list" }, id = "volume_device_background", - bg = color["Grey800"], + bg = cat["Surface0"], 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, widget = wibox.container.background }, @@ -385,10 +385,10 @@ return function(s) layout = wibox.layout.fixed.horizontal }, id = "audio_bg", - bg = color["Grey800"], + bg = cat["Surface0"], fg = color["Purple200"], shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background }, @@ -432,10 +432,10 @@ return function(s) layout = wibox.layout.fixed.horizontal }, id = "mic_bg", - bg = color["Grey800"], + bg = cat["Surface0"], fg = color["LightBlueA200"], shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background }, @@ -465,7 +465,7 @@ return function(s) gears.shape.rounded_rect(cr, width, height, 5) end, bar_height = dpi(5), - bar_color = color["Grey800"], + bar_color = cat["Surface0"], bar_active_color = color["Purple200"], handle_color = color["Purple200"], handle_shape = gears.shape.circle, @@ -505,7 +505,7 @@ return function(s) gears.shape.rounded_rect(cr, width, height, 5) end, bar_height = dpi(5), - bar_color = color["Grey800"], + bar_color = cat["Surface0"], bar_active_color = color["Blue200"], handle_color = color["Blue200"], handle_shape = gears.shape.circle, @@ -536,10 +536,10 @@ return function(s) widget = wibox.container.margin }, bg = cat["Crust"], - border_color = color["Grey800"], + border_color = cat["Surface0"], border_width = dpi(4), shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 12) + gears.shape.rounded_rect(cr, width, height, 20) end, forced_width = dpi(400), widget = wibox.container.background @@ -558,12 +558,12 @@ return function(s) volume_list.visible = not volume_list.visible if volume_list.visible then 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 audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) else audio_bg.shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end @@ -583,12 +583,12 @@ return function(s) mic_list.visible = not mic_list.visible if mic_list.visible then 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 mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) else mic_bg.shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end @@ -628,7 +628,7 @@ return function(s) screen = s, placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(305), top = dpi(60) } }) end, shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 12) + gears.shape.rounded_rect(cr, width, height, 25) end } diff --git a/src/modules/volume_osd.lua b/src/modules/volume_osd.lua index 3240df8..bf7c17a 100644 --- a/src/modules/volume_osd.lua +++ b/src/modules/volume_osd.lua @@ -66,7 +66,7 @@ return function(s) id = "volume_slider", bar_shape = gears.shape.rounded_rect, bar_height = dpi(10), - bar_color = color["Grey800"] .. "88", + bar_color = cat["Surface0"] .. "88", bar_active_color = "#ffffff", handle_color = "#ffffff", handle_shape = gears.shape.circle, @@ -200,7 +200,7 @@ return function(s) screen = s, placement = function(c) awful.placement.centered(c, { margins = { top = dpi(700) } }) end, shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 15) + gears.shape.rounded_rect(cr, width, height, 20) end } diff --git a/src/theme/user_variables.lua b/src/theme/user_variables.lua index 8086578..506aa63 100644 --- a/src/theme/user_variables.lua +++ b/src/theme/user_variables.lua @@ -34,10 +34,11 @@ user_vars = { autostart = { "killall -9 gwe", "gwe --hide-window &", - "nautilus --gapplication-service &", +-- "nautilus --gapplication-service &", "setxkbmap -option compose:ralt", "setxkbmap -option caps:escape", "emacs --daemon=instance1", + "nvidia-settings", "bash -c \"[[ ! $(pgrep picom) ]] && picom &\"", "bash -c \"[[ ! -s ~/.config/mpd/pid ]] && mpd &\"", "bash -c \"[[ ! $(pgrep ulauncher) ]] && ulauncher --hide-window &\"", diff --git a/src/widgets/kblayout.lua b/src/widgets/kblayout.lua index 4024643..34a5f27 100644 --- a/src/widgets/kblayout.lua +++ b/src/widgets/kblayout.lua @@ -209,7 +209,7 @@ return function(s) shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 8) end, - bg = color["Grey800"], + bg = cat["Surface0"], fg = cat["Text"], widget = wibox.container.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("background1")[1].fg = cat["Crust"] 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("background1")[1].fg = color["Purple200"] end @@ -284,7 +284,7 @@ return function(s) bg = cat["Crust"], fg = cat["Text"], border_width = dpi(4), - border_color = color["Grey800"], + border_color = cat["Surface0"], width = dpi(100), max_height = dpi(600), visible = false, diff --git a/src/widgets/mpris.lua b/src/widgets/mpris.lua index 6fd725e..9c552ae 100644 --- a/src/widgets/mpris.lua +++ b/src/widgets/mpris.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") +local naughty = require("naughty") local color = require("src.theme.colors") local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi @@ -25,13 +26,11 @@ return function() { { id = "icon", + image = gears.color.recolor_image(icon_dir .. "disc" .. ".png", cat["Crust"]), widget = wibox.widget.imagebox, resize = true }, 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.margin, @@ -39,17 +38,31 @@ return function() }, spacing = dpi(10), { - id = "label", - font = "UbuntuMono Nerd Font, Bold 8", - align = "left", - valign = "center", - widget = wibox.widget.textbox + { + { + id = "title", + font = "UbuntuMono Nerd Font, Bold 11", + align = "left", + widget = wibox.widget.textbox + }, + { + id = "desc", + font = "UbuntuMono Nerd Font, Bold 8", + align = "left", + widget = wibox.widget.textbox + }, + id = "label", + layout = wibox.layout.fixed.vertical + }, + id = "label_margin", + top = dpi(2), + widget = wibox.container.margin }, id = "mpris_layout", layout = wibox.layout.fixed.horizontal }, id = "container", - right = dpi(8), + right = dpi(10), widget = wibox.container.margin }, bg = cat["Lavender"], @@ -57,25 +70,53 @@ return function() shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, + forced_height = 65, widget = wibox.container.background } - Hover_signal(mpris_widget, cat["Lavender"], cat["Crust"]) + --Hover_signal(mpris_widget, cat["Lavender"], cat["Crust"]) watch( - [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status.sh" ]], - 5, + [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status_desc_only.sh" ]], + 10, 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)) 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( [[ bash -c "$HOME/.config/awesome/bin/get_mpris_art.sh" ]], - 5, + 10, 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)) end ) diff --git a/src/widgets/power.lua b/src/widgets/power.lua index 0bf2ff0..fc32225 100644 --- a/src/widgets/power.lua +++ b/src/widgets/power.lua @@ -43,7 +43,7 @@ return function() widget = wibox.container.margin }, bg = cat["Maroon"], - fg = color["Grey800"], + fg = cat["Surface0"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, diff --git a/src/widgets/taglist.lua b/src/widgets/taglist.lua index 57d7df3..14e97c9 100644 --- a/src/widgets/taglist.lua +++ b/src/widgets/taglist.lua @@ -109,7 +109,7 @@ local list_update = function(widget, buttons, label, data, objects) function() old_bg = tag_widget.bg if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#dddddd' .. 'dd' + tag_widget.bg = cat["Subtext0"] else tag_widget.bg = '#3A475C' .. 'dd' end @@ -125,7 +125,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::press", function() if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#bbbbbb' .. 'dd' + tag_widget.bg = cat["Subtext0"] else tag_widget.bg = '#3A475C' .. 'dd' end @@ -136,7 +136,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::release", function() if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#dddddd' .. 'dd' + tag_widget.bg = cat["Text"] else tag_widget.bg = '#3A475C' .. 'dd' end diff --git a/src/widgets/tasklist.lua b/src/widgets/tasklist.lua index 9726290..fea0739 100644 --- a/src/widgets/tasklist.lua +++ b/src/widgets/tasklist.lua @@ -57,15 +57,15 @@ local list_update = function(widget, buttons, label, data, objects) widget = wibox.container.background } - local task_tool_tip = awful.tooltip { - objects = { task_widget }, - mode = "inside", - preferred_alignments = "middle", - preferred_positions = "bottom", - margins = dpi(10), - gaps = 0, - delay_show = 1 - } + --local task_tool_tip = awful.tooltip { + -- objects = { task_widget }, + -- mode = "inside", + -- preferred_alignments = "middle", + -- preferred_positions = "bottom", + -- margins = dpi(10), + -- gaps = 0, + -- delay_show = 1 + --} local function create_buttons(buttons, object) if buttons then @@ -101,10 +101,10 @@ local list_update = function(widget, buttons, label, data, objects) else text = object.class:sub(1, 20) end - task_tool_tip:set_text(text_full) - task_tool_tip:add_to_object(task_widget) + --task_tool_tip:set_text(text_full) + --task_tool_tip:add_to_object(task_widget) else - task_tool_tip:remove_from_object(task_widget) + --task_tool_tip:remove_from_object(task_widget) end end task_widget:set_bg(cat["Text"]) @@ -125,7 +125,7 @@ local list_update = function(widget, buttons, label, data, objects) function() old_bg = task_widget.bg if object == client.focus then - task_widget.bg = '#dddddddd' + task_widget.bg = cat["Subtext1"] else task_widget.bg = '#3A475Cdd' end @@ -141,7 +141,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::press", function() if object == client.focus then - task_widget.bg = "#ffffffaa" + task_widget.bg = cat["Subtext1"] else task_widget.bg = '#3A475Caa' end @@ -152,7 +152,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::release", function() if object == client.focus then - task_widget.bg = "#ffffffdd" + task_widget.bg = cat["Text"] else task_widget.bg = '#3A475Cdd' end