162 lines
4.9 KiB
Bash
Executable File
162 lines
4.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# prtctl - pyradio theme helper
|
|
|
|
# TODO start pyradio if not running
|
|
|
|
THEMERC=~/.config/pyradio/themes/mbcolors.pyradio-theme
|
|
CONF_DIR="$HOME/.config/pyradio/"
|
|
CONF_FILE="$CONF_DIR/config"
|
|
|
|
stations() {
|
|
sd "^Stations .*$" "Stations $1 $2" ${THEMERC}
|
|
}
|
|
stations_txt() {
|
|
read S SFG SBG<<< "$(grep '^Stations ' ${THEMERC})"
|
|
sd "^Stations .*$" "Stations $1 $SBG" ${THEMERC}
|
|
}
|
|
stations_bg() {
|
|
read S SFG SBG<<< "$(grep '^Stations ' ${THEMERC})"
|
|
sd "^Stations .*$" "Stations $SFG $1" ${THEMERC}
|
|
}
|
|
|
|
active_station(){
|
|
read AS1 AS2 ASFG<<< "$(grep '^Active Station ' ${THEMERC})"
|
|
sd "^Active Station .*$" "Active Station $1" ${THEMERC}
|
|
}
|
|
status_bar() {
|
|
read SB1 SB2 SBFG SBBG<<< "$(grep '^Status Bar ' ${THEMERC})"
|
|
sd "^Status Bar .*$" "Status Bar $1 $2" ${THEMERC}
|
|
}
|
|
status_bar_txt() {
|
|
read SB1 SB2 SBFG SBBG<<< "$(grep '^Status Bar ' ${THEMERC})"
|
|
sd "^Status Bar .*$" "Status Bar $1 $SBBG" ${THEMERC}
|
|
}
|
|
status_bar_bg() {
|
|
read SB1 SB2 SBFG SBBG<<< "$(grep '^Status Bar ' ${THEMERC})"
|
|
sd "^Status Bar .*$" "Status Bar $SBFG $1" ${THEMERC}
|
|
}
|
|
normal_cursor() {
|
|
sd "^Normal Cursor .*$" "Normal Cursor $1 $2" ${THEMERC}
|
|
}
|
|
normal_cursor_txt() {
|
|
read NC1 NC2 NCFG NCBG<<< "$(grep '^Normal Cursor ' ${THEMERC})"
|
|
sd "^Normal Cursor .*$" "Normal Cursor $1 $NCBG" ${THEMERC}
|
|
}
|
|
normal_cursor_bg() {
|
|
read NC1 NC2 NCFG NCBG<<< "$(grep '^Normal Cursor ' ${THEMERC})"
|
|
sd "^Normal Cursor .*$" "Normal Cursor $NCFG $1" ${THEMERC}
|
|
}
|
|
active_cursor() {
|
|
sd "^Active Cursor .*$" "Active Cursor $1 $2" ${THEMERC}
|
|
}
|
|
active_cursor_txt() {
|
|
read AC1 AC2 ACFG ACBG<<< "$(grep '^Active Cursor ' ${THEMERC})"
|
|
sd "^Active Cursor .*$" "Active Cursor $1 $ACBG" ${THEMERC}
|
|
}
|
|
active_cursor_bg() {
|
|
read AC1 AC2 ACFG ACBG<<< "$(grep '^Active Cursor ' ${THEMERC})"
|
|
sd "^Active Cursor .*$" "Active Cursor $ACFG $1" ${THEMERC}
|
|
}
|
|
edit_cursor() {
|
|
read EC1 EC2 ECFG ECBG<<< "$(grep '^Edit Cursor ' ${THEMERC})"
|
|
sd "^Edit Cursor .*$" "Edit Cursor $1 $2" ${THEMERC}
|
|
}
|
|
edit_cursor_txt() {
|
|
read EC1 EC2 ECFG ECBG<<< "$(grep '^Edit Cursor ' ${THEMERC})"
|
|
sd "^Edit Cursor .*$" "Edit Cursor $1 $ECBG" ${THEMERC}
|
|
}
|
|
edit_cursor() {
|
|
read EC1 EC2 ECFG ECBG<<< "$(grep '^Edit Cursor ' ${THEMERC})"
|
|
sd "^Edit Cursor .*$" "Edit Cursor $ECFG $1" ${THEMERC}
|
|
}
|
|
extra_func() {
|
|
sd "^Extra Func .*$" "Extra Func $1" ${THEMERC}
|
|
}
|
|
pyradio_url() {
|
|
sd "^PyRadio URL .*$" "PyRadio URL $1" ${THEMERC}
|
|
}
|
|
messages_border() {
|
|
sd "^Messages Border .*$" "Messages Border $1" ${THEMERC}
|
|
}
|
|
resettheme () {
|
|
mkdir -p ~/.config/pyradio/themes
|
|
cat <<EOF > ${THEMERC}
|
|
# Main foreground and background
|
|
Stations #309552 #142C2C
|
|
|
|
# Playing station text color
|
|
# (background color will come from Stations)
|
|
Active Station #cdc76d
|
|
|
|
# Status bar foreground and background
|
|
Status Bar #cdc76d #22564b
|
|
|
|
# Normal cursor foreground and background
|
|
Normal Cursor #0c1d23 #74885a
|
|
|
|
# Cursor foreground and background
|
|
# when cursor on playing station
|
|
Active Cursor #1a231a #cdc76d
|
|
|
|
# Cursor foreground and background
|
|
# This is the Line Editor cursor
|
|
Edit Cursor #eed6aa #1a231a
|
|
|
|
# Text color for extra function indication
|
|
# and jump numbers within the status bar
|
|
# (background color will come from Stations)
|
|
Extra Func #22564b
|
|
|
|
# Text color for URL
|
|
# (background color will come from Stations)
|
|
PyRadio URL #d2cda1
|
|
|
|
# Message window border foreground
|
|
# (background color will come from Stations)
|
|
Messages Border #d3d4bf
|
|
|
|
# Theme Transparency
|
|
# Values are:
|
|
# 0: No transparency (default)
|
|
# 1: Theme is transparent
|
|
# 2: Obey config setting
|
|
transparency 0
|
|
|
|
EOF
|
|
}
|
|
export_theme () {
|
|
DATE=$(date +'%Y%m%d-%H-%M-%S')
|
|
cp ${THEMERC} "$HOME/.config/pyradio/themes/exported_${DATE}.pyradio-theme"
|
|
notify-send.sh -i radio "PyRadio theme exported!" "\nNew PyRadio theme created as:\n<b>exported_${DATE}.pyradio-theme</b>\n" -o " Open in editor:xdg-open ${CONF_DIR}/themes/exported_${DATE}.pyradio-theme" -o " Open Themes dir:xdg-open ${CONF_DIR}/themes"
|
|
}
|
|
#run
|
|
if [ ! -f $THEMERC ]; then
|
|
resettheme
|
|
fi
|
|
|
|
case "$1" in
|
|
stations) stations "$2" "$3";;
|
|
stations_txt) stations_txt "$2";;
|
|
stations_bg) stations_bg "$2";;
|
|
active_station) active_station "$2";;
|
|
status_bar) status_bar "$2" "$3";;
|
|
status_bar_txt) status_bar_txt "$2";;
|
|
status_bar_bg) status_bar_bg "$2";;
|
|
normal_cursor) normal_cursor "$2" "$3";;
|
|
normal_cursor_txt) normal_cursor_txt "$2";;
|
|
normal_cursor_bg) normal_cursor_bg "$2";;
|
|
active_cursor) active_cursor "$2" "$3";;
|
|
active_cursor_txt) active_cursor_txt "$2";;
|
|
active_cursor_bg) active_cursor_bg "$2";;
|
|
edit_cursor) edit_cursor "$2" "$3";;
|
|
edit_cursor_txt) edit_cursor_txt "$2";;
|
|
edit_cursor_bg) edit_cursor_bg "$2";;
|
|
extra_func) extra_func "$2";;
|
|
pyradio_url) pyradio_url "$2";;
|
|
messages_border) messages_border "$2";;
|
|
resettheme) resettheme;;
|
|
exp) export_theme;;
|
|
*);;
|
|
esac
|