first Version

This commit is contained in:
willifan 2024-03-13 19:01:27 +01:00
commit 0c4bef47e8
149 changed files with 32273 additions and 0 deletions

View file

View file

@ -0,0 +1,10 @@
(defwindow example
:monitor 0
:geometry (geometry :x "0%"
:y "20px"
:width "50%"
:height "50px"
:anchor "top center")
:stacking "fg"
"example content")

View file

@ -0,0 +1,70 @@
.bar {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.calendar {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.power {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.activeWorkspace {
color: green;
}
.cpu {
color: red;
}
.ram {
color: green;
}
.volume {
color: lavender;
}
.brightness {
color: yellow;
}
.network {
color: orange;
}
.bluetooth {
color: lightblue;
}
.battery {
color: lightgreen;
}
.batteryLow {
color: red;
}
.power {
color: darkred;
}
.time {
}
.workspaces {
}
.playback {
}

View file

@ -0,0 +1,242 @@
;;Input values
(deflisten monitors
:initial "[]"
`scripts/monitors.sh`)
(defvar brightnessValue 96000)
(defpoll activeNetworks
:interval "2s"
`nmcli connection show --active | awk 'NR>1 && $3!="loopback" { print $1 }'`)
(deflisten workspaces
:initial "[]"
`scripts/workspaces.sh`)
(defpoll activeWorkspace
:interval "2s"
`hyprctl activeworkspace | awk 'NR==1{print $3}'`)
(deflisten bluetooth
:initial "[]"
`scripts/bluetooth.sh`)
(defvar volumeValue 100)
;; Widget templates
(defwidget icon [widgetclass ?hover percentage image]
(box
:class "${widgetclass}"
:space-evenly false
(overlay
:tooltip "${hover}"
(circular-progress
:width 20
:value "${percentage}"
:start-at 75
:thickness 2
:clockwise false)
(transform
:scale-x "50%"
:scale-y "50%"
:halign "center"
:valign "center"
:translate-x "16"
:translate-y "16"
(image
:path "${image}"
:image-width "32"
:image-height "32")))))
;; Widgets
(defwidget workspaces []
(box
(for workspace in workspaces
(label
:width "15"
:class {workspace.active == 1 ? "activeWorkspace" :""}
:visible {workspace.occupied == 1 ? "true" : "false"}
:text "${workspace.num}"))))
(defwidget time []
(eventbox
:onhover "eww open calendar"
:onhoverlost "eww close calendar"
{formattime(EWW_TIME, "%H:%M:%S")}))
(defwidget cpu []
(icon
:widgetclass "cpu"
:hover "${round(EWW_CPU.avg, 1)}%"
:percentage "${round(EWW_CPU.avg, 1)}"
:image "images/cpu.png"))
(defwidget ram []
(icon
:widgetclass "ram"
:hover "${round(EWW_RAM.used_mem_perc, 1)}%"
:percentage "${round(EWW_RAM.used_mem_perc, 1)}"
:image "images/ram.png"))
(defwidget volume []
(icon
:widgetclass "volume"
:hover "${volumeValue}%"
:percentage "${volumeValue}"
:image "images/volume.png"))
(defwidget brightness []
(icon
:widgetclass "brightness"
:hover "${brightnessValue / 960}%"
:percentage "${brightnessValue / 960}"
:image "images/brightness.png"))
(defwidget network []
(icon
:widgetclass "network"
:hover "${activeNetworks}"
:percentage "0"
:image "images/wifi.png"))
;;(defwidget bluetooth []
;; (icon
;; :widgetclass "bluetooth"
;; :hover "${bluetoothDevices}"
;; :percentage "${bluetoothBattery}"
;; :image "images/bluetooth.png"))
(defwidget battery []
(icon
:widgetclass {EWW_BATTERY.BAT1.status == "Charging" ? "battery" : EWW_BATTERY.total_avg > 25 ? "battery" : "batteryLow"}
:hover "${round(EWW_BATTERY.total_avg, 1)}%"
:percentage "${round(EWW_BATTERY.total_avg, 1)}"
:image {EWW_BATTERY.BAT1.status == "Charging" ? "images/charging.png" : EWW_BATTERY.total_avg > 25 ? "images/battery.png" : "images/batteryLow.png"}))
(defwidget power []
(icon
:widgetclass "power"
:hover "placeholder"
:percentage "0"
:image "images/power.png"))
(defwidget space []
(box
:width 5))
(defwidget seperator []
(box
:width 20
(label
:text "|"
)))
(defwidget cal []
(calendar
:day {formattime(EWW_TIME, "%d")}
:month {formattime(EWW_TIME, "%m")}
:year {formattime(EWW_TIME, "%y")}))
(defwidget winPower []
(box
:orientation "v"
(box
:halign "end"
(power))))
;; Widget blocks
(defwidget start []
(box
:orientation "h"
:space-evenly false
:halign "start"
(space)
(workspaces)))
(defwidget center []
(box
:orientation "h"
:space-evenly false
:halign "center"
(time)))
(defwidget end []
(box
:orientation "h"
:space-evenly false
:halign "end"
(cpu)
(space)
(ram)
(seperator)
(volume)
(space)
(brightness)
(seperator)
(network)
(space)
;; (bluetooth)
(seperator)
(battery)
(space)
(power)))
(defwidget bar []
(centerbox :orientation "h"
(start)
(center)
(end)))
;; Window definition
(defwindow bar
:monitor 0
:class "bar"
:geometry (geometry
:x "0%"
:y "5px"
:width "1279px"
:height "3%"
:anchor "top center")
:stacking "fg"
:exclusive true
(bar))
(defwindow calendar
:monitor 0
:class "calendar"
:geometry
(geometry
:x "0%"
:y "5px"
:width "0%"
:height "0%"
:anchor "top center")
:stacking "overlay"
(cal))
(defwindow power
:monitor 0
:class "bars"
:geometry
(geometry
:x "5px"
:y "5px"
:width "2%"
:height "3%"
:anchor "top right")
:stacking "fg"
(winPower))

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,22 @@
#!/bin/bash
# Get the list of connected Bluetooth devices
devices=$(bluetoothctl devices Connected | awk '{print $2}')
# Iterate through each device and get its name and battery percentage
for device in $devices; do
# Get the device info using bluetoothctl
info=$(bluetoothctl info $device)
# Extract the name and battery percentage from the device info
name=$(echo "$info" | grep "Name" | awk '{ for(i=2; i<=NF; i++) printf "%s ", $i;}')
battery=$(echo "$info" | grep "Battery" | awk '{print $4}' | tr -d '()')
done
eww update bluetoothDevices="$name: $battery%"
eww update bluetoothBattery="$battery"
if [[ !$devices ]]; then
eww update bluetoothBattery="0"
fi

View file

@ -0,0 +1,38 @@
#!/bin/bash
brightness_file="/sys/class/backlight/intel_backlight/brightness"
min_brightness=1
max_brightness=96000
# Check if an argument is provided
if [[ -z $1 ]]; then
echo "Error: Number argument is missing."
exit 1
fi
# Retrieve the argument value
number_to_add=$1
# Validate if the argument is a number
if ! [[ $number_to_add =~ ^-?[0-9]+$ ]]; then
echo "Error: Invalid number argument."
exit 1
fi
# Read the current brightness value from the file
current_brightness=$(cat "$brightness_file")
# Add the desired number to the current brightness
new_brightness=$((current_brightness + number_to_add))
# Enforce minimum and maximum brightness values
if (( new_brightness < min_brightness )); then
new_brightness=$min_brightness
elif (( new_brightness > max_brightness )); then
new_brightness=$max_brightness
fi
# Write the new brightness value back to the file
echo "$new_brightness" >> "$brightness_file"
eww update brightnessValue="$new_brightness"

View file

@ -0,0 +1,34 @@
#!/bin/bash
declare -A id
declare -A horizontal
declare -A vertical
declare -A scale
generate() {
while read -r k h v s f; do
id[$k]="$k"
horizontal[$k]="$h"
vertical[$k]="$v"
scale[$k]="$s"
done < <(hyprctl monitors -j | jq -r '.[]|"\(.id) \(.width) \(.height) \(.scale)"')
echo -n '['
for ((i = 0; i < ${#id[@]}; i++)); do
echo -n ''$([ $i -eq 0 ] || echo ,)'{"id":"'$i'","width":"'${horizontal[$i]}'","height":"'${vertical[$i]}'",".scale":"'${scale[$i]}'"}'
done
echo ']'
}
generate
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
if [[ ${line%>>*} == "monitor"* ]]; then
generate
fi
done

View file

@ -0,0 +1,3 @@
#!/bin/bash
whoami > /home/willifan/text.txt

View file

@ -0,0 +1,19 @@
#!/bin/bash
#!/bin/bash
windows=()
workspaces=()
i=0
while read -r k v; do
windows[$i]="$k"
i=$i+1
workspaces[$i]="$v"
done < <(hyprctl clients -j | jq -r '.[]|"\(.pid) \(.workspace.id)"')
for window in ${!windows[@]}; do
echo $(ps -p ${windows[$window]} -o comm=)
done
test=$(ps -p ${windows[5]} -o comm=)
$(feh /usr/share/icons/Papirus-Dark/128x128/apps/${test}.svg)

View file

@ -0,0 +1,36 @@
#!/bin/bash
min_volume="0"
max_volume="100"
# Check if an argument is provided
if [[ -z $1 ]]; then
echo "Error: Number argument is missing."
exit 1
fi
# Retrieve the argument value
number_to_add=$1
# Validate if the argument is a number
if ! [[ $number_to_add =~ ^-?[0-9]+$ ]]; then
echo "Error: Invalid number argument."
exit 1
fi
# Read the current brightness value from the file
current_volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}')
# Add the desired number to the current brightness
new_volume=$((current_volume + number_to_add))
# Enforce minimum and maximum brightness values
if (( new_volume < min_volume )); then
new_volume=$min_volume
elif (( new_volume > max_volume )); then
new_volume=$max_volume
fi
wpctl set-volume @DEFAULT_AUDIO_SINK@ "${new_volume}%"
eww update volumeValue="$new_volume"

View file

@ -0,0 +1,113 @@
#!/bin/bash
# get initial focused workspace
focusedws=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
declare -A o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
declare -A monitormap
declare -A workspaces
# handle workspace create/destroy
workspace_event() {
if (( $1 <= 10 )); then
o[$1]=$2
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
fi
if [ "$2" == "0" ]; then
unset "workspaces[$1]"
fi
}
# handle monitor (dis)connects
monitor_event() {
while read -r k v; do monitormap["$k"]=$v; done < <(hyprctl -j monitors | jq -r '.[]|"\(.name) \(.id) "')
}
# generate the json for eww
generate() {
activeWorkspace=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
echo -n '['
for i in {1..10}; do
active=0
if [[ $activeWorkspace == $i ]]; then
active=1
fi
echo -n ''$([ $i -eq 1 ] || echo ,)'{"num":"'$i'","occupied":"'${o[$i]}'","active":"'$active'"}'
# echo -n ''$([ $i -eq 1 ] || echo ,) '{ "number": "'"$i"'", "activity": "'"$(status_activity $i)"'", "color": "'$(status "$i")'" }'
done
# echo -n ',{"num":"'$focusedws'","clr":"'$(status "$focusedws")'"}'
echo ']'
}
# setup
# add monitors
monitor_event
# add workspaces
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
# get active workspace
activeWorkspace=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
# check occupied workspaces
for num in "${!workspaces[@]}"; do
o[$num]=1
done
# generate initial widget
generate
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
# echo "${#workspaces[@]} ${#o[@]}"
# echo $line
case ${line%>>*} in
"focusedmon")
focusedws=${line#*,}
generate
;;
"createworkspace")
# workspace_event "${line#*>>}" 1
o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
workspaces=()
# add workspaces
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
# check occupied workspaces
for num in "${!workspaces[@]}"; do
o[$num]=1
done
# focusedws=${line#*>>}
generate
;;
"movewindow")
generate
;;
"destroyworkspace")
# workspace_event "${line#*>>}" 0
o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
workspaces=()
# add workspaces
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
# check occupied workspaces
for num in "${!workspaces[@]}"; do
o[$num]=1
done
generate
;;
"monitor"*)
monitor_event
generate
;;
"workspace")
generate
;;
esac
# echo $line
# generate
done

0
backup/eww/bar/eww.scss Normal file
View file

10
backup/eww/bar/eww.yuck Normal file
View file

@ -0,0 +1,10 @@
(defwindow example
:monitor 0
:geometry (geometry :x "0%"
:y "20px"
:width "50%"
:height "50px"
:anchor "top center")
:stacking "fg"
"example content")

70
backup/eww/eww.scss Normal file
View file

@ -0,0 +1,70 @@
.bar {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.calendar {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.power {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.activeWorkspace {
color: green;
}
.cpu {
color: red;
}
.ram {
color: green;
}
.volume {
color: lavender;
}
.brightness {
color: yellow;
}
.network {
color: orange;
}
.bluetooth {
color: lightblue;
}
.battery {
color: lightgreen;
}
.batteryLow {
color: red;
}
.power {
color: darkred;
}
.time {
}
.workspaces {
}
.playback {
}

242
backup/eww/eww.yuck Normal file
View file

@ -0,0 +1,242 @@
;;Input values
(deflisten monitors
:initial "[]"
`scripts/monitors.sh`)
(defvar brightnessValue 96000)
(defpoll activeNetworks
:interval "2s"
`nmcli connection show --active | awk 'NR>1 && $3!="loopback" { print $1 }'`)
(deflisten workspaces
:initial "[]"
`scripts/workspaces.sh`)
(defpoll activeWorkspace
:interval "2s"
`hyprctl activeworkspace | awk 'NR==1{print $3}'`)
(deflisten bluetooth
:initial "[]"
`scripts/bluetooth.sh`)
(defvar volumeValue 100)
;; Widget templates
(defwidget icon [widgetclass ?hover percentage image]
(box
:class "${widgetclass}"
:space-evenly false
(overlay
:tooltip "${hover}"
(circular-progress
:width 20
:value "${percentage}"
:start-at 75
:thickness 2
:clockwise false)
(transform
:scale-x "50%"
:scale-y "50%"
:halign "center"
:valign "center"
:translate-x "16"
:translate-y "16"
(image
:path "${image}"
:image-width "32"
:image-height "32")))))
;; Widgets
(defwidget workspaces []
(box
(for workspace in workspaces
(label
:width "15"
:class {workspace.active == 1 ? "activeWorkspace" :""}
:visible {workspace.occupied == 1 ? "true" : "false"}
:text "${workspace.num}"))))
(defwidget time []
(eventbox
:onhover "eww open calendar"
:onhoverlost "eww close calendar"
{formattime(EWW_TIME, "%H:%M:%S")}))
(defwidget cpu []
(icon
:widgetclass "cpu"
:hover "${round(EWW_CPU.avg, 1)}%"
:percentage "${round(EWW_CPU.avg, 1)}"
:image "images/cpu.png"))
(defwidget ram []
(icon
:widgetclass "ram"
:hover "${round(EWW_RAM.used_mem_perc, 1)}%"
:percentage "${round(EWW_RAM.used_mem_perc, 1)}"
:image "images/ram.png"))
(defwidget volume []
(icon
:widgetclass "volume"
:hover "${volumeValue}%"
:percentage "${volumeValue}"
:image "images/volume.png"))
(defwidget brightness []
(icon
:widgetclass "brightness"
:hover "${brightnessValue / 960}%"
:percentage "${brightnessValue / 960}"
:image "images/brightness.png"))
(defwidget network []
(icon
:widgetclass "network"
:hover "${activeNetworks}"
:percentage "0"
:image "images/wifi.png"))
;;(defwidget bluetooth []
;; (icon
;; :widgetclass "bluetooth"
;; :hover "${bluetoothDevices}"
;; :percentage "${bluetoothBattery}"
;; :image "images/bluetooth.png"))
(defwidget battery []
(icon
:widgetclass {EWW_BATTERY.BAT1.status == "Charging" ? "battery" : EWW_BATTERY.total_avg > 25 ? "battery" : "batteryLow"}
:hover "${round(EWW_BATTERY.total_avg, 1)}%"
:percentage "${round(EWW_BATTERY.total_avg, 1)}"
:image {EWW_BATTERY.BAT1.status == "Charging" ? "images/charging.png" : EWW_BATTERY.total_avg > 25 ? "images/battery.png" : "images/batteryLow.png"}))
(defwidget power []
(icon
:widgetclass "power"
:hover "placeholder"
:percentage "0"
:image "images/power.png"))
(defwidget space []
(box
:width 5))
(defwidget seperator []
(box
:width 20
(label
:text "|"
)))
(defwidget cal []
(calendar
:day {formattime(EWW_TIME, "%d")}
:month {formattime(EWW_TIME, "%m")}
:year {formattime(EWW_TIME, "%y")}))
(defwidget winPower []
(box
:orientation "v"
(box
:halign "end"
(power))))
;; Widget blocks
(defwidget start []
(box
:orientation "h"
:space-evenly false
:halign "start"
(space)
(workspaces)))
(defwidget center []
(box
:orientation "h"
:space-evenly false
:halign "center"
(time)))
(defwidget end []
(box
:orientation "h"
:space-evenly false
:halign "end"
(cpu)
(space)
(ram)
(seperator)
(volume)
(space)
(brightness)
(seperator)
(network)
(space)
;; (bluetooth)
(seperator)
(battery)
(space)
(power)))
(defwidget bar []
(centerbox :orientation "h"
(start)
(center)
(end)))
;; Window definition
(defwindow bar
:monitor 0
:class "bar"
:geometry (geometry
:x "0%"
:y "5px"
:width "1279px"
:height "3%"
:anchor "top center")
:stacking "fg"
:exclusive true
(bar))
(defwindow calendar
:monitor 0
:class "calendar"
:geometry
(geometry
:x "0%"
:y "5px"
:width "0%"
:height "0%"
:anchor "top center")
:stacking "overlay"
(cal))
(defwindow power
:monitor 0
:class "bars"
:geometry
(geometry
:x "5px"
:y "5px"
:width "2%"
:height "3%"
:anchor "top right")
:stacking "fg"
(winPower))

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
backup/eww/images/cpu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
backup/eww/images/power.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
backup/eww/images/ram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
backup/eww/images/test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
backup/eww/images/wifi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

3
backup/eww/scripts/backup.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
rsync -av --exclude='/backup/' /home/willifan/.config/eww /home/willifan/.config/eww/backup

22
backup/eww/scripts/bluetooth.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
# Get the list of connected Bluetooth devices
devices=$(bluetoothctl devices Connected | awk '{print $2}')
# Iterate through each device and get its name and battery percentage
for device in $devices; do
# Get the device info using bluetoothctl
info=$(bluetoothctl info $device)
# Extract the name and battery percentage from the device info
name=$(echo "$info" | grep "Name" | awk '{ for(i=2; i<=NF; i++) printf "%s ", $i;}')
battery=$(echo "$info" | grep "Battery" | awk '{print $4}' | tr -d '()')
done
eww update bluetoothDevices="$name: $battery%"
eww update bluetoothBattery="$battery"
if [[ !$devices ]]; then
eww update bluetoothBattery="0"
fi

View file

@ -0,0 +1,38 @@
#!/bin/bash
brightness_file="/sys/class/backlight/intel_backlight/brightness"
min_brightness=1
max_brightness=96000
# Check if an argument is provided
if [[ -z $1 ]]; then
echo "Error: Number argument is missing."
exit 1
fi
# Retrieve the argument value
number_to_add=$1
# Validate if the argument is a number
if ! [[ $number_to_add =~ ^-?[0-9]+$ ]]; then
echo "Error: Invalid number argument."
exit 1
fi
# Read the current brightness value from the file
current_brightness=$(cat "$brightness_file")
# Add the desired number to the current brightness
new_brightness=$((current_brightness + number_to_add))
# Enforce minimum and maximum brightness values
if (( new_brightness < min_brightness )); then
new_brightness=$min_brightness
elif (( new_brightness > max_brightness )); then
new_brightness=$max_brightness
fi
# Write the new brightness value back to the file
echo "$new_brightness" >> "$brightness_file"
eww update brightnessValue="$new_brightness"

34
backup/eww/scripts/monitors.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
declare -A id
declare -A horizontal
declare -A vertical
declare -A scale
generate() {
while read -r k h v s f; do
id[$k]="$k"
horizontal[$k]="$h"
vertical[$k]="$v"
scale[$k]="$s"
done < <(hyprctl monitors -j | jq -r '.[]|"\(.id) \(.width) \(.height) \(.scale)"')
echo -n '['
for ((i = 0; i < ${#id[@]}; i++)); do
echo -n ''$([ $i -eq 0 ] || echo ,)'{"id":"'$i'","width":"'${horizontal[$i]}'","height":"'${vertical[$i]}'",".scale":"'${scale[$i]}'"}'
done
echo ']'
}
generate
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
if [[ ${line%>>*} == "monitor"* ]]; then
generate
fi
done

3
backup/eww/scripts/sussy.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
whoami > /home/willifan/text.txt

19
backup/eww/scripts/test.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
#!/bin/bash
windows=()
workspaces=()
i=0
while read -r k v; do
windows[$i]="$k"
i=$i+1
workspaces[$i]="$v"
done < <(hyprctl clients -j | jq -r '.[]|"\(.pid) \(.workspace.id)"')
for window in ${!windows[@]}; do
echo $(ps -p ${windows[$window]} -o comm=)
done
test=$(ps -p ${windows[5]} -o comm=)
$(feh /usr/share/icons/Papirus-Dark/128x128/apps/${test}.svg)

36
backup/eww/scripts/volume.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
min_volume="0"
max_volume="100"
# Check if an argument is provided
if [[ -z $1 ]]; then
echo "Error: Number argument is missing."
exit 1
fi
# Retrieve the argument value
number_to_add=$1
# Validate if the argument is a number
if ! [[ $number_to_add =~ ^-?[0-9]+$ ]]; then
echo "Error: Invalid number argument."
exit 1
fi
# Read the current brightness value from the file
current_volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}')
# Add the desired number to the current brightness
new_volume=$((current_volume + number_to_add))
# Enforce minimum and maximum brightness values
if (( new_volume < min_volume )); then
new_volume=$min_volume
elif (( new_volume > max_volume )); then
new_volume=$max_volume
fi
wpctl set-volume @DEFAULT_AUDIO_SINK@ "${new_volume}%"
eww update volumeValue="$new_volume"

113
backup/eww/scripts/workspaces.sh Executable file
View file

@ -0,0 +1,113 @@
#!/bin/bash
# get initial focused workspace
focusedws=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
declare -A o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
declare -A monitormap
declare -A workspaces
# handle workspace create/destroy
workspace_event() {
if (( $1 <= 10 )); then
o[$1]=$2
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
fi
if [ "$2" == "0" ]; then
unset "workspaces[$1]"
fi
}
# handle monitor (dis)connects
monitor_event() {
while read -r k v; do monitormap["$k"]=$v; done < <(hyprctl -j monitors | jq -r '.[]|"\(.name) \(.id) "')
}
# generate the json for eww
generate() {
activeWorkspace=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
echo -n '['
for i in {1..10}; do
active=0
if [[ $activeWorkspace == $i ]]; then
active=1
fi
echo -n ''$([ $i -eq 1 ] || echo ,)'{"num":"'$i'","occupied":"'${o[$i]}'","active":"'$active'"}'
# echo -n ''$([ $i -eq 1 ] || echo ,) '{ "number": "'"$i"'", "activity": "'"$(status_activity $i)"'", "color": "'$(status "$i")'" }'
done
# echo -n ',{"num":"'$focusedws'","clr":"'$(status "$focusedws")'"}'
echo ']'
}
# setup
# add monitors
monitor_event
# add workspaces
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
# get active workspace
activeWorkspace=$(hyprctl -j monitors | jq -r '.[] | select(.focused == true) | .activeWorkspace.id')
# check occupied workspaces
for num in "${!workspaces[@]}"; do
o[$num]=1
done
# generate initial widget
generate
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
# echo "${#workspaces[@]} ${#o[@]}"
# echo $line
case ${line%>>*} in
"focusedmon")
focusedws=${line#*,}
generate
;;
"createworkspace")
# workspace_event "${line#*>>}" 1
o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
workspaces=()
# add workspaces
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
# check occupied workspaces
for num in "${!workspaces[@]}"; do
o[$num]=1
done
# focusedws=${line#*>>}
generate
;;
"movewindow")
generate
;;
"destroyworkspace")
# workspace_event "${line#*>>}" 0
o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
workspaces=()
# add workspaces
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jq -r '.[]|"\(.id) \(.monitor)"')
# check occupied workspaces
for num in "${!workspaces[@]}"; do
o[$num]=1
done
generate
;;
"monitor"*)
monitor_event
generate
;;
"workspace")
generate
;;
esac
# echo $line
# generate
done

