diff --git a/bin/bsplock b/bin/bsplock index b0f6003..e830b47 100755 --- a/bin/bsplock +++ b/bin/bsplock @@ -34,7 +34,7 @@ i3lock \ \ --ringver-color=${GREEN} \ --ringwrong-color=${RED} \ ---ring-color="#fab387" \ +--ring-color="#f5e0dc" \ \ --line-color=${BG} \ --separator-color=${BG} \ 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 new file mode 100755 index 0000000..07a1f3d --- /dev/null +++ b/bin/get_mpris_art.sh @@ -0,0 +1,38 @@ +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 +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 + get_artUrl $player + 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 + get_artUrl ${PAUSED[0]} + echo $(playerctl -p metadata | grep artUrl | awk '{$1=$2=""; print $0}') +fi + diff --git a/bin/get_mpris_status.sh b/bin/get_mpris_status.sh new file mode 100755 index 0000000..db5cc04 --- /dev/null +++ b/bin/get_mpris_status.sh @@ -0,0 +1,99 @@ +#!/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" + artist=$(extract_meta artist) + [ -z "$artist" ] && artist=$(extract_meta albumArtist) + + if [ -n "$artist" ]; then + album=$(extract_meta album) + [ -n "$album" ] && printf "\nfrom $album" + + printf "\nby $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_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_hide_album.sh b/bin/get_mpris_status_hide_album.sh new file mode 100755 index 0000000..ee397c7 --- /dev/null +++ b/bin/get_mpris_status_hide_album.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) + + echo -n "$artist  " + fi + + echo "$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/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/get_spotify_status.sh b/bin/get_spotify_status.sh new file mode 100755 index 0000000..97ac861 --- /dev/null +++ b/bin/get_spotify_status.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# The name of polybar bar which houses the main spotify module and the control modules. +PARENT_BAR="now-playing" +PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1) + +# Set the source audio player here. +# Players supporting the MPRIS spec are supported. +# Examples: spotify, vlc, chrome, mpv and others. +# Use `playerctld` to always detect the latest player. +# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control +PLAYER="playerctld" + +# Format of the information displayed +# Eg. {{ artist }} - {{ album }} - {{ title }} +# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata +FORMAT="{{ title }} - {{ artist }}" + +# Sends $2 as message to all polybar PIDs that are part of $1 +update_hooks() { + while IFS= read -r id + do + polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1 + done < <(echo "$1") +} + +PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null) +EXIT_CODE=$? + +if [ $EXIT_CODE -eq 0 ]; then + STATUS=$PLAYERCTL_STATUS +else + STATUS="No player is running" +fi + +if [ "$1" == "--status" ]; then + echo "$STATUS" +else + if [ "$STATUS" = "Stopped" ]; then + echo "No music is playing" + elif [ "$STATUS" = "Paused" ]; then + update_hooks "$PARENT_BAR_PID" 2 + playerctl --player=$PLAYER metadata --format "$FORMAT" + elif [ "$STATUS" = "No player is running" ]; then + echo "$STATUS" + else + update_hooks "$PARENT_BAR_PID" 1 + playerctl --player=$PLAYER metadata --format "$FORMAT" + fi +fi + diff --git a/bin/scroll_mpris_status.sh b/bin/scroll_mpris_status.sh new file mode 100755 index 0000000..ec4b26a --- /dev/null +++ b/bin/scroll_mpris_status.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +cmd="${0%/*}/get_mpris_status.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/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/bin/scroll_spotify_status.sh b/bin/scroll_spotify_status.sh new file mode 100755 index 0000000..f70ef09 --- /dev/null +++ b/bin/scroll_spotify_status.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# see man zscroll for documentation of the following parameters +zscroll -l 30 \ + --delay 0.4 \ + --match-command "`dirname $0`/get_spotify_status.sh --status" \ + --match-text "Playing" "--scroll 1" \ + --match-text "Paused" "--scroll 0" \ + --update-check true "`dirname $0`/get_spotify_status.sh" & + +wait + diff --git a/crylia_bar/bottom_left_bar.lua b/crylia_bar/bottom_left_bar.lua new file mode 100644 index 0000000..d051f29 --- /dev/null +++ b/crylia_bar/bottom_left_bar.lua @@ -0,0 +1,85 @@ +-------------------------------------------------------------------------------------------------------------- +-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- +-------------------------------------------------------------------------------------------------------------- +-- Awesome Libs +local awful = require("awful") +local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +return function(s, widgets) + + local bottom_left = awful.popup { + widget = wibox.container.background, + ontop = false, + bg = color["Grey900"], + visible = true, + screen = s, + 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) + end + } + + bottom_left:struts { + bottom = 65 + } + + local function prepare_widgets(widgets) + local layout = { + layout = wibox.layout.fixed.horizontal + } + if #widgets == 1 then + table.insert(layout, + { + widgets[1], + widget = wibox.container.margin + }) + return layout; + end + for i, widget in pairs(widgets) do + if i == 1 then + table.insert(layout, + { + widget, + left = dpi(6), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }) + elseif i == #widgets then + table.insert(layout, + { + widget, + left = dpi(3), + right = dpi(6), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }) + else + table.insert(layout, + { + widget, + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }) + end + end + return layout + end + + bottom_left:setup { + nil, + nil, + prepare_widgets(widgets), + layout = wibox.layout.align.horizontal + } +end diff --git a/crylia_bar/center_bar.lua b/crylia_bar/center_bar.lua index 441fb2b..b3717ec 100644 --- a/crylia_bar/center_bar.lua +++ b/crylia_bar/center_bar.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -14,22 +15,22 @@ return function(s, widgets) screen = s, widget = wibox.container.background, ontop = false, - bg = color["Grey900"], + bg = cat["Crust"], visible = true, maximum_width = dpi(500), - placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end, + placement = function(c) awful.placement.top(c, { margins = dpi(5) }) end, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end } top_center:struts { - top = 55 + top = 45 } local function prepare_widgets(widgets) local layout = { - forced_height = 45, + forced_height = 40, layout = wibox.layout.fixed.horizontal } for i, widget in pairs(widgets) do diff --git a/crylia_bar/dock.lua b/crylia_bar/dock.lua index 55d028d..c93be7e 100644 --- a/crylia_bar/dock.lua +++ b/crylia_bar/dock.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -34,7 +35,7 @@ return function(screen, programs) shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 10) end, - bg = color["Grey900"], + bg = cat["Crust"], widget = wibox.container.background, id = "background" }, @@ -46,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"], color["White"]) + Hover_signal(dock_element.background, cat["Surface0"], cat["Text"]) dock_element:connect_signal( "button::press", @@ -77,7 +78,7 @@ return function(screen, programs) local dock = awful.popup { widget = wibox.container.background, ontop = true, - bg = color["Grey900"], + bg = cat["Crust"], visible = true, screen = screen, type = "dock", diff --git a/crylia_bar/init.lua b/crylia_bar/init.lua index a6dda7c..17cc083 100644 --- a/crylia_bar/init.lua +++ b/crylia_bar/init.lua @@ -36,30 +36,32 @@ awful.screen.connect_for_each_screen( s.kblayout = require("src.widgets.kblayout")(s) s.taglist = require("src.widgets.taglist")(s) s.tasklist = require("src.widgets.tasklist")(s) + s.mpris = require("src.widgets.mpris")() --s.cpu_freq = require("src.widgets.cpu_info")("freq", "average") -- Add more of these if statements if you want to change -- the modules/widgets per screen. if s.index == 1 then s.systray = require("src.widgets.systray")(s) - s.cpu_usage = require("src.widgets.cpu_info")("usage") - s.cpu_temp = require("src.widgets.cpu_info")("temp") - s.gpu_usage = require("src.widgets.gpu_info")("usage") - s.gpu_temp = require("src.widgets.gpu_info")("temp") require("crylia_bar.left_bar")(s, { s.layoutlist, s.systray, s.taglist }) require("crylia_bar.center_bar")(s, { s.tasklist }) - require("crylia_bar.right_bar")(s, { s.gpu_usage, s.gpu_temp, s.cpu_usage, s.cpu_temp, s.audio, s.date, s.clock, s.powerbutton }) - -- require("crylia_bar.dock")(s, user_vars.dock_programs) + require("crylia_bar.right_bar")(s, { s.audio, s.date, s.clock, s.powerbutton }) + --require("crylia_bar.dock")(s, user_vars.dock_programs) end if s.index == 2 then s.network = require("src.widgets.network")() s.ram_info = require("src.widgets.ram_info")() + s.cpu_temp = require("src.widgets.cpu_info")("temp") + s.gpu_temp = require("src.widgets.gpu_info")("temp") + -- s.cpu_usage = require("src.widgets.cpu_info")("usage") + -- s.gpu_usage = require("src.widgets.gpu_info")("usage") require("crylia_bar.left_bar")(s, { s.layoutlist, s.taglist }) require("crylia_bar.center_bar")(s, { s.tasklist }) - require("crylia_bar.right_bar")(s, { s.ram_info, s.audio, s.kblayout, s.bluetooth, s.network, s.date, s.clock, s.powerbutton }) + require("crylia_bar.right_bar")(s, { s.gpu_temp, s.cpu_temp, s.ram_info, s.kblayout, s.bluetooth, s.network, s.clock, s.powerbutton }) + require("crylia_bar.bottom_left_bar")(s, { s.mpris }) end end ) diff --git a/crylia_bar/left_bar.lua b/crylia_bar/left_bar.lua index 93f2031..823326c 100644 --- a/crylia_bar/left_bar.lua +++ b/crylia_bar/left_bar.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -14,22 +15,22 @@ return function(s, widgets) screen = s, widget = wibox.container.background, ontop = false, - bg = color["Grey900"], + bg = cat["Crust"], visible = true, maximum_width = dpi(650), - placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end, + placement = function(c) awful.placement.top_left(c, { margins = dpi(5) }) end, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end } top_left:struts { - top = 55 + top = 45 } local function prepare_widgets(widgets) local layout = { - forced_height = 45, + forced_height = 40, layout = wibox.layout.fixed.horizontal } for i, widget in pairs(widgets) do diff --git a/crylia_bar/right_bar.lua b/crylia_bar/right_bar.lua index 3e4ec2e..402788c 100644 --- a/crylia_bar/right_bar.lua +++ b/crylia_bar/right_bar.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -13,22 +14,22 @@ return function(s, widgets) local top_right = awful.popup { widget = wibox.container.background, ontop = false, - bg = color["Grey900"], + bg = cat["Crust"], visible = true, screen = s, - placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end, + placement = function(c) awful.placement.top_right(c, { margins = dpi(5) }) end, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end } top_right:struts { - top = 55 + top = 45 } local function prepare_widgets(widgets) local layout = { - forced_height = 45, + forced_height = 40, layout = wibox.layout.fixed.horizontal } for i, widget in pairs(widgets) do diff --git a/mappings/global_keys.lua b/mappings/global_keys.lua index 0ae49ff..65604f1 100644 --- a/mappings/global_keys.lua +++ b/mappings/global_keys.lua @@ -5,6 +5,9 @@ local hotkeys_popup = require("awful.hotkeys_popup") local ruled = require("ruled") local modkey = user_vars.modkey +local switcher = require("src.modules.awesome_switcher") +local revelation = require("src.modules.revelation") +revelation.init() return gears.table.join( awful.key( @@ -49,13 +52,23 @@ return gears.table.join( { description = "Focus previous client by index", group = "Client" } ), awful.key( - { "Mod1" }, - "#23", - function() - awful.client.focus.byidx(1) - end, - { description = "Focus next client by index", group = "Client" } + { modkey, "Shift" }, + "w", + revelation, + { description = "Focus previous client by index", group = "Client" } ), +--awful.key( +-- { "Mod1" }, +-- "#23", +-- function() +-- awful.client.focus.byidx(1) +-- end, +-- { description = "Focus next client by index", group = "Client" } +--), + awful.key({ "Mod1" }, "#23", + function () + switcher.switch( 1, "Mod1", "Alt_L", "Shift", "Tab") + end), awful.key( { "Mod1", "Shift" }, "#23", @@ -204,6 +217,14 @@ return gears.table.join( end, { descripton = "Client switcher (alt+tab)", group = "Application" } ), + awful.key( + { modkey }, + "#25", + function() + awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi") + end, + { descripton = "Client switcher (alt+tab)", group = "Application" } + ), awful.key( { modkey }, "#26", 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/cd.svg b/src/assets/icons/mpris/cd.svg new file mode 100644 index 0000000..fc13427 --- /dev/null +++ b/src/assets/icons/mpris/cd.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/assets/icons/mpris/cd24x24.svg b/src/assets/icons/mpris/cd24x24.svg new file mode 100644 index 0000000..95a3428 --- /dev/null +++ b/src/assets/icons/mpris/cd24x24.svg @@ -0,0 +1,6 @@ + + + + + + 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 be337e8..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( @@ -44,17 +44,17 @@ naughty.connect_signal( "request::display", function(n) if n.urgency == "critical" then - n.title = string.format("%s", - cat["Red"], n.title) or "" - n.message = string.format("%s", cat["Red"], n.message) or "" - n.app_name = string.format("%s", cat["Red"], n.app_name) or "" + n.title = string.format("%s", + cat["Maroon"], n.title) or "" + n.message = string.format("%s", cat["Maroon"], n.message) or "" + n.app_name = string.format("%s", cat["Maroon"], n.app_name) or "" n.bg = cat["Surface0"] else - n.title = string.format("%s", + n.title = string.format("%s", color["White"], n.title) or "" - n.message = string.format("%s", cat['Text'], n.message) or "" + n.message = string.format("%s", cat['Text'], n.message) or "" n.bg = cat["Surface0"] - n.timeout = n.timeout or 3 + n.timeout = n.timeout or 5 end local use_image = false @@ -117,7 +117,7 @@ naughty.connect_signal( { { id = "text_role", - font = "Google Sans, Regular 12", + font = "Ubuntu, Regular 12", widget = wibox.widget.textbox }, id = "centered", @@ -126,7 +126,7 @@ naughty.connect_signal( margins = dpi(5), widget = wibox.container.margin }, - fg = color["Green200"], + fg = cat["Green"], 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/core/rules.lua b/src/core/rules.lua index d27e411..16e0a45 100644 --- a/src/core/rules.lua +++ b/src/core/rules.lua @@ -62,7 +62,17 @@ awful.rules.rules = { name = { "cairo-dock" } }, properties = { ontop = true, titlebars_enabled = false } - } + }, + { + id = "genshinimpact.exe", + rule_any = { + class = "genshinimpact.exe" + }, + properties = { + screen = "DP-2", + fullscreen = true + } + } } awful.spawn.easy_async_with_shell( diff --git a/src/core/signals.lua b/src/core/signals.lua index 136cbcf..1d23083 100644 --- a/src/core/signals.lua +++ b/src/core/signals.lua @@ -93,7 +93,7 @@ client.connect_signal( client.connect_signal( "focus", function(c) - c.border_color = "#fab387" + c.border_color = "#f4dbd6" end ) diff --git a/src/modules/awesome_switcher.lua b/src/modules/awesome_switcher.lua new file mode 100644 index 0000000..6292598 --- /dev/null +++ b/src/modules/awesome_switcher.lua @@ -0,0 +1,532 @@ +local cairo = require("lgi").cairo +local mouse = mouse +local screen = screen +local wibox = require('wibox') +local table = table +local keygrabber = keygrabber +local math = require('math') +local awful = require('awful') +local gears = require("gears") +local timer = gears.timer +local client = client +awful.client = require('awful.client') + +local naughty = require("naughty") +local string = string +local tostring = tostring +local tonumber = tonumber +local debug = debug +local pairs = pairs +local unpack = unpack or table.unpack + +local surface = cairo.ImageSurface(cairo.Format.RGB24,20,20) +local cr = cairo.Context(surface) + +local _M = {} + +-- settings + +_M.settings = { + preview_box = true, + preview_box_bg = "#18192611", + preview_box_border = "#18192611", + preview_box_fps = 30, + preview_box_delay = 100, + preview_box_title_font = {"Ubuntu","italic","normal"}, + preview_box_title_font_size_factor = 0.8, + preview_box_title_color = {202,211,245,1}, + + client_opacity = true, + client_opacity_value_selected = 1, + client_opacity_value_in_focus = 0.5, + client_opacity_value = 0.5, + + cycle_raise_client = true, +} + +-- Create a wibox to contain all the client-widgets +_M.preview_wbox = wibox({ width = screen[mouse.screen].geometry.width }) +_M.preview_wbox.border_width = 3 +_M.preview_wbox.ontop = true +_M.preview_wbox.visible = false + +_M.preview_live_timer = timer({ timeout = 1/_M.settings.preview_box_fps }) +_M.preview_widgets = {} + +_M.altTabTable = {} +_M.altTabIndex = 1 + +_M.source = string.sub(debug.getinfo(1,'S').source, 2) +_M.path = string.sub(_M.source, 1, string.find(_M.source, "/[^/]*$")) +_M.noicon = _M.path .. "noicon.png" + +-- simple function for counting the size of a table +function _M.tableLength(T) + local count = 0 + for _ in pairs(T) do count = count + 1 end + return count +end + +-- this function returns the list of clients to be shown. +function _M.getClients() + local clients = {} + + -- Get focus history for current tag + local s = mouse.screen; + local idx = 0 + local c = awful.client.focus.history.get(s, idx) + + while c do + table.insert(clients, c) + + idx = idx + 1 + c = awful.client.focus.history.get(s, idx) + end + + -- Minimized clients will not appear in the focus history + -- Find them by cycling through all clients, and adding them to the list + -- if not already there. + -- This will preserve the history AND enable you to focus on minimized clients + + local t = s.selected_tag + local all = client.get(s) + + for i = 1, #all do + local c = all[i] + local ctags = c:tags(); + + -- check if the client is on the current tag + local isCurrentTag = false + for j = 1, #ctags do + if t == ctags[j] then + isCurrentTag = true + break + end + end + + if isCurrentTag then + -- check if client is already in the history + -- if not, add it + local addToTable = true + for k = 1, #clients do + if clients[k] == c then + addToTable = false + break + end + end + + + if addToTable then + table.insert(clients, c) + end + end + end + + return clients +end + +-- here we populate altTabTable using the list of clients taken from +-- _M.getClients(). In case we have altTabTable with some value, the list of the +-- old known clients is restored. +function _M.populateAltTabTable() + local clients = _M.getClients() + + if _M.tableLength(_M.altTabTable) then + for ci = 1, #clients do + for ti = 1, #_M.altTabTable do + if _M.altTabTable[ti].client == clients[ci] then + _M.altTabTable[ti].client.opacity = _M.altTabTable[ti].opacity + _M.altTabTable[ti].client.minimized = _M.altTabTable[ti].minimized + break + end + end + end + end + + _M.altTabTable = {} + + for i = 1, #clients do + table.insert(_M.altTabTable, { + client = clients[i], + minimized = clients[i].minimized, + opacity = clients[i].opacity + }) + end +end + +-- If the length of list of clients is not equal to the length of altTabTable, +-- we need to repopulate the array and update the UI. This function does this +-- check. +function _M.clientsHaveChanged() + local clients = _M.getClients() + return _M.tableLength(clients) ~= _M.tableLength(_M.altTabTable) +end + +function _M.createPreviewText(client) + if client.class then + return " " .. client.class + else + return " " .. client.name + end +end + +-- Preview is created here. +function _M.clientOpacity() + if not _M.settings.client_opacity then return end + + local opacity = _M.settings.client_opacity_value + if opacity > 1 then opacity = 1 end + for i,data in pairs(_M.altTabTable) do + data.client.opacity = opacity + end + + if client.focus == _M.altTabTable[_M.altTabIndex].client then + -- Let's normalize the value up to 1. + local opacityFocusSelected = _M.settings.client_opacity_value_selected + _M.settings.client_opacity_value_in_focus + if opacityFocusSelected > 1 then opacityFocusSelected = 1 end + client.focus.opacity = opacityFocusSelected + else + -- Let's normalize the value up to 1. + local opacityFocus = _M.settings.client_opacity_value_in_focus + if opacityFocus > 1 then opacityFocus = 1 end + local opacitySelected = _M.settings.client_opacity_value_selected + if opacitySelected > 1 then opacitySelected = 1 end + + client.focus.opacity = opacityFocus + _M.altTabTable[_M.altTabIndex].client.opacity = opacitySelected + end +end + +-- This is called any _M.settings.preview_box_fps milliseconds. In case the list +-- of clients is changed, we need to redraw the whole preview box. Otherwise, a +-- simple widget::updated signal is enough +function _M.updatePreview() + if _M.clientsHaveChanged() then + _M.populateAltTabTable() + _M.preview() + end + + for i = 1, #_M.preview_widgets do + _M.preview_widgets[i]:emit_signal("widget::updated") + end +end + +function _M.cycle(dir) + -- Switch to next client + _M.altTabIndex = _M.altTabIndex + dir + if _M.altTabIndex > #_M.altTabTable then + _M.altTabIndex = 1 -- wrap around + elseif _M.altTabIndex < 1 then + _M.altTabIndex = #_M.altTabTable -- wrap around + end + + _M.updatePreview() + + _M.altTabTable[_M.altTabIndex].client.minimized = false + + if not _M.settings.preview_box and not _M.settings.client_opacity then + client.focus = _M.altTabTable[_M.altTabIndex].client + end + + if _M.settings.client_opacity and _M.preview_wbox.visible then + _M.clientOpacity() + end + + if _M.settings.cycle_raise_client == true then + _M.altTabTable[_M.altTabIndex].client:raise() + end +end + +function _M.preview() + if not _M.settings.preview_box then return end + + -- Apply settings + _M.preview_wbox:set_bg(_M.settings.preview_box_bg) + _M.preview_wbox.border_color = _M.settings.preview_box_border + + -- Make the wibox the right size, based on the number of clients + local n = math.max(7, #_M.altTabTable) + local W = screen[mouse.screen].geometry.width -- + 2 * _M.preview_wbox.border_width + local w = W / n -- widget width + local h = w * 0.75 -- widget height + local textboxHeight = w * 0.125 + + local x = screen[mouse.screen].geometry.x - _M.preview_wbox.border_width + local y = screen[mouse.screen].geometry.y + (screen[mouse.screen].geometry.height - h - textboxHeight) / 2 + _M.preview_wbox:geometry({x = x, y = y, width = W, height = h + textboxHeight}) + + -- create a list that holds the clients to preview, from left to right + local leftRightTab = {} + local leftRightTabToAltTabIndex = {} -- save mapping from leftRightTab to altTabTable as well + local nLeft + local nRight + if #_M.altTabTable == 2 then + nLeft = 0 + nRight = 2 + else + nLeft = math.floor(#_M.altTabTable / 2) + nRight = math.ceil(#_M.altTabTable / 2) + end + + for i = 1, nLeft do + table.insert(leftRightTab, _M.altTabTable[#_M.altTabTable - nLeft + i].client) + table.insert(leftRightTabToAltTabIndex, #_M.altTabTable - nLeft + i) + end + for i = 1, nRight do + table.insert(leftRightTab, _M.altTabTable[i].client) + table.insert(leftRightTabToAltTabIndex, i) + end + + -- determine fontsize -> find maximum classname-length + local text, textWidth, textHeight, maxText + local maxTextWidth = 0 + local maxTextHeight = 0 + local bigFont = textboxHeight / 2 + cr:set_font_size(fontSize) + for i = 1, #leftRightTab do + text = _M.createPreviewText(leftRightTab[i]) + textWidth = cr:text_extents(text).width + textHeight = cr:text_extents(text).height + if textWidth > maxTextWidth or textHeight > maxTextHeight then + maxTextHeight = textHeight + maxTextWidth = textWidth + maxText = text + end + end + + while true do + cr:set_font_size(bigFont) + textWidth = cr:text_extents(maxText).width + textHeight = cr:text_extents(maxText).height + + if textWidth < w - textboxHeight and textHeight < textboxHeight then + break + end + + bigFont = bigFont - 1 + end + local smallFont = bigFont * _M.settings.preview_box_title_font_size_factor + + _M.preview_widgets = {} + + -- create all the widgets + for i = 1, #leftRightTab do + _M.preview_widgets[i] = wibox.widget.base.make_widget() + _M.preview_widgets[i].fit = function(preview_widget, width, height) + return w, h + end + local c = leftRightTab[i] + _M.preview_widgets[i].draw = function(preview_widget, preview_wbox, cr, width, height) + if width ~= 0 and height ~= 0 then + + local a = 0.8 + local overlay = 0.6 + local fontSize = smallFont + if c == _M.altTabTable[_M.altTabIndex].client then + a = 0.9 + overlay = 0 + fontSize = bigFont + end + + local sx, sy, tx, ty + + -- Icons + local icon + if c.icon == nil then + icon = gears.surface(gears.surface.load(_M.noicon)) + else + icon = gears.surface(c.icon) + end + + local iconboxWidth = 0.9 * textboxHeight + local iconboxHeight = iconboxWidth + + -- Titles + cr:select_font_face(unpack(_M.settings.preview_box_title_font)) + cr:set_font_face(cr:get_font_face()) + cr:set_font_size(fontSize) + + text = _M.createPreviewText(c) + textWidth = cr:text_extents(text).width + textHeight = cr:text_extents(text).height + + local titleboxWidth = textWidth + iconboxWidth + local titleboxHeight = textboxHeight + + -- Draw icons + tx = (w - titleboxWidth) / 2 + ty = h + sx = iconboxWidth / icon.width + sy = iconboxHeight / icon.height + + cr:translate(tx, ty) + cr:scale(sx, sy) + cr:set_source_surface(icon, 0, 0) + cr:paint() + cr:scale(1/sx, 1/sy) + cr:translate(-tx, -ty) + + -- Draw titles + tx = tx + iconboxWidth + ty = h + (textboxHeight + textHeight) / 2 + + cr:set_source_rgba(unpack(_M.settings.preview_box_title_color)) + cr:move_to(tx, ty) + cr:show_text(text) + cr:stroke() + + -- Draw previews + local cg = c:geometry() + if cg.width > cg.height then + sx = a * w / cg.width + sy = math.min(sx, a * h / cg.height) + else + sy = a * h / cg.height + sx = math.min(sy, a * h / cg.width) + end + + tx = (w - sx * cg.width) / 2 + ty = (h - sy * cg.height) / 2 + + local tmp = gears.surface(c.content) + cr:translate(tx, ty) + cr:scale(sx, sy) + cr:set_source_surface(tmp, 0, 0) + cr:paint() + tmp:finish() + + -- Overlays + cr:scale(1/sx, 1/sy) + cr:translate(-tx, -ty) + cr:set_source_rgba(0,0,0,overlay) + cr:rectangle(tx, ty, sx * cg.width, sy * cg.height) + cr:fill() + end + end + + -- Add mouse handler + _M.preview_widgets[i]:connect_signal("mouse::enter", function() + _M.cycle(leftRightTabToAltTabIndex[i] - _M.altTabIndex) + end) + end + + -- Spacers left and right + local spacer = wibox.widget.base.make_widget() + spacer.fit = function(leftSpacer, width, height) + return (W - w * #_M.altTabTable) / 2, _M.preview_wbox.height + end + spacer.draw = function(preview_widget, preview_wbox, cr, width, height) end + + --layout + preview_layout = wibox.layout.fixed.horizontal() + + preview_layout:add(spacer) + for i = 1, #leftRightTab do + preview_layout:add(_M.preview_widgets[i]) + end + preview_layout:add(spacer) + + _M.preview_wbox:set_widget(preview_layout) +end + + +-- This starts the timer for updating and it shows the preview UI. +function _M.showPreview() + _M.preview_live_timer.timeout = 1 / _M.settings.preview_box_fps + _M.preview_live_timer:connect_signal("timeout", _M.updatePreview) + _M.preview_live_timer:start() + + _M.preview() + _M.preview_wbox.visible = true + + _M.clientOpacity() +end + +function _M.switch(dir, mod_key1, release_key, mod_key2, key_switch) + _M.populateAltTabTable() + + if #_M.altTabTable == 0 then + return + elseif #_M.altTabTable == 1 then + _M.altTabTable[1].client.minimized = false + _M.altTabTable[1].client:raise() + return + end + + -- reset index + _M.altTabIndex = 1 + + -- preview delay timer + local previewDelay = _M.settings.preview_box_delay / 1000 + _M.previewDelayTimer = timer({timeout = previewDelay}) + _M.previewDelayTimer:connect_signal("timeout", function() + _M.previewDelayTimer:stop() + _M.showPreview() + end) + _M.previewDelayTimer:start() + + -- Now that we have collected all windows, we should run a keygrabber + -- as long as the user is alt-tabbing: + keygrabber.run( + function (mod, key, event) + -- Stop alt-tabbing when the alt-key is released + if gears.table.hasitem(mod, mod_key1) then + if (key == release_key or key == "Escape") and event == "release" then + if _M.preview_wbox.visible == true then + _M.preview_wbox.visible = false + _M.preview_live_timer:stop() + else + _M.previewDelayTimer:stop() + end + + if key == "Escape" then + for i = 1, #_M.altTabTable do + _M.altTabTable[i].client.opacity = _M.altTabTable[i].opacity + _M.altTabTable[i].client.minimized = _M.altTabTable[i].minimized + end + else + -- Raise clients in order to restore history + local c + for i = 1, _M.altTabIndex - 1 do + c = _M.altTabTable[_M.altTabIndex - i].client + if not _M.altTabTable[i].minimized then + c:raise() + client.focus = c + end + end + + -- raise chosen client on top of all + c = _M.altTabTable[_M.altTabIndex].client + c:raise() + client.focus = c + + -- restore minimized clients + for i = 1, #_M.altTabTable do + if i ~= _M.altTabIndex and _M.altTabTable[i].minimized then + _M.altTabTable[i].client.minimized = true + end + _M.altTabTable[i].client.opacity = _M.altTabTable[i].opacity + end + end + + keygrabber.stop() + + elseif key == key_switch and event == "press" then + if gears.table.hasitem(mod, mod_key2) then + -- Move to previous client on Shift-Tab + _M.cycle(-1) + else + -- Move to next client on each Tab-press + _M.cycle( 1) + end + end + end + end + ) + + -- switch to next client + _M.cycle(dir) + +end -- function altTab + +return {switch = _M.switch, settings = _M.settings} diff --git a/src/modules/brightness_osd.lua b/src/modules/brightness_osd.lua index 728eef1..177b3af 100644 --- a/src/modules/brightness_osd.lua +++ b/src/modules/brightness_osd.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -74,12 +75,12 @@ 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, handle_width = dpi(10), - handle_border_color = color["White"], + handle_border_color = cat["Text"], maximum = 100, widget = wibox.widget.slider }, @@ -99,7 +100,7 @@ return function(s) right = dpi(24), widget = wibox.container.margin }, - bg = color["Grey900"] .. "88", + bg = cat["Crust"] .. "88", widget = wibox.container.background, ontop = true, visible = true, @@ -173,7 +174,7 @@ return function(s) local brightness_container = awful.popup { widget = wibox.container.background, ontop = true, - bg = color["Grey900"] .. "00", + bg = cat["Crust"] .. "00", stretch = false, visible = false, screen = s, diff --git a/src/modules/powermenu.lua b/src/modules/powermenu.lua index 4bcb943..aec38a1 100644 --- a/src/modules/powermenu.lua +++ b/src/modules/powermenu.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -77,7 +78,7 @@ return function(s) -- TODO: using gears.color to recolor a SVG will make it look super low res -- currently I recolor it in the .svg file directly, but later implement -- a better way to recolor a SVG - -- image = gears.color.recolor_image(icon, color["Grey900"]), + -- image = gears.color.recolor_image(icon, cat["Crust"]), image = icon, resize = true, forced_height = dpi(30), @@ -100,7 +101,7 @@ return function(s) margins = dpi(10), widget = wibox.container.margin }, - fg = color["Grey900"], + fg = cat["Crust"], bg = bg_color, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 10) @@ -150,17 +151,17 @@ return function(s) -- Create the buttons with their command and name etc local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color["Blue200"], shutdown_command) - local reboot_button = button("Reboot", icondir .. "reboot.svg", color["Red200"], reboot_command) - local suspend_button = button("Suspend", icondir .. "suspend.svg", color["Yellow200"], suspend_command) - local logout_button = button("Logout", icondir .. "logout.svg", color["Green200"], logout_command) - local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command) + local reboot_button = button("Reboot", icondir .. "reboot.svg", cat["Maroon"], reboot_command) + local suspend_button = button("Suspend", icondir .. "suspend.svg", cat["Yellow"], suspend_command) + local logout_button = button("Logout", icondir .. "logout.svg", cat["Green"], logout_command) + local lock_button = button("Lock", icondir .. "lock.svg", cat["Peach"], lock_command) -- Signals to change color on hover - Hover_signal(shutdown_button.background, color["Blue200"], color["Grey900"]) - Hover_signal(reboot_button.background, color["Red200"], color["Grey900"]) - Hover_signal(suspend_button.background, color["Yellow200"], color["Grey900"]) - Hover_signal(logout_button.background, color["Green200"], color["Grey900"]) - Hover_signal(lock_button.background, color["Orange200"], color["Grey900"]) + Hover_signal(shutdown_button.background, color["Blue200"], cat["Crust"]) + Hover_signal(reboot_button.background, cat["Maroon"], cat["Crust"]) + Hover_signal(suspend_button.background, cat["Yellow"], cat["Crust"]) + Hover_signal(logout_button.background, cat["Green"], cat["Crust"]) + Hover_signal(lock_button.background, cat["Peach"], cat["Crust"]) -- The powermenu widget local powermenu = wibox.widget { diff --git a/src/modules/titlebar.lua b/src/modules/titlebar.lua index c69f4cc..4ff8d78 100644 --- a/src/modules/titlebar.lua +++ b/src/modules/titlebar.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -73,7 +74,7 @@ local create_titlebar = function(c, bg, size) { awful.titlebar.widget.closebutton(c), widget = wibox.container.background, - bg = color["Red200"], + bg = cat["Maroon"], shape = function(cr, height, width) gears.shape.rounded_rect(cr, width, height, 4) end, @@ -82,7 +83,7 @@ local create_titlebar = function(c, bg, size) { awful.titlebar.widget.maximizedbutton(c), widget = wibox.container.background, - bg = color["Yellow200"], + bg = cat["Yellow"], shape = function(cr, height, width) gears.shape.rounded_rect(cr, width, height, 4) end, @@ -91,7 +92,7 @@ local create_titlebar = function(c, bg, size) { awful.titlebar.widget.minimizebutton(c), widget = wibox.container.background, - bg = color["Green200"], + bg = cat["Green"], shape = function(cr, height, width) gears.shape.rounded_rect(cr, width, height, 4) end, @@ -119,9 +120,9 @@ local create_titlebar = function(c, bg, size) layout = wibox.layout.align.vertical, id = "main" } - Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"]) - Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"], color["Grey900"]) - Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"]) + Hover_signal(titlebar.main.margin.spacing.closebutton, cat["Maroon"], cat["Crust"]) + Hover_signal(titlebar.main.margin.spacing.maximizebutton, cat["Yellow"], cat["Crust"]) + Hover_signal(titlebar.main.margin.spacing.minimizebutton, cat["Green"], cat["Crust"]) end local create_titlebar_dialog = function(c, bg, size) @@ -137,7 +138,7 @@ local create_titlebar_dialog = function(c, bg, size) { awful.titlebar.widget.closebutton(c), widget = wibox.container.background, - bg = color["Red200"], + bg = cat["Maroon"], shape = function(cr, height, width) gears.shape.rounded_rect(cr, width, height, 4) end, @@ -146,7 +147,7 @@ local create_titlebar_dialog = function(c, bg, size) { awful.titlebar.widget.minimizebutton(c), widget = wibox.container.background, - bg = color["Green200"], + bg = cat["Green"], shape = function(cr, height, width) gears.shape.rounded_rect(cr, width, height, 4) end, @@ -174,8 +175,8 @@ local create_titlebar_dialog = function(c, bg, size) layout = wibox.layout.align.vertical, id = "main" } - Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"]) - Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"]) + Hover_signal(titlebar.main.margin.spacing.closebutton, cat["Maroon"], cat["Crust"]) + Hover_signal(titlebar.main.margin.spacing.minimizebutton, cat["Green"], cat["Crust"]) end local draw_titlebar = function(c) diff --git a/src/modules/volume_controller.lua b/src/modules/volume_controller.lua index a2b7cdb..e9f6bf2 100644 --- a/src/modules/volume_controller.lua +++ b/src/modules/volume_controller.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local naughty = require("naughty") @@ -38,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 }, @@ -150,16 +151,16 @@ return function(s) function(new_node) if node == new_node then old_bg = color["Purple200"] - old_fg = color["Grey900"] + old_fg = cat["Crust"] bg = color["Purple200"] - fg = color["Grey900"] + fg = cat["Crust"] device.background:set_bg(color["Purple200"]) - device.background:set_fg(color["Grey900"]) + 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 ) @@ -169,14 +170,14 @@ return function(s) local node_active = stdout:gsub("\n", "") if node == node_active then bg = color["Purple200"] - fg = color["Grey900"] + fg = cat["Crust"] device.background:set_bg(color["Purple200"]) - device.background:set_fg(color["Grey900"]) + 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 ) @@ -280,16 +281,16 @@ return function(s) function(new_node) if node == new_node then old_bg = color["Blue200"] - old_fg = color["Grey900"] + old_fg = cat["Crust"] bg = color["Blue200"] - fg = color["Grey900"] + fg = cat["Crust"] device.background:set_bg(color["Blue200"]) - device.background:set_fg(color["Grey900"]) + 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 ) @@ -299,14 +300,14 @@ return function(s) local node_active = stdout:gsub("\n", "") if node == node_active then bg = color["Blue200"] - fg = color["Grey900"] + fg = cat["Crust"] device.background:set_bg(color["Blue200"]) - device.background:set_fg(color["Grey900"]) + 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 ) @@ -322,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 }, @@ -341,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 }, @@ -384,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 }, @@ -431,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 }, @@ -464,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, @@ -504,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, @@ -534,11 +535,11 @@ return function(s) margins = dpi(10), widget = wibox.container.margin }, - bg = color["Grey900"], - border_color = color["Grey800"], + bg = cat["Crust"], + 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 @@ -557,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 @@ -582,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 @@ -621,13 +622,13 @@ return function(s) local volume_controller_container = awful.popup { widget = wibox.container.background, ontop = true, - bg = color["Grey900"], + bg = cat["Crust"], stretch = false, visible = false, 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 719793b..bf7c17a 100644 --- a/src/modules/volume_osd.lua +++ b/src/modules/volume_osd.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -65,12 +66,12 @@ 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, handle_width = dpi(10), - handle_border_color = color["White"], + handle_border_color = cat["Text"], maximum = 100, widget = wibox.widget.slider }, @@ -99,7 +100,7 @@ return function(s) top = dpi(2), widget = wibox.container.margin }, - bg = color["Grey900"] .. '88', + bg = cat["Crust"] .. '88', widget = wibox.container.background, ontop = true, visible = true, @@ -193,13 +194,13 @@ return function(s) local volume_container = awful.popup { widget = wibox.container.background, ontop = true, - bg = color["Grey900"] .. "00", + bg = cat["Crust"] .. "00", stretch = false, visible = false, 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/catppuccin.lua b/src/theme/catppuccin.lua index cea880d..54285dd 100644 --- a/src/theme/catppuccin.lua +++ b/src/theme/catppuccin.lua @@ -6,30 +6,30 @@ return { ['White'] = '#ffffffdd', ['Black'] = '#000000', - ['Crust'] = '#11111b', - ['Mantle'] = '#181825', - ['Base'] = '#1e1e2e', - ['Surface0'] = '#313244', - ['Surface1'] = '#45475a', - ['Surface2'] = '#585b70', - ['Overlay0'] = '#6c7086', - ['Overlay1'] = '#7f849c', - ['Overlay2'] = '#9399b2', - ['Subtext0'] = '#a6adc8', - ['Subtext1'] = '#bac2de', - ['Text'] = '#cdd6f4', - ['Lavender'] = '#b4befe', - ['Blue'] = '#89b4fa', - ['Sapphire'] = '#74c7ec', - ['Sky'] = '#89dceb', - ['Teal'] = '#94e2d5', - ['Green'] = '#a6e3a1', - ['Yellow'] = '#f9e2af', - ['Peach'] = '#fab387', - ['Maroon'] = '#eba0ac', - ['Red'] = '#f38ba8', - ['Mauve'] = '#cba6f7', - ['Pink'] = '#f5c2e7', - ['Flamingo'] = '#f2cdcd', - ['Rosewater'] = '#f5e0dc' + ['Crust'] = '#181926', + ['Mantle'] = '#1e2030', + ['Base'] = '#24273a', + ['Surface0'] = '#363a4f', + ['Surface1'] = '#494d64', + ['Surface2'] = '#5b6078', + ['Overlay0'] = '#6e738d', + ['Overlay1'] = '#8087a2', + ['Overlay2'] = '#939ab7', + ['Subtext0'] = '#a5adcb', + ['Subtext1'] = '#b8c0e0', + ['Text'] = '#cad3f5', + ['Lavender'] = '#b7bdf8', + ['Blue'] = '#8aadf4', + ['Sapphire'] = '#7dc4e4', + ['Sky'] = '#91d7e3', + ['Teal'] = '#8bd5ca', + ['Green'] = '#a6da95', + ['Yellow'] = '#eed49f', + ['Peach'] = '#f5a97f', + ['Maroon'] = '#ee99a0', + ['Red'] = '#ed8796', + ['Mauve'] = '#c6a0f6', + ['Pink'] = '#f5bde6', + ['Flamingo'] = '#f0c6c6', + ['Rosewater'] = '#f4dbd6' } diff --git a/src/theme/catppuccin_mocha.lua b/src/theme/catppuccin_mocha.lua new file mode 100644 index 0000000..cea880d --- /dev/null +++ b/src/theme/catppuccin_mocha.lua @@ -0,0 +1,35 @@ +----------------------------------------------------- +-- This is a table with almost all Material colors -- +----------------------------------------------------- + +return { + ['White'] = '#ffffffdd', + ['Black'] = '#000000', + + ['Crust'] = '#11111b', + ['Mantle'] = '#181825', + ['Base'] = '#1e1e2e', + ['Surface0'] = '#313244', + ['Surface1'] = '#45475a', + ['Surface2'] = '#585b70', + ['Overlay0'] = '#6c7086', + ['Overlay1'] = '#7f849c', + ['Overlay2'] = '#9399b2', + ['Subtext0'] = '#a6adc8', + ['Subtext1'] = '#bac2de', + ['Text'] = '#cdd6f4', + ['Lavender'] = '#b4befe', + ['Blue'] = '#89b4fa', + ['Sapphire'] = '#74c7ec', + ['Sky'] = '#89dceb', + ['Teal'] = '#94e2d5', + ['Green'] = '#a6e3a1', + ['Yellow'] = '#f9e2af', + ['Peach'] = '#fab387', + ['Maroon'] = '#eba0ac', + ['Red'] = '#f38ba8', + ['Mauve'] = '#cba6f7', + ['Pink'] = '#f5c2e7', + ['Flamingo'] = '#f2cdcd', + ['Rosewater'] = '#f5e0dc' +} diff --git a/src/theme/theme_variables.lua b/src/theme/theme_variables.lua index 83f99ae..8191b44 100644 --- a/src/theme/theme_variables.lua +++ b/src/theme/theme_variables.lua @@ -17,7 +17,7 @@ Theme.font = user_vars.font.bold Theme.bg_normal = cat["Base"] Theme.bg_focus = cat["Base"] -Theme.bg_urgent = cat["Red"] +Theme.bg_urgent = cat["Maroon"] Theme.bg_minimize = cat["Text"] Theme.bg_systray = cat["Text"] @@ -27,10 +27,10 @@ Theme.fg_urgent = cat["Text"] Theme.fg_minimize = cat["Text"] Theme.useless_gap = dpi(5) -- Change this to 0 if you dont like window gaps -Theme.border_width = dpi(2) -- Change this to 0 if you dont like borders +Theme.border_width = dpi(0) -- Change this to 0 if you dont like borders Theme.border_normal = cat["Base"] --Theme.border_focus = color["Red"] -- Doesnt work, no idea why; workaround is in signals.lua -Theme.border_marked = cat["Red"] +Theme.border_marked = cat["Maroon"] Theme.menu_submenu_icon = Theme_path .. "assets.ArchLogo.png" Theme.menu_height = dpi(40) @@ -64,7 +64,7 @@ Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg" Theme.titlebar_maximized_button_active = icondir .. "maximize.svg" Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg" -Theme.bg_systray = color["BlueGrey800"] +Theme.bg_systray = cat["Surface0"] Theme.systray_icon_spacing = dpi(10) Theme.hotkeys_bg = cat["Base"] diff --git a/src/theme/user_variables.lua b/src/theme/user_variables.lua index 3238518..506aa63 100644 --- a/src/theme/user_variables.lua +++ b/src/theme/user_variables.lua @@ -32,18 +32,22 @@ user_vars = { -- Write the terminal command to start anything here autostart = { - "killall -9 gwe redshift", - "picom --experimental-backends", + "killall -9 gwe", "gwe --hide-window &", - "redshift -x", - "redshift &", --- "plank &", +-- "nautilus --gapplication-service &", "setxkbmap -option compose:ralt", "setxkbmap -option caps:escape", "emacs --daemon=instance1", - "bash -c \"[ ! -s ~/.config/mpd/pid ] && mpd &\"", - "bash -c \"[ ! `pidof xfce-polkit` ] && /usr/lib/xfce-polkit/xfce-polkit &\"", - "bash -c \"[ ! `pidof transmission-daemon` ] && transmission-daemon\"", + "nvidia-settings", + "bash -c \"[[ ! $(pgrep picom) ]] && picom &\"", + "bash -c \"[[ ! -s ~/.config/mpd/pid ]] && mpd &\"", + "bash -c \"[[ ! $(pgrep ulauncher) ]] && ulauncher --hide-window &\"", +-- "bash -c \"[[ ! $(pidof transmission-daemon) ]] && transmission-daemon\"", + "bash -c \"[[ ! $(pidof polkit-gnome-authentication-agent-1) ]] && /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &\"", + "bash -c \"[ ! $(pgrep mpDris2) ] && mpDris2 &\"", +-- "bash -c \"[[ ! $(pgrep redshift) ]] && redshift &\"", +-- "plank &", +-- "bash -c \"[ ! `pidof xfce-polkit` ] && /usr/lib/xfce-polkit/xfce-polkit &\"", }, -- Type 'ip a' and check your wlan and ethernet name @@ -54,20 +58,20 @@ user_vars = { -- Set your font with this format: font = { - regular = "Google Sans, 14", - bold = "Google Sans, bold 14", - extrabold = "Google Sans, ExtraBold 14", - specify = "Google Sans" + regular = "Ubuntu, 11", + bold = "Ubuntu, bold 11", + extrabold = "Ubuntu, ExtraBold 11", + specify = "Ubuntu" }, -- This is your default Terminal - terminal = "alacritty", + terminal = "kitty", -- This is the modkey 'mod4' = Super/Mod/WindowsKey, 'mod3' = alt... modkey = "Mod4", -- place your wallpaper at this path with this name, you could also try to change the path - wallpaper = home .. "/.config/awesome/src/assets/fuji.jpg", + wallpaper = home .. "/Pictures/wallpapers/inazuma2x.jpg", -- Naming scheme for the powermenu, userhost = "user@hostname", fullname = "Firstname Surname", something else ... namestyle = "userhost", @@ -76,7 +80,7 @@ user_vars = { kblayout = { "us", "fr" }, -- Your filemanager that opens with super+e - file_manager = "bash -c \"wmctrl -xa nemo || nemo \"", + file_manager = "bash -c \"wmctrl -xa nautilus || nautilus \"", -- Screenshot program to make a screenshot when print is hit screenshot_program = "flameshot gui", @@ -92,11 +96,11 @@ user_vars = { -- Use xprop | grep WM_CLASS and use the *SECOND* string -- { WM_CLASS, program, name, user_icon, isSteam } dock_programs = { - { "nemo", "bash -c \"wmctrl -xa nemo || nemo\"", "Files" }, - { "Alacritty", "alacritty", "Alacritty" }, + { "nautilus", "bash -c \"wmctrl -xa nautilus || nautilus\"", "Files", "/usr/share/icons/Papirus-Dark/128x128/apps/org.gnome.Nautilus.svg" }, + { "kitty", "kitty", "Kitty" }, -- { "Firefox Beta", "firefox-beta", "Firefox" }, { "firefox", "firefox-developer-edition --class='firefox-developer-edition'", "Firefox", "/usr/share/icons/Papirus-Dark/128x128/apps/firefox-developer-icon.svg" }, - { "brave-browser-beta", "brave-beta", "Brave" }, + { "Thorium-browser-unstable", "thorium-browser", "thorium-browser-unstable", "/usr/share/icons/Papirus-Dark/128x128/apps/Thorium-browser-unstable.svg" }, { "osu!.exe", "/home/eric/.wineosu/osu/start.sh", "osu!", "/home/eric/.wineosu/osu/icon.png"}, { "osu!", "osu-lazer", "osu-lazer"}, { "discord", "discord", "Discord" } diff --git a/src/widgets/audio.lua b/src/widgets/audio.lua index a584772..c3f59a7 100644 --- a/src/widgets/audio.lua +++ b/src/widgets/audio.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -47,8 +48,8 @@ return function(s) right = dpi(8), widget = wibox.container.margin }, - bg = color["Yellow200"], - fg = color["Grey900"], + bg = cat["Yellow"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -77,7 +78,7 @@ return function(s) end audio_widget.container.audio_layout.label:set_text(volume .. "%") audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image( - gears.color.recolor_image(icon .. ".svg", color["Grey900"])) + gears.color.recolor_image(icon .. ".svg", cat["Crust"])) awesome.emit_signal("get::volume", volume) end ) @@ -91,7 +92,7 @@ return function(s) audio_widget.container.audio_layout.label.visible = false audio_widget.container:set_right(0) audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image( - gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"])) + gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", cat["Crust"])) awesome.emit_signal("get::volume_mute", true) else audio_widget.container:set_right(10) @@ -103,7 +104,7 @@ return function(s) end -- Signals - Hover_signal(audio_widget, color["Yellow200"], color["Grey900"]) + Hover_signal(audio_widget, cat["Yellow"], cat["Crust"]) audio_widget:connect_signal( "button::press", diff --git a/src/widgets/battery.lua b/src/widgets/battery.lua index ea80907..100ef5e 100644 --- a/src/widgets/battery.lua +++ b/src/widgets/battery.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local naughty = require("naughty") @@ -51,7 +52,7 @@ return function() widget = wibox.container.margin }, bg = color["Purple200"], - fg = color["Grey900"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -96,7 +97,7 @@ return function() local battery_warning = function() naughty.notification { - icon = gears.color.recolor_image(icondir .. "battery-alert.svg", color["White"]), + icon = gears.color.recolor_image(icondir .. "battery-alert.svg", cat["Text"]), app_name = "System notification", title = "Battery is low", message = "Battery is almost empty", @@ -168,7 +169,7 @@ return function() ) end - Hover_signal(battery_widget, color["Purple200"], color["Grey900"]) + Hover_signal(battery_widget, color["Purple200"], cat["Crust"]) battery_widget:connect_signal( 'button::press', diff --git a/src/widgets/bluetooth.lua b/src/widgets/bluetooth.lua index 0d22343..444bc47 100644 --- a/src/widgets/bluetooth.lua +++ b/src/widgets/bluetooth.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local naughty = require("naughty") @@ -34,7 +35,7 @@ return function() widget = wibox.container.margin }, bg = color["Blue200"], - fg = color["Grey900"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -76,13 +77,13 @@ return function() end ) end - bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"])) + bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", cat["Crust"])) end, bluetooth_widget ) -- Signals - Hover_signal(bluetooth_widget, color["Blue200"], color["Grey900"]) + Hover_signal(bluetooth_widget, color["Blue200"], cat["Crust"]) bluetooth_widget:connect_signal( "button::press", diff --git a/src/widgets/clock.lua b/src/widgets/clock.lua index bf9b4f5..a4553e1 100644 --- a/src/widgets/clock.lua +++ b/src/widgets/clock.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -23,7 +24,7 @@ return function() { { id = "icon", - image = gears.color.recolor_image(icondir .. "clock.svg", color["Grey900"]), + image = gears.color.recolor_image(icondir .. "clock.svg", cat["Crust"]), widget = wibox.widget.imagebox, resize = false }, @@ -50,15 +51,15 @@ return function() right = dpi(8), widget = wibox.container.margin }, - bg = color["Orange200"], - fg = color["Grey900"], + bg = cat["Peach"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, widget = wibox.container.background } - Hover_signal(clock_widget, color["Orange200"], color["Grey900"]) + Hover_signal(clock_widget, cat["Peach"], cat["Crust"]) return clock_widget end diff --git a/src/widgets/cpu_info.lua b/src/widgets/cpu_info.lua index 697d874..89d518c 100644 --- a/src/widgets/cpu_info.lua +++ b/src/widgets/cpu_info.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local watch = awful.widget.watch @@ -24,7 +25,7 @@ return function(widget, clock_mode) { id = "icon", widget = wibox.widget.imagebox, - image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]), + image = gears.color.recolor_image(icon_dir .. "cpu.svg", cat["Crust"]), resize = false }, id = "icon_layout", @@ -50,7 +51,7 @@ return function(widget, clock_mode) widget = wibox.container.margin }, bg = color["Blue200"], - fg = color["Grey900"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -89,8 +90,8 @@ return function(widget, clock_mode) right = dpi(8), widget = wibox.container.margin }, - bg = color["Green200"], - fg = color["Grey900"], + bg = cat["Green"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -131,7 +132,7 @@ return function(widget, clock_mode) widget = wibox.container.margin }, bg = color["Purple200"], - fg = color["Grey900"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -172,16 +173,16 @@ return function(widget, clock_mode) local temp_num = tonumber(stdout:match("%d+")) if temp_num < 50 then - temp_color = color["Green200"] + temp_color = cat["Green"] temp_icon = icon_dir .. "thermometer-low.svg" elseif temp_num >= 50 and temp_num < 80 then - temp_color = color["Orange200"] + temp_color = cat["Peach"] temp_icon = icon_dir .. "thermometer.svg" elseif temp_num >= 80 then - temp_color = color["Red200"] + temp_color = cat["Maroon"] temp_icon = icon_dir .. "thermometer-high.svg" end - Hover_signal(cpu_temp, temp_color, color["Grey900"]) + Hover_signal(cpu_temp, temp_color, cat["Crust"]) cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon) cpu_temp:set_bg(temp_color) cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C" @@ -212,8 +213,8 @@ return function(widget, clock_mode) end ) - Hover_signal(cpu_usage_widget, color["Blue200"], color["Grey900"]) - Hover_signal(cpu_clock, color["Purple200"], color["Grey900"]) + Hover_signal(cpu_usage_widget, color["Blue200"], cat["Crust"]) + Hover_signal(cpu_clock, color["Purple200"], cat["Crust"]) if widget == "usage" then return cpu_usage_widget diff --git a/src/widgets/date.lua b/src/widgets/date.lua index 5ce7037..343c80c 100644 --- a/src/widgets/date.lua +++ b/src/widgets/date.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -23,7 +24,7 @@ return function() { { id = "icon", - image = gears.color.recolor_image(icondir .. "calendar.svg", color["Grey900"]), + image = gears.color.recolor_image(icondir .. "calendar.svg", cat["Crust"]), widget = wibox.widget.imagebox, resize = false }, @@ -50,7 +51,7 @@ return function() widget = wibox.container.margin }, bg = color["Teal200"], - fg = color["Grey900"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -72,7 +73,7 @@ return function() } -- Signals - Hover_signal(date_widget, color["Teal200"], color["Grey900"]) + Hover_signal(date_widget, color["Teal200"], cat["Crust"]) date_widget:connect_signal( "mouse::enter", diff --git a/src/widgets/gpu_info.lua b/src/widgets/gpu_info.lua index 7bb241a..51b0f66 100644 --- a/src/widgets/gpu_info.lua +++ b/src/widgets/gpu_info.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local watch = awful.widget.watch @@ -22,7 +23,7 @@ return function(widget) { id = "icon", widget = wibox.widget.imagebox, - image = gears.color.recolor_image(icon_dir .. "gpu.svg", color["Grey900"]), + image = gears.color.recolor_image(icon_dir .. "gpu.svg", cat["Crust"]), resize = false }, id = "icon_layout", @@ -47,14 +48,14 @@ return function(widget) right = dpi(8), widget = wibox.container.margin }, - bg = color["Green200"], - fg = color["Grey900"], + bg = cat["Green"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, widget = wibox.container.background } - Hover_signal(gpu_usage_widget, color["Green200"], color["Grey900"]) + Hover_signal(gpu_usage_widget, cat["Green"], cat["Crust"]) local gpu_temp_widget = wibox.widget { { @@ -64,7 +65,7 @@ return function(widget) { id = "icon", widget = wibox.widget.imagebox, - image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]), + image = gears.color.recolor_image(icon_dir .. "cpu.svg", cat["Crust"]), resize = false }, id = "icon_layout", @@ -90,7 +91,7 @@ return function(widget) widget = wibox.container.margin }, bg = color["Blue200"], - fg = color["Grey900"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -120,21 +121,21 @@ return function(widget) if temp_num then if temp_num < 50 then - temp_color = color["Green200"] + temp_color = cat["Green"] temp_icon = icon_dir .. "thermometer-low.svg" elseif temp_num >= 50 and temp_num < 80 then - temp_color = color["Orange200"] + temp_color = cat["Peach"] temp_icon = icon_dir .. "thermometer.svg" elseif temp_num >= 80 then - temp_color = color["Red200"] + temp_color = cat["Maroon"] temp_icon = icon_dir .. "thermometer-high.svg" end else temp_num = "NaN" - temp_color = color["Green200"] + temp_color = cat["Green"] temp_icon = icon_dir .. "thermometer-low.svg" end - Hover_signal(gpu_temp_widget, temp_color, color["Grey900"]) + Hover_signal(gpu_temp_widget, temp_color, cat["Crust"]) gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon) gpu_temp_widget:set_bg(temp_color) gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C" diff --git a/src/widgets/kblayout.lua b/src/widgets/kblayout.lua index 428ee72..34a5f27 100644 --- a/src/widgets/kblayout.lua +++ b/src/widgets/kblayout.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -23,7 +24,7 @@ return function(s) id = "icon", widget = wibox.widget.imagebox, resize = false, - image = gears.color.recolor_image(icondir .. "keyboard.svg", color["Grey900"]) + image = gears.color.recolor_image(icondir .. "keyboard.svg", cat["Crust"]) }, id = "icon_layout", widget = wibox.container.place @@ -47,8 +48,8 @@ return function(s) right = dpi(8), widget = wibox.container.margin }, - bg = color["Green200"], - fg = color["Grey900"], + bg = cat["Green"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -182,7 +183,7 @@ return function(s) font = user_vars.font.extrabold, id = "shortname" }, - fg = color["Red200"], + fg = cat["Maroon"], widget = wibox.container.background, id = "background2" }, @@ -208,8 +209,8 @@ return function(s) shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 8) end, - bg = color["Grey800"], - fg = color["White"], + bg = cat["Surface0"], + fg = cat["Text"], widget = wibox.container.background, id = "background", keymap = keymap @@ -225,11 +226,11 @@ return function(s) local layout = stdout:gsub("\n", "") if kb_layout_item.keymap == layout then kb_layout_item.bg = color["DeepPurple200"] - kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"] - kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"] + 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:get_children_by_id("background2")[1].fg = color["Red200"] + 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 end @@ -280,10 +281,10 @@ return function(s) gears.shape.rounded_rect(cr, width, height, 12) end, widget = wibox.container.background, - bg = color["Grey900"], - fg = color["White"], + 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, @@ -296,7 +297,7 @@ return function(s) function() mousegrabber.run( function() - kblayout_widget.bg = color["Green200"] + kblayout_widget.bg = cat["Green"] awesome.emit_signal("kblayout::hide:kbmenu") mousegrabber.stop() return true @@ -352,7 +353,7 @@ return function(s) ) -- Signals - Hover_signal(kblayout_widget, color["Green200"], color["Grey900"]) + Hover_signal(kblayout_widget, cat["Green"], cat["Crust"]) local kblayout_keygrabber = awful.keygrabber { autostart = false, diff --git a/src/widgets/layout_list.lua b/src/widgets/layout_list.lua index 7f8d5ca..4371a1d 100644 --- a/src/widgets/layout_list.lua +++ b/src/widgets/layout_list.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -35,7 +36,7 @@ return function(s) } -- Signals - Hover_signal(layout, color["LightBlue200"], color["Grey900"]) + Hover_signal(layout, color["LightBlue200"], cat["Crust"]) layout:connect_signal( "button::press", diff --git a/src/widgets/mpris.lua b/src/widgets/mpris.lua new file mode 100644 index 0000000..9c552ae --- /dev/null +++ b/src/widgets/mpris.lua @@ -0,0 +1,126 @@ +--------------------------------- +-- This is the mPris2 widget -- +--------------------------------- + +-- 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 +local gears = require("gears") +local watch = awful.widget.watch +local wibox = require("wibox") +require("src.core.signals") + +-- Icon directory path +local icon_dir = awful.util.getdir("config") .. "src/assets/icons/mpris/" + +-- Returns the mPris widget +return function() + + local mpris_widget = wibox.widget { + { + { + { + { + { + id = "icon", + image = gears.color.recolor_image(icon_dir .. "disc" .. ".png", cat["Crust"]), + widget = wibox.widget.imagebox, + resize = true + }, + id = "icon_layout", + widget = wibox.container.place + }, + widget = wibox.container.margin, + id = "icon_margin" + }, + spacing = dpi(10), + { + { + { + 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(10), + widget = wibox.container.margin + }, + bg = cat["Lavender"], + fg = cat["Crust"], + 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"]) + + watch( + [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status_desc_only.sh" ]], + 10, + function(_, 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" ]], + 10, + function(_, stdout) + 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 + ) + + return mpris_widget +end + diff --git a/src/widgets/network.lua b/src/widgets/network.lua index 60f2db3..5c5e5fa 100644 --- a/src/widgets/network.lua +++ b/src/widgets/network.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local naughty = require("naughty") @@ -34,7 +35,7 @@ return function() { { id = 'icon', - image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", color["Grey900"]), + image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", cat["Crust"]), widget = wibox.widget.imagebox, resize = false }, @@ -61,8 +62,8 @@ return function() right = dpi(8), widget = wibox.container.margin }, - bg = color["Red200"], - fg = color["Grey900"], + bg = cat["Maroon"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -111,7 +112,7 @@ return function() text = message, title = title, app_name = app_name, - icon = gears.color.recolor_image(icon, color["White"]), + icon = gears.color.recolor_image(icon, cat["Text"]), timeout = 3 } end @@ -165,7 +166,7 @@ return function() update_wireless_data(false) end network_widget.container.network_layout.spacing = dpi(8) - network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"])) + network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", cat["Crust"])) end ) end @@ -261,7 +262,7 @@ return function() network_widget.container.network_layout.label.visible = false update_tooltip("Network unreachable") network_widget.container.network_layout.spacing = dpi(0) - network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"])) + network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", cat["Crust"])) end local check_network_mode = function() @@ -324,7 +325,7 @@ return function() } -- Signals - Hover_signal(network_widget, color["Red200"], color["Grey900"]) + Hover_signal(network_widget, cat["Maroon"], cat["Crust"]) network_widget:connect_signal( "button::press", diff --git a/src/widgets/notification_list.lua b/src/widgets/notification_list.lua new file mode 100644 index 0000000..0462f8a --- /dev/null +++ b/src/widgets/notification_list.lua @@ -0,0 +1,80 @@ +--------------------------------- +-- This is the mPris2 widget -- +--------------------------------- + +-- 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 +local gears = require("gears") +local wibox = require("wibox") +require("src.core.signals") + +-- Icon directory path +local icon_dir = awful.util.getdir("config") .. "src/assets/icons/mpris/" + +-- Returns the mPris widget +return function() + + local notification_list = wibox.widget { + { + { + { + { + { + id = "icon", + image = gears.color.recolor_image(icon_dir .. "disc" .. ".png", cat["Crust"]), + widget = wibox.widget.imagebox, + resize = true + }, + id = "icon_layout", + widget = wibox.container.place + }, + widget = wibox.container.margin, + id = "icon_margin" + }, + spacing = dpi(10), + { + { + { + 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(10), + widget = wibox.container.margin + }, + bg = cat["Lavender"], + fg = cat["Crust"], + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end, + forced_height = 65, + widget = wibox.container.background + } + + Hover_signal(notification_list, cat["Lavender"], cat["Crust"]) + + return notification_list +end + diff --git a/src/widgets/power.lua b/src/widgets/power.lua index 95812ab..fc32225 100644 --- a/src/widgets/power.lua +++ b/src/widgets/power.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -22,7 +23,7 @@ return function() { { id = "icon", - image = gears.color.recolor_image(icondir .. "power.svg", color["Grey900"]), + image = gears.color.recolor_image(icondir .. "power.svg", cat["Crust"]), widget = wibox.widget.imagebox, resize = false }, @@ -41,8 +42,8 @@ return function() right = dpi(8), widget = wibox.container.margin }, - bg = color["Red200"], - fg = color["Grey800"], + bg = cat["Maroon"], + fg = cat["Surface0"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -50,7 +51,7 @@ return function() } -- Signals - Hover_signal(power_widget, color["Red200"], color["Grey900"]) + Hover_signal(power_widget, cat["Maroon"], cat["Crust"]) power_widget:connect_signal( "button::release", diff --git a/src/widgets/ram_info.lua b/src/widgets/ram_info.lua index 09b9c2e..1a3d797 100644 --- a/src/widgets/ram_info.lua +++ b/src/widgets/ram_info.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local watch = awful.widget.watch @@ -22,7 +23,7 @@ return function() { id = "icon", widget = wibox.widget.imagebox, - image = gears.color.recolor_image(icon_dir .. "ram.svg", color["Grey900"]), + image = gears.color.recolor_image(icon_dir .. "ram.svg", cat["Crust"]), resize = false }, id = "icon_layout", @@ -47,15 +48,15 @@ return function() right = dpi(8), widget = wibox.container.margin }, - bg = color["Red200"], - fg = color["Grey900"], + bg = cat["Maroon"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, widget = wibox.container.background } - Hover_signal(ram_widget, color["Red200"], color["Grey900"]) + Hover_signal(ram_widget, cat["Maroon"], cat["Crust"]) watch( [[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]], diff --git a/src/widgets/systray.lua b/src/widgets/systray.lua index 95111d7..f5c371a 100644 --- a/src/widgets/systray.lua +++ b/src/widgets/systray.lua @@ -5,6 +5,7 @@ -- Awesome Libs local awful = require("awful") local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") @@ -27,10 +28,10 @@ return function(s) shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, - bg = color["BlueGrey800"] + bg = cat["Surface0"] } -- Signals - Hover_signal(systray.container, color["Red200"], color["Grey900"]) + Hover_signal(systray.container, cat["Maroon"], cat["Crust"]) awesome.connect_signal("systray::update", function() local num_entries = awesome.systray() diff --git a/src/widgets/taglist.lua b/src/widgets/taglist.lua index 97798bd..14e97c9 100644 --- a/src/widgets/taglist.lua +++ b/src/widgets/taglist.lua @@ -8,6 +8,7 @@ local awful = require("awful") local gears = require("gears") local dpi = require("beautiful").xresources.apply_dpi local color = require("src.theme.colors") +local cat = require("src.theme.catppuccin") require("src.tools.icon_handler") local list_update = function(widget, buttons, label, data, objects) @@ -36,7 +37,7 @@ local list_update = function(widget, buttons, label, data, objects) id = "container", layout = wibox.layout.fixed.horizontal }, - fg = color["White"], + fg = cat["Text"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, @@ -68,10 +69,10 @@ local list_update = function(widget, buttons, label, data, objects) tag_widget.container.margin.label:set_text(object.index) if object.urgent == true then tag_widget:set_bg(color["RedA200"]) - tag_widget:set_fg(color["Grey900"]) + tag_widget:set_fg(cat["Crust"]) elseif object == awful.screen.focused().selected_tag then - tag_widget:set_bg(color["White"]) - tag_widget:set_fg(color["Grey900"]) + tag_widget:set_bg(cat["Text"]) + tag_widget:set_fg(cat["Crust"]) else tag_widget:set_bg("#3A475C") end @@ -108,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 @@ -124,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 @@ -135,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 fdc219a..fea0739 100644 --- a/src/widgets/tasklist.lua +++ b/src/widgets/tasklist.lua @@ -8,6 +8,7 @@ local wibox = require('wibox') local dpi = require('beautiful').xresources.apply_dpi local gears = require('gears') local color = require('src.theme.colors') +local cat = require("src.theme.catppuccin") local list_update = function(widget, buttons, label, data, objects) widget:reset() @@ -48,23 +49,23 @@ local list_update = function(widget, buttons, label, data, objects) widget = wibox.container.margin, id = "container" }, - bg = color["White"], - fg = color["Grey900"], + bg = cat["Text"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, 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 @@ -100,14 +101,14 @@ 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(color["White"]) - task_widget:set_fg(color["Grey900"]) + task_widget:set_bg(cat["Text"]) + task_widget:set_fg(cat["Crust"]) task_widget.container.layout_it.title:set_text(text) else task_widget:set_bg("#3A475C") @@ -124,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 @@ -140,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 @@ -151,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