Added Network icon to bar and rework some of the debug prints
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@ PanelWindow {
|
|||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
// TODO: Add bluetooth, network, audio, power, maybe HW monitor
|
// TODO: Add bluetooth, network, audio, power, maybe HW monitor
|
||||||
// Network {}
|
Network {}
|
||||||
PowerButton {}
|
PowerButton {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
OUTPUT="$(ip -br link | awk '{print $1, $2}' | grep UP| awk '{print $1}')"
|
||||||
|
|
||||||
|
# echo "$OUTPUT"
|
||||||
|
|
||||||
|
ITYPES=()
|
||||||
|
IFACES=()
|
||||||
|
|
||||||
|
for IFACE in $OUTPUT; do
|
||||||
|
case $IFACE in
|
||||||
|
en*|eth*) TYPE="Ethernet" ;;
|
||||||
|
wl*|wlan*) TYPE="Wi-Fi" ;;
|
||||||
|
*) TYPE="Unknown" ;;
|
||||||
|
esac
|
||||||
|
ITYPES+=("$TYPE")
|
||||||
|
IFACES+=("$IFACE")
|
||||||
|
done
|
||||||
|
|
||||||
|
if printf "%s\n" "${ITYPES[@]}" | grep -qx "Ethernet"; then
|
||||||
|
echo " "
|
||||||
|
elif printf "%s\n" "${ITYPES[@]}" | grep -qx "Wi-Fi"; then
|
||||||
|
if [ -x "/usr/bin/nmcli" ]; then
|
||||||
|
CONNECTION="$(nmcli -f DEVICE,ACTIVE,SSID,SIGNAL dev wifi | grep yes | awk '{print $4}')"
|
||||||
|
if [[ -z "$CONNECTION" ]]; then
|
||||||
|
echo " "
|
||||||
|
elif (( CONNECTION > 80 )); then
|
||||||
|
echo " "
|
||||||
|
elif (( CONNECTION > 60 )); then
|
||||||
|
echo " "
|
||||||
|
elif (( CONNECTION > 40 )); then
|
||||||
|
echo " "
|
||||||
|
elif (( CONNECTION > 20 )); then
|
||||||
|
echo " "
|
||||||
|
else
|
||||||
|
echo " "
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " "
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " / "
|
||||||
|
fi
|
||||||
@@ -1,26 +1,56 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
// import Quickshell.Networking
|
import Quickshell.Io
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: networkButton
|
id: networkButton
|
||||||
width: 30
|
width: output.width + 16
|
||||||
height: 28
|
height: bar.height
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
// onClicked: {
|
||||||
|
// console.log("Wifi Hardware:", Networking.wifiHardwareEnabled)
|
||||||
|
// console.log("Wifi:", Networking.wifiEnabled)
|
||||||
|
// console.log("Device Type:", Networking.devices.DeviceType.toString(DeviceType))
|
||||||
|
// console.log("Device Type:", Networking.devices.DeviceConnectionState.toString(DeviceConnectionState)) // ???
|
||||||
|
// console.log("Device Type:", Networking.devices.toString(NetworkDevice))
|
||||||
|
// console.log("Device Type:", Networking.devices.length)
|
||||||
|
// }
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: networkButton.containsMouse ? "#2a2a2a" : "transparent"
|
color: networkButton.containsMouse ? "#2a2a2a" : "transparent"
|
||||||
radius: 6
|
radius: 6
|
||||||
|
width: output.width + 16
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: output
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: " "
|
|
||||||
font.pixelSize: 26
|
font.pixelSize: 26
|
||||||
font.family: "Nerd Font"
|
font.family: "Nerd Font"
|
||||||
color: "#ffffff"
|
color: output.text === " /" ? "#FF0000" : "#00ff00"
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: networkStatus
|
||||||
|
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Network.sh"]
|
||||||
|
running: true
|
||||||
|
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
output.text = this.text.trim()
|
||||||
|
console.log("networkScript output:", this.text.trim())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 10000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: networkStatus.running = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ import Quickshell.Io
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
id: powerButton
|
id: powerButton
|
||||||
width: 30
|
width: 30
|
||||||
height: 28
|
height: bar.height
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ PanelWindow {
|
|||||||
id: wallpaperProcess
|
id: wallpaperProcess
|
||||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/set-wallpaper.sh" + " " + model.filePath + " &"]
|
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/set-wallpaper.sh" + " " + model.filePath + " &"]
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
onStreamFinished: console.log('line read:', this.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Item { // container, invisible
|
|||||||
id: generateThumbs
|
id: generateThumbs
|
||||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/generate-wallpaper-thumbs.sh"]
|
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/generate-wallpaper-thumbs.sh"]
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
onStreamFinished: console.log(this.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,8 @@ Item { // container, invisible
|
|||||||
description: "Open wallpaper picker"
|
description: "Open wallpaper picker"
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
generateThumbs.startDetached()
|
// generateThumbs.startDetached()
|
||||||
|
generateThumbs.running = true
|
||||||
wallpaperLoader.active = !wallpaperLoader.active
|
wallpaperLoader.active = !wallpaperLoader.active
|
||||||
console.log("Pressed Meta+Shift+W (Hyprland global shortcut)")
|
console.log("Pressed Meta+Shift+W (Hyprland global shortcut)")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ mkdir -p "$THUMB_DIR"
|
|||||||
# Max width/height of the thumbnails
|
# Max width/height of the thumbnails
|
||||||
MAX_DIM=300
|
MAX_DIM=300
|
||||||
|
|
||||||
|
num=0
|
||||||
|
|
||||||
# Process each image
|
# Process each image
|
||||||
for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do
|
for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do
|
||||||
# Skip if no files match
|
# Skip if no files match
|
||||||
@@ -33,8 +35,10 @@ for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
num+=1
|
||||||
|
|
||||||
# Generate thumbnail using ImageMagick
|
# Generate thumbnail using ImageMagick
|
||||||
magick "$img" -resize "${MAX_DIM}x${MAX_DIM}" "$thumb"
|
magick "$img" -resize "${MAX_DIM}x${MAX_DIM}" "$thumb"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Thumbnails generated in $THUMB_DIR"
|
echo "$num Thumbnails generated in $THUMB_DIR"
|
||||||
@@ -53,6 +53,12 @@ if [ ! -d $static_wallpaper_dir ]; then
|
|||||||
mkdir -p $static_wallpaper_dir;
|
mkdir -p $static_wallpaper_dir;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
current_wallpaper="$static_wallpaper_dir/current"
|
||||||
|
|
||||||
|
echo "$image" > $current_wallpaper
|
||||||
|
|
||||||
blurred_wp="$static_wallpaper_dir/blurred.jpg"
|
blurred_wp="$static_wallpaper_dir/blurred.jpg"
|
||||||
|
|
||||||
magick $image -blur $blur $blurred_wp
|
magick $image -blur $blur $blurred_wp
|
||||||
|
|
||||||
|
echo "test"
|
||||||
|
|||||||
Reference in New Issue
Block a user