198 lines
4.5 KiB
Bash
Executable File
198 lines
4.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
ID="$1"
|
|
|
|
if [[ -z "$ID" ]]; then
|
|
echo "Usage: $0 Number"
|
|
exit 1
|
|
fi
|
|
|
|
# =========================
|
|
# ICON MAP (ADD YOUR TABLE HERE)
|
|
# =========================
|
|
# Command Helper: hyprctl clients -j | jq '.[] | select(.workspace.id == 1)'
|
|
# Icons: https://www.nerdfonts.com/cheat-sheet
|
|
declare -A MAP=(
|
|
# Youtube
|
|
["Grayjay"]=""
|
|
# Browser
|
|
["Ablaze Floorp"]=""
|
|
["floorp"]=""
|
|
["LibreWolf"]=""
|
|
["midori"]=""
|
|
["brave-browser"]=""
|
|
["chromium"]=""
|
|
# E-Mail
|
|
["org.mozilla.Thunderbird"]=""
|
|
# Terminals
|
|
["kitty"]=""
|
|
["Alacritty"]=""
|
|
# Videoplayer
|
|
["VLC media player"]=""
|
|
["mpv"]=""
|
|
["ffplay"]=""
|
|
# Video editing
|
|
["org.kde.kdenlive"]=""
|
|
# Chats
|
|
["discord"]=""
|
|
["vesktop"]=""
|
|
["Signal"]=""
|
|
["xyz.chatboxapp.app"]=""
|
|
# Coding
|
|
["Visual Studio Code"]=""
|
|
["VSCodium"]=""
|
|
["jetbrains-idea"]=""
|
|
["jetbrains-studio"]=""
|
|
# Text Editor
|
|
["org.xfce.mousepad"]=""
|
|
# Password
|
|
["org.keepassxc.KeePassXC"]=""
|
|
["Yubico Authenticator"]=""
|
|
# Cloud
|
|
["com.nextcloud.desktopclient.nextcloud"]=""
|
|
# App Store
|
|
["Octopi"]=""
|
|
# Games
|
|
["steam*"]=""
|
|
["org.prismlauncher.PrismLauncher"]=""
|
|
["Minecraft*"]=""
|
|
["game"]=""
|
|
# Digital Arts
|
|
["Blender"]=""
|
|
["Krita"]=""
|
|
# VM
|
|
["virt-manager"]=""
|
|
["VirtualBox Manager"]=""
|
|
["VirtualBox Machine"]=""
|
|
["remote-viewer"]=""
|
|
# Audio
|
|
["qpwgraph"]=""
|
|
["Carla"]=""
|
|
# Video
|
|
["com.obsproject.Studio"]=""
|
|
["hyprland-share-picker"]=""
|
|
# Document Editor/Viewer
|
|
["libreoffice-startcenter"]=""
|
|
["libreoffice-base"]=""
|
|
["libreoffice-calc"]=""
|
|
["libreoffice-draw"]=""
|
|
["libreoffice-impress"]=""
|
|
["libreoffice-math"]=""
|
|
["libreoffice-writer"]=""
|
|
["com.github.flxzt.rnote"]=""
|
|
["Xreader"]=""
|
|
["com.github.xournalpp.xournalpp"]=""
|
|
["qpdfview.local.qpdfview"]=""
|
|
# Hardware
|
|
["Mission Center"]=""
|
|
["QDirStat"]=""
|
|
["Disks"]=""
|
|
# File Manager
|
|
["nemo"]=""
|
|
["org.gnome.Nautilus"]=""
|
|
["org.kde.dolphin"]=""
|
|
["xdg-desktop-portal-gtk"]=""
|
|
# Settings
|
|
["nwg-look"]="" # gtk-settings
|
|
["qt5ct"]=""
|
|
["qt6ct"]=""
|
|
["sddm-conf"]=""
|
|
["blueman-manager"]=""
|
|
["nm-connection-editor"]=""
|
|
# Calculator
|
|
["Calculator"]=""
|
|
# VPN
|
|
["Proton VPN"]=""
|
|
["com.cisco.secureclient.gui"]=""
|
|
# Torrent
|
|
["org.qbittorrent.qBittorrent"]=""
|
|
# Hardware Design
|
|
["Xilinx Unified 2022.2 Installer"]=""
|
|
["Xilinx Information Center"]=""
|
|
["Xilinx Unified 2022.2 Installer"]=""
|
|
["vsim"]=""
|
|
# BoxBuddy
|
|
["io.github.dvlv.boxbuddyrs"]=""
|
|
# Stream
|
|
["Fladder"]=""
|
|
["crunchyroll"]=""
|
|
["netflix"]=""
|
|
["primevideo"]=""
|
|
# Image Viewer
|
|
["viewnior"]=""
|
|
# Image Editor
|
|
["gimp"]=""
|
|
["org.inkscape.Inkscape"]=""
|
|
# CNC
|
|
["LightBurn"]=""
|
|
)
|
|
|
|
# =========================
|
|
# COLLECT HYPRLAND CLIENTS
|
|
# =========================
|
|
|
|
to_lower() {
|
|
echo "${1,,}"
|
|
}
|
|
|
|
match_map() {
|
|
local input
|
|
input="$(to_lower "$1")"
|
|
|
|
for key in "${!MAP[@]}"; do
|
|
local pattern
|
|
pattern="$(to_lower "$key")"
|
|
|
|
# wildcard + glob match
|
|
if [[ "$input" == $pattern ]]; then
|
|
echo "${MAP[$key]}"
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
return 1
|
|
}
|
|
|
|
# APPS=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == $ID) | .initialTitle")
|
|
|
|
# =========================
|
|
# COLLECT HYPRLAND CLIENTS
|
|
# =========================
|
|
|
|
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"
|
|
)
|
|
|
|
# =========================
|
|
# MAP ICONS
|
|
# =========================
|
|
|
|
for i in "${!APPS[@]}"; do
|
|
icon=""
|
|
|
|
icon="$(match_map "${APPS[$i]}")"
|
|
|
|
if [[ -z "$icon" ]]; then
|
|
icon="$(match_map "${APPS_CLASS[$i]}")"
|
|
fi
|
|
|
|
if [[ -n "$icon" ]]; then
|
|
APPS[$i]="$icon"
|
|
else
|
|
APPS[$i]="${APPS_CLASS[$i]}|${APPS[$i]}"
|
|
fi
|
|
done
|
|
|
|
# =========================
|
|
# OUTPUT
|
|
# =========================
|
|
|
|
RESULT="$(printf '%s' "${APPS[@]}")"
|
|
# RESULT=${RESULT% } # remove trailing space
|
|
echo "$RESULT" |