Workspaces Show which Apps (only some few are translated to icons)
This commit is contained in:
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
ID="$1"
|
||||
|
||||
if [[ -z "$ID" ]]; then
|
||||
echo "Usage: $0 Number"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A MAP=(
|
||||
# Youtube
|
||||
["Grayjay"]=""
|
||||
# Browser
|
||||
["Ablaze Floorp"]=""
|
||||
["LibreWolf"]=""
|
||||
["brave-browser"]=""
|
||||
["chromium"]=""
|
||||
#E-Mail
|
||||
["Mozilla Thunderbird"]=""
|
||||
# Terminals
|
||||
["kitty"]=""
|
||||
["Alacritty"]=""
|
||||
# Videoplayer
|
||||
["VLC media player"]=""
|
||||
["mpv"]=""
|
||||
["ffplay"]=""
|
||||
# Chats
|
||||
["Discord"]=""
|
||||
["Signal"]=""
|
||||
# Coding
|
||||
["Visual Studio Code"]=""
|
||||
["VSCodium"]=""
|
||||
# Password
|
||||
["org.keepassxc.KeePassXC"]=""
|
||||
# Cloud
|
||||
["Nextcloud"]=""
|
||||
)
|
||||
|
||||
# APPS=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == $ID) | .initialTitle")
|
||||
|
||||
mapfile -t APPS < <(
|
||||
hyprctl clients -j |
|
||||
jq -r ".[] | select(.workspace.id == $ID) | .initialTitle"
|
||||
)
|
||||
|
||||
mapfile -t APPS_CLASS < <(
|
||||
hyprctl clients -j |
|
||||
jq -r ".[] | select(.workspace.id == $ID) | .initialClass"
|
||||
)
|
||||
|
||||
for i in "${!APPS[@]}"; do
|
||||
if [[ -n "${MAP["${APPS[$i]}"]}" ]]; then
|
||||
APPS[$i]="${MAP["${APPS[$i]}"]}"
|
||||
elif [[ -n "${MAP["${APPS_CLASS[$i]}"]}" ]]; then
|
||||
APPS[$i]="${MAP["${APPS_CLASS[$i]}"]}"
|
||||
else
|
||||
APPS[$i]="${APPS_CLASS[$i]}|${APPS[$i]}"
|
||||
fi
|
||||
done
|
||||
|
||||
# for app in "${APPS[@]}"; do
|
||||
# echo "$app"
|
||||
# done
|
||||
|
||||
RESULT="$ID $(printf '%s ' "${APPS[@]}")"
|
||||
RESULT=${RESULT% } # remove trailing space
|
||||
echo "$RESULT"
|
||||
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import "../../../colors"
|
||||
|
||||
Row { // Workspace Row
|
||||
@@ -49,6 +50,26 @@ Row { // Workspace Row
|
||||
font.pixelSize: 18
|
||||
font.family: "Inter, sans-serif"
|
||||
}
|
||||
|
||||
Process {
|
||||
id: workspaceContent
|
||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Apps.sh " + modelData.id]
|
||||
running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
workspaceNum.text = this.text
|
||||
console.log("networkScript output:", this.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: workspaceContent.running = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user