From 8d5ee408cf68dc6956211a57a09d99023a30fe96 Mon Sep 17 00:00:00 2001 From: Hydroxycarbamide Date: Wed, 14 Sep 2022 19:25:13 +0200 Subject: [PATCH 1/5] Update with mpris, Macchiato catppuccin colors and awesome_switcher --- bin/bsplock | 2 +- bin/get_mpris_status.sh | 99 ++++++ bin/get_mpris_status_hide_album.sh | 98 ++++++ bin/get_spotify_status.sh | 51 +++ bin/scroll_mpris_status.sh | 22 ++ bin/scroll_spotify_status.sh | 12 + crylia_bar/center_bar.lua | 6 +- crylia_bar/init.lua | 15 +- crylia_bar/left_bar.lua | 6 +- crylia_bar/right_bar.lua | 6 +- mappings/global_keys.lua | 21 +- src/assets/icons/mpris/cd.svg | 10 + src/assets/icons/mpris/cd24x24.svg | 6 + src/core/notifications.lua | 14 +- src/core/rules.lua | 12 +- src/core/signals.lua | 2 +- src/modules/awesome_switcher.lua | 532 +++++++++++++++++++++++++++++ src/theme/catppuccin.lua | 52 +-- src/theme/catppuccin_mocha.lua | 35 ++ src/theme/theme_variables.lua | 2 +- src/theme/user_variables.lua | 39 ++- src/widgets/mpris.lua | 75 ++++ 22 files changed, 1038 insertions(+), 79 deletions(-) create mode 100755 bin/get_mpris_status.sh create mode 100755 bin/get_mpris_status_hide_album.sh create mode 100755 bin/get_spotify_status.sh create mode 100755 bin/scroll_mpris_status.sh create mode 100755 bin/scroll_spotify_status.sh create mode 100644 src/assets/icons/mpris/cd.svg create mode 100644 src/assets/icons/mpris/cd24x24.svg create mode 100644 src/modules/awesome_switcher.lua create mode 100644 src/theme/catppuccin_mocha.lua create mode 100644 src/widgets/mpris.lua 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/get_mpris_status.sh b/bin/get_mpris_status.sh new file mode 100755 index 0000000..450e806 --- /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 + artist=$(extract_meta artist) + [ -z "$artist" ] && artist=$(extract_meta albumArtist) + + if [ -n "$artist" ]; then + album=$(extract_meta album) + [ -n "$album" ] && echo -n "  $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_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_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_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/center_bar.lua b/crylia_bar/center_bar.lua index 441fb2b..4d65b43 100644 --- a/crylia_bar/center_bar.lua +++ b/crylia_bar/center_bar.lua @@ -17,19 +17,19 @@ return function(s, widgets) bg = color["Grey900"], 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/init.lua b/crylia_bar/init.lua index a6dda7c..7cf8768 100644 --- a/crylia_bar/init.lua +++ b/crylia_bar/init.lua @@ -36,30 +36,31 @@ 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.mpris, 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 }) end end ) diff --git a/crylia_bar/left_bar.lua b/crylia_bar/left_bar.lua index 93f2031..98246fe 100644 --- a/crylia_bar/left_bar.lua +++ b/crylia_bar/left_bar.lua @@ -17,19 +17,19 @@ return function(s, widgets) bg = color["Grey900"], 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..2c76b38 100644 --- a/crylia_bar/right_bar.lua +++ b/crylia_bar/right_bar.lua @@ -16,19 +16,19 @@ return function(s, widgets) bg = color["Grey900"], 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..9898de0 100644 --- a/mappings/global_keys.lua +++ b/mappings/global_keys.lua @@ -5,6 +5,7 @@ local hotkeys_popup = require("awful.hotkeys_popup") local ruled = require("ruled") local modkey = user_vars.modkey +local switcher = require("src.modules.awesome_switcher") return gears.table.join( awful.key( @@ -48,14 +49,18 @@ return gears.table.join( end, { 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() +-- 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", 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/core/notifications.lua b/src/core/notifications.lua index be337e8..bc70491 100644 --- a/src/core/notifications.lua +++ b/src/core/notifications.lua @@ -44,17 +44,17 @@ naughty.connect_signal( "request::display", function(n) if n.urgency == "critical" then - n.title = string.format("%s", + 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.message = string.format("%s", cat["Red"], n.message) or "" + n.app_name = string.format("%s", cat["Red"], 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", 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/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..e0b7411 100644 --- a/src/theme/theme_variables.lua +++ b/src/theme/theme_variables.lua @@ -27,7 +27,7 @@ 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"] diff --git a/src/theme/user_variables.lua b/src/theme/user_variables.lua index 3238518..6a84a23 100644 --- a/src/theme/user_variables.lua +++ b/src/theme/user_variables.lua @@ -32,18 +32,21 @@ 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\"", + "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 +57,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 +79,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 +95,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/mpris.lua b/src/widgets/mpris.lua new file mode 100644 index 0000000..fdc4ed1 --- /dev/null +++ b/src/widgets/mpris.lua @@ -0,0 +1,75 @@ +--------------------------------- +-- This is the mPris2 widget -- +--------------------------------- + +-- Awesome Libs +local awful = require("awful") +local color = require("src.theme.colors") +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", +-- widget = wibox.widget.imagebox, +-- image = gears.color.recolor_image(icon_dir .. "cd.svg", color["Grey900"]), +-- resize = false +-- }, +-- id = "icon_layout", +-- widget = wibox.container.place +-- }, +-- top = dpi(2), +-- widget = wibox.container.margin, +-- id = "icon_margin" +-- }, +-- spacing = dpi(10), + { + id = "label", + align = "center", + valign = "center", + font = "UbuntuMono Nerd Font, Bold", + widget = wibox.widget.textbox + }, + id = "mpris_layout", + layout = wibox.layout.fixed.horizontal + }, + id = "container", + left = dpi(8), + right = dpi(8), + widget = wibox.container.margin + }, + bg = color["Orange200"], + fg = color["Grey900"], + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end, + widget = wibox.container.background + } + + Hover_signal(mpris_widget, color["Orange200"], color["Grey900"]) + + watch( + [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status_hide_album.sh" ]], + 5, + function(_, stdout) + mpris_widget.container.mpris_layout.label.text = stdout:gsub("\n", "") + awesome.emit_signal("update::mpris_widget", tostring(stdout)) + end + ) + + return mpris_widget +end + From 0ff84042abf1d94678f583866177d84a2202a337 Mon Sep 17 00:00:00 2001 From: Hydroxycarbamide Date: Thu, 15 Sep 2022 00:25:31 +0200 Subject: [PATCH 2/5] Update mpris plugin with cover art --- bin/get_mpris_art.sh | 22 +++++++++ bin/get_mpris_status.sh | 6 +-- crylia_bar/bottom_right_bar.lua | 85 +++++++++++++++++++++++++++++++++ crylia_bar/init.lua | 3 +- src/widgets/mpris.lua | 56 +++++++++++++--------- 5 files changed, 145 insertions(+), 27 deletions(-) create mode 100755 bin/get_mpris_art.sh create mode 100644 crylia_bar/bottom_right_bar.lua diff --git a/bin/get_mpris_art.sh b/bin/get_mpris_art.sh new file mode 100755 index 0000000..ad0dbf8 --- /dev/null +++ b/bin/get_mpris_art.sh @@ -0,0 +1,22 @@ + +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 + echo $(playerctl -p $player metadata | grep artUrl | awk '{$1=$2=""; print $0}') + 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 + echo $(playerctl -p ${PAUSED[0]} metadata | grep artUrl | awk '{$1=$2=""; print $0}') +fi + diff --git a/bin/get_mpris_status.sh b/bin/get_mpris_status.sh index 450e806..db5cc04 100755 --- a/bin/get_mpris_status.sh +++ b/bin/get_mpris_status.sh @@ -35,17 +35,17 @@ get_info() { # 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" ] && echo -n "  $album " + [ -n "$album" ] && printf "\nfrom $album" - echo -n " ﴁ $artist  " + printf "\nby $artist" fi - echo "$title" return 0 fi diff --git a/crylia_bar/bottom_right_bar.lua b/crylia_bar/bottom_right_bar.lua new file mode 100644 index 0000000..3eda2ec --- /dev/null +++ b/crylia_bar/bottom_right_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_right = awful.popup { + widget = wibox.container.background, + ontop = false, + bg = color["Grey900"], + visible = true, + screen = s, + maximum_height = dpi(80), + 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_right:struts { + bottom = 85 + } + + 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_right:setup { + nil, + nil, + prepare_widgets(widgets), + layout = wibox.layout.align.horizontal + } +end diff --git a/crylia_bar/init.lua b/crylia_bar/init.lua index 7cf8768..1600e8f 100644 --- a/crylia_bar/init.lua +++ b/crylia_bar/init.lua @@ -46,7 +46,7 @@ awful.screen.connect_for_each_screen( 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.mpris, s.audio, s.date, s.clock, s.powerbutton }) + require("crylia_bar.right_bar")(s, { s.audio, s.date, s.clock, s.powerbutton }) --require("crylia_bar.dock")(s, user_vars.dock_programs) end @@ -61,6 +61,7 @@ awful.screen.connect_for_each_screen( 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.gpu_temp, s.cpu_temp, s.ram_info, s.kblayout, s.bluetooth, s.network, s.clock, s.powerbutton }) + require("crylia_bar.bottom_right_bar")(s, { s.mpris }) end end ) diff --git a/src/widgets/mpris.lua b/src/widgets/mpris.lua index fdc4ed1..9cb39ff 100644 --- a/src/widgets/mpris.lua +++ b/src/widgets/mpris.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 @@ -20,38 +21,38 @@ return function() local mpris_widget = wibox.widget { { { --- { --- { --- { --- id = "icon", --- widget = wibox.widget.imagebox, --- image = gears.color.recolor_image(icon_dir .. "cd.svg", color["Grey900"]), --- resize = false --- }, --- id = "icon_layout", --- widget = wibox.container.place --- }, --- top = dpi(2), --- widget = wibox.container.margin, --- id = "icon_margin" --- }, --- spacing = dpi(10), + { + { + { + id = "icon", + widget = wibox.widget.imagebox, + resize = true + }, + id = "icon_layout", + clip_shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 2) + end, + widget = wibox.container.place + }, + widget = wibox.container.margin, + id = "icon_margin" + }, + spacing = dpi(10), { id = "label", - align = "center", + font = "UbuntuMono Nerd Font, Bold 8", + align = "left", valign = "center", - font = "UbuntuMono Nerd Font, Bold", widget = wibox.widget.textbox }, id = "mpris_layout", layout = wibox.layout.fixed.horizontal }, id = "container", - left = dpi(8), right = dpi(8), widget = wibox.container.margin }, - bg = color["Orange200"], + bg = cat["Lavender"], fg = color["Grey900"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) @@ -59,13 +60,22 @@ return function() widget = wibox.container.background } - Hover_signal(mpris_widget, color["Orange200"], color["Grey900"]) + Hover_signal(mpris_widget, cat["Lavender"], color["Grey900"]) watch( - [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status_hide_album.sh" ]], + [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status.sh" ]], 5, function(_, stdout) - mpris_widget.container.mpris_layout.label.text = stdout:gsub("\n", "") + mpris_widget.container.mpris_layout.label.text = stdout + awesome.emit_signal("update::mpris_widget", tostring(stdout)) + end + ) + + watch( + [[ bash -c "$HOME/.config/awesome/bin/get_mpris_art.sh" ]], + 5, + function(_, stdout) + mpris_widget.container.mpris_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(stdout:gsub("\n", ""):gsub("file://", ""))) awesome.emit_signal("update::mpris_widget", tostring(stdout)) end ) From b725dccade94ecfc28e5ae28eabb58d6be722486 Mon Sep 17 00:00:00 2001 From: Hydroxycarbamide Date: Thu, 15 Sep 2022 00:44:25 +0200 Subject: [PATCH 3/5] Update colors with catppuccin --- crylia_bar/bottom_right_bar.lua | 2 +- crylia_bar/center_bar.lua | 3 ++- crylia_bar/dock.lua | 7 ++++--- crylia_bar/left_bar.lua | 3 ++- crylia_bar/right_bar.lua | 3 ++- src/core/notifications.lua | 18 +++++++++--------- src/modules/brightness_osd.lua | 7 ++++--- src/modules/powermenu.lua | 23 ++++++++++++----------- src/modules/titlebar.lua | 21 +++++++++++---------- src/modules/volume_controller.lua | 25 +++++++++++++------------ src/modules/volume_osd.lua | 7 ++++--- src/theme/theme_variables.lua | 6 +++--- src/theme/user_variables.lua | 2 +- src/widgets/audio.lua | 11 ++++++----- src/widgets/battery.lua | 7 ++++--- src/widgets/bluetooth.lua | 7 ++++--- src/widgets/clock.lua | 9 +++++---- src/widgets/cpu_info.lua | 23 ++++++++++++----------- src/widgets/date.lua | 7 ++++--- src/widgets/gpu_info.lua | 23 ++++++++++++----------- src/widgets/kblayout.lua | 25 +++++++++++++------------ src/widgets/layout_list.lua | 3 ++- src/widgets/mpris.lua | 4 ++-- src/widgets/network.lua | 15 ++++++++------- src/widgets/power.lua | 7 ++++--- src/widgets/ram_info.lua | 9 +++++---- src/widgets/systray.lua | 5 +++-- src/widgets/taglist.lua | 9 +++++---- src/widgets/tasklist.lua | 9 +++++---- 29 files changed, 162 insertions(+), 138 deletions(-) diff --git a/crylia_bar/bottom_right_bar.lua b/crylia_bar/bottom_right_bar.lua index 3eda2ec..3758d7d 100644 --- a/crylia_bar/bottom_right_bar.lua +++ b/crylia_bar/bottom_right_bar.lua @@ -14,7 +14,7 @@ return function(s, widgets) local bottom_right = awful.popup { widget = wibox.container.background, ontop = false, - bg = color["Grey900"], + bg = cat["Crust"], visible = true, screen = s, maximum_height = dpi(80), diff --git a/crylia_bar/center_bar.lua b/crylia_bar/center_bar.lua index 4d65b43..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,7 +15,7 @@ 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(5) }) end, diff --git a/crylia_bar/dock.lua b/crylia_bar/dock.lua index 55d028d..504c89f 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" }, @@ -50,7 +51,7 @@ return function(screen, programs) end end - Hover_signal(dock_element.background, color["Grey800"], color["White"]) + Hover_signal(dock_element.background, color["Grey800"], 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/left_bar.lua b/crylia_bar/left_bar.lua index 98246fe..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,7 +15,7 @@ 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(5) }) end, diff --git a/crylia_bar/right_bar.lua b/crylia_bar/right_bar.lua index 2c76b38..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,7 +14,7 @@ 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(5) }) end, diff --git a/src/core/notifications.lua b/src/core/notifications.lua index bc70491..9dd4ec4 100644 --- a/src/core/notifications.lua +++ b/src/core/notifications.lua @@ -45,13 +45,13 @@ naughty.connect_signal( 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 "" + 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", - color["White"], n.title) or "" + cat["Text"], n.title) or "" n.message = string.format("%s", cat['Text'], n.message) or "" n.bg = cat["Surface0"] n.timeout = n.timeout or 5 @@ -63,15 +63,15 @@ naughty.connect_signal( n.actions = { naughty.action { program = "Spotify", id = "skip-prev", - icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"]) + icon = gears.color.recolor_image(icondir .. "skip-prev.svg", cat["Lavender"]) }, naughty.action { program = "Spotify", id = "play-pause", - icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"]) + icon = gears.color.recolor_image(icondir .. "play-pause.svg", cat["Lavender"]) }, naughty.action { program = "Spotify", id = "skip-next", - icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"]) + icon = gears.color.recolor_image(icondir .. "skip-next.svg", cat["Lavender"]) } } use_image = true end @@ -97,7 +97,7 @@ naughty.connect_signal( }, forced_height = dpi(35), forced_width = dpi(35), - fg = color["Cyan200"], + fg = cat["Lavender"], bg = cat["Surface0"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, dpi(6)) @@ -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)) diff --git a/src/modules/brightness_osd.lua b/src/modules/brightness_osd.lua index 728eef1..e50e790 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") @@ -79,7 +80,7 @@ return function(s) 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..e362796 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") @@ -150,11 +151,11 @@ 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"] @@ -169,9 +170,9 @@ 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"] @@ -280,11 +281,11 @@ 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"] @@ -299,9 +300,9 @@ 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"] @@ -534,7 +535,7 @@ return function(s) margins = dpi(10), widget = wibox.container.margin }, - bg = color["Grey900"], + bg = cat["Crust"], border_color = color["Grey800"], border_width = dpi(4), shape = function(cr, width, height) @@ -621,7 +622,7 @@ 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, diff --git a/src/modules/volume_osd.lua b/src/modules/volume_osd.lua index 719793b..3240df8 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") @@ -70,7 +71,7 @@ return function(s) 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,7 +194,7 @@ 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, diff --git a/src/theme/theme_variables.lua b/src/theme/theme_variables.lua index e0b7411..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"] @@ -30,7 +30,7 @@ Theme.useless_gap = dpi(5) -- Change this to 0 if you dont like window gaps 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 6a84a23..8086578 100644 --- a/src/theme/user_variables.lua +++ b/src/theme/user_variables.lua @@ -43,7 +43,7 @@ user_vars = { "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 mpDris2) ] && mpDris2 &\"", -- "bash -c \"[[ ! $(pgrep redshift) ]] && redshift &\"", -- "plank &", -- "bash -c \"[ ! `pidof xfce-polkit` ] && /usr/lib/xfce-polkit/xfce-polkit &\"", 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..4024643 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" }, @@ -209,7 +210,7 @@ return function(s) gears.shape.rounded_rect(cr, width, height, 8) end, bg = color["Grey800"], - fg = color["White"], + 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:get_children_by_id("background2")[1].fg = cat["Maroon"] kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"] end end @@ -280,8 +281,8 @@ 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"], width = dpi(100), @@ -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 index 9cb39ff..6fd725e 100644 --- a/src/widgets/mpris.lua +++ b/src/widgets/mpris.lua @@ -53,14 +53,14 @@ return function() widget = wibox.container.margin }, bg = cat["Lavender"], - fg = color["Grey900"], + fg = cat["Crust"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, widget = wibox.container.background } - Hover_signal(mpris_widget, cat["Lavender"], color["Grey900"]) + Hover_signal(mpris_widget, cat["Lavender"], cat["Crust"]) watch( [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status.sh" ]], 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/power.lua b/src/widgets/power.lua index 95812ab..0bf2ff0 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,7 +42,7 @@ return function() right = dpi(8), widget = wibox.container.margin }, - bg = color["Red200"], + bg = cat["Maroon"], fg = color["Grey800"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) @@ -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..57d7df3 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 diff --git a/src/widgets/tasklist.lua b/src/widgets/tasklist.lua index fdc219a..9726290 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,8 +49,8 @@ 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, @@ -106,8 +107,8 @@ local list_update = function(widget, buttons, label, data, objects) 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") From e1aa18dbed2a47f80542e3f45c7b89d14ff0e2fa Mon Sep 17 00:00:00 2001 From: Hydroxycarbamide Date: Sat, 1 Oct 2022 19:38:53 +0200 Subject: [PATCH 4/5] Update mprix and colors --- bin/dominant-color.py | 30 ++++++++ bin/get_mpris_art.sh | 20 +++++- bin/get_mpris_status_desc_only.sh | 98 ++++++++++++++++++++++++++ bin/get_mpris_status_title_only.sh | 89 +++++++++++++++++++++++ bin/scroll_mpris_status_title_only.sh | 22 ++++++ crylia_bar/bottom_right_bar.lua | 6 +- crylia_bar/dock.lua | 4 +- src/assets/icons/mpris/cd-hi-res.svg | 7 ++ src/assets/icons/mpris/disc.png | Bin 0 -> 11551 bytes src/assets/rules.txt | 2 +- src/core/notifications.lua | 18 ++--- src/modules/brightness_osd.lua | 2 +- src/modules/volume_controller.lua | 54 +++++++------- src/modules/volume_osd.lua | 4 +- src/theme/user_variables.lua | 3 +- src/widgets/kblayout.lua | 6 +- src/widgets/mpris.lua | 71 +++++++++++++++---- src/widgets/power.lua | 2 +- src/widgets/taglist.lua | 6 +- src/widgets/tasklist.lua | 30 ++++---- 20 files changed, 389 insertions(+), 85 deletions(-) create mode 100755 bin/dominant-color.py create mode 100755 bin/get_mpris_status_desc_only.sh create mode 100755 bin/get_mpris_status_title_only.sh create mode 100755 bin/scroll_mpris_status_title_only.sh create mode 100644 src/assets/icons/mpris/cd-hi-res.svg create mode 100644 src/assets/icons/mpris/disc.png diff --git a/bin/dominant-color.py b/bin/dominant-color.py new file mode 100755 index 0000000..84cc746 --- /dev/null +++ b/bin/dominant-color.py @@ -0,0 +1,30 @@ +from __future__ import print_function +import binascii +from PIL import Image +import numpy as np +import scipy +import scipy.misc +import scipy.cluster +import sys + +NUM_CLUSTERS = 5 + +# print('reading image') +im = Image.open(sys.argv[1]) +im = im.resize((150, 150)) # optional, to reduce time +ar = np.asarray(im) +shape = ar.shape +ar = ar.reshape(np.product(shape[:2]), shape[2]).astype(float) + +# print('finding clusters') +codes, dist = scipy.cluster.vq.kmeans(ar, NUM_CLUSTERS) +# print('cluster centres:\n', codes) + +vecs, dist = scipy.cluster.vq.vq(ar, codes) # assign codes +counts, bins = np.histogram(vecs, len(codes)) # count occurrences + +index_max = np.argmax(counts) # find most frequent +peak = codes[index_max] +colour = binascii.hexlify(bytearray(int(c) for c in peak)).decode('ascii') +# print('most frequent is %s (#%s)' % (peak, colour)) +print(colour) diff --git a/bin/get_mpris_art.sh b/bin/get_mpris_art.sh index ad0dbf8..07a1f3d 100755 --- a/bin/get_mpris_art.sh +++ b/bin/get_mpris_art.sh @@ -1,3 +1,18 @@ +get_artUrl() { + artUrl=$(playerctl -p $1 metadata | grep artUrl | awk '{$1=$2=""; print $0}') + regex='(https?|ftp)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]' + if [[ $artUrl =~ $regex ]] + then + filename=/tmp/spotify-mpris/$(basename $artUrl) + if [ ! -f $filename ] + then + curl -sSL $artUrl --create-dirs -o $filename + fi + echo $filename + else + echo $artUrl + fi +} read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)" declare -a PAUSED @@ -8,7 +23,7 @@ for player in "${PLAYERS[@]}"; do # if we have one playing, we'll use it and EXIT if [ "$p_status" = "Playing" ]; then - echo $(playerctl -p $player metadata | grep artUrl | awk '{$1=$2=""; print $0}') + get_artUrl $player exit 0; fi @@ -17,6 +32,7 @@ done # if we have a paused, show it otherwise assume there are no players or have all stopped if [ -n "${PAUSED[0]}" ]; then - echo $(playerctl -p ${PAUSED[0]} metadata | grep artUrl | awk '{$1=$2=""; print $0}') + get_artUrl ${PAUSED[0]} + echo $(playerctl -p metadata | grep artUrl | awk '{$1=$2=""; print $0}') fi diff --git a/bin/get_mpris_status_desc_only.sh b/bin/get_mpris_status_desc_only.sh new file mode 100755 index 0000000..105bf73 --- /dev/null +++ b/bin/get_mpris_status_desc_only.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +# The name of polybar bar which houses the main spotify module and the control modules. +PARENT_BAR="${1:-music}" +PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1) + +urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } + +send_hook() { + [ -z "$1" ] && echo "send_hook: missing arg" && exit 1 + polybar-msg hook mpris-play-pause "$1" 1>/dev/null 2>&1 +} + + +extract_meta() { + grep "$1\W" <<< "$meta" | awk '{$1=$2=""; print $0}' | sed 's/^ *//; s/; */;/g' | paste -s -d/ - +} + +# if "icon" given, determine icon. otherwise, print metadata +get_info() { + if [ -z "$1" ]; then + echo "Usage: get_info PLAYER [icon]" + exit 1 + fi + + meta=$(playerctl -p "$1" metadata) + + # get title + title=$(extract_meta title) + # if no title, try url e.g. vlc + if [ -z "$title" ]; then + title=$(extract_meta url) + title=$(urldecode "${title##*/}") + fi + + # if not "icon", display information and return + if [ "$2" != "icon" ]; then + artist=$(extract_meta artist) + [ -z "$artist" ] && artist=$(extract_meta albumArtist) + + if [ -n "$artist" ]; then + album=$(extract_meta album) + [ -n "$album" ] && printf "from $album\n" + + printf "by $artist" + fi + + return 0 + fi + + # determine icon: + # if player name is recognised, use it + case "$1" in + spotify* | vlc | mpv) echo "$1";; + kdeconnect*) echo "kdeconnect";; + chromium*) + # if a browser, search window titles: + + # this tries to avoid title messing up the regex + regex_title=$(echo "$title" | tr "[:punct:]" ".") + windowname=$(xdotool search --name --class --classname "$regex_title" getwindowname 2>/dev/null) + case $windowname in + "") ;; # ignore if empty + *Netflix*) echo "netflix";; + *YouTube*) echo "youtube";; + *"Prime Video"*) echo "prime";; + *"Corridor Digital"*) echo "corridor";; + *) echo "browser";; + esac;; + *) echo "none";; + esac +} + +# manually go through players +read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)" +declare -a PAUSED +for player in "${PLAYERS[@]}"; do + [ "$player" = "playerctld" ] && continue; + + p_status=$(playerctl -p "$player" status 2>/dev/null) + + # if we have one playing, we'll use it and EXIT + if [ "$p_status" = "Playing" ]; then + send_hook 1 + get_info "$player" "$2" + exit 0; + fi + + [ "$p_status" = "Paused" ] && PAUSED+=("$player") +done + +# if we have a paused, show it otherwise assume there are no players or have all stopped +if [ -n "${PAUSED[0]}" ]; then + send_hook 2 + get_info "${PAUSED[0]}" "$2" +else + [ "$2" = icon ] && echo "none" || echo " 鈴 no players " +fi diff --git a/bin/get_mpris_status_title_only.sh b/bin/get_mpris_status_title_only.sh new file mode 100755 index 0000000..e20ddc0 --- /dev/null +++ b/bin/get_mpris_status_title_only.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +# The name of polybar bar which houses the main spotify module and the control modules. +PARENT_BAR="${1:-music}" +PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1) + +urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } + +send_hook() { + [ -z "$1" ] && echo "send_hook: missing arg" && exit 1 + polybar-msg hook mpris-play-pause "$1" 1>/dev/null 2>&1 +} + + +extract_meta() { + grep "$1\W" <<< "$meta" | awk '{$1=$2=""; print $0}' | sed 's/^ *//; s/; */;/g' | paste -s -d/ - +} + +# if "icon" given, determine icon. otherwise, print metadata +get_info() { + if [ -z "$1" ]; then + echo "Usage: get_info PLAYER [icon]" + exit 1 + fi + + meta=$(playerctl -p "$1" metadata) + + # get title + title=$(extract_meta title) + # if no title, try url e.g. vlc + if [ -z "$title" ]; then + title=$(extract_meta url) + title=$(urldecode "${title##*/}") + fi + + # if not "icon", display information and return + if [ "$2" != "icon" ]; then + printf "$title" + return 0 + fi + + # determine icon: + # if player name is recognised, use it + case "$1" in + spotify* | vlc | mpv) echo "$1";; + kdeconnect*) echo "kdeconnect";; + chromium*) + # if a browser, search window titles: + + # this tries to avoid title messing up the regex + regex_title=$(echo "$title" | tr "[:punct:]" ".") + windowname=$(xdotool search --name --class --classname "$regex_title" getwindowname 2>/dev/null) + case $windowname in + "") ;; # ignore if empty + *Netflix*) echo "netflix";; + *YouTube*) echo "youtube";; + *"Prime Video"*) echo "prime";; + *"Corridor Digital"*) echo "corridor";; + *) echo "browser";; + esac;; + *) echo "none";; + esac +} + +# manually go through players +read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)" +declare -a PAUSED +for player in "${PLAYERS[@]}"; do + [ "$player" = "playerctld" ] && continue; + + p_status=$(playerctl -p "$player" status 2>/dev/null) + + # if we have one playing, we'll use it and EXIT + if [ "$p_status" = "Playing" ]; then + send_hook 1 + get_info "$player" "$2" + exit 0; + fi + + [ "$p_status" = "Paused" ] && PAUSED+=("$player") +done + +# if we have a paused, show it otherwise assume there are no players or have all stopped +if [ -n "${PAUSED[0]}" ]; then + send_hook 2 + get_info "${PAUSED[0]}" "$2" +else + [ "$2" = icon ] && echo "none" || echo " 鈴 no players " +fi diff --git a/bin/scroll_mpris_status_title_only.sh b/bin/scroll_mpris_status_title_only.sh new file mode 100755 index 0000000..6fd4d8a --- /dev/null +++ b/bin/scroll_mpris_status_title_only.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +cmd="${0%/*}/get_mpris_status_title_only.sh $1" + +zscroll -l 50 \ + --scroll-padding "$(printf ' %.0s' {1..8})" \ + -d 0.5 \ + -M "$cmd icon" \ + -m "none" "-b ''" \ + -m "browser" "-b ' '" \ + -m "netflix" "-b 'ﱄ '" \ + -m "youtube" "-b ' '" \ + -m "prime" "-b ' '" \ + -m "spotify" "-b ' '" \ + -m "spotifyd" "-b ' '" \ + -m "vlc" "-b '嗢 '" \ + -m "mpv" "-b ' '" \ + -m "kdeconnect" "-b ' '" \ + -m "corridor" "-b ' '" \ + -U 1 -u t "$cmd" & + +wait diff --git a/crylia_bar/bottom_right_bar.lua b/crylia_bar/bottom_right_bar.lua index 3758d7d..1aa6aec 100644 --- a/crylia_bar/bottom_right_bar.lua +++ b/crylia_bar/bottom_right_bar.lua @@ -14,10 +14,10 @@ return function(s, widgets) local bottom_right = awful.popup { widget = wibox.container.background, ontop = false, - bg = cat["Crust"], + bg = color["Grey900"], visible = true, screen = s, - maximum_height = dpi(80), + maximum_height = dpi(60), placement = function(c) awful.placement.bottom_left(c, { margins = dpi(5) }) end, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) @@ -25,7 +25,7 @@ return function(s, widgets) } bottom_right:struts { - bottom = 85 + bottom = 65 } local function prepare_widgets(widgets) diff --git a/crylia_bar/dock.lua b/crylia_bar/dock.lua index 504c89f..c93be7e 100644 --- a/crylia_bar/dock.lua +++ b/crylia_bar/dock.lua @@ -47,11 +47,11 @@ return function(screen, programs) for _, c in ipairs(client.get()) do if string.lower(c.class):match(program) and c == client.focus then - dock_element.background.bg = color["Grey800"] + dock_element.background.bg = cat["Surface0"] end end - Hover_signal(dock_element.background, color["Grey800"], cat["Text"]) + Hover_signal(dock_element.background, cat["Surface0"], cat["Text"]) dock_element:connect_signal( "button::press", diff --git a/src/assets/icons/mpris/cd-hi-res.svg b/src/assets/icons/mpris/cd-hi-res.svg new file mode 100644 index 0000000..89b200e --- /dev/null +++ b/src/assets/icons/mpris/cd-hi-res.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/src/assets/icons/mpris/disc.png b/src/assets/icons/mpris/disc.png new file mode 100644 index 0000000000000000000000000000000000000000..caa7bfad6279e426d7b3538a9d78086182c5a127 GIT binary patch literal 11551 zcmb_?i93{E*#CKEjIoZbC>g}q3XvsDg)AAOvShEJWGNYyC5dP9EhA}}6p2X6zGUC3 zM@cCmyGkZ4!jzGe%JQD+{ax4ZA9!6{ICGYJKll0EchWAW?cyTxA^-q!nw_;X066$3 z4hRXtUq7Pz{=i?t3_H(b0FWN@e~_nP1qa~Z>f<&Z$6dk>9*^=n8UUiAqI83g96Gk& zj}f37b~NzDx6SeZC0O>4m{<-(wHD1U z;0L}g|NelDEoGbcEq_p<$1Qh_|5~2i$hmCq>`;_NKwZmbFhja3-HM*DvMgoK{O@zi z!$ao`bPz?L=rhsyaQW%V<*L6ZHEGP!*-snf`M98^?#Duf&$lNJ7)T&>WuF@pG}lr3 zJ8%|7?PPzNI3Xo9~Ivu ziC_BCu}gezJ12%CNRM2OP^~aDNbQrA1wFh_(GCF;_^B@VH>oh`br`aHMTej+UYBr$ z=14J0C7^~T`;&eyGFy8WEn9J0J~heB8|fu$3dM6f0$Ls75DrT4(OTM$vl7dep;iC~eL5NgYv8)BfFZImrLwgTD1q zVDyo{g^oXxbN3BmLNbxg{^54<26L9V;pegs+x3cY>y@RQEQ0s&Y}?+E`(=VoV8AwH z6%~ZA$;?6URHhueYCog*YUR8DBlM^&E#yoMFL<=rbMSi^)@a8*dpL@71ylVPf9vE4 z@$s1SFGAe2l;9MSz=MRHfA@ZEJcw*~9PCbu$(U)iUmCr`>q_jZC9vBT#_@v*K3(3Q``=2 z=WM16|1R~|P|hxUg1Mt#FXzb)v!h#{`+t8JbidjD!8Pe|;po(wJli*?qeVxre2l*r zbHZrCOCVNwNS+pQDTOJ46MeRuD_4&Eu!w9-BNV%Wy#q{k8we7Ik%S?Ef8mct51wStHCiITwnk!_B6n!ZZ z!o0jb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5840 100644 --- a/src/assets/rules.txt +++ b/src/assets/rules.txt @@ -1 +1 @@ -Steam; \ No newline at end of file +Steam;watchdogs2.exe; \ No newline at end of file diff --git a/src/core/notifications.lua b/src/core/notifications.lua index 9dd4ec4..af35076 100644 --- a/src/core/notifications.lua +++ b/src/core/notifications.lua @@ -19,12 +19,12 @@ naughty.config.defaults.icon_size = dpi(32) naughty.config.defaults.timeout = 3 naughty.config.defaults.title = "System Notification" naughty.config.defaults.margin = dpi(10) -naughty.config.defaults.position = "bottom_right" +naughty.config.defaults.position = "top_right" naughty.config.defaults.shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, dpi(10)) end naughty.config.defaults.border_width = dpi(4) -naughty.config.defaults.border_color = color["Grey800"] +naughty.config.defaults.border_color = cat["Surface0"] naughty.config.defaults.spacing = dpi(10) naughty.connect_signal( @@ -51,7 +51,7 @@ naughty.connect_signal( n.bg = cat["Surface0"] else n.title = string.format("%s", - cat["Text"], n.title) or "" + color["White"], n.title) or "" n.message = string.format("%s", cat['Text'], n.message) or "" n.bg = cat["Surface0"] n.timeout = n.timeout or 5 @@ -63,15 +63,15 @@ naughty.connect_signal( n.actions = { naughty.action { program = "Spotify", id = "skip-prev", - icon = gears.color.recolor_image(icondir .. "skip-prev.svg", cat["Lavender"]) + icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"]) }, naughty.action { program = "Spotify", id = "play-pause", - icon = gears.color.recolor_image(icondir .. "play-pause.svg", cat["Lavender"]) + icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"]) }, naughty.action { program = "Spotify", id = "skip-next", - icon = gears.color.recolor_image(icondir .. "skip-next.svg", cat["Lavender"]) + icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"]) } } use_image = true end @@ -97,7 +97,7 @@ naughty.connect_signal( }, forced_height = dpi(35), forced_width = dpi(35), - fg = cat["Lavender"], + fg = color["Cyan200"], bg = cat["Surface0"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, dpi(6)) @@ -300,7 +300,7 @@ naughty.connect_signal( border_color = cat["Surface1"], border_width = dpi(0), shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 12) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background } @@ -374,7 +374,7 @@ naughty.connect_signal( type = "notification", screen = awful.screen.focused(), shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 10) + gears.shape.rounded_rect(cr, width, height, 20) end, widget_template = w_template } diff --git a/src/modules/brightness_osd.lua b/src/modules/brightness_osd.lua index e50e790..177b3af 100644 --- a/src/modules/brightness_osd.lua +++ b/src/modules/brightness_osd.lua @@ -75,7 +75,7 @@ return function(s) id = "brightness_slider", bar_shape = gears.shape.rounded_rect, bar_height = dpi(10), - bar_color = color["Grey800"] .. "88", + bar_color = cat["Surface0"] .. "88", bar_active_color = "#ffffff", handle_color = "#ffffff", handle_shape = gears.shape.circle, diff --git a/src/modules/volume_controller.lua b/src/modules/volume_controller.lua index e362796..e9f6bf2 100644 --- a/src/modules/volume_controller.lua +++ b/src/modules/volume_controller.lua @@ -39,12 +39,12 @@ return function(s) layout = wibox.layout.align.horizontal }, id = "device_margin", - margins = dpi(5), + margins = dpi(10), widget = wibox.container.margin }, id = "background", shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background }, @@ -158,9 +158,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Purple200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Purple200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -175,9 +175,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Purple200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Purple200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -288,9 +288,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Blue200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Blue200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -305,9 +305,9 @@ return function(s) device.background:set_fg(cat["Crust"]) else fg = color["Blue200"] - bg = color["Grey700"] + bg = cat["Surface1"] device.background:set_fg(color["Blue200"]) - device.background:set_bg(color["Grey700"]) + device.background:set_bg(cat["Surface1"]) end end ) @@ -323,9 +323,9 @@ return function(s) id = "volume_device_list" }, id = "volume_device_background", - bg = color["Grey800"], + bg = cat["Surface0"], shape = function(cr, width, height) - gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4) + gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 20) end, widget = wibox.container.background }, @@ -342,9 +342,9 @@ return function(s) id = "volume_device_list" }, id = "volume_device_background", - bg = color["Grey800"], + bg = cat["Surface0"], shape = function(cr, width, height) - gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4) + gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 20) end, widget = wibox.container.background }, @@ -385,10 +385,10 @@ return function(s) layout = wibox.layout.fixed.horizontal }, id = "audio_bg", - bg = color["Grey800"], + bg = cat["Surface0"], fg = color["Purple200"], shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background }, @@ -432,10 +432,10 @@ return function(s) layout = wibox.layout.fixed.horizontal }, id = "mic_bg", - bg = color["Grey800"], + bg = cat["Surface0"], fg = color["LightBlueA200"], shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end, widget = wibox.container.background }, @@ -465,7 +465,7 @@ return function(s) gears.shape.rounded_rect(cr, width, height, 5) end, bar_height = dpi(5), - bar_color = color["Grey800"], + bar_color = cat["Surface0"], bar_active_color = color["Purple200"], handle_color = color["Purple200"], handle_shape = gears.shape.circle, @@ -505,7 +505,7 @@ return function(s) gears.shape.rounded_rect(cr, width, height, 5) end, bar_height = dpi(5), - bar_color = color["Grey800"], + bar_color = cat["Surface0"], bar_active_color = color["Blue200"], handle_color = color["Blue200"], handle_shape = gears.shape.circle, @@ -536,10 +536,10 @@ return function(s) widget = wibox.container.margin }, bg = cat["Crust"], - border_color = color["Grey800"], + border_color = cat["Surface0"], border_width = dpi(4), shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 12) + gears.shape.rounded_rect(cr, width, height, 20) end, forced_width = dpi(400), widget = wibox.container.background @@ -558,12 +558,12 @@ return function(s) volume_list.visible = not volume_list.visible if volume_list.visible then audio_bg.shape = function(cr, width, height) - gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) + gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 20) end audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) else audio_bg.shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end @@ -583,12 +583,12 @@ return function(s) mic_list.visible = not mic_list.visible if mic_list.visible then mic_selector_margin.mic_bg.shape = function(cr, width, height) - gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) + gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 20) end mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"])) else mic_bg.shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 4) + gears.shape.rounded_rect(cr, width, height, 20) end mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"])) end @@ -628,7 +628,7 @@ return function(s) screen = s, placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(305), top = dpi(60) } }) end, shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 12) + gears.shape.rounded_rect(cr, width, height, 25) end } diff --git a/src/modules/volume_osd.lua b/src/modules/volume_osd.lua index 3240df8..bf7c17a 100644 --- a/src/modules/volume_osd.lua +++ b/src/modules/volume_osd.lua @@ -66,7 +66,7 @@ return function(s) id = "volume_slider", bar_shape = gears.shape.rounded_rect, bar_height = dpi(10), - bar_color = color["Grey800"] .. "88", + bar_color = cat["Surface0"] .. "88", bar_active_color = "#ffffff", handle_color = "#ffffff", handle_shape = gears.shape.circle, @@ -200,7 +200,7 @@ return function(s) screen = s, placement = function(c) awful.placement.centered(c, { margins = { top = dpi(700) } }) end, shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 15) + gears.shape.rounded_rect(cr, width, height, 20) end } diff --git a/src/theme/user_variables.lua b/src/theme/user_variables.lua index 8086578..506aa63 100644 --- a/src/theme/user_variables.lua +++ b/src/theme/user_variables.lua @@ -34,10 +34,11 @@ user_vars = { autostart = { "killall -9 gwe", "gwe --hide-window &", - "nautilus --gapplication-service &", +-- "nautilus --gapplication-service &", "setxkbmap -option compose:ralt", "setxkbmap -option caps:escape", "emacs --daemon=instance1", + "nvidia-settings", "bash -c \"[[ ! $(pgrep picom) ]] && picom &\"", "bash -c \"[[ ! -s ~/.config/mpd/pid ]] && mpd &\"", "bash -c \"[[ ! $(pgrep ulauncher) ]] && ulauncher --hide-window &\"", diff --git a/src/widgets/kblayout.lua b/src/widgets/kblayout.lua index 4024643..34a5f27 100644 --- a/src/widgets/kblayout.lua +++ b/src/widgets/kblayout.lua @@ -209,7 +209,7 @@ return function(s) shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 8) end, - bg = color["Grey800"], + bg = cat["Surface0"], fg = cat["Text"], widget = wibox.container.background, id = "background", @@ -229,7 +229,7 @@ return function(s) kb_layout_item:get_children_by_id("background2")[1].fg = cat["Crust"] kb_layout_item:get_children_by_id("background1")[1].fg = cat["Crust"] else - kb_layout_item.bg = color["Grey800"] + kb_layout_item.bg = cat["Surface0"] kb_layout_item:get_children_by_id("background2")[1].fg = cat["Maroon"] kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"] end @@ -284,7 +284,7 @@ return function(s) bg = cat["Crust"], fg = cat["Text"], border_width = dpi(4), - border_color = color["Grey800"], + border_color = cat["Surface0"], width = dpi(100), max_height = dpi(600), visible = false, diff --git a/src/widgets/mpris.lua b/src/widgets/mpris.lua index 6fd725e..9c552ae 100644 --- a/src/widgets/mpris.lua +++ b/src/widgets/mpris.lua @@ -4,6 +4,7 @@ -- Awesome Libs local awful = require("awful") +local naughty = require("naughty") local color = require("src.theme.colors") local cat = require("src.theme.catppuccin") local dpi = require("beautiful").xresources.apply_dpi @@ -25,13 +26,11 @@ return function() { { id = "icon", + image = gears.color.recolor_image(icon_dir .. "disc" .. ".png", cat["Crust"]), widget = wibox.widget.imagebox, resize = true }, id = "icon_layout", - clip_shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 2) - end, widget = wibox.container.place }, widget = wibox.container.margin, @@ -39,17 +38,31 @@ return function() }, spacing = dpi(10), { - id = "label", - font = "UbuntuMono Nerd Font, Bold 8", - align = "left", - valign = "center", - widget = wibox.widget.textbox + { + { + id = "title", + font = "UbuntuMono Nerd Font, Bold 11", + align = "left", + widget = wibox.widget.textbox + }, + { + id = "desc", + font = "UbuntuMono Nerd Font, Bold 8", + align = "left", + widget = wibox.widget.textbox + }, + id = "label", + layout = wibox.layout.fixed.vertical + }, + id = "label_margin", + top = dpi(2), + widget = wibox.container.margin }, id = "mpris_layout", layout = wibox.layout.fixed.horizontal }, id = "container", - right = dpi(8), + right = dpi(10), widget = wibox.container.margin }, bg = cat["Lavender"], @@ -57,25 +70,53 @@ return function() shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, + forced_height = 65, widget = wibox.container.background } - Hover_signal(mpris_widget, cat["Lavender"], cat["Crust"]) + --Hover_signal(mpris_widget, cat["Lavender"], cat["Crust"]) watch( - [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status.sh" ]], - 5, + [[ bash -c "$HOME/.config/awesome/bin/get_mpris_status_desc_only.sh" ]], + 10, function(_, stdout) - mpris_widget.container.mpris_layout.label.text = stdout + mpris_widget.container.mpris_layout.label_margin.label.desc.text = stdout awesome.emit_signal("update::mpris_widget", tostring(stdout)) end ) + awful.spawn.with_line_callback( + [[ bash -c "$HOME/.config/awesome/bin/scroll_mpris_status_title_only.sh" ]], { + stdout = function(line) + mpris_widget.container.mpris_layout.label_margin.label.title.text = line + end, + } + ) + watch( [[ bash -c "$HOME/.config/awesome/bin/get_mpris_art.sh" ]], - 5, + 10, function(_, stdout) - mpris_widget.container.mpris_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(stdout:gsub("\n", ""):gsub("file://", ""))) + local file = stdout:gsub("\n", ""):gsub("file://", "") + if #file <= 0 then + return + end + local command = string.format([[ bash -c "python3 $HOME/.config/awesome/bin/dominant-color.py %s" ]], file) + awful.spawn.easy_async( + command, + function(stdout, stderr, reason, exit_code) + local hex = stdout:gsub("\n", "") + local r, g, b = tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) + local brightness = (r * 0.299) + (g * 0.587) + (b * 0.114); + mpris_widget.bg = "#" .. hex + if brightness > 186 then + mpris_widget.fg = cat["Crust"] + else + mpris_widget.fg = cat["Text"] + end + end + ) + mpris_widget.container.mpris_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(file)) awesome.emit_signal("update::mpris_widget", tostring(stdout)) end ) diff --git a/src/widgets/power.lua b/src/widgets/power.lua index 0bf2ff0..fc32225 100644 --- a/src/widgets/power.lua +++ b/src/widgets/power.lua @@ -43,7 +43,7 @@ return function() widget = wibox.container.margin }, bg = cat["Maroon"], - fg = color["Grey800"], + fg = cat["Surface0"], shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 5) end, diff --git a/src/widgets/taglist.lua b/src/widgets/taglist.lua index 57d7df3..14e97c9 100644 --- a/src/widgets/taglist.lua +++ b/src/widgets/taglist.lua @@ -109,7 +109,7 @@ local list_update = function(widget, buttons, label, data, objects) function() old_bg = tag_widget.bg if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#dddddd' .. 'dd' + tag_widget.bg = cat["Subtext0"] else tag_widget.bg = '#3A475C' .. 'dd' end @@ -125,7 +125,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::press", function() if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#bbbbbb' .. 'dd' + tag_widget.bg = cat["Subtext0"] else tag_widget.bg = '#3A475C' .. 'dd' end @@ -136,7 +136,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::release", function() if object == awful.screen.focused().selected_tag then - tag_widget.bg = '#dddddd' .. 'dd' + tag_widget.bg = cat["Text"] else tag_widget.bg = '#3A475C' .. 'dd' end diff --git a/src/widgets/tasklist.lua b/src/widgets/tasklist.lua index 9726290..fea0739 100644 --- a/src/widgets/tasklist.lua +++ b/src/widgets/tasklist.lua @@ -57,15 +57,15 @@ local list_update = function(widget, buttons, label, data, objects) widget = wibox.container.background } - local task_tool_tip = awful.tooltip { - objects = { task_widget }, - mode = "inside", - preferred_alignments = "middle", - preferred_positions = "bottom", - margins = dpi(10), - gaps = 0, - delay_show = 1 - } + --local task_tool_tip = awful.tooltip { + -- objects = { task_widget }, + -- mode = "inside", + -- preferred_alignments = "middle", + -- preferred_positions = "bottom", + -- margins = dpi(10), + -- gaps = 0, + -- delay_show = 1 + --} local function create_buttons(buttons, object) if buttons then @@ -101,10 +101,10 @@ local list_update = function(widget, buttons, label, data, objects) else text = object.class:sub(1, 20) end - task_tool_tip:set_text(text_full) - task_tool_tip:add_to_object(task_widget) + --task_tool_tip:set_text(text_full) + --task_tool_tip:add_to_object(task_widget) else - task_tool_tip:remove_from_object(task_widget) + --task_tool_tip:remove_from_object(task_widget) end end task_widget:set_bg(cat["Text"]) @@ -125,7 +125,7 @@ local list_update = function(widget, buttons, label, data, objects) function() old_bg = task_widget.bg if object == client.focus then - task_widget.bg = '#dddddddd' + task_widget.bg = cat["Subtext1"] else task_widget.bg = '#3A475Cdd' end @@ -141,7 +141,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::press", function() if object == client.focus then - task_widget.bg = "#ffffffaa" + task_widget.bg = cat["Subtext1"] else task_widget.bg = '#3A475Caa' end @@ -152,7 +152,7 @@ local list_update = function(widget, buttons, label, data, objects) "button::release", function() if object == client.focus then - task_widget.bg = "#ffffffdd" + task_widget.bg = cat["Text"] else task_widget.bg = '#3A475Cdd' end From fe159655c37a1bf9db67079d342a2fd97e29862e Mon Sep 17 00:00:00 2001 From: Hydroxycarbamide Date: Sat, 8 Oct 2022 12:25:10 +0200 Subject: [PATCH 5/5] Add reveletaion + rename bottom right to bottom left --- ...ttom_right_bar.lua => bottom_left_bar.lua} | 6 +- crylia_bar/init.lua | 2 +- mappings/global_keys.lua | 16 ++++ src/widgets/notification_list.lua | 80 +++++++++++++++++++ 4 files changed, 100 insertions(+), 4 deletions(-) rename crylia_bar/{bottom_right_bar.lua => bottom_left_bar.lua} (96%) create mode 100644 src/widgets/notification_list.lua diff --git a/crylia_bar/bottom_right_bar.lua b/crylia_bar/bottom_left_bar.lua similarity index 96% rename from crylia_bar/bottom_right_bar.lua rename to crylia_bar/bottom_left_bar.lua index 1aa6aec..d051f29 100644 --- a/crylia_bar/bottom_right_bar.lua +++ b/crylia_bar/bottom_left_bar.lua @@ -11,7 +11,7 @@ local wibox = require("wibox") return function(s, widgets) - local bottom_right = awful.popup { + local bottom_left = awful.popup { widget = wibox.container.background, ontop = false, bg = color["Grey900"], @@ -24,7 +24,7 @@ return function(s, widgets) end } - bottom_right:struts { + bottom_left:struts { bottom = 65 } @@ -76,7 +76,7 @@ return function(s, widgets) return layout end - bottom_right:setup { + bottom_left:setup { nil, nil, prepare_widgets(widgets), diff --git a/crylia_bar/init.lua b/crylia_bar/init.lua index 1600e8f..17cc083 100644 --- a/crylia_bar/init.lua +++ b/crylia_bar/init.lua @@ -61,7 +61,7 @@ awful.screen.connect_for_each_screen( 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.gpu_temp, s.cpu_temp, s.ram_info, s.kblayout, s.bluetooth, s.network, s.clock, s.powerbutton }) - require("crylia_bar.bottom_right_bar")(s, { s.mpris }) + require("crylia_bar.bottom_left_bar")(s, { s.mpris }) end end ) diff --git a/mappings/global_keys.lua b/mappings/global_keys.lua index 9898de0..65604f1 100644 --- a/mappings/global_keys.lua +++ b/mappings/global_keys.lua @@ -6,6 +6,8 @@ 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,6 +51,12 @@ return gears.table.join( end, { description = "Focus previous client by index", group = "Client" } ), + awful.key( + { modkey, "Shift" }, + "w", + revelation, + { description = "Focus previous client by index", group = "Client" } + ), --awful.key( -- { "Mod1" }, -- "#23", @@ -209,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/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 +