Refactor panel configs to reduce color duplication
This commit is contained in:
parent
efc20b7369
commit
d0f770f27c
4 changed files with 28 additions and 62 deletions
|
|
@ -5,9 +5,3 @@ export WORKON_HOME=$HOME/.virtualenvs
|
||||||
source /usr/bin/virtualenvwrapper.sh
|
source /usr/bin/virtualenvwrapper.sh
|
||||||
|
|
||||||
export XDG_CONFIG_HOME=$HOME/.config
|
export XDG_CONFIG_HOME=$HOME/.config
|
||||||
|
|
||||||
PANEL_CONFIG_DIR=$XDG_CONFIG_HOME/panel
|
|
||||||
PANEL_FIFO=/tmp/panel-fifo
|
|
||||||
PANEL_HEIGHT=24
|
|
||||||
PANEL_FONT_FAMILY="-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1"
|
|
||||||
export PANEL_FIFO PANEL_HEIGHT PANEL_FONT_FAMILY PANEL_CONFIG_DIR
|
|
||||||
|
|
|
||||||
11
panel/panel
11
panel/panel
|
|
@ -1,6 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
PATH=$PATH:"$PANEL_CONFIG_DIR"
|
PANEL_HEIGHT=24
|
||||||
|
PANEL_FONT_FAMILY="-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1"
|
||||||
|
|
||||||
|
COLOR_FOREGROUND='#FFAAAAAA'
|
||||||
|
COLOR_BACKGROUND='#FF111111'
|
||||||
|
|
||||||
if [ $(pgrep -cx panel) -gt 1 ] ; then
|
if [ $(pgrep -cx panel) -gt 1 ] ; then
|
||||||
printf "%s\n" "The panel is already running." >&2
|
printf "%s\n" "The panel is already running." >&2
|
||||||
|
|
@ -11,8 +15,9 @@ trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
|
||||||
|
|
||||||
bspc config bottom_padding $PANEL_HEIGHT
|
bspc config bottom_padding $PANEL_HEIGHT
|
||||||
|
|
||||||
source panel_colors
|
$XDG_CONFIG_HOME/panel/panel_bar.py | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -b &
|
||||||
|
|
||||||
$PANEL_CONFIG_DIR/panel_bar.py | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -b &
|
sleep 1
|
||||||
|
xdo lower $(xdo id -a bar)
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
|
||||||
|
|
@ -12,44 +12,35 @@ PERIOD = 1
|
||||||
# Lemonbar seems to struggle if you update too fast
|
# Lemonbar seems to struggle if you update too fast
|
||||||
MIN_UPDATE_INTERVAL = 0.01
|
MIN_UPDATE_INTERVAL = 0.01
|
||||||
PATH = os.path.dirname(os.path.realpath(__file__))
|
PATH = os.path.dirname(os.path.realpath(__file__))
|
||||||
COLOR_ACTIVE_MONITOR_FG = '#FF34322E'
|
|
||||||
COLOR_ACTIVE_MONITOR_BG = '#FF58C5F1'
|
PANEL_FOREGROUND='#FF888888'
|
||||||
COLOR_INACTIVE_MONITOR_FG = '#FF58C5F1'
|
PANEL_BACKGROUND='#FF111111'
|
||||||
COLOR_INACTIVE_MONITOR_BG = '#FF34322E'
|
|
||||||
COLOR_FOCUSED_OCCUPIED_FG = '#FFF6F9FF'
|
COLOR_FOCUSED_FG = '#FFE0E0E0'
|
||||||
COLOR_FOCUSED_OCCUPIED_BG = '#FF5C5955'
|
|
||||||
COLOR_FOCUSED_FREE_FG = '#FFF6F9FF'
|
|
||||||
COLOR_FOCUSED_FREE_BG = '#FF6D561C'
|
|
||||||
COLOR_FOCUSED_URGENT_FG = '#FF34322E'
|
|
||||||
COLOR_FOCUSED_URGENT_BG = '#FFF9A299'
|
|
||||||
COLOR_OCCUPIED_FG = '#FFA3A6AB'
|
COLOR_OCCUPIED_FG = '#FFA3A6AB'
|
||||||
COLOR_OCCUPIED_BG = '#FF34322E'
|
|
||||||
COLOR_FREE_FG = '#FF6F7277'
|
|
||||||
COLOR_FREE_BG = '#FF34322E'
|
|
||||||
COLOR_URGENT_FG = '#FFF9A299'
|
|
||||||
COLOR_URGENT_BG = '#FF34322E'
|
COLOR_URGENT_BG = '#FF34322E'
|
||||||
COLOR_LAYOUT_FG = '#FFA3A6AB'
|
|
||||||
COLOR_LAYOUT_BG = '#FF34322E'
|
|
||||||
COLOR_STATUS_FG = '#FFA3A6AB'
|
|
||||||
COLOR_STATUS_BG = '#FF34322E'
|
|
||||||
DIVIDER = ' | '
|
DIVIDER = ' | '
|
||||||
|
|
||||||
|
|
||||||
def color_string(string, fg=COLOR_STATUS_FG, bg=COLOR_STATUS_BG):
|
def color_string(string, fg=PANEL_FOREGROUND, bg=PANEL_BACKGROUND):
|
||||||
return "%%{F%s}%%{B%s} %s %%{B-}%%{F-}" % (fg, bg, string)
|
return "%%{F%s}%%{B%s} %s %%{B-}%%{F-}" % (fg, bg, string)
|
||||||
|
|
||||||
|
|
||||||
def status_update(data):
|
def status_update(data):
|
||||||
|
# monitor, occupied, free, urgent (with uppercase meaning focused)
|
||||||
colors = {
|
colors = {
|
||||||
'M': None, # (COLOR_ACTIVE_MONITOR_FG, COLOR_ACTIVE_MONITOR_BG),
|
'm': None,
|
||||||
'm': (COLOR_INACTIVE_MONITOR_FG, COLOR_INACTIVE_MONITOR_BG),
|
'M': None,
|
||||||
'O': (COLOR_FOCUSED_OCCUPIED_FG, COLOR_FOCUSED_OCCUPIED_BG),
|
'o': {},
|
||||||
'F': (COLOR_FOCUSED_FREE_FG, COLOR_FOCUSED_FREE_BG),
|
'O': {'fg': COLOR_FOCUSED_FG},
|
||||||
'U': (COLOR_FOCUSED_URGENT_FG, COLOR_FOCUSED_URGENT_BG),
|
'f': None,
|
||||||
'o': (COLOR_OCCUPIED_FG, COLOR_OCCUPIED_BG),
|
'F': {'fg': COLOR_FOCUSED_FG},
|
||||||
'f': None, # (COLOR_FREE_FG, COLOR_FREE_BG),
|
'u': {'bg': COLOR_URGENT_BG},
|
||||||
'u': (COLOR_URGENT_FG, COLOR_URGENT_BG),
|
'U': {'fg': COLOR_FOCUSED_FG, 'bg': COLOR_URGENT_BG},
|
||||||
'L': None, # (COLOR_LAYOUT_FG, COLOR_LAYOUT_BG),
|
'L': None, # focused desktop layout
|
||||||
|
'T': None, # focused node state
|
||||||
|
'G': None, # focused node active flags
|
||||||
}
|
}
|
||||||
data = data.decode('utf-8')
|
data = data.decode('utf-8')
|
||||||
assert data[0] == 'W'
|
assert data[0] == 'W'
|
||||||
|
|
@ -62,7 +53,7 @@ def status_update(data):
|
||||||
color = colors[item[0]]
|
color = colors[item[0]]
|
||||||
if color is not None:
|
if color is not None:
|
||||||
name = item[1:]
|
name = item[1:]
|
||||||
wm_info += color_string(name, *color)
|
wm_info += color_string(name, **color)
|
||||||
return 'status', wm_info
|
return 'status', wm_info
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
COLOR_FOREGROUND='#FFA3A6AB'
|
|
||||||
COLOR_BACKGROUND='#FF34322E'
|
|
||||||
COLOR_ACTIVE_MONITOR_FG='#FF34322E'
|
|
||||||
COLOR_ACTIVE_MONITOR_BG='#FF58C5F1'
|
|
||||||
COLOR_INACTIVE_MONITOR_FG='#FF58C5F1'
|
|
||||||
COLOR_INACTIVE_MONITOR_BG='#FF34322E'
|
|
||||||
COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF'
|
|
||||||
COLOR_FOCUSED_OCCUPIED_BG='#FF5C5955'
|
|
||||||
COLOR_FOCUSED_FREE_FG='#FFF6F9FF'
|
|
||||||
COLOR_FOCUSED_FREE_BG='#FF6D561C'
|
|
||||||
COLOR_FOCUSED_URGENT_FG='#FF34322E'
|
|
||||||
COLOR_FOCUSED_URGENT_BG='#FFF9A299'
|
|
||||||
COLOR_OCCUPIED_FG='#FFA3A6AB'
|
|
||||||
COLOR_OCCUPIED_BG='#FF34322E'
|
|
||||||
COLOR_FREE_FG='#FF6F7277'
|
|
||||||
COLOR_FREE_BG='#FF34322E'
|
|
||||||
COLOR_URGENT_FG='#FFF9A299'
|
|
||||||
COLOR_URGENT_BG='#FF34322E'
|
|
||||||
COLOR_LAYOUT_FG='#FFA3A6AB'
|
|
||||||
COLOR_LAYOUT_BG='#FF34322E'
|
|
||||||
COLOR_TITLE_FG='#FFA3A6AB'
|
|
||||||
COLOR_TITLE_BG='#FF34322E'
|
|
||||||
COLOR_STATUS_FG='#FFA3A6AB'
|
|
||||||
COLOR_STATUS_BG='#FF34322E'
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue