updated eww files and bash scripts
This commit is contained in:
parent
5a419c03f3
commit
cd7e93374e
11 changed files with 119 additions and 60 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue