updated eww files and bash scripts

This commit is contained in:
willifan 2024-06-01 17:20:15 +02:00
parent 5a419c03f3
commit cd7e93374e
11 changed files with 119 additions and 60 deletions

View file

@ -1,8 +1,15 @@
@import url("file:///home/willifan/.config/gtk-4.0/gtk.css");
window { window {
border-width: 2px; background-image: none;
border-color: #595959; box-shadow: none;
border-radius: 12.5px; background-color: rgba(12, 12, 12, 0.0);
}
.barbox {
border-width: 2px;
border-color: #595959;
border-radius: 15px;
background-color: rgba(12, 12, 12, 0.9);
} }
.calendar { .calendar {
@ -93,4 +100,5 @@ window {
.smallBox:active { .smallBox:active {
background-color: #52341A; background-color: #52341A;
} }

View file

@ -22,6 +22,8 @@
(box (box
:space-evenly false :space-evenly false
:spacing 3 :spacing 3
:valign "center"
:height 20
(for workspace in workspaces (for workspace in workspaces
(workspace (workspace
:activeOn {workspace.normal.activeOn} :activeOn {workspace.normal.activeOn}
@ -96,24 +98,34 @@
;; Widget blocks ;; Widget blocks
;;(defwidget media [] (defwidget media []
;; (box (box
;; :class "smallBox" :visible {media.status == "Playing" ? true : false}
;; :height 20 :spacing 3
;; :valign "center" :space-evenly false
;; :space-evenly false :halign "end"
;; :visible {media.status == "Playing" ? true : false} :valign "center"
;; (smallSpacer) :height 20
;; (label (seperator)
;; :text {media.name} (box
;; :tooltip {media.name} :class "smallBox"
;; :limit-width 40) :height 20
;; (smallSpacer))) :valign "center"
:space-evenly false
(space)
(label
:text {media.name}
:tooltip {media.name}
:limit-width 40)
(space))))
(defwidget processing [] (defwidget processing []
(eventbox (eventbox
:onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty bpytop -b proc"' :onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty bpytop -b proc"'
:class "smallBox" :class "smallBox"
:halign "end"
:valign "center"
:height 20
(box (box
:space-evenly false :space-evenly false
:halign "end" :halign "end"
@ -129,6 +141,9 @@
(eventbox (eventbox
:onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty pulsemixer"' :onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty pulsemixer"'
:class "smallBox" :class "smallBox"
:halign "end"
:valign "center"
:height 20
(box (box
:space-evenly false :space-evenly false
:halign "end" :halign "end"
@ -144,11 +159,14 @@
(eventbox (eventbox
:onclick "`networkmanager_dmenu`" :onclick "`networkmanager_dmenu`"
:class "smallBox" :class "smallBox"
:halign "end"
:valign "center"
:height 20
(box (box
:space-evenly false :space-evenly false
:halign "end" :halign "end"
:valign "center" :valign "center"
:height 20 :height 24
(smallSpacer) (smallSpacer)
(network) (network)
(space) (space)
@ -157,8 +175,10 @@
(defwidget energy [] (defwidget energy []
(eventbox (eventbox
:onclick `sleep 1 && systemctl hibernate` :onclick `wlogout -r 25 -c 25 -m 300 &`
:class "smallBox" :class "smallBox"
:valign "center"
:height 20
(box (box
:space-evenly false :space-evenly false
:halign "end" :halign "end"
@ -173,17 +193,28 @@
(defwidget start [] (defwidget start []
(box (box
:class "barbox"
:orientation "h" :orientation "h"
:space-evenly false :space-evenly false
:height 30
:halign "start" :halign "start"
:valign "center"
:spacing 3
(space) (space)
(time))) (time)
(media)
(space)))
(defwidget center [monitor] (defwidget center [monitor]
(box (box
:class "barbox"
:orientation "h" :orientation "h"
:space-evenly false :space-evenly false
:spacing 3
:height 30
:halign "center" :halign "center"
:valign "center"
(space)
(workspace (workspace
:activeOn {workspaces[0].special.activeOn} :activeOn {workspaces[0].special.activeOn}
:occupied {workspaces[0].special.occupied} :occupied {workspaces[0].special.occupied}
@ -211,15 +242,26 @@
:occupied {workspaces[3].special.occupied} :occupied {workspaces[3].special.occupied}
:id {workspaces[3].special.id} :id {workspaces[3].special.id}
:icon {workspaces[3].special.icon} :icon {workspaces[3].special.icon}
:monitor {monitor}))) :monitor {monitor})
(space)))
(defwidget end [] (defwidget end []
(box (box
:class "barbox"
:spacing 2 :spacing 2
:orientation "h" :orientation "h"
:space-evenly false :space-evenly false
:height 30
:valign "center" :valign "center"
:halign "end" :halign "end"
(space)
;; (systray
;; :spacing 2
;; :orientation "h"
;; :space-evenly true
;; :icon-size 16)
;;
;; (seperator)
(processing) (processing)
@ -238,7 +280,8 @@
(space))) (space)))
(defwidget bar [monitor] (defwidget bar [monitor]
(centerbox :orientation "h" (centerbox
:orientation "h"
(start) (start)
(center (center
:monitor {monitor}) :monitor {monitor})
@ -247,7 +290,6 @@
(defwindow bar [monitor width height] (defwindow bar [monitor width height]
:monitor {monitor} :monitor {monitor}
:class "bar"
:geometry (geometry :geometry (geometry
:x "0%" :x "0%"
:y "5px" :y "5px"
@ -257,4 +299,4 @@
:stacking "fg" :stacking "fg"
:exclusive true :exclusive true
(bar (bar
:monitor {monitor})) :monitor {monitor}))

View file

@ -1,5 +1,6 @@
(defwidget imageDPI [image size visible] (defwidget imageDPI [image size visible]
(overlay (overlay
:valign "center"
:width "${size}" :width "${size}"
:height "${size}" :height "${size}"
:visible "${visible}" :visible "${visible}"
@ -53,28 +54,35 @@
:width 20 :width 20
(box (box
:halign "center" :halign "center"
:valign "center"
:space-evenly false :space-evenly false
(smallSpacer) (smallSpacer)
(label (label
:class {occupied > 0 ? "" : "unoccupiedWorkspace"} :class {occupied > 0 ? "" : "unoccupiedWorkspace"}
:width 16 :width 16
:valign "center"
:text {matches(id, "special:") ? substring(id, 8, 1) : id }) :text {matches(id, "special:") ? substring(id, 8, 1) : id })
(imageDPI (imageDPI
:visible {occupied > 0 ? true : false} :visible {occupied > 0 ? true : false}
:image "/usr/share/icons/Papirus-Dark/128x128/apps/${icon}" :valign "center"
:image "/run/current-system/sw/share/icons/Papirus-Dark/128x128/apps/${icon}"
:size "16") :size "16")
(smallSpacer)))) (smallSpacer))))
(defwidget smallSpacer [] (defwidget smallSpacer []
(box (box
:valign "center"
:width 2)) :width 2))
(defwidget space [] (defwidget space []
(box (box
:width 5)) :valign "center"
:width 3))
(defwidget seperator [] (defwidget seperator []
(box (box
:valign "center"
(label (label
:valign "center"
:text "|" :text "|"
))) )))

View file

@ -4,7 +4,7 @@
(deflisten network (deflisten network
:initial '{"name":"No Connection","image":"n.A."}' :initial '{"name":"No Connection","image":"n.A."}'
`scripts/network.sh`) `sh scripts/network.sh`)
(deflisten workspaces (deflisten workspaces
:initial '' :initial ''
@ -13,13 +13,13 @@
(defpoll bluetooth (defpoll bluetooth
:initial '{"name":"","battery":"0"}' :initial '{"name":"","battery":"0"}'
:interval "2s" :interval "2s"
`scripts/bluetooth.sh`) `sh scripts/bluetooth.sh`)
(deflisten volume (deflisten volume
:initial '{"volume":"0","muted":"0"}' :initial '{"volume":"0","muted":"0"}'
`scripts/volume.sh`) `sh scripts/volume.sh`)
;;(defpoll media (defpoll media
;; :initial '{"status":"","name":""}' :initial '{"status":"","name":""}'
;; :interval "2s" :interval "2s"
;; `scripts/media.sh`) `scripts/media.sh`)

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Get the list of connected Bluetooth devices # Get the list of connected Bluetooth devices
devices=$(bluetoothctl devices Connected | awk '{print $2}') devices=$(bluetoothctl devices Connected | awk '{print $2}')
@ -9,15 +9,15 @@ i=0
for device in $devices; do for device in $devices; do
# Get the device info using bluetoothctl # Get the device info using bluetoothctl
info=$(bluetoothctl info $device) info=$(bluetoothctl info "$device")
# Extract the name and battery percentage from the device info # 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;}') 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 '()') battery[i]=$(echo "$info" | awk '/Battery Percentage:/ {print $4}' | tr -d '()')
((i=i+1)) ((i=i+1))
done done
echo '{"name":"'${name[0]}'","battery":"'${battery[0]}'"}' echo '{"name":"'"${name[0]}"'","battery":"'"${battery[0]}"'"}'

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
FILE_TO_WATCH="/sys/class/backlight/intel_backlight/brightness" # Replace with the actual file path FILE_TO_WATCH="/sys/class/backlight/intel_backlight/brightness" # Replace with the actual file path

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/usr/bin/env bash
status=$(playerctl status) status=$(playerctl status)
name=$(playerctl metadata title) name=$(playerctl metadata title)
echo '{"status":"'$status'","name":"'$name'"}' echo '{"status":"'"$status"'","name":"'"$name"'"}'

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/usr/bin/env bash
unset id name horizontal vertical scale activeWorkspace unset id name horizontal vertical scale activeWorkspace
i=0 i=0
@ -34,6 +35,6 @@ for ((i = 0; i < ${#id[@]}; i++)); do
monitorID=$(xrandr --listactivemonitors | grep +"${name[$i]}" | awk '{sub(/.$/,"",$1); print $1}') monitorID=$(xrandr --listactivemonitors | grep +"${name[$i]}" | awk '{sub(/.$/,"",$1); print $1}')
eww open bar --id bar"${monitorID}" --arg monitor="${monitorID}" --arg width="${new_width}" --arg height=25 eww open bar --id bar"${monitorID}" --arg monitor="${monitorID}" --arg width="${new_width}" --arg height=30
sleep 2 sleep 2
done done

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
ethernet() { ethernet() {
name="Wired" name="Wired"
@ -28,16 +28,16 @@ while true; do
networkInfo=$(nmcli -f NAME,TYPE connection show --active | awk '!/loopback/ && NR > 1') networkInfo=$(nmcli -f NAME,TYPE connection show --active | awk '!/loopback/ && NR > 1')
if [[ $(awk '/wifi/' <<< $networkInfo) ]]; then if [[ $(awk '/wifi/' <<< "$networkInfo") ]]; then
wifi wifi
fi fi
if [[ $(awk '/ethernet/' <<< $networkInfo) ]]; then if [[ $(awk '/ethernet/' <<< "$networkInfo") ]]; then
ethernet ethernet
fi fi
echo '{"name":"'$name'","image":"'$image'"}' echo '{"name":"'"$name"'","image":"'"$image"'"}'
sleep 2 sleep 2
done done

View file

@ -1,25 +1,25 @@
#!/bin/bash #!/usr/bin/env bash
getIcon() { getIcon() {
local desktop="" local desktop=""
# Search for desktop files by WM class # Search for desktop files by WM class
if [ -n "$1" ]; then if [ -n "$1" ]; then
desktop=$(grep -l "StartupWMClass.*$1$" /usr/share/applications/*.desktop) desktop=$(grep -l "StartupWMClass.*$1$" /run/current-system/sw/share/applications/*.desktop)
[ -z "$desktop" ] && desktop=$(grep -Pl "Name\s*=\s*$1$" /usr/share/applications/*.desktop) [ -z "$desktop" ] && desktop=$(grep -Pl "Name\s*=\s*$1$" /run/current-system/sw/share/applications/*.desktop)
[ -z "$desktop" ] && desktop=$(ls /usr/share/applications/${1}.desktop 2>/dev/null) [ -z "$desktop" ] && desktop=$(ls /run/current-system/sw/share/applications/"${1}".desktop 2>/dev/null)
fi fi
# If not found by WM class, search by process name # If not found by WM class, search by process name
if [ -z "$desktop" ] && [ -n "$2" ]; then if [ -z "$desktop" ] && [ -n "$2" ]; then
process=$(ps -p ${2} -o comm=) process=$(ps -p "${2}" -o comm=)
desktop=$(grep -Pl "$process" /usr/share/applications/*.desktop) desktop=$(grep -Pl "$process" /run/current-system/sw/share/applications/*.desktop)
[ -n "$desktop" ] && desktop="$desktop" [ -n "$desktop" ]
fi fi
# If not found by WM class or process name, search by name or description # If not found by WM class or process name, search by name or description
if [ -z "$desktop" ] && [ -n "$1" ]; then if [ -z "$desktop" ] && [ -n "$1" ]; then
desktop=$(grep -Pl "$1" /usr/share/applications/*.desktop) desktop=$(grep -Pl "$1" /run/current-system/sw/share/applications/*.desktop)
fi fi
echo "$desktop" echo "$desktop"

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
generate() { generate() {
message=$(wpctl get-volume @DEFAULT_AUDIO_SINK@) message=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
@ -10,7 +10,7 @@ generate() {
muted=0 muted=0
fi fi
echo '{"volume":"'$volume'","muted":"'$muted'"}' echo '{"volume":"'"$volume"'","muted":"'"$muted"'"}'
} }
generate generate