a metric butt ton of updates that idk....

This commit is contained in:
Chris Cochrun 2022-12-08 12:15:21 -06:00
parent 972aec6926
commit fc5a0acaec
18 changed files with 486 additions and 405 deletions

37
eww/scripts/appname Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
#define icons for workspaces 1-9
#icontheme=$(geticons -U)
icontheme=$(grep "gtk-icon-theme-name" "$HOME"/.config/gtk-3.0/settings.ini | cut --delimiter="=" -f 2)
workspaces() {
if [[ ${1:0:12} == "activewindow" ]]; then #set focused workspace
string=${1:14}
class="${string/,*/}"
export title=${string/,/, }
[[ $title == ", " ]] && unset title
export iconpath=$(geticons "$class" -s 16 -c 1 -t "$icontheme" | head -n 1)
fi
}
module() {
#output eww widget
echo "(box \
:orientation \"h\" \
:halign \"start\" \
:space-evenly false \
(image \
:class \"app-icon\" \
:path \"$iconpath\" \
:image-width \"18\") \
(label \
:class \"app-name\" \
:limit-width \"35\" \
:text \"$title\" \
:tooltip \"$title\"))"
}
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do
workspaces "$event"
module
done

3
eww/scripts/bright Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
brightnessctl | rg Current | awk '{print $4}' | sed 's/(\(.*\)%)/\1/'

55
eww/scripts/notifications Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env bash
tmp=/tmp/dunst-history.json
notif() {
export ids=($(dunstctl history | jq '.data[] | .[].id.data'))
printf "\n (box \
:orientation \"v\" \
:space-evenly \"false\" \
:spacing \"20\" \
:halign \"start\" "
for id in "${ids[@]}"; do
mapfile -t notif < <(jq -r ".data[] | .[] | select(.id.data == $id) | .appname.data, .icon_path.data, .summary.data, .body.data" "$tmp" | sed -r '/^\s*$/d' | sed -e 's/\%/ percent/g')
printf "(eventbox :onclick \"dunstctl history-pop $id && dunstctl action 0 && dunstctl close\" \
(box \
:class \"notification\" \
:orientation \"h\" \
:width 300 \
:space-evenly \"false\" \
(image \
:class \"notification-icon\" \
:path \"${notif[1]}\" \
:image-height 50 \
:image-width 100) \
(box \
:orientation \"v\" \
:space-evenly \"false\" \
:valign \"left\" \
:width 300 \
:spacing 10 \
(label \
:xalign 0 \
:wrap "true" \
:class \"notification-appname\" \
:text \"${notif[0]}\") \
(label \
:xalign 0 \
:wrap "true" \
:class \"notification-summary\" \
:text \"${notif[2]}\") \
(label \
:xalign 0 \
:wrap "true" \
:class \"notification-body\" \
:text \"${notif[3]}\"))))"
done
printf ") \n"
}
notif
tail --follow $tmp 2> /dev/null | grep --line-buffered "aa{sv}" | while read -r; do
notif
done

View file

@ -1,20 +1,20 @@
#!/bin/bash
#!/usr/bin/env bash
calendar() {
LOCK_FILE="$HOME/.cache/eww-calendar.lock"
EWW_BIN="$HOME/.local/bin/eww/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open calendar
eww open calendar
}
# Open widgets
if [[ ! -f "$LOCK_FILE" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close system music_win audio_ctl
eww close system music_win audio_ctl
touch "$LOCK_FILE"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close calendar
eww close calendar
rm "$LOCK_FILE" && echo "closed"
fi
}
@ -25,16 +25,16 @@ LOCK_FILE_MEM="$HOME/.cache/eww-system.lock"
EWW_BIN="$HOME/.local/bin/eww/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open system
eww open system
}
# Open widgets
if [[ ! -f "$LOCK_FILE_MEM" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close calendar music_win audio_ctl
eww close calendar music_win audio_ctl
touch "$LOCK_FILE_MEM"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close system
eww close system
rm "$LOCK_FILE_MEM" && echo "closed"
fi
}
@ -45,16 +45,16 @@ LOCK_FILE_SONG="$HOME/.cache/eww-song.lock"
EWW_BIN="$HOME/.local/bin/eww/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open music_win
eww open music_win
}
# Open widgets
if [[ ! -f "$LOCK_FILE_SONG" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close system calendar
eww close system calendar
touch "$LOCK_FILE_SONG"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close music_win
eww close music_win
rm "$LOCK_FILE_SONG" && echo "closed"
fi
}
@ -66,16 +66,16 @@ LOCK_FILE_AUDIO="$HOME/.cache/eww-audio.lock"
EWW_BIN="$HOME/.local/bin/eww/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open audio_ctl
eww open audio_ctl
}
# Open widgets
if [[ ! -f "$LOCK_FILE_AUDIO" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close system calendar music
eww close system calendar music
touch "$LOCK_FILE_AUDIO"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close audio_ctl
eww close audio_ctl
rm "$LOCK_FILE_AUDIO" && echo "closed"
fi
}

View file

@ -1,26 +1,22 @@
#!/bin/bash
#!/bin/sh
status=$(nmcli g | grep -oE "disconnected")
essid=$(nmcli c | grep wlp2s0 | awk '{print ($1)}')
essid=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2)
if [ $status ] ; then
icon=""
icon=""
text=""
col="#575268"
else
icon=""
icon=""
text="${essid}"
col="#a1bdce"
fi
if [[ "$1" == "--COL" ]]; then
echo $col
elif [[ "$1" == "--ESSID" ]]; then
echo $text
elif [[ "$1" == "--ICON" ]]; then
echo $icon
fi
case $1 in
--COL) echo $col;;
--ESSID) echo $text;;
--ICON) echo $icon;;
esac

