bspwm: more floating rules
[~bandali/configs] / wp / .local / bin / wp-auto
CommitLineData
b93770a3
AB
1#! /bin/bash
2
3SED=$(which sed)
4ROFI=$(which rofi)
5
6export DISPLAY=:0
7HOUR=$(date +%H)
8
9if [ -z "${SED}" ]
10then
11 echo "Did not find 'sed', script cannot continue."
12 exit 1
13fi
14if [ -z "${ROFI}" ]
15then
16 echo "Did not find rofi, there is no point to continue."
17 exit 1
18fi
19
20###
21# Create if not exists, then removes #include of .theme file (if present) and add the selected theme to the end.
22# Repeated calls should leave the config clean-ish
23###
24function set_theme()
25{
26 CDIR="${HOME}/.config/rofi/"
27 if [ ! -d "${CDIR}" ]
28 then
29 mkdir -p ${CDIR}
30 fi
31 if [ -f "${CDIR}/config" ]
32 then
33 ${SED} -i "/rofi\.theme: .*\.rasi$/d" "${CDIR}/config"
34 fi
35 echo "rofi.theme: ${1}" >> "${CDIR}/config"
36
37}
38
39if [ "$HOUR" -gt "19" ] || [ "$HOUR" -lt "7" ]
40 then
41 feh --bg-scale $HOME/usr/pics/island_night_by_arsenixc-d6cz757.jpg
42 xrdb -merge $HOME/.Xresources.d/gruvbox-dark.xresources
43 set_theme "/usr/share/rofi/themes//gruvbox-dark.rasi"
44 else
45 feh --bg-scale $HOME/usr/pics/island_day_by_arsenixc-d6ctqon.jpg
46 xrdb -merge $HOME/.Xresources.d/gruvbox-light.xresources
47 set_theme "/usr/share/rofi/themes//gruvbox-light.rasi"
48fi