From 4c9feb3b99a85dc95ebae3af40b0cb1dfa53a66b Mon Sep 17 00:00:00 2001 From: meliurwen Date: Sun, 29 Nov 2020 04:03:10 +0100 Subject: [PATCH] Updated dunst config, volume and brightness scripts with proper custom Adwaita icons --- .../dunst/{dunstrc => dunstrc.template} | 10 ++-- i3/.config/i3/config | 1 + i3/.config/i3/scripts/brightnessControl.sh | 54 +++++++++++++++--- i3/.config/i3/scripts/volumeControl.sh | 46 ++++++++++++--- .../32x32/status/audio-volume-high-dark.png | Bin 0 -> 487 bytes .../32x32/status/audio-volume-low-dark.png | Bin 0 -> 495 bytes .../32x32/status/audio-volume-medium-dark.png | Bin 0 -> 494 bytes .../32x32/status/audio-volume-muted-dark.png | Bin 0 -> 504 bytes .../32x32/status/audio-volume-none-dark.png | Bin 0 -> 493 bytes .../audio-volume-overamplified-dark.png | Bin 0 -> 347 bytes .../display-brightness-disabled-dark.png | Bin 0 -> 637 bytes .../status/display-brightness-high-dark.png | Bin 0 -> 487 bytes .../status/display-brightness-low-dark.png | Bin 0 -> 577 bytes .../status/display-brightness-medium-dark.png | Bin 0 -> 551 bytes .../status/display-brightness-none-dark.png | Bin 0 -> 592 bytes 15 files changed, 90 insertions(+), 21 deletions(-) rename dunst/.config/dunst/{dunstrc => dunstrc.template} (92%) create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-high-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-low-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-medium-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-muted-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-none-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-overamplified-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-disabled-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-high-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-low-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-medium-dark.png create mode 100644 icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-none-dark.png diff --git a/dunst/.config/dunst/dunstrc b/dunst/.config/dunst/dunstrc.template similarity index 92% rename from dunst/.config/dunst/dunstrc rename to dunst/.config/dunst/dunstrc.template index 83bda61..d64e58c 100644 --- a/dunst/.config/dunst/dunstrc +++ b/dunst/.config/dunst/dunstrc.template @@ -1,10 +1,8 @@ -## Modified By Aditya Shakya ... - [global] monitor = 0 follow = mouse -geometry = "250x50-20+40" +geometry = "330x50-20+40" indicate_hidden = yes shrink = no transparency = 0 @@ -12,8 +10,8 @@ notification_height = 0 separator_height = 4 padding = 16 horizontal_padding = 16 -frame_width = 2 -frame_color = "#43B581" +frame_width = 1 +frame_color = "#285577" separator_color = frame sort = yes idle_threshold = 120 @@ -32,7 +30,7 @@ icon_position = left max_icon_size = 32 ## Paths to default icons. -icon_folders = /usr/share/icons/Adwaita/32x32/status/:/usr/share/icons/Adwaita/32x32/devices/ +icon_path = ${HOME}/.icons/Adwaita-dark-custom/32x32/status/:/usr/share/icons/hicolor/scalable/apps/:/usr/share/icons/hicolor/48x48/apps/ sticky_history = yes history_length = 20 dmenu = /usr/bin/dmenu -p dunst: diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 29fa95d..0c33568 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -233,6 +233,7 @@ exec --no-startup-id feh --bg-fill $HOME/Scaricati/northern_lights_by_aenami_dbb exec --no-startup-id compton --config $HOME/.config/compton/config # Notification Manager +exec --no-startup-id envsubst < ~/.config/dunst/dunstrc.template > ~/.config/dunst/dunstrc exec --no-startup-id dunst --config $HOME/.config/dunst/dunstrc # Pulseaudio diff --git a/i3/.config/i3/scripts/brightnessControl.sh b/i3/.config/i3/scripts/brightnessControl.sh index 89c78a7..ce6bd0d 100755 --- a/i3/.config/i3/scripts/brightnessControl.sh +++ b/i3/.config/i3/scripts/brightnessControl.sh @@ -9,17 +9,57 @@ # https://gist.github.com/sebastiencs/5d7227f388d93374cebdf72e783fbd6a function get_brightness { - xbacklight -get | cut -d '.' -f 1 + #xbacklight -get | cut -d '.' -f 1 # This seems to no longer work on Intel graphics + max_bright=$(cat /sys/class/backlight/intel_backlight/max_brightness) + act_bright=$(cat /sys/class/backlight/intel_backlight/actual_brightness) + # To round down/up/nearest in sh: https://stackoverflow.com/a/2395294 + # In this case we round to the nearest: (num + (denom / 2)) / denom + echo $(( (act_bright*100+(max_bright/2))/max_bright )) +} + +function draw_bar { + percentual=$1 + slices=$2 + lvl=$((percentual / slices)) + empty=$(((100 / slices) - lvl)) + lvl_bar="" + for X in $(seq "$lvl"); do + lvl_bar="$lvl_bar$(printf '\u2588')" + done + empty_bar="" + for X in $(seq "$empty"); do + empty_bar="$empty_bar$(printf '\u2591')" + done + echo "$lvl_bar$empty_bar" } function send_notification { - icon="preferences-system-brightness-lock" - brightness=$(get_brightness) - # Make the bar with the special character ─ (it's not dash -) - # https://en.wikipedia.org/wiki/Box-drawing_character - bar=$(seq -s "─" 0 $((brightness / 5)) | sed 's/[0-9]//g') + if [ ! -d "/sys/class/backlight/intel_backlight/" ]; then + notif_icon="display-brightness-disabled-dark" + notif_text="Disabled" + else + brightness=$(get_brightness) + if [ $brightness -le 0 ] ; then + notif_icon="display-brightness-none-dark" + else + if [ $brightness -le 30 ] ; then + notif_icon="display-brightness-low-dark" + else + if [ $brightness -le 85 ] ; then + notif_icon="display-brightness-medium-dark" + else + if [ $brightness -le 100 ] ; then + notif_icon="display-brightness-high-dark" + else + notif_icon="display-brightness-overamplified-dark" + fi + fi + fi + fi + notif_text=$(draw_bar $brightness 5) + fi # Send the notification - dunstify -i "$icon" -r 5555 -u normal " $bar" + dunstify -i "$notif_icon" -r 5555 -u normal "$notif_text" } case $1 in diff --git a/i3/.config/i3/scripts/volumeControl.sh b/i3/.config/i3/scripts/volumeControl.sh index 86ff4df..ee61a7e 100755 --- a/i3/.config/i3/scripts/volumeControl.sh +++ b/i3/.config/i3/scripts/volumeControl.sh @@ -17,19 +17,49 @@ function is_mute { amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off > /dev/null } +function draw_bar { + percentual=$1 + slices=$2 + lvl=$((percentual / slices)) + empty=$(((100 / slices) - lvl)) + lvl_bar="" + for X in $(seq "$lvl"); do + lvl_bar="$lvl_bar$(printf '\u2588')" + done + empty_bar="" + for X in $(seq "$empty"); do + empty_bar="$empty_bar$(printf '\u2591')" + done + echo "$lvl_bar$empty_bar" +} + function send_notification { - iconSound="audio-volume-high" - iconMuted="audio-volume-muted" if is_mute ; then - dunstify -i $iconMuted -r 2593 -u normal "mute" + notif_icon="audio-volume-muted-dark" + notif_text="Muted" else volume=$(get_volume) - # Make the bar with the special character ─ (it's not dash -) - # https://en.wikipedia.org/wiki/Box-drawing_character - bar=$(seq --separator="─" 0 "$((volume / 5))" | sed 's/[0-9]//g') - # Send the notification - dunstify -i $iconSound -r 2593 -u normal " $bar" + if [ $volume -le 0 ] ; then + notif_icon="audio-volume-none-dark" + else + if [ $volume -le 30 ] ; then + notif_icon="audio-volume-low-dark" + else + if [ $volume -le 85 ] ; then + notif_icon="audio-volume-medium-dark" + else + if [ $volume -le 100 ] ; then + notif_icon="audio-volume-high-dark" + else + notif_icon="audio-volume-overamplified-dark" + fi + fi + fi + fi + notif_text="$(draw_bar $volume 5)" fi + # Send the notification + dunstify -i $notif_icon -r 2593 -u normal "$notif_text" } case $1 in diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-high-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-high-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..332eeb8881cbeab2f841a30b2b6032fec326e2f5 GIT binary patch literal 487 zcmVkdg00055Nkl|N63)1$rhq0MdpF5NKV>0lbJ2)qKEHTQYp|noy`6i*6~%2CT+sq_18Vx*o?X zS%Alq18}5ip$}%gO9NIUCqQZl-89|NLUC`dTYMEE(m=$tL6vzp^_%mGw*`X zOVdw;JTkGwUG`|0RRx-+%f6|68`v~G4SX?u#TQTpKAFA*v`k+F2$WaP0T9J{oaG#c z0CWgreayJu4F-k-I0a7PI`n)(+pZ3908E(v=?mBfW=-z{Qwi+_cn{2*{tR3-y&FBG zD3MwU6Nyw4dSm*LUnVXjQn{;8fey^NF#IeZuC83qZK|(r`#{%R0Cc~gt-o^r3q>ExH7QX-h002ovPDHLkV1ig}&7lAQ literal 0 HcmV?d00001 diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-low-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-low-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..eb6aa30a3d061a157286f69f13388d41841c0165 GIT binary patch literal 495 zcmVkdg0005DNklN9}2tAQ+4N>nsn4#CT_Ct2rp^6d!5?r}wFwKC+>T%*^*b-Js#7$s| zA)ne4gt+BeSVOkJB*VXWrU^I@7PHFF!*u3IR)~p77jPlGmO^ew1CUR(o)4A@v(1;B zPz0PJD)a=xbo0u&u&5$Xs_VoK;8Ji1coAHzE6@zwJ1&Gb1#1bED?vd82XqC#07Jp% zU;Dwmovy5I+y6sXU=Ju$1d0``C9np>1U~^`!OwaEx2zDPPS~Y*0pL+jpobJK^4}*( zu;sL$F0A|UvxG6C%4tnNz%{jyCEAt#jw?#CiHWvarKX?QpMSTyS0A9w~Nm ld6_=hv~Gd-9{lg?{0$&hVLhU*)N=p;002ovPDHLkV1f^8-@yO? literal 0 HcmV?d00001 diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-medium-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/audio-volume-medium-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..d2d001d2ff7dcef4604a91347c7207d9c54d96c8 GIT binary patch literal 494 zcmVkdg0005CNklstnht` zDk5BoR+$QzVniALYy!ZsXl3yfaA8_=)YkVdU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ALofH$VL=KLK!`s{Pg tGAjVYgb6cX%;75cY`^mhRnDjbd;=VB&5Hz{hqV9z002ovPDHLkV1n0Dkz4=( literal 0 HcmV?d00001 diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-disabled-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-disabled-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..700abf7ae69eede1e5a6844380fb77ce76ad8a92 GIT binary patch literal 637 zcmV-@0)qXCP)kdg0006+Nkl8i@?#%4G@4WBq_q|DiE^Wp!RLyr@Qs{^?04MJ2m=20y$JVu*>3^d}=cc>G2=QXSqLAU)ViM%pB>X~BLkg*4R`&WOp@$-b7E zveU7*?VYa}HenE)@yX9WF&K}zZ+qd3nwoXbBP=oA%3vl+CRJTZe_1VCRrAh8aNOHW zrBE$o-BfjHoo_X4w3StCU8OMeAJkZFs{GwJ8gBXna$j?pzLt95R0b2avQsEI7keAc z8fi^oC2C^ORVNe`oiG!BW3bY^yj>-pceYKkk9)VYC7b_dX^gsN%)SL5G*S!k8T@h` z%-R!#dp4r=vzqsV@17~8 zR@tG=dgM?x>i5K4()DtkYbv5z+;BfDfZE@wF+I9lZp2iIeO&=nLrpgm!A%dqLj`^V Xn5LXfE&6ew00000NkvXXu0mjf6WAr5 literal 0 HcmV?d00001 diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-high-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-high-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..420d8db7c63971635b9316dc17f7acb4019757c6 GIT binary patch literal 487 zcmVkdg00055Nkl3Tn=N&tLeKoz zBMwV$y}bup`~cu!`<(j#^nJ(^4gd=*lc3C2ea)d3d*(G24h~l)!JZr5V+rOu+zyto zr`V};xTMXP4I9R^C?N=ScEK`(DbA@Q>T-(wii%@57mKc?2j#r|rM>gyoMbIVA zI%xclouGhHWU=|zUWB)76BrYs#TZZG*(vY2c`&Lx_RShHqCL)Csz&bI#M z{Fs4K_6@6}Mw-PUVyK31CR-2HvtSACSbt6&>ksBw_g`(66lIj+YAef9zO+dG)!i7j dK|p&E_6w08_NW(J{rUg^002ovPDHLkV1n&i-x~k` literal 0 HcmV?d00001 diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-low-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-low-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..730fe87d71c9311d6f33612afbdf43eb8ff57537 GIT binary patch literal 577 zcmV-H0>1r;P)kdg0006ANkl(rg(f%7}T16l+`Y$RPI9Yllx1hjy@ zi5{lD{*(ZKkcg4n!H`eLlz5!m{u4tNCk$sd@tY|jz5uYs9_QR}!#N$A0DLwXC$>kB z`_$D|LnzX|Zsp=uU4=powN-aHeu2po>AkYhQ<%=qDzL9SbjuW2v(0~1TT5Ef3tgB< ztVi<;>{)u%#+G$yqPw&Ci^g$S*KL{A4!`YA|6+$XVE=VE3-&c}-F>q<@)YpFDsk#k zfYq{Y4D#JLm{EQrkxege)5^_v#~{6l9kX2*TDGy8u1xgR{8MP!W4zS1s;X++(qla= zBcyJwkao){F;p*;{%*dM6ElVCD)z{+I@x9lz z9eUQy)aN5&%<*KTy7$6Q4v3ObS%B{xFiz-h0T@lgg&6*~yD^RQ&6L7FKR6N#fR*`T P00000NkvXXu0mjfe<>0X literal 0 HcmV?d00001 diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-medium-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-medium-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..b88447f96a63786f62f5adc8f86aff348ce6f9d0 GIT binary patch literal 551 zcmV+?0@(eDP)kdg0005*Nkl3%M5QUE;J6&vqk`mK`BMd^~2@(($Q3_%#-Gb-HGsKRiyaG)kM2jMRo&ZIF^Mfd` z2&I+8IO%Nbqqut~_uBUlBxVcm%+5KU-8*NufKu$S7A5udJ~?GB4X;H>(o$MVIzbK# z6I4~tg}JY49Kiz}=s;d3{JB2qiyoPeKdPJqFrtBMtkR^(YAEu85dddY{YbD-XAF*F zBLs+!4F`u2_o4*X-0&ljpl5KaQ#0jF@DO5|Z4SBOibLAe5W-_Jz0K(odw7U>c5F+& zjp2sgu}9t$dwWVm}uC zHoKJrF_q|;xP#)`*9eV z%hO)s%e1G0Ua2T)s6q5vKh=uPG|@}#roK$OYHF;3p6Zt$DB99zJyb>AOjW$rcU=VV pFu}D7vh3@BdmCr1Kc&4G`vc$O4XGrm*OUMN002ovPDHLkV1in42Uh?9 literal 0 HcmV?d00001 diff --git a/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-none-dark.png b/icons/.icons/Adwaita-dark-custom/32x32/status/display-brightness-none-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..434f025172321a4338bd9de98424aa34a3ae3ded GIT binary patch literal 592 zcmV-W0kdg0006PNkl?R;mx^LD=Tg3tilFol}!{w^bf@TS0nK`w&>3}KxC#!L={nKagZ z8BJFAt;^eYdI!9ytZB!uG=niO+!I(;>~OAiJa6rxvOwN?%pzuxmji(^&Z6DzO!hSa z$jPgBGPv|X7=>8sOMf|nhxS}{pTSqG34}g^f_XE>aii+Q6^^V5g!U4Sf-p^S*^yHt zRxCu>L^(gJXen7#X~Vk%#0UG_OpgMpcD06Sq?Mj9JG3(@Mzp`VzxWCA?) z#r0hb=A+uLyzxU*(|4~USYSTOU?Y-Dth$)~k!Ir6bm$qFb&#kOY9q-qR$biZ7pX)S zNyoNT3J?B)8f#shUyt6VyZ(TVuN|1tOuttZz>cpp>^eOn0gJC+cqS_OF?(nXeShT66W!JGZwa~G5T1qxkBPUftQCT32 z##+H6vyq(7ow!D6keqMfaN|{l?8E literal 0 HcmV?d00001