forked from di-effe/amber
-
Notifications
You must be signed in to change notification settings - Fork 1
/
up
executable file
·183 lines (139 loc) · 5.38 KB
/
up
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/env bash
export SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
# [ SETTINGS ] ###############################################################
# - CHOSE STATUS BAR
# 0) polybar
# 1) lemonbar (not yet ready)
# 2) eww (not yet ready)
STATUSBAR=0
##############################################################################
# [ COLOR SCHEME ] ###########################################################
# Available themes:
# - amber
# - dracula
# - gruvbox
# - nord
# - catppuccin
#
# NOTE:
# To avoid issues colors.sh will check the theme name provided below and try
# to fallback to the amber theme if what you provide is NULL or does not exist
# in the array on line 12.
source $SCRIPTPATH/scripts/colors.sh amber
##############################################################################
# [ BASIC ] ##################################################################
# down the last running theme
if [ -f "/tmp/leftwm-theme-down" ]; then
/tmp/leftwm-theme-down
rm /tmp/leftwm-theme-down
fi
ln -s $SCRIPTPATH/down /tmp/leftwm-theme-down
# set the theme.ron config
leftwm-command "LoadTheme $SCRIPTPATH/theme.ron"
##############################################################################
# [ RUN STUFF ] ##############################################################
# keybindings daemon (if it exist)
if [ -x "$(command -v sxhkd)" ]; then
sxhkd -c $HOME/.config/leftwm/sxhkd/sxhkdrc &
fi
# apps
numlockx on &
# notifications
if [ -x "$(command -v dunst)" ]; then
dunst -config $HOME/.config/leftwm/themes/current/conf/dunst.config &
fi
#/usr/lib/xfce4/notifyd/xfce4-notifyd &
# picom (if it exists)
if [ -x "$(command -v picom)" ]; then
picom --config $HOME/.config/leftwm/themes/current/conf/picom.config &> /dev/null &
fi
##############################################################################
# [ WALLPAPERS ] #############################################################
# - Comment/uncomment the option you prefer
# 1) START - set random wallpapers -----------------------------------------+
#if [ -x "$(command -v feh)" ]; then
# feh --randomize --bg-fill "$SCRIPTPATH"/wallpapers/*
#fi
# END ----------------------------------------------------------------------+
# 2) START - set ONE wallpaper for all displays ----------------------------+
#if [ -x "$(command -v feh)" ]; then
# feh --bg-fill "$SCRIPTPATH"/wallpapers/atlas-ark-gruvbox-simple-lines.png
#fi
# END ----------------------------------------------------------------------+
# 3) START - set MULTIPLE wallpapers for all displays ----------------------+
# NOTE: the last image path DO NOT end with "\"
if [ -x "$(command -v feh)" ]; then
feh --bg-fill \
"$SCRIPTPATH"/wallpapers/atlas-ark-gruvbox-leftwm.png \
"$SCRIPTPATH"/wallpapers/atlas-ark-gruvbox-arch3.png
fi
# END ----------------------------------------------------------------------+
##############################################################################
# [ KEYMAP ] #################################################################
KEYBINDINGS=/tmp/leftwm-keybindings
if [ -f "$KEYBINDINGS" ]; then
rm $KEYBINDINGS
fi
leftwm-check -v | \
grep Keybind | \
sed -e "s/Keybind: Keybind { command: //g;s/ } true//;s/ } false//" \
> $KEYBINDINGS
KEYMAP=/tmp/leftwm-keymap
if [ -f "$KEYMAP" ]; then
rm $KEYMAP
fi
sort $KEYBINDINGS | \
tr -d '"' | \
sed -e "s/modifier: //g;s/key: //;s/value: None//;s/value: Some(//;s/)//;s/modkey,/modkey +/" | \
awk -F, '{print $3","$4","$1","$2}' | \
column -s ',' -t \
> $KEYMAP
##############################################################################
# [ START STATUSBAR ] #########################################################
case $STATUSBAR in
0)
pkill polybar &
pkill lemonbar &
index=0
monitor="$(polybar -m | grep +0+0 | sed s/:.*// | tac)"
leftwm-state -q -n -t $SCRIPTPATH/sizes.liquid | sed -r '/^\s*$/d' | \
while read -r width x y
do
barname="mainbar$index"
monitor="$(polybar -m | awk -v i="$(( index + 1 ))" 'NR==i{print}' | sed s/:.*// | tr -d '\n')"
monitor=$monitor width=$(( width - 0 )) polybar -c "$SCRIPTPATH"/polybar.config $barname &
let index=index+1
done
;;
1)
pkill lemonbar &
pkill polybar &
pkill eww &
index=0
barheight=30
export TENDERBLOCKS="$SCRIPTPATH/scripts/bartender"
leftwm-state -q -n -t $SCRIPTPATH/sizes.liquid | sed -r '/^\s*$/d' | while read -r width x y
do
# 1) Classic/simple mode - lemonbar generated by lemonbar.liquid
#leftwm-state -w $index -t $SCRIPTPATH/lemonbar.liquid | lemonbar -g "$width"x"$barheight"+"$x" -f "Iosevka Nerd Font"-11 -B$COLOR_BACKGROUND -F$COLOR_FOREGROUND -u 2 -U$COLOR_PRIMARY| sh&
# 2) Experimental mode - lemonbar generated by a loop in lemonbar.worker
exec $HOME/.config/leftwm/themes/current/lemonbar.worker $index | lemonbar -g "$width"x"$barheight"+"$x" -f "Iosevka Nerd Font"-11 -B$COLOR_BACKGROUND -F$COLOR_FOREGROUND -u 2 -U$COLOR_PRIMARY| sh&
lemonbar -g "$width"x2+$x+$barheight --B$COLOR_PRIMARY -p&
let index=index+1
done
;;
2)
pkill lemonbar &
pkill polybar &
pkill eww &
#sleep 1
index=0
sizes=( $(leftwm-state -q -n -t $SCRIPTPATH/sizes.liquid | sed -r '/^\s*$/d' ) )
for size in "${sizes[@]}"
do
eww -c $SCRIPTPATH open bar$index
let index=index+1
done
;;
esac
##############################################################################