summaryrefslogtreecommitdiffstats
path: root/eww/scripts/fetch
blob: 931bf3039c57651885bbe09db6873d31f4e72463 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

os() {
  source /etc/os-release
  echo  $PRETTY_NAME | awk '{print $1;}' 

}

wm() {
  wm=$XDG_CURRENT_DESKTOP
  [ "$wm" ] || wm=$DESKTOP_SESSION

  ## WM/DE
  [ ! "$wm" ] &&
    # loop over all processes and check the binary name
    for i in /proc/*/comm; do
      read -r c <"$i"
      case $c in
      *bar*) ;;
      awesome | xmonad* | qtile | sway | i3 | [bfo]*box | *wm*)
        wm=${c%%-*}
        break
        ;;
      esac
    done

  echo $wm
}

shell() {
  basename $SHELL
}

"$@"