63
bar.yuck Normal file
View file

@ -0,0 +1,63 @@
(defwindow bar0
:monitor "0"
:class "bar"
:geometry (geometry
:x "0%"
:y "5px"
:width "1400px"
:height "25px"
:anchor "top center")
:stacking "fg"
:exclusive true
(bar0))
(defwidget monitor0 []
(box
:visible false
(label
:width "15"
:text "1")
(seperator)))
(defwidget workspaces0 []
(box
:space-evenly false
:spacing 3
(for workspace in workspaces
(eventbox
:onclick `/home/willifan/.config/scripts/workspaces.sh ${workspace.ID}`
:class {workspace.activeID == "0" ? "activeWorkspace" : "smallBox"}
:valign "center"
:halign "center"
:height 20
:width 20
(box
:halign "center"
:space-evenly false
(smallSpacer)
(label
:class {workspace.occupied == true ? "" : "unoccupiedWorkspace"}
:width 16
:text "${workspace.ID}")
(imageDPI
:visible "${workspace.occupied}"
:image "${workspace.clients[0].icon}"
:size "16")
(smallSpacer))))))
(defwidget start0 []
(box
:orientation "h"
:space-evenly false
:halign "start"
(space)
(monitor0)
(time)))
(defwidget bar0 []
(centerbox :orientation "h"
(start0)
(center)
(end)))

