WIP xresources upgrades

This commit is contained in:
Daniel Flanagan 2020-01-24 15:35:53 -06:00
parent 2e6c33891b
commit ba6a2135d0
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
13 changed files with 133 additions and 171 deletions

View file

@ -1,28 +1,24 @@
#!/usr/bin/env sh
export WINDOW_GAP=0
NUM_DESKTOPS=10
DESKTOPS=$(seq "$NUM_DESKTOPS")
NUM_DESKTOPS="$(xrq bspwm.num_desktops)"
REVERSE_DESKTOP_ORDERING="$(xrq bspwm.reverse_desktop_ordering)"
BSPWM_MONITORS=$(bspc query -M | tac)
MONITOR_COUNT=$(<<< "$BSPWM_MONITORS" wc -w | awk '{ printf $1 }')
PER_MONITOR=$((NUM_DESKTOPS / MONITOR_COUNT))
REVERSE_DESKTOP_ORDERING=${REVERSE_DESKTOP_ORDERING:-0}
DESKTOPS=$(seq "$NUM_DESKTOPS")
. maybe_source_env_file bspwm
bspc config normal_border_color "$(xrdb -query | sed -ne 's/.*background:\s*//p')"
bspc config focused_border_color "$(xrdb -query | sed -ne 's/.*color0\?4:\s*//p')"
bspc config active_border_color "$(xrdb -query | sed -ne 's/.*color0\?4:\s*//p')"
bspc config presel_feedback_color "$(xrdb -query | sed -ne 's/.*color0\?4:\s*//p')"
bspc config border_width "$BORDER_WIDTH"
bspc config split_ratio 0.5
bspc config normal_border_color "$(xrq bspwm.normal_border_color)"
bspc config focused_border_color "$(xrq bspwm.focused_border_color)"
bspc config active_border_color "$(xrq bspwm.active_border_color)"
bspc config presel_feedback_color "$(xrq bspwm.presel_feedback_color)"
bspc config border_width "$(xrq bspwm.border_width)"
bspc config split_ratio "$(xrq bspwm.split_ratio)"
bspc config window_gap "$(xrq bspwm.window_gap)"
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config pointer_modifier "mod4"
bspc config remove_unplugged_monitors true
bspc config remove_disabled_monitors true
bspc config window_gap "$WINDOW_GAP"
bspc rule -a "*" split_dir=right

View file

@ -38,14 +38,14 @@ time = ${colors.foreground}
; ########################### ;
[bar/lytedev]
monitor = ${env:BAR_MONITOR:HDMI-1}
width = ${env:BAR_WIDTH:HDMI-1}
height = ${env:BAR_HEIGHT:30}
offset-x = ${env:POS_X:30}
offset-y = ${env:POS_Y:30}
monitor = ${xrdb:polybar.display_monitor:HDMI-1}
width = ${xrdb:polybar.width:100%-200}
height = ${xrdb:polybar.height:40}
offset-x = ${xrdb:polybar.offset_x:30}
offset-y = ${xrdb:polybar.offset_y:30}
radius = 0.0
fixed-center = true
bottom = ${env:BAR_BOTTOM:true}
bottom = ${xrdb:polybar.bottom_of_display:true}
dpi = ${xrdb:dpi:92}
background = ${colors.background}
@ -63,8 +63,8 @@ padding-right = 2
module-margin-left = 1
module-margin-right = 1
font-0 = ${env:BAR_FONT_DECLARATION}
font-1 = ${env:BAR_ICON_FONT_DECLARATION}
font-0 = ${xrdb:polybar.primary_font}
font-1 = ${xrdb:polybar.secondary_font}
modules-left = bspwm
modules-center = date
@ -89,7 +89,7 @@ override-redirect = true
type = internal/fs
interval = 25
mount-0 = ${env:BAR_FS_VOLUME:/}
mount-0 = ${xrdb:polybar.storage_volume:/}
format = <label-mounted>
label-mounted = %free%
@ -171,14 +171,14 @@ label = 
bar-width = 5
bar-indicator = |
bar-indicator-foreground = ${colors.foreground}
bar-indicator-font = 0
bar-indicator-font = 1
bar-fill = ─
; bar-fill = -
bar-fill-font = 0
bar-fill-font = 1
bar-fill-foreground = ${colors.bar-bg}
bar-empty = ─
; bar-empty = -
bar-empty-font = 0
bar-empty-font = 1
bar-empty-foreground = ${colors.bar-bg}
; ########################### ;
@ -211,7 +211,7 @@ label-foreground = ${colors.memory}
[module/wifi]
type = internal/network
interface = ${env:BAR_WIFI_INTERFACE}
interface = ${xrdb:polybar.wireless_interface}
interval = 10.0
;format-connected = <ramp-signal> <label-connected>
@ -239,7 +239,7 @@ ramp-signal-4 = 
[module/eth]
type = internal/network
interface = ${env:BAR_ETH_INTERFACE}
interface = ${xrdb:polybar.ethernet_interface}
interval = 10.0
format-connected-prefix = " "
@ -298,11 +298,11 @@ bar-volume-foreground-5 = ${colors.bar-bg}
bar-volume-foreground-6 = ${colors.bar-bg}
bar-volume-gradient = false
bar-volume-indicator = |
bar-volume-indicator-font = 0
bar-volume-indicator-font = 1
bar-volume-fill = ─
bar-volume-fill-font = 0
bar-volume-fill-font = 1
bar-volume-empty = ─
bar-volume-empty-font = 0
bar-volume-empty-font = 1
bar-volume-empty-foreground = ${colors.icon}
; ######################### ;
@ -382,8 +382,8 @@ compositing-border = source
; ######################### ;
[global/wm]
margin-top = ${env:WINDOW_GAP:0}
margin-bottom = ${env:WINDOW_GAP:0}
margin-top = ${xrdb:polybar.margin:0}
margin-bottom = ${xrdb:polybar.margin:0}
[module/microphone]
type = custom/script

