added i3-local configuration updater
This commit is contained in:
parent
57c501fb89
commit
6c8022eb97
59
bin/i3/update-local-config
Executable file
59
bin/i3/update-local-config
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
source $ZSH_COLOR_UTIL
|
||||
|
||||
#####################################################################
|
||||
|
||||
GLOBAL_FONT_SIZE="$1"
|
||||
DMENU_FONT_SIZE="$2"
|
||||
BORDER_PIXEL_SIZE="$3"
|
||||
|
||||
[ ! $GLOBAL_FONT_SIZE ] && GLOBAL_FONT_SIZE=$I3__GLOBAL_FONT_SIZE
|
||||
[ ! $DMENU_FONT_SIZE ] && DMENU_FONT_SIZE=$I3__DMENU_FONT_SIZE
|
||||
[ ! $BORDER_PIXEL_SIZE ] && BORDER_PIXEL_SIZE=$I3__BORDER_PIXEL_SIZE
|
||||
|
||||
|
||||
LOCAL_CONFIG="$HOME/.config/i3/config"
|
||||
MODEL_CONFIG="$DOTWRYN/config/i3/config"
|
||||
|
||||
REGEX_FONT='^\(font [^0-9]*\)\(.*\)'
|
||||
REGEX_DMENU="^\\(.*dmenu_run -fn '[^0-9]*\\)\\([0-9]*\\)'"
|
||||
REGEX_BORDER='^\(for_window.*border pixel \)\(.*\)'
|
||||
|
||||
DEFAULT_GLOBAL_FONT_SIZE=$(sed -n "s/$REGEX_FONT/\\2/p" $MODEL_CONFIG)
|
||||
DEFAULT_DMENU_FONT_SIZE=$(sed -n "s/$REGEX_DMENU/\\2/p" $MODEL_CONFIG)
|
||||
DEFAULT_BORDER_PIXEL_SIZE=$(sed -n "s/$REGEX_BORDER/\\2/p" $MODEL_CONFIG)
|
||||
|
||||
#####################################################################
|
||||
|
||||
RESET_CONFIG_TO_DEFAULT() {
|
||||
STATUS 'relinking config to .wryn/config/i3/config'
|
||||
ln -s $MODEL_CONFIG $LOCAL_CONFIG
|
||||
}
|
||||
|
||||
UPDATE_CONFIG() {
|
||||
[ ! $GLOBAL_FONT_SIZE ] && GLOBAL_FONT_SIZE=$DEFAULT_GLOBAL_FONT_SIZE
|
||||
[ ! $DMENU_FONT_SIZE ] && DMENU_FONT_SIZE=$DEFAULT_DMENU_FONT_SIZE
|
||||
[ ! $BORDER_PIXEL_SIZE ] && BORDER_PIXEL_SIZE=$DEFAULT_BORDER_PIXEL_SIZE
|
||||
|
||||
STATUS 'updating config with the following settings:'
|
||||
MENU "GLOBAL_FONT_SIZE : $GLOBAL_FONT_SIZE"
|
||||
MENU "DMENU_FONT_SIZE : $DMENU_FONT_SIZE"
|
||||
MENU "BORDER_PIXEL_SIZE : $BORDER_PIXEL_SIZE"
|
||||
|
||||
sed "\
|
||||
s/$REGEX_FONT/\\1$GLOBAL_FONT_SIZE/;\
|
||||
s/$REGEX_DMENU/\\1$DMENU_FONT_SIZE'/;\
|
||||
s/$REGEX_BORDER/\\1$BORDER_PIXEL_SIZE/;\
|
||||
" $MODEL_CONFIG > $LOCAL_CONFIG
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
[ -f $LOCAL_CONFIG ] && rm $LOCAL_CONFIG
|
||||
[ ! $GLOBAL_FONT_SIZE ] && [ ! $DMENU_FONT_SIZE ] && [ ! $BORDER_PIXEL_SIZE ] \
|
||||
&& RESET_CONFIG_TO_DEFAULT 2>/dev/null \
|
||||
|| UPDATE_CONFIG 2>/dev/null \
|
||||
;
|
||||
|
||||
return 0
|
4
env/env.zsh
vendored
4
env/env.zsh
vendored
@ -19,6 +19,10 @@ RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config"
|
||||
TMUX_DEFAULT_SESSION_NAME='wryn'
|
||||
WEBBROWSER='google-chrome-stable'
|
||||
|
||||
#I3__GLOBAL_FONT_SIZE=
|
||||
#I3__DMENU_FONT_SIZE=
|
||||
#I3__BORDER_PIXEL_SIZE=
|
||||
|
||||
PS1_BRANCH_SYMBOL=''
|
||||
PS1_INDICATOR_SYMBOL='☕'
|
||||
PS1_SEPARATOR='::'
|
||||
|
Loading…
Reference in New Issue
Block a user