From 77aad00d4bd642769e6271c0aac344b00cdb08c1 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 5 Jul 2023 21:57:17 -0400 Subject: [PATCH] feat: remove actions and use swaync instead --- configs/eww/actions/actions.scss | 157 ---------- configs/eww/actions/actions.yuck | 207 -------------- configs/eww/eww.scss | 1 - configs/eww/eww.yuck | 1 - configs/eww/scripts/bluetooth | 35 --- configs/eww/scripts/cpu.sh | 2 - configs/eww/scripts/disk.sh | 3 - configs/eww/scripts/mic | 64 ----- configs/eww/scripts/network.sh | 101 ------- configs/eww/scripts/notif.sh | 10 +- configs/eww/scripts/ram.sh | 42 --- configs/eww/scripts/redshift | 70 ----- configs/eww/scripts/temp.sh | 39 --- configs/eww/scripts/user.sh | 8 - configs/eww/traybuttons/traybuttons.scss | 9 +- configs/eww/variables.yuck | 22 +- configs/swaync/config.json | 104 +++++++ configs/swaync/style.css | 349 +++++++++++++++++++++++ nixos/home/dotfiles.nix | 5 + 19 files changed, 474 insertions(+), 755 deletions(-) delete mode 100644 configs/eww/actions/actions.scss delete mode 100644 configs/eww/actions/actions.yuck delete mode 100755 configs/eww/scripts/bluetooth delete mode 100755 configs/eww/scripts/cpu.sh delete mode 100755 configs/eww/scripts/disk.sh delete mode 100755 configs/eww/scripts/mic delete mode 100755 configs/eww/scripts/network.sh delete mode 100755 configs/eww/scripts/ram.sh delete mode 100755 configs/eww/scripts/redshift delete mode 100755 configs/eww/scripts/temp.sh delete mode 100755 configs/eww/scripts/user.sh create mode 100644 configs/swaync/config.json create mode 100644 configs/swaync/style.css diff --git a/configs/eww/actions/actions.scss b/configs/eww/actions/actions.scss deleted file mode 100644 index d8ee50e..0000000 --- a/configs/eww/actions/actions.scss +++ /dev/null @@ -1,157 +0,0 @@ -.actions { - background-color: $bg; - color: $fg; - font-family: Product Sans; - border-radius: 30px; - border: 5px solid $contrastbg; - padding: 10px 18px; -} - -.controlsbox { - background-color: $contrastbg; - border-radius: 15px; - padding: 7px 12px; - - .vol-slider { - .vol-label { - min-width: 25px; /* Set the width according to your icons */ - font-size: 26px; - font-family: Iosevka Nerd Font; - margin-right: 15px; - color: $blue; - } - & scale trough { - all: unset; - border-radius: 10px; - background-color: $black; - border: none; - min-height: 16px; - min-width: 250px; - margin-left: 3px; - & highlight { - all: unset; - background: linear-gradient(to right, $blue, $cyan); - color: #000000; - border-radius: 10px; - } - } - } - - .br-slider { - .br-label { - min-width: 25px; /* Set the width according to your icons */ - font-size: 26px; - font-family: Iosevka Nerd Font; - margin-right: 15px; - color: $yellow; - } - & scale trough { - all: unset; - border-radius: 10px; - background-color: $black; - border: none; - min-height: 16px; - min-width: 250px; - margin-left: 3px; - & highlight { - all: unset; - background: linear-gradient(to right, $red, $yellow); - color: #000000; - border-radius: 10px; - } - } - } -} - -.userinfobox { - .time { - font-size: 42px; - } - .pfp { - background-position: center; - background-size: cover; - background-repeat: no-repeat; - border-radius: 50px; - min-width: 30px; - min-height: 30px; - } - .daybox { - margin-top: 8px; - font-size: 14px; - } - .username { - font-family: Product Sans; - } - .useractions { - .logout { - background-color: $black; - font-family: Iosevka Nerd Font; - font-size: 18px; - padding: 6px 12px 6px 6px; - border-radius: 4px; - transition: all ease .2s; - &:hover { background-color: $dimblack; } - &:active { background-color: $black; } - } - } -} - -.sysbuttonsbox { - .block-container { - .block { - background-color: $contrastbg; - padding: 0px 6px; - border-radius: 50px; - transition: all ease .2s; - color: $fg; - &:hover { background-color: $bgSecondary; } - &:active { background-color: $contrastbg; } - &.active { - background-color: $black; - &:hover { background-color: $dimblack; } - &:active { background-color: $black; } - .sepbox .sep { - background-color: $lightblack; - } - } - .iconbox .icon { - font-family: MesloLGS NF; - padding: 7px 14px 7px 14px; - font-size: 20px; - min-width: 20px; - } - .sepbox .sep { - background-color: $black; - margin: 0px 4px; - padding: 0px 1px; - } - .chevronbox { - font-family: Iosevka Nerd Font; - padding: 0px 12px; - } - } - .label { - font-family: Product Sans; - font-size: 14px; - } - } -} - -.poweractionsbox { - .info { - font-size: 26px; - } - .buttons { - font-family: Iosevka Nerd Font; - font-size: 22px; - button { - padding: 1px 9px 1px 9px; - background-color: $bgSecondary; - border-radius: 5px; - transition: all ease .2s; - &:hover { background-color: $black; } - &:active { background-color: $bg; } - &.do-logout { color: $yellow; } - } - } -} diff --git a/configs/eww/actions/actions.yuck b/configs/eww/actions/actions.yuck deleted file mode 100644 index 5e45619..0000000 --- a/configs/eww/actions/actions.yuck +++ /dev/null @@ -1,207 +0,0 @@ -(defwidget sysblock [icon onclick active label] - (box :class "block-container" - :orientation "v" - :space-evenly false - :spacing 5 - (button :class "block ${active ? 'active' : ''}" :onclick "${onclick}" - (box :orientation "h" - :space-evenly false - (box :class "iconbox" - :halign "start" - :space-evenly true - :orientation "h" - (label :text "${icon}" :class "icon") - ) - (box :class "sepbox" - :halign "center" - :space-evenly true - :orientation "h" - (box :class "sep") - ) - (box :class "chevronbox" - :halign "end" - :space-evenly true - :orientation "h" - (label :text "") - ) - ) - ) - (label :halign "center" :text "${label}" :class "label") - ) -) - -(defwidget sysbuttons [] - (box :class "sysbuttonsbox" - :orientation "v" - :space-evenly false - :spacing 20 - (box :class "firstrow" - :orientation "h" - :space-evenly true - (box :halign "start" - :orientation "h" - :space-evenly true - (sysblock :icon "${network_icon}" - :onclick "$EWW_PATH/network.sh toggle" - :active "${network_status == 'Connected' ? true : false}" - :label "${network_ssid}" - ) - ) - (box :halign "center" - :orientation "h" - :space-evenly true - (sysblock :icon "${bluetooth_state == 'on' ? '' : ''}" - :onclick "$EWW_PATH/bluetooth toggle" - :active "${bluetooth_state == 'on' ? true : false}" - :label "Bluetooth" - ) - ) - (box :halign "end" - :orientation "h" - :space-evenly true - (sysblock :icon "${network_radio == 'on' ? '' : ''}" - :onclick "$EWW_PATH/network.sh toggle-radio" - :active "${network_radio == 'on' ? false : true}" - :label "Airplane" - ) - ) - ) - (box :class "lastrow" - :orientation "h" - :space-evenly true - (box :halign "start" - :orientation "h" - :space-evenly true - (sysblock :icon "${redshift_state == 'on' ? '' : ''}" - :onclick "$EWW_PATH/redshift toggle" - :active "${redshift_state == 'on' ? true : false}" - :label "Night Light" - ) - ) - (box :halign "center" - :orientation "h" - :space-evenly true - (sysblock :icon "${volume_icon}" - :onclick "$EWW_PATH/volume.sh toggle-muted" - :active "${is_muted == 'yes' ? false : true}" - :label "Volume" - ) - ) - (box :halign "end" - :orientation "h" - :space-evenly true - (sysblock :icon "${mic_status == 'yes' ? '' : ''}" - :onclick "$EWW_PATH/mic toggle" - :active "${mic_status == 'yes' ? true : false}" - :label "Micro" - ) - ) - ) - ) -) - -(defwidget controls [] - (box :class "controlsbox" - :orientation "v" - :space-evenly false - :spacing 10 - (box :orientation "h" - :space-evenly "false" - :class "vol-slider" - (box :class "vol-label" - volume_icon - ) - (scale :value volume_value - :onchange "$EWW_PATH/volume.sh set {}" - :min 0 - :max 101 - ) - ) - (box :orientation "h" - :space-evenly "false" - :class "br-slider" - (box :class "br-label" - br_icon - ) - (scale :value br - :onchange "$EWW_PATH/brightness.sh set {}" - :min 0 - :max 101 - ) - ) - ) -) - -(defwidget user [] - (box :class "userinfobox" - :orientation "h" - :space-evenly false - (box :class "info" - :space-evenly false - :orientation "h" - :halign "start" - :valign "center" - :spacing 10 - (label :text "${lithour}:${litmin}" :class "time") - (box :class "daybox" - :orientation "v" - :space-evenly false - (label :text "${shortday}" :halign "start") - (label :text "${weekday}" :halign "start") - ) - ) - ) -) - -(defwidget poweractions [] - (box :class "poweractionsbox" - :orientation "h" - :space-evenly true - (box :class "buttons-container" - :space-evenly true - :halign "end" - :orientation "h" - (box :class "buttons" - :orientation "h" - :space-evenly true - :spacing 10 - (button :class "do-logout" - :onclick "eww close closer && $EWW_PATH/open.sh powermenu && eww open closer" - :tooltip "Logout" - :halign "end" - "" - ) - ) - ) - ) -) - -(defwidget actions [] - (box :class "actions" - :orientation "v" - :space-evenly false - :spacing 20 - (user) - (sysbuttons) - (controls) - (poweractions) - ) -) - -(defvar actions-visible false) - -(defwindow actions-reveal - :monitor "0" - :stacking "overlay" - :geometry (geometry :x "10px" - :y "4px" - :width "320px" ; this isn't respected btw, so it's auto-adjusted by eww lol. - :height "10px" ; automatically generated by eww. - :anchor "top right") - - (revealer :transition "crossfade" - :reveal actions-visible - :duration "550ms" - (actions) - ) -) diff --git a/configs/eww/eww.scss b/configs/eww/eww.scss index 7e56d41..63b6b9c 100644 --- a/configs/eww/eww.scss +++ b/configs/eww/eww.scss @@ -4,6 +4,5 @@ @import "colors.scss"; @import "date/date.scss"; -@import "actions/actions.scss"; @import "powermenu/powermenu.scss"; @import "traybuttons/traybuttons.scss"; diff --git a/configs/eww/eww.yuck b/configs/eww/eww.yuck index dbbec3e..d7f34f5 100644 --- a/configs/eww/eww.yuck +++ b/configs/eww/eww.yuck @@ -1,6 +1,5 @@ (include "variables.yuck") (include "date/date.yuck") -(include "actions/actions.yuck") (include "powermenu/powermenu.yuck") (include "closer/closer.yuck") (include "traybuttons/traybuttons.yuck") diff --git a/configs/eww/scripts/bluetooth b/configs/eww/scripts/bluetooth deleted file mode 100755 index e735c62..0000000 --- a/configs/eww/scripts/bluetooth +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -get_state () { - state=$(bluetoothctl show | grep 'Powered' | awk '{print $2}') - if [[ $state == "yes" ]]; then - echo on - else - echo off - fi -} - -turn_off () { - bluetoothctl power off 2>&1 > /dev/null -} - -turn_on () { - bluetoothctl power on 2>&1 > /dev/null -} - -toggle () { - state=$(get_state) - if [[ $state == "on" ]]; then - turn_off - else - turn_on - fi -} - -if [[ $1 == "state" ]]; then - get_state -fi - -if [[ $1 == "toggle" ]]; then - toggle -fi diff --git a/configs/eww/scripts/cpu.sh b/configs/eww/scripts/cpu.sh deleted file mode 100755 index 0afb9e3..0000000 --- a/configs/eww/scripts/cpu.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}' | tr '.' ' ' | awk '{print $1}' \ No newline at end of file diff --git a/configs/eww/scripts/disk.sh b/configs/eww/scripts/disk.sh deleted file mode 100755 index 5717c07..0000000 --- a/configs/eww/scripts/disk.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -df --output=pcent / | tail -n 1 | sed 's/%//g' | awk '{print $1}' \ No newline at end of file diff --git a/configs/eww/scripts/mic b/configs/eww/scripts/mic deleted file mode 100755 index 8853778..0000000 --- a/configs/eww/scripts/mic +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash - -# @requires: pactl - -SINK=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1) - -status () { - status=$(pactl get-source-mute $SINK | awk '{print $2}') - if [[ $status == 'yes' ]]; then - echo no - else - echo yes - fi -} - -set_volume () { - local max_db=65536 - local percent=$1 - - # getting the $percent% of $max_db - local value=$(jq -n ${percent}/100*${max_db} | sed 's/\./ /g' | awk '{print $1}') - - # set volume - pacmd set-source-volume $SINK $value -} - -get () { - local enabled=$(status) - if [[ $enabled == 'no' ]]; then - echo '0' - else - pacmd list short sinks | grep volume:\ front | tail -n 1 | awk '{print $5}' | sed 's/%//g' - fi -} - -percentage () { - local val=$(get) - echo "${val}%" -} - -_ () { - ${@} - exit 0 -} - -if [[ $1 == "status" ]]; then - _ status -fi - -if [[ $1 == "toggle" ]]; then - _ pactl set-source-mute $SINK toggle -fi - -if [[ $1 == "set" ]]; then - _ set_volume ${2} -fi - -if [[ $1 == "get" ]]; then - _ get -fi - -if [[ $1 == "percent" ]]; then - _ percentage -fi diff --git a/configs/eww/scripts/network.sh b/configs/eww/scripts/network.sh deleted file mode 100755 index ba03b4a..0000000 --- a/configs/eww/scripts/network.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash - -symbol() { - [ $(cat /sys/class/net/w*/operstate) = down ] && echo 睊 && exit - echo  -} - -name() { - iwgetid -r -} - -cut () { - toshow="$1" - maxlen="$2" - - sufix="" - - if test $(echo $toshow | wc -c) -ge $maxlen ; then - sufix=" ..." - fi - - echo "${toshow:0:$maxlen}$sufix" -} - -[ "$1" = "icon" ] && symbol - -if [[ $1 == "ssid" ]]; then - ssid=$(name) - if [[ "$ssid" == "" ]]; then - cut "Disconnected" 10 - else - cut "$ssid" 10 - fi -fi - -if [[ $1 == "name" || $1 == "class" ]]; then - wifiname=$(name) - if [[ $wifiname == "" ]]; then - if [[ $1 == "name" ]]; then - echo "Disconnected" - elif [[ $1 == "class" ]]; then - echo "disconnected" - fi - else - if [[ $1 == "name" ]]; then - echo "Connected to $wifiname" - elif [[ $1 == "class" ]]; then - echo "connected" - fi - fi -fi - -if [[ $1 == "status" ]]; then - name=$(name) - if [[ $name != "" ]]; then - echo "Connected" - else - echo "Disconnected" - fi -fi - -if [[ $1 == "disconnect" ]]; then - wifiname=$(nmcli d | grep wifi | sed 's/^.*wifi.*connected//g' | xargs) - nmcli con down id "${wifiname}" -fi - -if [[ $1 == "connect" ]]; then - nmcli con up ifname "$(/usr/bin/ls /sys/class/ieee80211/*/device/net/)" -fi - -if [[ $1 == "toggle" ]]; then - name=$(name) - if [[ "$name" == "" ]]; then - nmcli con up ifname "$(/usr/bin/ls /sys/class/ieee80211/*/device/net/)" - else - wifiname=$(nmcli d | grep wifi | sed 's/^.*wifi.*connected//g' | xargs) - nmcli con down id "${wifiname}" - fi -fi - -radio_status () { - radio_status=$(nmcli radio wifi) - if [[ $radio_status == "enabled" ]]; then - echo "on" - else - echo "off" - fi -} - -if [[ $1 == "radio-status" ]]; then - radio_status -fi - -if [[ $1 == "toggle-radio" ]]; then - stat=$(radio_status) - if [[ $stat == "on" ]]; then - nmcli radio wifi off - else - nmcli radio wifi on - fi -fi diff --git a/configs/eww/scripts/notif.sh b/configs/eww/scripts/notif.sh index 4c42ad7..ea7064d 100755 --- a/configs/eww/scripts/notif.sh +++ b/configs/eww/scripts/notif.sh @@ -2,7 +2,10 @@ state () { if [[ $(hyprctl layers | grep swaync-control-center) == "" ]]; then - eww update notif-panel-state=false + if [[ $(eww get notif-panel-state) == "true" ]]; then + eww update notif-panel-state=false + eww reload + fi fi } @@ -20,6 +23,9 @@ icon () { } if [[ $1 == "icon" ]]; then - icon + while true; do + sleep 0.2 + icon + done fi diff --git a/configs/eww/scripts/ram.sh b/configs/eww/scripts/ram.sh deleted file mode 100755 index a2f0065..0000000 --- a/configs/eww/scripts/ram.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -percentage () { - local val=$(echo $1 | tr '%' ' ' | awk '{print $1}') - local icon1=$2 - local icon2=$3 - local icon3=$4 - local icon4=$5 - if [ "$val" -le 15 ]; then - echo $icon1 - elif [ "$val" -le 30 ]; then - echo $icon2 - elif [ "$val" -le 60 ]; then - echo $icon3 - else - echo $icon4 - fi -} - -get_ram () { - free -m | grep Mem | awk '{print ($3/$2)*100}' | tr '.' ' ' | awk '{print $1}' -} - -get_percent () { - echo $(get_ram)% -} - -get_class () { - local percent=$(get_percent) - echo $(percentage "$percent" "yellow" "magenta" "purple" "red") -} - -if [[ $1 == "ram" ]]; then - get_ram -fi - -if [[ $1 == "percent" ]]; then - get_percent -fi - -if [[ $1 == "class" ]]; then - get_class -fi \ No newline at end of file diff --git a/configs/eww/scripts/redshift b/configs/eww/scripts/redshift deleted file mode 100755 index 38ce6a9..0000000 --- a/configs/eww/scripts/redshift +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash - -cache_file=$HOME/.cache/eww/services/redshift_state - -initial_hook () { - if [ ! -d $(dirname $cache_file) ]; then - mkdir -p $(dirname $cache_file) - fi - if [ ! -f $cache_file ]; then - echo off > $cache_file - fi -} - -get_state () { - # check if redshift is running - cat $cache_file -} - -restore () { - local state=$(get_state) - if [[ $state == "on" ]]; then - enable_redshift - else - disable_redshift - fi -} - -disable_redshift () { - redshift -x 2>&1 > /dev/null - # saving state - echo off > $cache_file -} - -enable_redshift () { - redshift -x 2>&1 > /dev/null - redshift -O 5000 2>&1 > /dev/null - # saving new state - echo on > $cache_file -} - -toggle () { - local state=$(get_state) - if [[ $state == "on" ]]; then - disable_redshift - else - enable_redshift - fi -} - -initial_hook - -if [[ $1 == "state" ]]; then - get_state -fi - -if [[ $1 == "enable" ]]; then - enable_redshift -fi - -if [[ $1 == "disable" ]]; then - disable_redshift -fi - -if [[ $1 == "toggle" ]]; then - toggle -fi - -if [[ $1 == "restore" ]]; then - restore -fi diff --git a/configs/eww/scripts/temp.sh b/configs/eww/scripts/temp.sh deleted file mode 100755 index 92be642..0000000 --- a/configs/eww/scripts/temp.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -# thanks to rxyhn - -path () { - local temp_path=null - for i in /sys/class/hwmon/hwmon*/temp*_input; - do - temp_path="$(echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || - echo $(basename ${i%_*})) $(readlink -f $i)");" - label="$(echo $temp_path | awk '{print $2}')" - if [ "$label" = "Package" ]; - then - echo ${temp_path} | awk '{print $5}' | tr -d ';\n' - exit; - fi - done -} - -get () { - local path=$(path) - if [[ $path == "" ]]; then - path="/sys/class/thermal/thermal_zone0/temp" - fi - - local max_temp=100 - local temp=$(cat $path) - - jq -n $(jq -n $temp/1000)/$max_temp*100 -} - -_ () { - ${@} - exit 0 -} - -if [[ $1 == "get" ]]; then - _ get -fi \ No newline at end of file diff --git a/configs/eww/scripts/user.sh b/configs/eww/scripts/user.sh deleted file mode 100755 index 29568c8..0000000 --- a/configs/eww/scripts/user.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -name () { - username=$(whoami) - echo ${username^} -} - -name \ No newline at end of file diff --git a/configs/eww/traybuttons/traybuttons.scss b/configs/eww/traybuttons/traybuttons.scss index e403d46..a79868e 100644 --- a/configs/eww/traybuttons/traybuttons.scss +++ b/configs/eww/traybuttons/traybuttons.scss @@ -1,6 +1,6 @@ .notif-panel { -/* min-width: 110px; - min-height: 34px; */ + min-width: 50px; + min-height: 16px; font-size: 20px; padding: 2px 25px 2px 35px; } @@ -30,3 +30,8 @@ border-radius: 80px; border: 3px solid #CBA6F7; } + +.toggle-on:hover { + background-color: rgba(127, 132, 156, 0.4); + transition: background-color 0.5s ease-in-out; +} diff --git a/configs/eww/variables.yuck b/configs/eww/variables.yuck index 2a1ffe2..f1aa724 100644 --- a/configs/eww/variables.yuck +++ b/configs/eww/variables.yuck @@ -1,23 +1,10 @@ -(defpoll network_status :interval "1s" "$EWW_PATH/network.sh status") -(defpoll network_icon :interval "1s" "$EWW_PATH/network.sh icon") -(defpoll network_radio :interval "1s" "$EWW_PATH/network.sh radio-status") -(defpoll network_ssid :interval "1s" "$EWW_PATH/network.sh ssid") +(deflisten notif_icon "$EWW_PATH/notif.sh icon") (defpoll volume_icon :interval "1s" "$EWW_PATH/volume.sh icon") (defpoll volume :interval "1s" "$EWW_PATH/volume.sh percentage") (defpoll volume_value :interval "1s" "$EWW_PATH/volume.sh vol") (defpoll is_muted :interval "1s" "$EWW_PATH/volume.sh muted") -(defpoll mic :interval "1s" "$EWW_PATH/mic get") -(defpoll mic_status :interval "1s" "$EWW_PATH/mic status") - -(defpoll bluetooth_state :interval "1s" "$EWW_PATH/bluetooth state") -(defpoll redshift_state :interval "1s" "$EWW_PATH/redshift state") - -(defpoll rawuser :interval "30s" "whoami") -(defpoll hostname :interval "30s" "cat /etc/hostname") -(defpoll uptime :interval "30s" "uptime -p") - (defpoll br_icon :interval "1s" "$EWW_PATH/brightness.sh icon") (defpoll br :interval "1s" "$EWW_PATH/brightness.sh br") @@ -30,10 +17,3 @@ (defpoll date :interval "30s" "date '+%d %b, %I:%M %p'") (defpoll shortday :interval "1h" "date '+%d %b %y'") (defpoll weekday :interval "24h" "date +%A") - -(defpoll cpu :interval "3s" "$EWW_PATH/cpu.sh") -(defpoll ram :interval "3s" "$EWW_PATH/ram.sh ram") -(defpoll temp :interval "3s" "$EWW_PATH/temp.sh get") -(defpoll disk :interval "3s" "$EWW_PATH/disk.sh") - -(defpoll notif_icon :interval "1s" "$EWW_PATH/notif.sh icon") diff --git a/configs/swaync/config.json b/configs/swaync/config.json new file mode 100644 index 0000000..e298e46 --- /dev/null +++ b/configs/swaync/config.json @@ -0,0 +1,104 @@ +{ + "$schema": "/etc/xdg/swaync/configSchema.json", + + "positionX": "right", + "positionY": "top", + "control-center-positionX": "none", + "control-center-positionY": "none", + "control-center-margin-top": 8, + "control-center-margin-bottom": 8, + "control-center-margin-right": 8, + "control-center-margin-left": 8, + "control-center-width": 500, + "control-center-height": 900, + "fit-to-screen": false, + + "layer": "top", + "control-center-layer": "top", + "cssPriority": "user", + "notification-icon-size": 64, + "notification-body-image-height": 100, + "notification-body-image-width": 200, + "notification-inline-replies": true, + "timeout": 10, + "timeout-low": 5, + "timeout-critical": 0, + "notification-window-width": 500, + "keyboard-shortcuts": true, + "image-visibility": "when-available", + "transition-time": 200, + "hide-on-clear": true, + "hide-on-action": true, + "script-fail-notify": true, + + "widgets": [ + "label", + "buttons-grid", + "backlight", + "volume", + "mpris", + "title", + "inhibitors", + "dnd", + "notifications" + ], + "widget-config": { + "backlight": { + "label": "󰃟 ", + "device": "amdgpu_bl0", + "min": 10 + }, + "volume": { + "label": "󰕾 " + }, + "inhibitors": { + "text": "Inhibitors", + "button-text": "Clear All", + "clear-all-button": true + }, + "title": { + "text": "Notifications", + "clear-all-button": true, + "button-text": "Clear All" + }, + "dnd": { + "text": "Do Not Disturb" + }, + "label": { + "max-lines": 5, + "text": "Control Center" + }, + "mpris": { + "image-size": 96, + "image-radius": 12 + }, + "buttons-grid": { + "actions": [ + { + "label": "󰖩 ", + "command": "nm-connection-editor &" + }, + { + "label": "󰂯", + "command": "blueberry &" + }, + { + "label": "󰌾", + "command": "$HOME/.config/gtklock/scripts/lock.sh" + }, + { + "label": "󰕾", + "command": "pavucontrol" + }, + { + "label": "󰍬", + "command": "swayosd --input-volume mute-toggle" + }, + { + "label": "󰍃", + "command": "swaync-client -cp; sleep 1; eww open closer; $EWW_PATH/open.sh powermenu" + } + ] + } + } +} diff --git a/configs/swaync/style.css b/configs/swaync/style.css new file mode 100644 index 0000000..47e32f2 --- /dev/null +++ b/configs/swaync/style.css @@ -0,0 +1,349 @@ + +/* Dracula Theme */ +/* https://gist.github.com/MrRoy/3a4a0b1462921e78bf667e1b36697268 */ +@define-color foreground rgb(248, 248, 242); +@define-color background rgb(40, 42, 54); +@define-color background-alpha rgba(40, 42, 54, 0.8); +@define-color accent rgba(189, 147, 249, 0.8); +@define-color current-line rgb(68, 71, 90); +@define-color comment rgb(98, 114, 164); + +.notification-row { + transition: all 200ms ease; + outline: none; + margin-bottom: 4px; + margin-right: 13px; + margin-top: 8px; + border-radius: 30px; +} + +.control-center .notification-row:focus, +.control-center .notification-row:hover { + opacity: 1; + background: transparent; +} + +.notification-row:focus .notification, +.notification-row:hover .notification { + box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.5); + border: 0px solid @accent; + background: @current-line; +} + +.control-center .notification { + box-shadow: none; +} + +.control-center .notification-row { + opacity: 0.5; + margin: -5px; +} + +.notification { + transition: all 200ms ease; + border-radius: 8px; + margin: 12px 7px 0px 7px; + box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.5); + padding: 0; +} + +/* Uncomment to enable specific urgency colors +.low { + background: yellow; + padding: 6px; + border-radius: 12px; +} +.normal { + background: green; + padding: 6px; + border-radius: 12px; +} +.critical { + background: red; + padding: 6px; + border-radius: 12px; +} +*/ + +.notification-content { + background: transparent; + padding: 6px; + border-radius: 30px; +} + +.close-button { + background: @current-line; + color: @foreground; + text-shadow: none; + padding: 0; + border-radius: 100%; + margin-top: 17px; + margin-right: 10px; + box-shadow: none; + border: none; + min-width: 24px; + min-height: 24px; +} + +.close-button:hover { + box-shadow: none; + background: @comment; + transition: all 0.15s ease-in-out; + border: none; +} + +.notification-default-action, +.notification-action { + padding: 4px; + margin: 0; + box-shadow: none; + background: @current-line; + border: 2px solid @accent; + color: @foreground; +} + +.notification-default-action:hover, +.notification-action:hover { + -gtk-icon-effect: none; + background: @current-line; +} + +.notification-default-action { + border-radius: 8px; +} + +/* When alternative actions are visible */ +.notification-default-action:not(:only-child) { + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} + +.notification-action { + border-radius: 0px; + border-top: none; + border-right: none; +} + +/* add bottom border radius to eliminate clipping */ +.notification-action:first-child { + border-bottom-left-radius: 8px; +} + +.notification-action:last-child { + border-bottom-right-radius: 8px; + border-right: 1px solid @accent; +} + +.image { +} + +.body-image { + margin-top: 6px; + background-color: @foreground; + border-radius: 30px; +} + +.summary { + font-size: 16px; + font-weight: bold; + background: transparent; + color: @foreground; + text-shadow: none; +} + +.time { + font-size: 16px; + font-weight: bold; + background: transparent; + color: @foreground; + text-shadow: none; + margin-right: 18px; +} + +.body { + font-size: 15px; + font-weight: normal; + background: transparent; + color: @foreground; + text-shadow: none; +} + +/* The "Notifications" and "Do Not Disturb" text widget */ +.top-action-title { + color: @foreground; + text-shadow: none; +} + +.control-center-clear-all { + color: @foreground; + text-shadow: none; + background: @background; + border: 2px solid @accent; + box-shadow: none; + border-radius: 30px; +} + +.control-center-clear-all:hover { + background: @background; +} + +.control-center-dnd { + border-radius: 30px; + background: @background; + border: 1px solid @accent; + box-shadow: none; +} + +.control-center-dnd:checked { + background: @accent; +} + +.control-center-dnd slider { + background: @background; + border-radius: 30px; +} + +.control-center { + background: @background-alpha; + border-radius: 35px; + background-clip: border-box; + padding: 4px; + box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.7), + 0 2px 6px 2px rgba(0, 0, 0, 0.3); + color: @foreground; + border: 2px solid @accent; +} + +.control-center-list { + background: transparent; +} + +.floating-notifications { + background: transparent; +} + +/* Window behind control center and on all other monitors */ +.blank-window { + background: transparent; +} + +/*** Widgets ***/ + +/* Title widget */ +.widget-title { + margin: 8px; + font-size: 1.5rem; + padding: 16px 0px 0px 0px; +} +.widget-title > button { + font-size: initial; + color: @foreground; + text-shadow: none; + background: @background; + border: 2px solid @accent; + box-shadow: none; + border-radius: 30px; +} +.widget-title > button:hover { + background: @current-line; +} + +/* DND widget */ +.widget-dnd { + margin: 8px; + font-size: 1.1rem; +} +.widget-dnd > switch { + font-size: initial; + border-radius: 30px; + background: @background; + border: 1px solid @accent; + box-shadow: none; +} +.widget-dnd > switch:checked { + background: @accent; +} +.widget-dnd > switch slider { + background: @background; + border-radius: 30px; + border: 1px solid @foreground; +} + +/* Label widget */ +.widget-label { + margin: 8px; + padding: 16px 0px 0px 0px; +} +.widget-label > label { + font-size: 1.5rem; +} + +/* Mpris widget */ +.widget-mpris { + /* The parent to all players */ +} +.widget-mpris-player { + padding: 8px; + margin: 8px; + background-color: @background; + border-radius: 30px; + border-top: 2px solid @accent; + border-bottom: 2px solid @accent; + color: @foreground; +} +.widget-mpris-title { + font-weight: bold; + font-size: 1.25rem; +} +.widget-mpris-subtitle { + font-size: 1.1rem; +} + +/* Buttons widget */ +.widget-buttons-grid { + font-size: 30px; + padding: 8px; + margin: 20px 10px 10px 10px; + border-radius: 12px; + border-bottom: 2px solid @accent; + border-top: 2px solid @accent; + background-color: @background; +} + +.widget-buttons-grid>flowbox>flowboxchild>button { + margin: 10px; + min-width: 80px; + background: #1b1b2b; + border-radius: 12px; + color: @foreground; + border: 2px solid @accent; +} + +.widget-buttons-grid>flowbox>flowboxchild>button:hover { + background: @current-line; + color: @accent; +} + +.widget-volume { + background-color: @background; + padding: 4px 8px 8px 8px; + margin: 0px 8px 8px 8px; + font-size: x-large; + border-bottom: 2px solid @accent; + border-bottom-left-radius: 12px; + border-bottom-right-radius: 12px; + border-top-left-radius: 0px; + border-top-right-radius: 0px; +} + +.widget-backlight { + background-color: @background; + padding: 8px 8px 4px 8px; + margin: 8px 8px 0px 8px; + font-size: x-large; + border-top: 2px solid @accent; + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; + border-top-left-radius: 12px; + border-top-right-radius: 12px; +} diff --git a/nixos/home/dotfiles.nix b/nixos/home/dotfiles.nix index 8efeb0a..8c7e864 100644 --- a/nixos/home/dotfiles.nix +++ b/nixos/home/dotfiles.nix @@ -5,6 +5,11 @@ let in { + xdg.configFile = { + "swaync/config.json".source = config.lib.file.mkOutOfStoreSymlink "${configDir}/swaync/config.json"; + "swaync/style.css".source = config.lib.file.mkOutOfStoreSymlink "${configDir}/swaync/style.css"; + }; + programs = { fzf = { enable = true;