View file

@ -1,62 +1,20 @@
#!/usr/bin/env sh
export BAR_MONITOR="$(polybar --list-monitors | tail -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')"
# export BAR_MONITOR="$(polybar --list-monitors | tail -n 2 | head -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')"
export BAR_HEIGHT=40
export BAR_ON_TOP=0
export BAR_SIDE_MARGIN=0
height="$(xrq polybar.height)"
margin="$(xrq polybar.margin)"
yoffset="$(xrq polybar.offset_y)"
eheight="$((height + margin + yoffset))"
bar_monitor="$(xrq polybar.display_monitor)"
export BAR_FONT="${BAR_FONT:-$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^:]*\)\:.*$/\1/p' | head -n 1)}"
export BAR_ICON_FONT="${BAR_ICON_FONT:-"Font Awesome 5 Free"}"
export BAR_FONT_SIZE="${BAR_FONT_SIZE:-$(xrdb -query | sed -ne 's/.*font:\s*xft:[^-,]*\=\([0-9]*\).*$/\1/p' | head -n 1)}"
export BAR_ICON_FONT_SIZE="${BAR_ICON_FONT_SIZE:-$((BAR_FONT_SIZE))}"
export GAP=$(bspc wm -d | grep -Po '(windowGap.*?,)' | grep -Po '\-?\d*' | head -n 1)
if [ "$GAP" -lt 0 ]; then
GAP=0
# TODO: if bspwm is the active window manager
if has_command bspc; then
if [ ! "$(xrq polybar.bottom_of_display)" = "true" ]; then
bspc config -m "${bar_monitor}" top_padding "$eheight"
bspc config -m "${bar_monitor}" bottom_padding "0"
else
bspc config -m "${bar_monitor}" top_padding "0"
bspc config -m "${bar_monitor}" bottom_padding "$eheight"
fi
fi
export BAR_BOTTOM="false"
export BAR_VERTICAL_MARGIN=0
export POS_Y=0
. maybe_source_env_file polybar
export MONITOR_WIDTH=$(xrandr | grep "^$BAR_MONITOR " | grep -Po ' \d+' | head -n 1)
export BAR_FONT_DECLARATION="${BAR_FONT}:pixelsize=${BAR_FONT_SIZE};1"
export BAR_ICON_FONT_DECLARATION="${BAR_ICON_FONT}:style=Solid:pixelsize=${BAR_ICON_FONT_SIZE};1"
export BAR_ICON_FONT_2_DECLARATION="${BAR_ICON_FONT_2}:style=Regular:pixelsize=${BAR_ICON_FONT_SIZE};1"
export BAR_WIDTH=$((MONITOR_WIDTH - GAP - GAP - BAR_SIDE_MARGIN - BAR_SIDE_MARGIN))
export POS_X=$((GAP + BAR_SIDE_MARGIN))
export EHEIGHT=$((BAR_HEIGHT + GAP + BAR_VERTICAL_MARGIN))
# if we just want the variables set here, pass an argument
if [ $# -gt 0 ]; then
return
fi
if [ "$BAR_ON_TOP" -eq 1 ]; then
export BAR_BOTTOM="false"
export POS_Y="$GAP"
bspc config -m "${BAR_MONITOR}" top_padding "$EHEIGHT"
bspc config -m "${BAR_MONITOR}" bottom_padding "0"
else
export BAR_BOTTOM="true"
export POS_Y="$GAP"
bspc config -m "${BAR_MONITOR}" top_padding "0"
bspc config -m "${BAR_MONITOR}" bottom_padding "$EHEIGHT"
fi
# bspc
echo "Monitor: $BAR_MONITOR"
echo "Bottom?: $BAR_BOTTOM"
echo "Dimensions: $POS_X $POS_Y $BAR_WIDTH $BAR_HEIGHT"
echo "EHeight: $EHEIGHT"
echo "Margin: $BAR_SIDE_MARGIN"
polybar lytedev

View file

@ -6,6 +6,7 @@ xqm() {
xqm "/etc/X11/xinit/.Xresources"
xqm "$HOME/.Xresources"
xqm "$HOME/.Xresources.colors"
xqm "$DOTFILES_PATH/bin/lib/colors/xresources"
xqm "$ENV_PATH/x/resources"

View file

@ -1,24 +1,32 @@
## Some of my favorite font setups...
## *font: xft:Monaco for Powerline-9
## *boldFont: xft:Monaco for Powerline-9
## *letterSpace: -1
! font
#define mono_font iosevka-lyte
#define mono_font_size 14
#define mono_font_letterspace 0
#define bold_mono_font iosevka-lyte Semibold
#define icon_font Font Awesome 5 Free
#define emoji_font Noto Emoji
#define font_fallback_stack xft:icon_font,xft:FreeSans
## *font: xft:artwiz lemon-8
## *boldFont: xft:artwiz lemon-8
## *letterSpace: 0
! window spacing
#define window_padding 24
#define window_border 5
#define window_margin 0
## *font: xft:xos4 Terminuss Powerline-8
## *boldFont: xft:xos4 Terminuss Powerline-8
## *letterSpace: 0
! dpi
#define base_dpi 92
*.font: xft:Iosevka Term:pixelsize=14,xft:Noto Emoji,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
*.boldFont: xft:Iosevka Term Bold:pixelsize=14,xft:Noto Emoji,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
! alternatives
!#define mono_font scientifica
!#define mono_font_size 11
!#define mono_font curie
!#define mono_font_size 10
*.letterSpace: 0
## URxvt.transparent: true
## URxvt.shading: 70
! font
*.font: xft:mono_font:pixelsize=mono_font_size,xft:emoji_font,font_fallback_stack
*.boldFont: xft:bold_mono_font:pixelsize=mono_font_size
*.letterSpace: mono_font_letterspace
## rxvt-unicode configuration
! rxvt-unicode
URxvt.termName: rxvt-unicode
URxvt.scrollBar: false
URxvt.cursorUnderline: true
@ -27,7 +35,7 @@ URxvt.intensityStyles: true
URxvt.utf8: 1
URxvt.scaleHeight: 1
URxvt.depth: 32
URxvt.internalBorder: 24
URxvt.internalBorder: window_padding
URxvt.perl-ext-common: default,matcher,resize-font
URxvt.keysym.M-Escape: perl:keyboard-select:activate
URxvt.resize-font.smaller: C-Down
@ -36,18 +44,50 @@ URxvt.url-launcher: /usr/bin/xdg-open
URxvt.matcher.button: 1
URxvt.iso14755: False
## Other Xorg configuration
! misc
Xcursor.theme: human
## DPI config
dpi: 92
.dpi: 92
*dpi: 92
Xft.dpi: 92
! dpi
dpi: base_dpi
.dpi: base_dpi
*dpi: base_dpi
Xft.dpi: base_dpi
! font rendering
! TODO: is this still relevant?
*autohint: 0
*lcdfilter: lcddefault
*hintstyle: hintfull
*hinting: 1
*antialias: 1
*rgba: rgb
! bspwm
bspwm.window_gap: window_margin
bspwm.border_width: window_border
bspwm.num_desktops: 10
bspwm.reverse_desktop_ordering: 0
bspwm.split_ratio: 0.5
! polybar
polybar.primary_font: xft:mono_font:pixelsize=mono_font_size
polybar.secondary_font: xft:icon_font:pixelsize=mono_font_size
polybar.display_monitor: HDMI-1
polybar.bottom_of_display: true
polybar.margin: window_margin
polybar.storage_volume: /
polybar.ethernet_interface: eth0
polybar.wireless_interface: wan0
polybar.width: 100%:-100
polybar.height: 40
! if you have a margin value, be sure to include that in your offsets
polybar.offset_x: 50
polybar.offset_y: 0
! rofi
rofi.font: mono_font mono_font_size
rofi.padding: window_padding
rofi.bw: window_border
rofi.color-enabled: true
rofi.monitor: -4
rofi.width: 600

View file

@ -20,10 +20,11 @@ nnoremap <leader><leader>t :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 1
" nnoremap <C-S-T> :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
nnoremap <C-y> :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
" close the terminal
" close
tnoremap <C-w> <C-\><C-n>:q!<CR>
tnoremap <leader>w <C-\><C-n>:q!<CR>
tnoremap <C-n> <C-\><C-n>
" normal mode
tnoremap <C-[> <C-\><C-n>
" moving between terminal splits
@ -117,6 +118,10 @@ nnoremap <C-b> :Buffers<CR>
" launch fzf for open buffers (files)
nnoremap <leader>l :Buffers<CR>
if has("nvim")
au FileType fzf tnoremap <Esc> <C-c><C-c>
endif
" switch to previous buffer
nnoremap <leader>h :b#<CR>

View file

@ -1,30 +1,3 @@
#!/usr/bin/env sh
. "$DOTFILES_PATH/apps/de/polybar/run" --just-vars
LAUNCHER_FONT="$BAR_FONT"
LAUNCHER_FONT_SIZE="$BAR_FONT_SIZE"
HIGHLIGHT_COLOR="$(xrq color4)"
HIGHLIGHT_FOREGROUND_COLOR="$(xrq background)"
BACKGROUND_COLOR=$(xrq background)
FOREGROUND_COLOR=$(xrq foreground)
GAP=$(xrq internalBorder)
. maybe_source_env_file app-launcher
rofi \
-combi-modi run,window \
-show combi \
-modi combi \
-font "$LAUNCHER_FONT $LAUNCHER_FONT_SIZE" \
-padding $GAP \
-bw "$BORDER_WIDTH" \
-color-enabled \
-color-window "$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR" \
-color-normal "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" \
-color-normal "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" \
-color-active "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" \
-color-urgent "$BACKGROUND_COLOR","$FOREGROUND_COLOR","$BACKGROUND_COLOR","$HIGHLIGHT_COLOR","$HIGHLIGHT_FOREGROUND_COLOR" \
-monitor -4 \
-width 600 \
"$@"
rofi -combi-modi run,window -show combi -modi combi "$@"

View file

@ -39,3 +39,14 @@
*color13: base06
*color14: base0F
*color15: base07
rofi.color-window: base00,base0D,base05,base00
rofi.color-normal: base00,base05,base00,base0D,base00
rofi.color-normal: base00,base05,base00,base0D,base00
rofi.color-active: base00,base05,base00,base0D,base00
rofi.color-urgent: base00,base05,base00,base0D,base00
bspwm.normal_border_color: base00
bspwm.focused_border_color: base0D
bspwm.active_border_color: base0D
bspwm.presel_feedback_color: base0D

4
env/desktop/bspwm vendored
View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# TODO: this doesn't quite work all the time
export REVERSE_DESKTOP_ORDERING=1

18
env/desktop/x/resources vendored Executable file → Normal file
View file

@ -1,16 +1,2 @@
## *.font: xft:scientifica:size=11
## *.faceName: xft:scientifica:size=11
## URxvt.font: xft:scientifica:size=11
## URxvt.faceName: xft:scientifica:size=11
*.font: xft:Iosevka Term:pixelsize=14,xft:Noto Emoji,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
*.boldFont: xft:Iosevka Term Semibold:pixelsize=14
## *.font: xft:curie:pixelsize=10,xft:Noto Emoji,xft:Font Awesome 5 Free,xft:FreeSans
## *.boldFont: xft:curie:pixelsize=10,xft:Noto Emoji,xft:Font Awesome 5 Free,xft:FreeSans
## *.font: xft:scientifica:size=11
## *.faceName: xft:scientifica:size=11
## URxvt.font: xft:scientifica:size=11
## URxvt.faceName: xft:scientifica:size=11
bspwm.reverse_desktop_ordering: 1
polybar.display_monitor: DisplayPort-0

9
env/laptop/polybar vendored
View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
export BAR_SIDE_MARGIN=0
export BAR_HEIGHT=80
[[ -v OVERRIDE_BAR_MONITOR ]] && export BAR_MONITOR="$OVERRIDE_BAR_MONITOR"
[[ -v OVERRIDE_BAR_HEIGHT ]] && export BAR_HEIGHT="$OVERRIDE_BAR_HEIGHT"
return 0

View file

@ -17,3 +17,5 @@ dpi: 92
.dpi: 92
*dpi: 92
Xft.dpi: 92
polybar.display_monitor: DP1

View file

@ -8,3 +8,6 @@ dpi: 190
.dpi: 190
*dpi: 190
Xft.dpi: 190
polybar.height: 80
polybar.display_monitor: eDP1