View file

@ -1,56 +1,72 @@
#!/bin/sh
workspaces() {
#!/usr/bin/env bash
ws1="1"
ws2="2"
ws3="3"
ws4="4"
ws5="5"
ws6="6"
#define icons for workspaces 1-9
ic=(0     輸  " " " " )
# Unoccupied
un="0"
# check if Occupied
o1=$(bspc query -D -d .occupied --names | grep "$ws1" )
o2=$(bspc query -D -d .occupied --names | grep "$ws2" )
o3=$(bspc query -D -d .occupied --names | grep "$ws3" )
o4=$(bspc query -D -d .occupied --names | grep "$ws4" )
o5=$(bspc query -D -d .occupied --names | grep "$ws5" )
o6=$(bspc query -D -d .occupied --names | grep "$ws6" )
# check if Focused
f1=$(bspc query -D -d focused --names | grep "$ws1" )
f2=$(bspc query -D -d focused --names | grep "$ws2" )
f3=$(bspc query -D -d focused --names | grep "$ws3" )
f4=$(bspc query -D -d focused --names | grep "$ws4" )
f5=$(bspc query -D -d focused --names | grep "$ws5" )
f6=$(bspc query -D -d focused --names | grep "$ws6" )
ic_1=""
ic_2=""
ic_3=""
ic_4=""
ic_5=""
ic_6=""
if [ $f1 ]; then
ic_1=""
elif [ $f2 ]; then
ic_2=""
elif [ $f3 ]; then
ic_3=""
elif [ $f4 ]; then
ic_4=""
elif [ $f5 ]; then
ic_5=""
elif [ $f6 ]; then
ic_6=""
fi
echo "(box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"false\" (button :onclick \"bspc desktop -f $ws1\" :class \"$un$o1$f1\" \"$ic_1\") (button :onclick \"bspc desktop -f $ws2\" :class \"$un$o2$f2\" \"$ic_2\") (button :onclick \"bspc desktop -f $ws3\" :class \"$un$o3$f3\" \"$ic_3\") (button :onclick \"bspc desktop -f $ws4\" :class \"$un$o4$f4\" \"$ic_4\") (button :onclick \"bspc desktop -f $ws5\" :class \"$un$o5$f5\" \"$ic_5\") (button :onclick \"bspc desktop -f $ws6\" :class \"$un$o6$f6\" \"$ic_6\"))"
}
workspaces
bspc subscribe desktop node_transfer | while read -r _ ; do
workspaces
#initial check for occupied workspaces
for num in $(hyprctl workspaces | grep ID | awk '{print $3}'); do
export o"$num"="$num"
done
#initial check for focused workspace
for num in $(hyprctl monitors | grep -B 4 "focused: yes" | awk 'NR==1{print $3}'); do
export f"$num"="$num"
export fnum=f"$num"
export mon=$(hyprctl monitors | grep -B 2 "\($num\)" | awk 'NR==1{print $2}')
done
workspaces() {
if [[ ${1:0:9} == "workspace" ]] && [[ ${1:11} != "special" ]]; then #set focused workspace
unset -v "$fnum"
num=${1:11}
export f"$num"="$num"
export fnum=f"$num"
elif [[ ${1:0:10} == "focusedmon" ]]; then #set focused workspace following monitor focus change
unset -v "$fnum"
string=${1:12}
num=${string##*,}
export mon=${string/,*/}
export f"$num"="$num"
export fnum=f"$num"
elif [[ ${1:0:13} == "moveworkspace" ]] && [[ ${1##*,} == "$mon" ]]; then #Set focused workspace following swapactiveworkspace
unset -v "$fnum"
string=${1:15}
num=${string/,*/}
export f"$num"="$num"
export fnum=f"$num"
elif [[ ${1:0:15} == "createworkspace" ]]; then #set Occupied workspace
num=${1:17}
export o"$num"="$num"
export onum=o"$num"
elif [[ ${1:0:16} == "destroyworkspace" ]]; then #unset unoccupied workspace
num=${1:18}
unset -v o"$num"
fi
}
module() {
#output eww widget
echo "(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace\" \
(box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"false\" :valign \"center\" \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 1\'\" :onrightclick \"hyprctl dispatch workspace 1 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o1$f1\" \"${ic[1]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 2\'\" :onrightclick \"hyprctl dispatch workspace 2 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o2$f2\" \"${ic[2]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 3\'\" :onrightclick \"hyprctl dispatch workspace 3 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o3$f3\" \"${ic[3]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 4\'\" :onrightclick \"hyprctl dispatch workspace 4 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o4$f4\" \"${ic[4]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 5\'\" :onrightclick \"hyprctl dispatch workspace 5 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o5$f5\" \"${ic[5]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 6\'\" :onrightclick \"hyprctl dispatch workspace 6 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o6$f6\" \"${ic[6]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 7\'\" :onrightclick \"hyprctl dispatch workspace 7 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o7$f7\" \"${ic[7]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 8\'\" :onrightclick \"hyprctl dispatch workspace 8 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o8$f8\" \"${ic[8]}\") \
(button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/neon/scripts/workspace 9\'\" :onrightclick \"hyprctl dispatch workspace 9 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o9$f9\" \"${ic[9]}\") \
)\
)"
}
module
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do
workspaces "$event"
module
done