0
bar/eww.scss Normal file
View file

10
bar/eww.yuck Normal file
View file

@ -0,0 +1,10 @@
(defwindow example
:monitor 0
:geometry (geometry :x "0%"
:y "20px"
:width "50%"
:height "50px"
:anchor "top center")
:stacking "fg"
"example content")

96
eww.scss Normal file
View file

@ -0,0 +1,96 @@
window {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.calendar {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.power {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
}
.activeWorkspace {
border-radius: 10px;
background-color: #52341A;
}
.unoccupiedWorkspace {
color: grey;
}
.cpu {
color: red;
}
.ram {
color: green;
}
.volume {
color: lavender;
}
.muted {
color: red;
}
.brightness {
color: yellow;
}
.network {
color: orange;
}
.bluetooth {
color: lightblue;
}
.battery {
color: lightgreen;
}
.batteryLow {
color: red;
}
.power {
color: darkred;
}
.time {
}
.workspaces {
}
.playback {
}
.test {
border-radius: 15px;
}
.smallBox {
border-radius: 10px;
background-color: #44464D;
}
.smallBox:hover {
background-color: #3B3D45;
}
.smallBox:active {
background-color: #52341A;
}

304
eww.yuck Normal file
View file

@ -0,0 +1,304 @@
;;Input values
(defvar image '["kitty.svg","firefox.svg","sublime.svg","kitty.svg","","","","","","webcord.svg"]')
(deflisten brightnessValue
:initial "0"
`scripts/brightness.sh`)
(defpoll network
:initial '{"name":"No Connection","image":"n.A."}'
:interval "2s"
`scripts/network.sh &`)
(deflisten workspaces
:initial '[{"ID":"1","occupied":"0","activeID":""},{"ID":"2","occupied":"0","activeID":""},{"ID":"3","occupied":"0","activeID":""},{"ID":"4","occupied":"0","activeID":""},{"ID":"5","occupied":"0","activeID":""},{"ID":"6","occupied":"0","activeID":""},{"ID":"7","occupied":"0","activeID":""},{"ID":"8","occupied":"0","activeID":""},{"ID":"9","occupied":"0","activeID":""},{"ID":"10","occupied":"0","activeID":""}]'
`scripts/clients.sh`)
(defpoll bluetooth
:initial '{"name":"","battery":"0"}'
:interval "2s"
`scripts/bluetooth.sh`)
(deflisten volume
:initial '{"volume":"0","muted":"0"}'
`scripts/volume.sh`)
(defpoll media
:initial '{"status":"","name":""}'
:interval "2s"
`scripts/media.sh`)
;; Widget templates
(defwidget imageDPI [image size visible]
(overlay
:width "${size}"
:height "${size}"
:visible "${visible}"
(box
:width "${size}"
:height "${size}")
(transform
:scale-x "50%"
:scale-y "50%"
:halign "center"
:valign "center"
:translate-x "${size}"
:translate-y "${size}"
(image
:path "${image}"
:image-width "${size * 2}"
:image-height "${size * 2}"))))
(defwidget icon [widgetclass ?hover percentage image]
(box
:class "${widgetclass}"
:space-evenly false
(overlay
:tooltip "${hover}"
(circular-progress
:width 18
:value "${percentage}"
:start-at 75
:thickness 2
:clockwise false)
(transform
:scale-x "50%"
:scale-y "50%"
:halign "center"
:valign "center"
:translate-x "16"
:translate-y "16"
(image
:path "${image}"
:image-width "32"
:image-height "32")))))
;; Widgets
(defwidget workspaces []
(box
(for workspace in workspaces
(eventbox
:onclick `/home/willifan/.config/scripts/workspaces.sh ${workspace.num}`
(label
:width "15"
:class {workspace.active == 1 ? "activeWorkspace" : workspace.occupied == 0 ? "unoccupiedWorkspace" : ""}
;;:visible {workspace.occupied == 1 ? "true" : "false"}
:text "${workspace.num}")))))
(defwidget time []
(eventbox
:onclick ``
:class "smallBox"
:valign "center"
:height 20
:width 70
(label
:text "${formattime(EWW_TIME, "%H:%M:%S")}")))
(defwidget cpu []
(icon
:widgetclass "cpu"
:hover "${round(EWW_CPU.avg, 1)}%"
:percentage "${round(EWW_CPU.avg, 1)}"
:image "images/cpu.png"))
(defwidget ram []
(icon
:widgetclass "ram"
:hover "${round(EWW_RAM.used_mem /(1024*1024*1024), 1)} GiB | ${round(EWW_RAM.used_mem_perc, 1)}%"
:percentage "${round(EWW_RAM.used_mem_perc, 1)}"
:image "images/ram.png"))
(defwidget audio []
(icon
:widgetclass "${volume.muted == 1 ? "muted" : "volume"}"
:hover "${volume.volume}%"
:percentage "${volume.volume >= 0 && volume.volume <= 100 ? volume.volume : 0}"
:image "${volume.muted == 1 ? "images/volumeMuted.png" : "images/volume.png"}"))
(defwidget brightness []
(icon
:widgetclass "brightness"
:hover "${brightnessValue / 960}%"
:percentage "${brightnessValue / 960}"
:image "images/brightness.png"))
(defwidget network []
(icon
:widgetclass "network"
:hover "${network.name}"
:percentage "100"
:image "images/${network.image}.png"))
(defwidget bluetooth []
(icon
:widgetclass "bluetooth"
:hover "${bluetooth.name}"
:percentage "${bluetooth.battery}"
:image "images/bluetooth.png"))
(defwidget battery []
(icon
:widgetclass {EWW_BATTERY.BAT1.status == "Charging" ? "battery" : EWW_BATTERY.total_avg > 25 ? "battery" : "batteryLow"}
:hover "${round(EWW_BATTERY.total_avg, 1)}%"
:percentage "${EWW_BATTERY.total_avg <= 90 ? round(EWW_BATTERY.total_avg, 1)/0.9 : 100}"
:image {EWW_BATTERY.BAT1.status == "Charging" ? "images/charging.png" : EWW_BATTERY.total_avg > 25 ? "images/battery.png" : "images/batteryLow.png"}))
(defwidget power []
(icon
:widgetclass "power"
:hover "placeholder"
:percentage "0"
:image "images/power.png"))
(defwidget smallSpacer []
(box
:width 2))
(defwidget space []
(box
:width 5))
(defwidget seperator []
(box
(label
:text "|"
)))
;; Widget blocks
(defwidget media []
(box
:class "smallBox"
:height 20
:valign "center"
:space-evenly false
:visible {media.status == "Playing" ? true : false}
(smallSpacer)
(label
:text "${media.name}"
:tooltip "${media.name}"
:limit-width 40)
(smallSpacer)))
(defwidget processing []
(eventbox
:onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty bpytop -b proc"'
:class "smallBox"
(box
:space-evenly false
:halign "end"
:valign "center"
:height 20
(smallSpacer)
(cpu)
(space)
(ram)
(smallSpacer))))
(defwidget controlls []
(eventbox
:onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty pulsemixer"'
:class "smallBox"
(box
:space-evenly false
:halign "end"
:valign "center"
:height 20
(smallSpacer)
(audio)
(space)
(brightness)
(smallSpacer))))
(defwidget wireless []
(eventbox
:onclick "`networkmanager_dmenu`"
:class "smallBox"
(box
:space-evenly false
:halign "end"
:valign "center"
:height 20
(smallSpacer)
(network)
(space)
(bluetooth)
(smallSpacer))))
(defwidget energy []
(eventbox
:onclick `sleep 1 && systemctl hibernate`
:class "smallBox"
(box
:space-evenly false
:halign "end"
:valign "center"
:height 20
(smallSpacer)
(battery)
(space)
(power)
(smallSpacer))))
(defwidget start []
(box
:orientation "h"
:space-evenly false
:halign "start"
(space)
(workspaces)))
(defwidget center []
(box
:orientation "h"
:space-evenly false
:halign "center"
(workspaces)
))
(defwidget end []
(box
:spacing 2
:orientation "h"
:space-evenly false
:valign "center"
:halign "end"
(processing)
(seperator)
(controlls)
(seperator)
(wireless)
(seperator)
(energy)
(space)))
(defwidget bar []
(centerbox :orientation "h"
(start)
(center)
(end)))
;; Window definition
(include "newbar.yuck")

BIN
images/battery.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/batteryLow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/bluetooth.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
images/brightness.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
images/charging.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
images/chargingOriginal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/cpu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
images/cpuOriginal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
images/ethernet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
images/ethernetOriginal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
images/power.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/powerOriginal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
images/ram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
images/ramOriginal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
images/test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
images/volume.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/volumeMuted.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
images/volumeOriginal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
images/wifiHigh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
images/wifiLow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
images/wifiMedium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
images/wifiOriginal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/wifiVeryLow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

55
newbar.yuck Normal file
View file

@ -0,0 +1,55 @@
(defwindow bar
:monitor "0"
:class "bar"
:geometry (geometry
:x "0%"
:y "5px"
:width "1400px"
:height "25px"
:anchor "top center")
:stacking "fg"
:exclusive true
(bar))
(defwidget workspaces []
(box
:space-evenly false
:spacing 3
(for workspace in workspaces
(eventbox
:onclick `/home/willifan/.config/scripts/workspaces.sh ${workspace.ID}`
:class {workspace.activeID == "0" ? "activeWorkspace" : "smallBox"}
:valign "center"
:halign "center"
:height 20
:width 20
(box
:halign "center"
:space-evenly false
(smallSpacer)
(label
:class {workspace.occupied == true ? "" : "unoccupiedWorkspace"}
:width 16
:text "${workspace.ID}")
(imageDPI
:visible "${workspace.occupied}"
:image "${workspace.clients[0].icon}"
:size "16")
(smallSpacer))))))
(defwidget start []
(box
:orientation "h"
:space-evenly false
:halign "start"
(space)
(time)))
(defwidget bar []
(centerbox :orientation "h"
(start)
(center)
(end)))

0
scripts/Struktur.md Normal file
View file

23
scripts/bluetooth.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Get the list of connected Bluetooth devices
devices=$(bluetoothctl devices Connected | awk '{print $2}')
name[0]=""
battery[0]=0
i=0
# Iterate through each device and get its name and battery percentage
for device in $devices; do
# Get the device info using bluetoothctl
info=$(bluetoothctl info $device)
# Extract the name and battery percentage from the device info
name[$i]=$(echo "$info" | awk '/Name:/ {for(i=2; i<=NF; i++) printf "%s ", $i;}')
battery[$i]=$(echo "$info" | awk '/Battery Percentage:/ {print $4}' | tr -d '()')
((i=i+1))
done
echo '{"name":"'${name[0]}'","battery":"'${battery[0]}'"}'

Some files were not shown because too many files have changed in this diff Show more