switch to hyprland, kitty, remove old KDE apps, add eww
Change-Id: Idbac14bf4ee5fd885a2417859847d719b57fd8e0
Reviewed-on: https://git.clicks.codes/c/Coded/nixConfig/+/370
Reviewed-by: Samuel Shuert <coded@clicks.codes>
Tested-by: Samuel Shuert <coded@clicks.codes>
diff --git a/extensions/eww/scripts/battery b/extensions/eww/scripts/battery
new file mode 100755
index 0000000..0540a1b
--- /dev/null
+++ b/extensions/eww/scripts/battery
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+battery() {
+ BAT=`ls /sys/class/power_supply | grep BAT | head -n 1`
+ cat /sys/class/power_supply/${BAT}/capacity
+}
+battery_stat() {
+ BAT=`ls /sys/class/power_supply | grep BAT | head -n 1`
+ cat /sys/class/power_supply/${BAT}/status
+}
+
+if [[ "$1" == "--bat" ]]; then
+ battery
+elif [[ "$1" == "--bat-st" ]]; then
+ battery_stat
+fi
+
diff --git a/extensions/eww/scripts/mem-ad b/extensions/eww/scripts/mem-ad
new file mode 100755
index 0000000..1e4cf89
--- /dev/null
+++ b/extensions/eww/scripts/mem-ad
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+
+total="$(free -m | grep Mem: | awk '{ print $2 }')"
+used="$(free -m | grep Mem: | awk '{ print $3 }')"
+
+free=$(expr $total - $used)
+
+if [ "$1" = "total" ]; then
+ echo $total
+elif [ "$1" = "used" ]; then
+ echo $used
+elif [ "$1" = "free" ]; then
+ echo $free
+fi
diff --git a/extensions/eww/scripts/memory b/extensions/eww/scripts/memory
new file mode 100755
index 0000000..217c834
--- /dev/null
+++ b/extensions/eww/scripts/memory
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')
diff --git a/extensions/eww/scripts/music_info b/extensions/eww/scripts/music_info
new file mode 100755
index 0000000..ffafe87
--- /dev/null
+++ b/extensions/eww/scripts/music_info
@@ -0,0 +1,98 @@
+#!/bin/bash
+# scripts by adi1090x
+
+## Get data
+STATUS="$(mpc status)"
+COVER="/tmp/.music_cover.png"
+MUSIC_DIR="$HOME/Music"
+
+## Get status
+get_status() {
+ if [[ $STATUS == *"[playing]"* ]]; then
+ echo ""
+ else
+ echo "奈"
+ fi
+}
+
+## Get song
+get_song() {
+ song=`mpc -f %title% current`
+ if [[ -z "$song" ]]; then
+ echo "Offline"
+ else
+ echo "$song"
+ fi
+}
+
+## Get artist
+get_artist() {
+ artist=`mpc -f %artist% current`
+ if [[ -z "$artist" ]]; then
+ echo ""
+ else
+ echo "$artist"
+ fi
+}
+
+## Get time
+get_time() {
+ time=`mpc status | grep "%)" | awk '{print $4}' | tr -d '(%)'`
+ if [[ -z "$time" ]]; then
+ echo "0"
+ else
+ echo "$time"
+ fi
+}
+get_ctime() {
+ ctime=`mpc status | grep "#" | awk '{print $3}' | sed 's|/.*||g'`
+ if [[ -z "$ctime" ]]; then
+ echo "0:00"
+ else
+ echo "$ctime"
+ fi
+}
+get_ttime() {
+ ttime=`mpc -f %time% current`
+ if [[ -z "$ttime" ]]; then
+ echo "0:00"
+ else
+ echo "$ttime"
+ fi
+}
+
+## Get cover
+get_cover() {
+ ffmpeg -i "${MUSIC_DIR}/$(mpc current -f %file%)" "${COVER}" -y &> /dev/null
+ STATUS=$?
+
+ # Check if the file has a embbeded album art
+ if [ "$STATUS" -eq 0 ];then
+ echo "$COVER"
+ else
+ echo "images/music.png"
+ fi
+}
+
+## Execute accordingly
+if [[ "$1" == "--song" ]]; then
+ get_song
+elif [[ "$1" == "--artist" ]]; then
+ get_artist
+elif [[ "$1" == "--status" ]]; then
+ get_status
+elif [[ "$1" == "--time" ]]; then
+ get_time
+elif [[ "$1" == "--ctime" ]]; then
+ get_ctime
+elif [[ "$1" == "--ttime" ]]; then
+ get_ttime
+elif [[ "$1" == "--cover" ]]; then
+ get_cover
+elif [[ "$1" == "--toggle" ]]; then
+ mpc -q toggle
+elif [[ "$1" == "--next" ]]; then
+ { mpc -q next; get_cover; }
+elif [[ "$1" == "--prev" ]]; then
+ { mpc -q prev; get_cover; }
+fi
diff --git a/extensions/eww/scripts/pop b/extensions/eww/scripts/pop
new file mode 100755
index 0000000..aef82e8
--- /dev/null
+++ b/extensions/eww/scripts/pop
@@ -0,0 +1,92 @@
+#!/bin/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
+}
+
+# Open widgets
+if [[ ! -f "$LOCK_FILE" ]]; then
+ ${EWW_BIN} -c $HOME/.config/eww/bar close system music_win audio_ctl
+ touch "$LOCK_FILE"
+ run && echo "ok good!"
+else
+ ${EWW_BIN} -c $HOME/.config/eww/bar close calendar
+ rm "$LOCK_FILE" && echo "closed"
+fi
+}
+
+
+system() {
+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
+}
+
+# Open widgets
+if [[ ! -f "$LOCK_FILE_MEM" ]]; then
+ ${EWW_BIN} -c $HOME/.config/eww/bar close calendar music_win audio_ctl
+ touch "$LOCK_FILE_MEM"
+ run && echo "ok good!"
+else
+ ${EWW_BIN} -c $HOME/.config/eww/bar close system
+ rm "$LOCK_FILE_MEM" && echo "closed"
+fi
+}
+
+
+music() {
+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
+}
+
+# Open widgets
+if [[ ! -f "$LOCK_FILE_SONG" ]]; then
+ ${EWW_BIN} -c $HOME/.config/eww/bar close system calendar
+ touch "$LOCK_FILE_SONG"
+ run && echo "ok good!"
+else
+ ${EWW_BIN} -c $HOME/.config/eww/bar close music_win
+ rm "$LOCK_FILE_SONG" && echo "closed"
+fi
+}
+
+
+
+audio() {
+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
+}
+
+# Open widgets
+if [[ ! -f "$LOCK_FILE_AUDIO" ]]; then
+ ${EWW_BIN} -c $HOME/.config/eww/bar close system calendar music
+ touch "$LOCK_FILE_AUDIO"
+ run && echo "ok good!"
+else
+ ${EWW_BIN} -c $HOME/.config/eww/bar close audio_ctl
+ rm "$LOCK_FILE_AUDIO" && echo "closed"
+fi
+}
+
+
+if [ "$1" = "calendar" ]; then
+calendar
+elif [ "$1" = "system" ]; then
+system
+elif [ "$1" = "music" ]; then
+music
+elif [ "$1" = "audio" ]; then
+audio
+fi
diff --git a/extensions/eww/scripts/wifi b/extensions/eww/scripts/wifi
new file mode 100755
index 0000000..5d7cc59
--- /dev/null
+++ b/extensions/eww/scripts/wifi
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+status=$(nmcli g | grep -oE "disconnected")
+essid=$(nmcli c | grep wlp2s0 | awk '{print ($1)}')
+
+if [ $status ] ; then
+ icon=""
+ text=""
+ col="#575268"
+
+else
+ 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
+
diff --git a/extensions/eww/scripts/workspace b/extensions/eww/scripts/workspace
new file mode 100755
index 0000000..f202ef1
--- /dev/null
+++ b/extensions/eww/scripts/workspace
@@ -0,0 +1,56 @@
+#!/bin/sh
+workspaces() {
+
+ws1="1"
+ws2="2"
+ws3="3"
+ws4="4"
+ws5="5"
+ws6="6"
+
+# 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
+done