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 {
background-image: none;
box-shadow: none;
background-color: rgba(12, 12, 12, 0.0);
}
.barbox {
border-width: 2px;
border-color: #595959;
border-radius: 12.5px;
border-radius: 15px;
background-color: rgba(12, 12, 12, 0.9);
}
.calendar {
@ -94,3 +101,4 @@ window {
.smallBox:active {
background-color: #52341A;
}

View file

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

View file

@ -1,5 +1,6 @@
(defwidget imageDPI [image size visible]
(overlay
:valign "center"
:width "${size}"
:height "${size}"
:visible "${visible}"
@ -53,28 +54,35 @@
:width 20
(box
:halign "center"
:valign "center"
:space-evenly false
(smallSpacer)
(label
:class {occupied > 0 ? "" : "unoccupiedWorkspace"}
:width 16
:valign "center"
:text {matches(id, "special:") ? substring(id, 8, 1) : id })
(imageDPI
: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")
(smallSpacer))))
(defwidget smallSpacer []
(box
:valign "center"
:width 2))
(defwidget space []
(box
:width 5))
:valign "center"
:width 3))
(defwidget seperator []
(box
:valign "center"
(label
:valign "center"
:text "|"
)))

View file

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

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Get the list of connected Bluetooth devices
devices=$(bluetoothctl devices Connected | awk '{print $2}')
@ -9,15 +9,15 @@ i=0
for device in $devices; do
# Get the device info using bluetoothctl
info=$(bluetoothctl info $device)
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 '()')
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]}'"}'
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

View file

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

View file

@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
unset id name horizontal vertical scale activeWorkspace
@ -34,6 +35,6 @@ for ((i = 0; i < ${#id[@]}; i++)); do
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
done

View file

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

View file

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

View file

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