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