giving the home PC config a bit of TLC

This commit is contained in:
Wryn (yage) Wagner 2024-04-08 19:11:39 -06:00
parent e34b8c3e05
commit 9e0a7f3251
45 changed files with 1439 additions and 431 deletions

View File

@ -61,13 +61,14 @@ XRANDR_SET() {
########################################## ##########################################
scwrypts desktop/xrandr/disconnect-all scwrypts desktop xrandr disconnect all
xrandr ${XRANDR_ARGS[@]} xrandr ${XRANDR_ARGS[@]}
sleep 1 sleep 1
scwrypts desktop/screen-blank -- $SCREEN_BLANK scwrypts desktop screen blank -- $SCREEN_BLANK
scwrypts desktop/i3/set-background -- $BACKGROUND scwrypts desktop i3 set background -- $BACKGROUND
scwrypts desktop/play-sound -- $SOUND_EFFECT $DOTWRYN/bin/polybar
scwrypts desktop play sound -- $SOUND_EFFECT
} }

View File

@ -1,11 +1,12 @@
#!/bin/zsh #!/bin/zsh
tmux new -d -s apps -n 'foreman' 'htop' \; \ tmux new -d -s apps -n 'foreman' 'htop' \; \
split-window -d -t apps:foreman "while true; do clear; ${0:a:h}/apps; echo 'Keeping apps fresh...'; sleep 30; done" \ split-window -d -t apps:foreman "clear; echo 'Keeping apps fresh...'; while true; do sleep 30; done" \
2>/dev/null 2>/dev/null
for APP in $(ls ${0:a:h} | grep -v 'apps') for APP in $(ls ${0:a:h} | grep -v 'apps')
do do
echo "looking for $APP"
tmux list-windows -t apps: | awk '{print $2;}' | grep -q $APP \ tmux list-windows -t apps: | awk '{print $2;}' | grep -q $APP \
|| tmux new-window -dn $APP -t apps: "${0:a:h}/$APP" || tmux new-window -dn $APP -t apps: "${0:a:h}/$APP"
done done

View File

@ -1,31 +1,30 @@
#!/bin/zsh #!/bin/zsh
source "$HOME/.config/wryn/env.zsh" source "$HOME/.config/wryn/env.zsh"
case $1 in case $1 in
#next ) scwrypts desktop/media -- next ;;
#prev ) scwrypts desktop/media -- prev ;;
#play ) scwrypts desktop/media -- play ;;
volumeup ) scwrypts desktop/pulseaudio -- sink up ;; #next ) scwrypts desktop media -- next ;;
volumedown ) scwrypts desktop/pulseaudio -- sink down ;; #prev ) scwrypts desktop media -- prev ;;
volumemute ) scwrypts desktop/pulseaudio -- sink mute ;; #play ) scwrypts desktop media -- play ;;
micmute ) scwrypts desktop/pulseaudio -- source mute ;;
backlightup ) scwrypts desktop/backlight -- up ;; volumeup ) scwrypts desktop pulseaudio -- sink up ;;
backlightdown ) scwrypts desktop/backlight -- down ;; volumedown ) scwrypts desktop pulseaudio -- sink down ;;
volumemute ) scwrypts desktop pulseaudio -- sink mute ;;
micmute ) scwrypts desktop pulseaudio -- source mute ;;
lock ) scwrypts desktop/i3/lock -- ;; backlightup ) scwrypts desktop backlight -- up ;;
backlightdown ) scwrypts desktop backlight -- down ;;
bgrandomize ) scwrypts desktop/i3/set-background -- random ;; lock ) scwrypts desktop lock i3 -- ;;
alternateterm ) scwrypts desktop/kitty-alternate-theme -- ;; bgrandomize ) scwrypts desktop set i3 background -- random ;;
logout ) scwrypts desktop/i3/logout -- ;; logout ) scwrypts desktop i3 logout -- ;;
launch ) launch )
local PROGRAM local PROGRAM
local ARGS=() local ARGS=()
case $2 in case $2 in
messages ) PROGRAM=android-messages-desktop ;; messages ) PROGRAM=slack ARGS+=(-c Slack --has-statusbar-icon) ;;
voice ) PROGRAM=google-voice-desktop ;; voice ) PROGRAM=google-voice-desktop ;;
ytmusic ) PROGRAM=youtubemusic-nativefier ;; ytmusic ) PROGRAM=youtubemusic-nativefier ;;
@ -38,7 +37,7 @@ case $1 in
* ) PROGRAM=$2 ;; * ) PROGRAM=$2 ;;
esac esac
scwrypts i3/launch-or-show -- $PROGRAM ${ARGS[@]} scwrypts i3 launch or show -- $PROGRAM ${ARGS[@]}
;; ;;
screenshot ) screenshot )

8
bin/polybar Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
command -v polybar || return 0
killall -q polybar
while pgrep -x polybar &>/dev/null; do sleep 0.1; done
polybar i3 &

View File

@ -1 +0,0 @@
/home/w0ryn/.wryn/colorschemes/main.conf

View File

@ -1,27 +0,0 @@
# do not edit; generated by scwrypts
[colors.cursor]
cursor = '0xE0D0FF'
[colors.primary]
background = '0x000505'
foreground = '0xCFC2E9'
[colors.normal]
black = '0x000505'
red = '0xC80064'
green = '0x00C864'
yellow = '0x6400C8'
blue = '0x007D96'
magenta = '0x9600FA'
cyan = '0x00FAC8'
white = '0x7E707E'
[colors.bright]
black = '0x424253'
red = '0x640032'
green = '0x006432'
yellow = '0x320064'
blue = '0x00324B'
magenta = '0x640096'
cyan = '0x009664'
white = '0xC0B0C0'

View File

@ -1,26 +0,0 @@
--- # yamllint disable rule:colons
# do not edit; generated by scwrypts
colors:
primary:
background: '0x000505'
foreground: '0xCFC2E9'
cursor:
cursor: '0xE0D0FF'
normal:
black: '0x000505'
red: '0xC80064'
green: '0x00C864'
yellow: '0x6400C8'
blue: '0x007D96'
magenta: '0x9600FA'
cyan: '0x00FAC8'
white: '0x7E707E'
bright:
black: '0x424253'
red: '0x640032'
green: '0x006432'
yellow: '0x320064'
blue: '0x00324B'
magenta: '0x640096'
cyan: '0x009664'
white: '0xC0B0C0'

View File

@ -1,7 +0,0 @@
#!/bin/sh
# source this file to apply colorscheme to linux getty
[[ "$TERM" =~ ^linux$ ]] || return 0
/bin/echo -e " ]P0000505 ]P1C80064 ]P200C864 ]P36400C8 ]P4007D96 ]P59600FA ]P600FAC8 ]P7CFC2E9 ]P8640032 ]P9006432 ]PA320064 ]PB00324B ]PC640096 ]PD009664 ]PE7E707E ]PFC0B0C0 "
[ ! $NO_CLEAR ] && clear
return 0

View File

@ -0,0 +1,28 @@
# do not edit; generated by scwrypts
# theme : main
[colors.cursor]
cursor = '0xeeddff'
[colors.primary]
background = '0x000505'
foreground = '0xd0f0f0'
[colors.normal]
black = '0x000505'
red = '0xc80064'
green = '0x11bb98'
yellow = '0x6911aa'
blue = '0x2262bb'
magenta = '0x9922dd'
cyan = '0x22ccba'
white = '0xd0f0f0'
[colors.bright]
black = '0x424253'
red = '0xff44ff'
green = '0x44dddd'
yellow = '0xaa44ff'
blue = '0x229df6'
magenta = '0xdd88ff'
cyan = '0x88ffff'
white = '0x7e707e'

View File

@ -0,0 +1,27 @@
--- # yamllint disable rule:colons
# do not edit; generated by scwrypts
# theme : main
colors:
primary:
background: '0x000505'
foreground: '0xd0f0f0'
cursor:
cursor: '0xeeddff'
normal:
black: '0x000505'
red: '0xc80064'
green: '0x11bb98'
yellow: '0x6911aa'
blue: '0x2262bb'
magenta: '0x9922dd'
cyan: '0x22ccba'
white: '0xd0f0f0'
bright:
black: '0x424253'
red: '0xff44ff'
green: '0x44dddd'
yellow: '0xaa44ff'
blue: '0x229df6'
magenta: '0xdd88ff'
cyan: '0x88ffff'
white: '0x7e707e'

View File

@ -0,0 +1,74 @@
--- # yamllint disable rule:colons
ansi:
red:
regular: .material.base.error
bright: .material.error.200
green:
regular: .material.base.secondary
bright: .material.secondary.200
yellow:
regular: .material.base.primary
bright: .material.primary.200
gray:
black: '#000505'
regular: '#424253'
bright: '#7e707e'
white: '#d0f0f0'
background: .ansi.gray.black
foreground: .ansi.gray.white
selection:
background: .material.base.primary
foreground: .material.base.foreground.primary
cursor: .material.primary.50
material:
base:
primary: .material.primary.500
secondary: .material.secondary.500
error: .material.error.500
foreground:
primary: .material.foreground.primary.500
secondary: .material.foreground.secondary.500
error: .material.foreground.error.500
foreground:
primary:
50: .ansi.gray.black
100: .ansi.gray.black
200: .ansi.gray.black
300: .ansi.gray.black
400: .ansi.gray.black
500: .ansi.gray.white
600: .ansi.gray.white
700: .ansi.gray.white
800: .ansi.gray.white
900: .ansi.gray.white
secondary:
50: .ansi.gray.black
100: .ansi.gray.black
200: .ansi.gray.black
300: .ansi.gray.black
400: .ansi.gray.black
500: .ansi.gray.white
600: .ansi.gray.white
700: .ansi.gray.white
800: .ansi.gray.white
900: .ansi.gray.white
error:
50: .ansi.gray.black
100: .ansi.gray.black
200: .ansi.gray.black
300: .ansi.gray.black
400: .ansi.gray.black
500: .ansi.gray.white
600: .ansi.gray.white
700: .ansi.gray.white
800: .ansi.gray.white
900: .ansi.gray.white

View File

@ -0,0 +1,11 @@
#!/bin/sh
# do not edit; generated by scwrypts
# theme : main
#
# source this file to apply colorscheme to linux getty
#
[[ "$TERM" =~ ^linux$ ]] || return 0
/bin/echo -e " ]P0000505 ]P1c80064 ]P211bb98 ]P36911aa ]P42262bb ]P59922dd ]P622ccba ]P7d0f0f0 ]P8ff44ff ]P944dddd ]PAaa44ff ]PB229df6 ]PCdd88ff ]PD88ffff ]PEd0f0f0 ]PF7e707e "
[ ! $NO_CLEAR ] && clear
return 0
sed $d

View File

@ -0,0 +1,23 @@
# do not edit; generated by scwrypts
# theme : main
color0 #000505
color1 #c80064
color2 #11bb98
color3 #6911aa
color4 #2262bb
color5 #9922dd
color6 #22ccba
color7 #d0f0f0
color8 #424253
color9 #ff44ff
color10 #44dddd
color11 #aa44ff
color12 #229df6
color13 #dd88ff
color14 #88ffff
color15 #7e707e
cursor #eeddff
background #000505
foreground #d0f0f0
selection_background #
selection_foreground #

View File

@ -0,0 +1,10 @@
# do not edit; generated by scwrypts
# theme : main
[colors]
background = #000505
background-alt = #6911aa
foreground = #d0f0f0
primary = #6911aa
secondary = #11bb98
alert = #c80064
disabled = #424253

View File

@ -0,0 +1,13 @@
/**
* do not edit; generated by scwrypts
* theme : main
**/
*{
background: #000505;
foreground: #d0f0f0;
background-alt: #9922dd;
selected: #000505;
active: #6911aa;
urgent: #c80064;
}

View File

@ -0,0 +1 @@
/home/w0ryn/.wryn/colorschemes/main.yaml

View File

@ -1,29 +0,0 @@
background #000505
foreground #cfc2e9
selection_background #01b282
selection_foreground #441580
cursor #e0d0ff
color0 #000505
color8 #424253
color1 #c80064
color9 #640032
color2 #00c864
color10 #006432
color3 #6400c8
color11 #320064
color4 #007d96
color12 #00324b
color5 #9600fa
color13 #640096
color6 #00fac8
color14 #009664
color7 #7e707e
color15 #c0b0c0

61
colorschemes/main.yaml Normal file
View File

@ -0,0 +1,61 @@
--- # yamllint disable rule:colons
ansi:
blue:
regular: '#2262bb'
bright: '#229df6'
magenta:
regular: .material.primary.300
bright: .material.primary.100
cyan:
regular: .material.secondary.300
bright: .material.secondary.100
material:
base:
secondary: .material.secondary.400
foreground:
secondary: .material.foreground.secondary.400
primary: # replaces ANSI yellow
50: '#eeddff'
100: '#dd88ff'
200: '#aa44ff'
300: '#9922dd'
400: '#8811cc'
500: '#6911aa'
600: '#490099'
700: '#420069'
800: '#220069'
900: '#110029'
secondary: # replaces ANSI green
50: '#ddffff'
100: '#88ffff'
200: '#44dddd'
300: '#22ccba'
400: '#11bb98'
500: '#00aa79'
600: '#009949'
700: '#006942'
800: '#006922'
900: '#001129'
error: # replaces ANSI red
50: '#ffddff'
100: '#ff88ff'
200: '#ff44ff'
300: '#ee22ba'
400: '#dd1198'
500: '#c80064'
600: '#990049'
700: '#790032'
800: '#690022'
900: '#290011'
foreground:
secondary:
500: .ansi.gray.black
error:
400: .ansi.gray.white

29
colorschemes/sanity.conf Normal file
View File

@ -0,0 +1,29 @@
background #000000
foreground #ffffff
selection_background #999999
selection_foreground #333333
cursor #ffffff
color0 #000000
color8 #333333
color1 #ff0000
color9 #990000
color2 #00ff00
color10 #009900
color3 #ffff00
color11 #999900
color4 #0000ff
color12 #000099
color5 #ff00ff
color13 #990099
color6 #00ffff
color14 #009999
color7 #ffffff
color15 #999999

View File

@ -25,3 +25,5 @@
serve = !git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/ serve = !git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
[init] [init]
defaultBranch = main defaultBranch = main
[safe]
directory = /opt/flutter

View File

@ -4,7 +4,7 @@
set $alt Mod1 set $alt Mod1
set $mod Mod4 set $mod Mod4
font pango:Monaspace Argon 20 font pango:Monaspace Argon, pango:Noto Color Emoji, pango:Symbols Nerd Font 16
################################################################################ ################################################################################
## Custom Utility ############################################################## ## Custom Utility ##############################################################
@ -39,7 +39,6 @@ bindsym $mod+Shift+o exec --no-startup-id $UTILS launch obs
# Terminal # Terminal
bindsym $mod+Return exec i3-sensible-terminal bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+shift+Return exec --no-startup-id $UTILS alternateterm
# Other # Other
bindsym $mod+p exec --no-startup-id $UTILS bgrandomize bindsym $mod+p exec --no-startup-id $UTILS bgrandomize
@ -78,16 +77,16 @@ bindsym $mod+Shift+f focus parent; fullscreen; focus child
bindsym $mod+BackSpace open bindsym $mod+BackSpace open
bindsym $mod+1 workspace number "1"; bar mode dock bindsym $mod+1 workspace number "1"
bindsym $mod+2 workspace number "2"; bar mode hide bindsym $mod+2 workspace number "2"
bindsym $mod+3 workspace number "3"; bar mode dock bindsym $mod+3 workspace number "3"
bindsym $mod+4 workspace number "4"; bar mode hide bindsym $mod+4 workspace number "4"
bindsym $mod+5 workspace number "5"; bar mode dock bindsym $mod+5 workspace number "5"
bindsym $mod+6 workspace number "6"; bar mode hide bindsym $mod+6 workspace number "6"
bindsym $mod+7 workspace number "7"; bar mode dock bindsym $mod+7 workspace number "7"
bindsym $mod+8 workspace number "8"; bar mode hide bindsym $mod+8 workspace number "8"
bindsym $mod+9 workspace number "9"; bar mode dock bindsym $mod+9 workspace number "9"
bindsym $mod+0 workspace number "0"; bar mode hide bindsym $mod+0 workspace number "0"
bindsym $mod+Shift+1 move container to workspace number "1" bindsym $mod+Shift+1 move container to workspace number "1"
bindsym $mod+Shift+2 move container to workspace number "2" bindsym $mod+Shift+2 move container to workspace number "2"
@ -136,11 +135,6 @@ bindsym Control+$alt+Delete exit
bindsym $mod+Shift+r restart bindsym $mod+Shift+r restart
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
# for use after any command which should refresh the statusbar
set $refresh_statusbar killall -SIGUSR1 i3status
bar {
status_command i3status
}
# i3-gaps settings # i3-gaps settings
for_window [class="^.*"] border pixel 4 for_window [class="^.*"] border pixel 4
@ -195,3 +189,18 @@ client.focused_inactive $INACTIVE_BORDER $INACTIVE_BACKGROUND $INACTIVE_TEXT $IN
client.unfocused $UNFOCUSED_BORDER $UNFOCUSED_BACKGROUND $UNFOCUSED_TEXT $UNFOCUSED_INDICATOR $UNFOCUSED_CHILD_BORDER client.unfocused $UNFOCUSED_BORDER $UNFOCUSED_BACKGROUND $UNFOCUSED_TEXT $UNFOCUSED_INDICATOR $UNFOCUSED_CHILD_BORDER
client.urgent $URGENT_BORDER $URGENT_BACKGROUND $URGENT_TEXT $URGENT_INDICATOR $URGENT_CHILD_BORDER client.urgent $URGENT_BORDER $URGENT_BACKGROUND $URGENT_TEXT $URGENT_INDICATOR $URGENT_CHILD_BORDER
client.placeholder $PLACEHOLDER_BORDER $PLACEHOLDER_BACKGROUND $PLACEHOLDER_TEXT $PLACEHOLDER_INDICATOR $PLACEHOLDER_CHILD_BORDER client.placeholder $PLACEHOLDER_BORDER $PLACEHOLDER_BACKGROUND $PLACEHOLDER_TEXT $PLACEHOLDER_INDICATOR $PLACEHOLDER_CHILD_BORDER
#####################################################################
### Legacy Defaults #################################################
#####################################################################
# These settings are system-specific and are removed by
# 'scwrypts generate i3 config' I've left them in place so my
# defaults are in place on machines which still use the symlinked
# version of this config file rather than the generated one.
# for use after any command which should refresh the statusbar
set $refresh_statusbar killall -SIGUSR1 i3status
bar {
status_command i3status
}

25
config/i3.config.yaml Normal file
View File

@ -0,0 +1,25 @@
--- # used by scwrypts i3 generate config (override at ~/.config/i3/local.yaml)
font:
size: 14
family: >-
pango:Monaspace Argon,
pango:Noto Color Emoji,
pango:Symbols Nerd Font,
FontAwesome
application-launcher: >-
dmenu_run -c -l 5 -fn 'DejaVuSansMono Nerd Font-25'
gaps:
inner: 0
outer: 0
i3configs:
- |-
# for use after any command which should refresh the statusbar
set $refresh_statusbar killall -SIGUSR1 i3status
bar {
status_command i3status
}
# - exec_always --no-startup-id $DOTWRYN/bin/polybar &
- exec --no-startup-id i3-msg workspace 1

150
config/polybar.ini Normal file
View File

@ -0,0 +1,150 @@
include-file = $DOTWRYN/colorschemes/active/polybar.ini
[settings]
screenchange-reload = true
pseudo-transparency = true
[bar/i3]
bottom = true
width = 100%
height = 24pt
radius = 0
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 4pt
border-size = 0pt
border-color = #{colors.background}
padding-left = 1
padding-right = 1
module-margin = 0
separator = " "
separator-foreground = ${colors.disabled}
font-0 = Monaspace Krypton:style=Bold
font-1 = Noto Color Emoji:style=Regular
font-2 = Symbols Nerd Font:style=Regular
font-3 = DejaVu Sans:style=Bold
font-4 = Font Awesome 6 Free
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
#####################################################################
### modules-left ####################################################
#####################################################################
[bar/i3]
modules-left = xworkspaces
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
#####################################################################
### modules-center ##################################################
#####################################################################
[bar/i3]
modules-center = tray
[module/tray]
type = internal/tray
format-margin = 8pt
tray-spacing = 8pt
#####################################################################
### modules-right ###################################################
#####################################################################
[bar/i3]
modules-right = fs memory cpu wlan eth datetime backlight battery
[module/fs]
type = internal/fs
interval = 17
mount-0 = /
spacing = 0
label-mounted = ""
label-unmounted = ""
warn-percentage = 83
format-warn = <label-warn>
label-warn = "%free% remaining on disk (%percentage_used%% full)"
label-warn-foreground = ${colors.alert}
[module/memory]
type = internal/memory
interval = 2
label = ""
warn-percentage = 73
format-warn = <label-warn>
label-warn = RAM%percentage_used:2%%
label-warn-foreground = ${colors.alert}
[module/cpu]
type = internal/cpu
interval = 3
label = ""
warn-percentage = 79
format-warn = <label-warn>
label-warn = CPU%percentage:2%%
label-warn-foreground = ${colors.alert}
[network-base]
type = internal/network
interval = 31
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = (%ifname%:⊘)
label-disconnected-foreground = ${colors.disabled}
label-connected = %ifname%/%local_ip%
label-connected-foreground = ${colors.secondary}
[module/wlan]
inherit = network-base
interface-type = wireless
[module/eth]
inherit = network-base
interface-type = wired
[module/datetime]
type = custom/script
label-foreground = ${colors.foreground}
interval = 0.5
exec = echo $(date +"%A %B %d, %Y : %I:%M:%S-%P") $(TZ=UTC date +"{%H:%M-UTC}")
[module/backlight]
type = internal/backlight
format = <bar>
[module/battery]
type = internal/battery
interval = 13
format-charging = <bar-capacity>
format-discharging = <bar-capacity>
format-full = <bar-capacity>
format-low = <bar-capacity> <label-low>
low-at = 10
label-low =
label-low-foreground = ${colors.alert}

274
config/rofi.theme.rasi Normal file
View File

@ -0,0 +1,274 @@
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Rofi Theme File
* Rofi Version: 1.7.3
**/
/*****----- Configuration -----*****/
configuration {
modi: "drun";
show-icons: true;
display-drun: "💻";
display-run: "☕";
display-filebrowser: "📂";
display-window: "🪟";
drun-display-format: "{name} [<span weight='light' size='small'><i>({generic})</i></span>]";
window-format: "{w} · {c} · {t}";
}
/*****----- Global Properties -----*****/
@import "../colorschemes/active/rofi"
* {
border-colour: var(selected);
handle-colour: var(selected);
background-colour: var(background);
foreground-colour: var(foreground);
alternate-background: var(background-alt);
normal-background: var(background);
normal-foreground: var(foreground);
urgent-background: var(urgent);
urgent-foreground: var(background);
active-background: var(active);
active-foreground: var(background);
selected-normal-background: var(selected);
selected-normal-foreground: var(background);
selected-urgent-background: var(active);
selected-urgent-foreground: var(background);
selected-active-background: var(urgent);
selected-active-foreground: var(background);
alternate-normal-background: var(background);
alternate-normal-foreground: var(foreground);
alternate-urgent-background: var(urgent);
alternate-urgent-foreground: var(background);
alternate-active-background: var(active);
alternate-active-foreground: var(background);
}
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 800px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @border-colour;
cursor: "default";
background-color: @background-colour;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 10px;
margin: 0px;
padding: 16px;
border: 0px solid;
border-radius: 0px 0px 0px 0px;
border-color: @border-colour;
background-color: transparent;
children: [ "inputbar", "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 10px;
margin: 0px;
padding: 0px 0px 10px 10px;
border: 0px;
border-radius: 0px;
border-color: @border-colour;
background-color: @background-colour;
text-color: @foreground-colour;
children: [ "prompt", "entry" ];
}
prompt {
enabled: true;
background-color: inherit;
text-color: inherit;
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "::";
background-color: inherit;
text-color: inherit;
}
entry {
enabled: true;
background-color: inherit;
text-color: inherit;
cursor: text;
placeholder: "";
placeholder-color: inherit;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 1;
lines: 12;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 0px;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @border-colour;
background-color: transparent;
text-color: @foreground-colour;
cursor: "default";
}
scrollbar {
handle-width: 5px ;
handle-color: @handle-colour;
border-radius: 0px;
background-color: @alternate-background;
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 10px;
margin: 0px;
padding: 5px;
border: 0px solid;
border-radius: 0px;
border-color: @border-colour;
background-color: transparent;
text-color: @foreground-colour;
cursor: pointer;
}
element normal.normal {
background-color: var(normal-background);
text-color: var(normal-foreground);
}
element normal.urgent {
background-color: var(urgent-background);
text-color: var(urgent-foreground);
}
element normal.active {
background-color: var(active-background);
text-color: var(active-foreground);
}
element selected.normal {
background-color: var(alternate-background);
text-color: var(foreground-colour);
}
element selected.urgent {
background-color: var(selected-urgent-background);
text-color: var(selected-urgent-foreground);
}
element selected.active {
background-color: var(selected-active-background);
text-color: var(selected-active-foreground);
}
element alternate.normal {
background-color: var(alternate-normal-background);
text-color: var(alternate-normal-foreground);
}
element alternate.urgent {
background-color: var(alternate-urgent-background);
text-color: var(alternate-urgent-foreground);
}
element alternate.active {
background-color: var(alternate-active-background);
text-color: var(alternate-active-foreground);
}
element-icon {
background-color: transparent;
text-color: inherit;
size: 24px;
cursor: inherit;
}
element-text {
background-color: transparent;
text-color: inherit;
highlight: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.0;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 10px;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @border-colour;
background-color: transparent;
text-color: @foreground-colour;
}
button {
padding: 10px;
border: 0px solid;
border-radius: 0px;
border-color: @border-colour;
background-color: @alternate-background;
text-color: inherit;
cursor: pointer;
}
button selected {
background-color: var(selected-normal-background);
text-color: var(selected-normal-foreground);
}
/*****----- Message -----*****/
message {
enabled: true;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px 0px 0px 0px;
border-color: @border-colour;
background-color: transparent;
text-color: @foreground-colour;
}
textbox {
padding: 10px;
border: 0px solid;
border-radius: 0px;
border-color: @border-colour;
background-color: @alternate-background;
text-color: @foreground-colour;
vertical-align: 0.5;
horizontal-align: 0.0;
highlight: none;
placeholder-color: @foreground-colour;
blink: true;
markup: true;
}
error-message {
padding: 10px;
border: 0px solid;
border-radius: 0px;
border-color: @border-colour;
background-color: @background-colour;
text-color: @foreground-colour;
}

View File

@ -11,10 +11,10 @@ SYMLINKS="
# fully qualified path ~/.config/THE-REST # fully qualified path ~/.config/THE-REST
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
$DOTWRYN/bin/i3-utils i3/utils $DOTWRYN/bin/i3-utils i3/utils
$DOTWRYN/colorschemes/active.main kitty/theme.conf $DOTWRYN/colorschemes/active/kitty.conf kitty/theme.conf
$DOTWRYN/colorschemes/active.main.alacritty alacritty/theme.toml $DOTWRYN/colorschemes/active/alacritty.toml alacritty/theme.toml
$DOTWRYN/colorschemes/active.main.alacritty.yml alacritty/theme.yml $DOTWRYN/colorschemes/active/alacritty.yaml alacritty/theme.yml
$DOTWRYN/colorschemes/active.main.getty wryn/tty-colorscheme $DOTWRYN/colorschemes/active/getty.sh wryn/tty-colorscheme
$DOTWRYN/config/alacritty.toml alacritty/alacritty.toml $DOTWRYN/config/alacritty.toml alacritty/alacritty.toml
$DOTWRYN/config/alacritty.yaml alacritty/alacritty.yml $DOTWRYN/config/alacritty.yaml alacritty/alacritty.yml
$DOTWRYN/config/bat.conf bat/config $DOTWRYN/config/bat.conf bat/config
@ -22,11 +22,11 @@ $DOTWRYN/config/code-activator.conf code-activator-zsh/settings.zs
$DOTWRYN/config/compton.conf compton/compton.conf $DOTWRYN/config/compton.conf compton/compton.conf
$DOTWRYN/config/git.conf git/config $DOTWRYN/config/git.conf git/config
$DOTWRYN/config/htop.conf htop/htoprc $DOTWRYN/config/htop.conf htop/htoprc
$DOTWRYN/config/i3.conf i3/config
$DOTWRYN/config/i3status.conf i3status/config $DOTWRYN/config/i3status.conf i3status/config
$DOTWRYN/config/kitty.conf kitty/kitty.conf $DOTWRYN/config/kitty.conf kitty/kitty.conf
$DOTWRYN/config/mssqlcli.conf mssqlci/config $DOTWRYN/config/mssqlcli.conf mssqlci/config
$DOTWRYN/config/pgcli.conf pgcli/config $DOTWRYN/config/pgcli.conf pgcli/config
$DOTWRYN/config/polybar.ini polybar/config.ini
$DOTWRYN/config/pylint.conf pylintrc $DOTWRYN/config/pylint.conf pylintrc
$DOTWRYN/config/ripgrep.conf ripgrep/config $DOTWRYN/config/ripgrep.conf ripgrep/config
$DOTWRYN/config/scwrypts/config.zsh scwrypts/config.zsh $DOTWRYN/config/scwrypts/config.zsh scwrypts/config.zsh
@ -35,8 +35,8 @@ $DOTWRYN/config/scwrypts/vundle.zsh scwrypts/vundle.zsh
$DOTWRYN/config/tmux.conf tmux/tmux.conf $DOTWRYN/config/tmux.conf tmux/tmux.conf
$DOTWRYN/config/xcompose.conf X11/xcompose $DOTWRYN/config/xcompose.conf X11/xcompose
$DOTWRYN/config/xconfig.conf X11/xconfig $DOTWRYN/config/xconfig.conf X11/xconfig
$DOTWRYN/config/xinitrc.i3 X11/xinitrc
$DOTWRYN/config/xinitrc.i3 ../.xinitrc $DOTWRYN/config/xinitrc.i3 ../.xinitrc
$DOTWRYN/config/xinitrc.i3 X11/xinitrc
$DOTWRYN/bin/scwrypts ../.local/bin/scwrypts $DOTWRYN/bin/scwrypts ../.local/bin/scwrypts
$DOTWRYN/bin/vim ../.local/bin/vim $DOTWRYN/bin/vim ../.local/bin/vim
$DOTWRYN/bin/$(hostnamectl --static) ../.$(hostnamectl --static) $DOTWRYN/bin/$(hostnamectl --static) ../.$(hostnamectl --static)

View File

@ -1,7 +1,56 @@
#!/bin/zsh #!/bin/zsh
use desktop/colorscheme --group dotwryn use desktop/colorscheme --group dotwryn
use desktop/xorg/i3 --group dotwryn
#####################################################################
USAGE__options+="
-t, --theme one of the available color themes
-l, --list-themes show available color themes and exit
--only only set the theme for a specific terminal/application
($COLORSCHEME__SUPPORTED_CONFIG_TYPES)
"
USAGE__args+='
\$1 shorthand for "--theme \$1"
'
USAGE__description+='
Generates source-controlled config files for the selected theme.
By default, generates all possible config types to provide a
consistent, system-wide theme.
Due to complexities with i3wm colorscheme management, it is not
possible to update i3wm colorscheme files when using the "--only"
flag.
'
##################################################################### #####################################################################
MAIN() { MAIN() {
SET_THEME $@ local ARGS=() UPDATE_I3_CONFIG=true
while [[ $# -gt 0 ]]
do
case $1 in
--only )
ARGS+=($1)
UPDATE_I3_CONFIG=false
;;
* ) ARGS+=($1) ;;
esac
shift 1
done
SET_THEME ${ARGS[@]} \
|| ERROR 'failed to set theme (see above)' \
|| return 1
[[ $UPDATE_I3_CONFIG =~ true ]] || return 0
I3__GENERATE_CUSTOM_CONFIG \
|| ERROR 'failed to update i3 config (see above)' \
|| return 1
} }

View File

@ -0,0 +1,12 @@
#!/bin/zsh
use desktop/xorg/i3 --group dotwryn
#####################################################################
I3__GENERATE_CUSTOM_CONFIG__USAGE
MAIN() {
I3__GENERATE_CUSTOM_CONFIG
}
#####################################################################

View File

@ -1,5 +1,5 @@
#!/bin/zsh #!/bin/zsh
use desktop/xrandr --group dotwryn use desktop/xorg/xrandr --group dotwryn
##################################################################### #####################################################################
MAIN() { MAIN() {

View File

@ -1,291 +0,0 @@
#####################################################################
DEPENDENCIES+=(awk sed tr)
REQUIRED_ENV+=()
#####################################################################
_COLORSCHEME_DIR="$DOTWRYN/colorschemes"
ACTIVE_THEME_NAME='main'
ACTIVE_THEME="$_COLORSCHEME_DIR/active.$ACTIVE_THEME_NAME"
GET_COLORSCHEME_HEX() {
[ ! $USAGE ] && USAGE="
usage: ...args... [...options...]
options:
-h, --help show this dialogue and exit
args:
\$1 [0-15] gets the indicated color by ANSI color number
background gets the background color
foreground gets the foreground color
cursor gets the cursor color
all sets all theme variables (returns nothing)
"
local ARGS=()
while [[ $# -gt 0 ]]
do
case $1 in
-h | --help ) USAGE; return 0;;
all ) ARGS=(all); break ;;
* ) ARGS+=($1) ;;
esac
shift 1
done
[[ ${#ARGS[@]} -gt 0 ]] || ERROR 'must provide at least one color lookup'
CHECK_ERRORS || return 1
##########################################
local PATTERN
for A in ${ARGS[@]}
do
case $A in
all )
FOREGROUND=$(GET_COLORSCHEME_HEX foreground)
BACKGROUND=$(GET_COLORSCHEME_HEX background)
CURSOR=$(GET_COLORSCHEME_HEX cursor)
BLACK=$(GET_COLORSCHEME_HEX 0)
RED=$(GET_COLORSCHEME_HEX 1)
GREEN=$(GET_COLORSCHEME_HEX 2)
YELLOW=$(GET_COLORSCHEME_HEX 3)
BLUE=$(GET_COLORSCHEME_HEX 4)
MAGENTA=$(GET_COLORSCHEME_HEX 5)
CYAN=$(GET_COLORSCHEME_HEX 6)
WHITE=$(GET_COLORSCHEME_HEX 7)
BRIGHT_BLACK=$(GET_COLORSCHEME_HEX 8 )
BRIGHT_RED=$(GET_COLORSCHEME_HEX 9 )
BRIGHT_GREEN=$(GET_COLORSCHEME_HEX 10)
BRIGHT_YELLOW=$(GET_COLORSCHEME_HEX 11)
BRIGHT_BLUE=$(GET_COLORSCHEME_HEX 12)
BRIGHT_MAGENTA=$(GET_COLORSCHEME_HEX 13)
BRIGHT_CYAN=$(GET_COLORSCHEME_HEX 14)
BRIGHT_WHITE=$(GET_COLORSCHEME_HEX 15)
return 0
;;
foreground | background | cursor ) PATTERN="^$A " ;;
* ) : \
&& [ $A ] && [[ $A -le 15 ]] && [[ $A -ge 0 ]] \
|| { ERROR 'must provide ANSI color number 0-15'; return 1; }
PATTERN="^color$A "
;;
esac
grep "$PATTERN" "$ACTIVE_THEME" \
| awk '{print $2}' \
| sed 's/ //g; s/#//g' \
| tr '[:lower:]' '[:upper:]' \
;
done
}
SET_THEME() {
[ ! $USAGE ] && USAGE="
usage: [...options...]
options:
-t, --theme one of the available color themes
-l, --list-themes show available color themes and exit
--only only set the theme for a specific terminal (alacritty kitty tty)
-h, --help show this dialogue and exit
generate all source-controlled theme files then link them to the
appropriate local theme file to immediately update terminal themes
"
local SOURCE_THEME EMULATOR
while [[ $# -gt 0 ]]
do
case $1 in
-t | --theme ) THEME_NAME=$2; shift 1 ;;
-l | --list-themes ) _LIST_THEMES; return 0 ;;
--only )
EMULATOR=$2; shift 1
command -v _SET_THEME__$EMULATOR >/dev/null 2>&1 \
|| ERROR "terminal emulator '$EMULATOR' not supported"
;;
-h | --help ) USAGE; return 0 ;;
* ) ERROR "unknown argument '$1'"
esac
shift 1
done
CHECK_ERRORS || return 1
##########################################
[ $THEME_NAME ] || THEME_NAME=$(_LIST_THEMES | FZF 'select a theme')
[ $THEME_NAME ] || ABORT
local THEME="$_COLORSCHEME_DIR/$THEME_NAME.conf"
[ -f "$THEME" ] || FAIL 1 "no such theme '$THEME_NAME'"
##########################################
STATUS "updating theme $ACTIVE_THEME_NAME" \
&& ln -sf "$THEME" "$ACTIVE_THEME" \
&& SUCCESS "theme $ACTIVE_THEME_NAME set to '$THEME_NAME'" \
|| FAIL 2 "unable to set theme $ACTIVE_THEME_NAME to '$THEME_NAME'"
local EMULATORS=(alacritty kitty getty)
[ $EMULATOR ] && EMULATORS=($EMULATOR)
GET_COLORSCHEME_HEX all
for EMULATOR in ${EMULATORS[@]}
do
STATUS "updating $EMULATOR theme to use $ACTIVE_THEME_NAME" \
&& _GENERATE_THEME__$EMULATOR \
&& _SET_THEME__$EMULATOR \
&& SUCCESS "emulator $EMULATOR successfully set to $ACTIVE_THEME_NAME" \
|| ERROR "error setting theme $ACTIVE_THEME_NAME for $EMULATOR"
[[ $EMULATOR =~ ^getty$ ]] && [[ $TERM =~ ^linux$ ]] && {
STATUS 'loading getty theme now' \
&& NO_CLEAR=1 source "$ACTIVE_THEME.getty" \
&& SUCCESS 'getty theme loaded' \
|| ERROR 'getty theme loading error (see above)'
}
done
CHECK_ERRORS --no-usage
}
#####################################################################
_LIST_THEMES() {
ls "$_COLORSCHEME_DIR" | grep '.conf$' | sed 's/.conf$//'
}
#####################################################################
_GENERATE_THEME__alacritty() {
STATUS "generating $ACTIVE_THEME_NAME.alacritty"
echo "# do not edit; generated by scwrypts
[colors.cursor]
cursor = '0x$CURSOR'
[colors.primary]
background = '0x$BACKGROUND'
foreground = '0x$FOREGROUND'
[colors.normal]
black = '0x$BLACK'
red = '0x$RED'
green = '0x$GREEN'
yellow = '0x$YELLOW'
blue = '0x$BLUE'
magenta = '0x$MAGENTA'
cyan = '0x$CYAN'
white = '0x$WHITE'
[colors.bright]
black = '0x$BRIGHT_BLACK'
red = '0x$BRIGHT_RED'
green = '0x$BRIGHT_GREEN'
yellow = '0x$BRIGHT_YELLOW'
blue = '0x$BRIGHT_BLUE'
magenta = '0x$BRIGHT_MAGENTA'
cyan = '0x$BRIGHT_CYAN'
white = '0x$BRIGHT_WHITE'
" | sed '$d' > "$ACTIVE_THEME.alacritty"
# backwards yaml compatibility
echo "--- # yamllint disable rule:colons
# do not edit; generated by scwrypts
colors:
primary:
background: '0x$BACKGROUND'
foreground: '0x$FOREGROUND'
cursor:
cursor: '0x$CURSOR'
normal:
black: '0x$BLACK'
red: '0x$RED'
green: '0x$GREEN'
yellow: '0x$YELLOW'
blue: '0x$BLUE'
magenta: '0x$MAGENTA'
cyan: '0x$CYAN'
white: '0x$WHITE'
bright:
black: '0x$BRIGHT_BLACK'
red: '0x$BRIGHT_RED'
green: '0x$BRIGHT_GREEN'
yellow: '0x$BRIGHT_YELLOW'
blue: '0x$BRIGHT_BLUE'
magenta: '0x$BRIGHT_MAGENTA'
cyan: '0x$BRIGHT_CYAN'
white: '0x$BRIGHT_WHITE'
" | sed '$d' > "$ACTIVE_THEME.alacritty.yml"
}
_SET_THEME__alacritty() {
ln -sf "$ACTIVE_THEME.alacritty" "$HOME/.config/alacritty/theme.toml"
ln -sf "$ACTIVE_THEME.alacritty.yml" "$HOME/.config/alacritty/theme.yml" # backwards yaml compatibility
}
#####################################################################
_GENERATE_THEME__kitty() {
return 0 # existing theme is compatible with kitty
}
_SET_THEME__kitty() {
local LOCAL_THEME="$HOME/.config/kitty/theme.conf"
ln -sf "$ACTIVE_THEME" "$LOCAL_THEME"
}
#####################################################################
_GENERATE_THEME__getty() {
echo "#!/bin/sh
# source this file to apply colorscheme to linux getty
[[ \"\$TERM\" =~ ^linux$ ]] || return 0
/bin/echo -e \" \
\\e]P0$BACKGROUND \
\\e]P1$RED \
\\e]P2$GREEN \
\\e]P3$YELLOW \
\\e]P4$BLUE \
\\e]P5$MAGENTA \
\\e]P6$CYAN \
\\e]P7$FOREGROUND \
\\e]P8$BRIGHT_RED \
\\e]P9$BRIGHT_GREEN \
\\e]PA$BRIGHT_YELLOW \
\\e]PB$BRIGHT_BLUE \
\\e]PC$BRIGHT_MAGENTA \
\\e]PD$BRIGHT_CYAN \
\\e]PE$WHITE \
\\e]PF$BRIGHT_WHITE \
\"
[ ! \$NO_CLEAR ] && clear
return 0" > "$ACTIVE_THEME.getty"
}
_SET_THEME__getty() {
local LOCAL_THEME="$HOME/.config/wryn/tty-colorscheme"
ln -sf "$ACTIVE_THEME.getty" "$LOCAL_THEME"
}

View File

@ -0,0 +1,69 @@
_COLORSCHEME_FILE__alacritty_toml="$ACTIVE_THEME_PATH/alacritty.toml"
_COLORSCHEME_FILE__alacritty_yaml="$ACTIVE_THEME_PATH/alacritty.yaml"
_GENERATE_THEME__alacritty() {
echo "# do not edit; generated by scwrypts
# theme : $THEME_NAME
[colors.cursor]
cursor = '0x$CURSOR'
[colors.primary]
background = '0x$BACKGROUND'
foreground = '0x$FOREGROUND'
[colors.normal]
black = '0x$BLACK'
red = '0x$RED'
green = '0x$GREEN'
yellow = '0x$YELLOW'
blue = '0x$BLUE'
magenta = '0x$MAGENTA'
cyan = '0x$CYAN'
white = '0x$WHITE'
[colors.bright]
black = '0x$BRIGHT_BLACK'
red = '0x$BRIGHT_RED'
green = '0x$BRIGHT_GREEN'
yellow = '0x$BRIGHT_YELLOW'
blue = '0x$BRIGHT_BLUE'
magenta = '0x$BRIGHT_MAGENTA'
cyan = '0x$BRIGHT_CYAN'
white = '0x$BRIGHT_WHITE'
" | sed '$d' > "$_COLORSCHEME_FILE__alacritty_toml"
# backwards yaml compatibility
echo "--- # yamllint disable rule:colons
# do not edit; generated by scwrypts
# theme : $THEME_NAME
colors:
primary:
background: '0x$BACKGROUND'
foreground: '0x$FOREGROUND'
cursor:
cursor: '0x$CURSOR'
normal:
black: '0x$BLACK'
red: '0x$RED'
green: '0x$GREEN'
yellow: '0x$YELLOW'
blue: '0x$BLUE'
magenta: '0x$MAGENTA'
cyan: '0x$CYAN'
white: '0x$WHITE'
bright:
black: '0x$BRIGHT_BLACK'
red: '0x$BRIGHT_RED'
green: '0x$BRIGHT_GREEN'
yellow: '0x$BRIGHT_YELLOW'
blue: '0x$BRIGHT_BLUE'
magenta: '0x$BRIGHT_MAGENTA'
cyan: '0x$BRIGHT_CYAN'
white: '0x$BRIGHT_WHITE'
" | sed '$d' > "$_COLORSCHEME_FILE__alacritty_yaml"
}
_SET_THEME__alacritty() {
ln -sf "$_COLORSCHEME_FILE__alacritty_toml" "$HOME/.config/alacritty/theme.toml"
ln -sf "$_COLORSCHEME_FILE__alacritty_yaml" "$HOME/.config/alacritty/theme.yml"
}

View File

@ -0,0 +1,257 @@
#####################################################################
_COLORSCHEME_DIR="$DOTWRYN/colorschemes"
ACTIVE_THEME_PATH="$_COLORSCHEME_DIR/active"
ACTIVE_THEME_SOURCE="$ACTIVE_THEME_PATH/source.yaml"
use desktop/colorscheme/alacritty --group dotwryn
use desktop/colorscheme/getty --group dotwryn
use desktop/colorscheme/kitty --group dotwryn
use desktop/colorscheme/polybar --group dotwryn
use desktop/colorscheme/rofi --group dotwryn
COLORSCHEME__SUPPORTED_CONFIG_TYPES=($(typeset -f + | sed -n 's/^_GENERATE_THEME__//p'))
DEFAULT_MATERIAL_REFERENCES="$ACTIVE_THEME_PATH/default.yaml"
DEPENDENCIES+=(sed yq)
#####################################################################
MAX_LOOKUP_RECURSION=10
GET_COLORSCHEME_HEX() {
[ ! $USAGE ] && USAGE="
usage: ...args... [...options...]
options:
-t, --theme get the colorscheme value for the indicated theme source
-l, --list-themes show available color themes and exit
args:
An ordered list of colorscheme lookup terms. The first term is preferred, and
subsequent lookup terms are used as fallback.
Some special terms are allowed (typically for compatibility); however,
these should be simple yq queries from the 'colorscheme/\$THEME_NAME.yaml'
(e.g. '.ansi.red.bright')
Special terms:
[0-15] : lookup by ANSI color number
compatibility : foreground | background | cursor | selection_foreground | selection_background
"
local THEME_NAME='current active theme'
local THEME_SOURCE="$ACTIVE_THEME_SOURCE"
local ARGS=()
local LOOKUPS=()
while [[ $# -gt 0 ]]
do
case $1 in
-t | --theme )
THEME_NAME=$2; shift 1
THEME_SOURCE="$_COLORSCHEME_DIR/$THEME_NAME.yaml"
[ -f "$THEME_SOURCE" ] \
|| ERROR "no such theme '$THEME_NAME' exists"
;;
-l | --list-themes ) _LIST_THEMES; return 0 ;;
[0-9] | 1[0-5] ) LOOKUPS+=($(_GET_YAML_LOOKUP_FOR_ANSI_COLOR $1)) ;;
foreground ) LOOKUPS+=(.foreground .ansi.gray.black) ;;
background ) LOOKUPS+=(.background .ansi.gray.white) ;;
cursor ) LOOKUPS+=(.cursor .ansi.gray.white) ;;
selection_foreground ) LOOKUPS+=(.selection.foreground .background ) ;;
selection_background ) LOOKUPS+=(.selection.background .foreground ) ;;
* ) LOOKUPS+=("$1") ;;
esac
shift 1
done
[[ ${#LOOKUPS[@]} -gt 0 ]] \
|| ERROR 'must provide at least one color lookup'
CHECK_ERRORS --no-fail || return 1
##########################################
local LOOKUP VALUE
local I INIT
for LOOKUP in ${LOOKUPS[@]}
do
I=0 INIT=$LOOKUP
while true
do
((I+=1))
VALUE=$(YQ eval-all '. as $item ireduce ({}; . * $item)' "$DEFAULT_MATERIAL_REFERENCES" "$THEME_SOURCE" | YQ -r $LOOKUP)
DEBUG "looking up $LOOKUP : $VALUE"
case $VALUE in
.* ) LOOKUP=$VALUE ;;
* ) break ;;
esac
[[ $I -ge $MAX_LOOKUP_RECURSION ]] && {
VALUE=null
WARNING "max recursive depth reached for '$INIT'"
break
}
done
[[ $VALUE =~ null ]] && continue
[[ $VALUE =~ ^$ ]] && continue
break
done
[[ $VALUE =~ null ]] && {
ERROR "color lookup error for '$LOOKUPS'"
return 1
}
echo $VALUE | sed 's/^#//'
}
SET_THEME() {
[ ! $USAGE ] && USAGE="
usage: [...options...]
options:
-t, --theme one of the available color themes
-l, --list-themes show available color themes and exit
--only only set the theme for a specific terminal/application
($COLORSCHEME__SUPPORTED_CONFIG_TYPES)
-h, --help show this dialogue and exit
args:
\$1 shorthand for '--theme \$1'
generate all source-controlled theme files then link them to the
appropriate local theme file to immediately update terminal themes
Note : 'i3wm colorscheme' configuration is supported but must be performed
through the 'desktop/xorg/i3 --group dotwryn' module due to
some odd complexity
"
local THEME_NAME CONFIG_TYPE
local UPDATE_ACTIVE_THEME=true
while [[ $# -gt 0 ]]
do
case $1 in
-t | --theme ) THEME_NAME=$2; shift 1 ;;
-l | --list-themes ) _LIST_THEMES; return 0 ;;
--only )
UPDATE_ACTIVE_THEME=false
CONFIG_TYPE=$2; shift 1
command -v _SET_THEME__$CONFIG_TYPE >/dev/null 2>&1 \
|| ERROR "configuration for '$CONFIG_TYPE' not supported"
;;
-h | --help ) USAGE; return 0 ;;
* ) [ ! $THEME_NAME ] \
&& THEME_NAME=$1 \
|| ERROR "unknown argument '$1'" \
;
esac
shift 1
done
CHECK_ERRORS --no-fail || return 1
##########################################
[ $THEME_NAME ] || THEME_NAME=$(_LIST_THEMES | FZF 'select a theme')
[ $THEME_NAME ] || ABORT
local SOURCE_THEME="$_COLORSCHEME_DIR/$THEME_NAME.yaml"
[ -f "$SOURCE_THEME" ] \
|| ERROR "no such theme '$THEME_NAME'" \
|| return 1
##########################################
[[ $UPDATE_ACTIVE_THEME =~ true ]] && {
mkdir -p "$ACTIVE_THEME_PATH" &>/dev/null
STATUS "updating active theme" \
&& ln -sf "$SOURCE_THEME" "$ACTIVE_THEME_SOURCE" \
&& SUCCESS "active theme set to '$THEME_NAME'" \
|| ERROR "unable to set active theme to '$THEME_NAME'" \
|| return 2
}
local CONFIG_TYPES=()
[ $CONFIG_TYPE ] \
&& CONFIG_TYPES=($CONFIG_TYPE) \
|| CONFIG_TYPES=($COLORSCHEME__SUPPORTED_CONFIG_TYPES) \
;
_GET_HEX() { GET_COLORSCHEME_HEX --theme $THEME_NAME $@; }
# allow simple ANSI-color reference
local BLACK=$(_GET_HEX .ansi.gray.black )
local BRIGHT_BLACK=$(_GET_HEX .ansi.gray.regular )
local RED=$(_GET_HEX .ansi.red.regular )
local BRIGHT_RED=$(_GET_HEX .ansi.red.bright )
local GREEN=$(_GET_HEX .ansi.green.regular )
local BRIGHT_GREEN=$(_GET_HEX .ansi.green.bright )
local YELLOW=$(_GET_HEX .ansi.yellow.regular )
local BRIGHT_YELLOW=$(_GET_HEX .ansi.yellow.bright )
local BLUE=$(_GET_HEX .ansi.blue.regular )
local BRIGHT_BLUE=$(_GET_HEX .ansi.blue.bright )
local MAGENTA=$(_GET_HEX .ansi.magenta.regular)
local BRIGHT_MAGENTA=$(_GET_HEX .ansi.magenta.bright )
local CYAN=$(_GET_HEX .ansi.cyan.regular )
local BRIGHT_CYAN=$(_GET_HEX .ansi.cyan.bright )
local WHITE=$(_GET_HEX .ansi.gray.white )
local BRIGHT_WHITE=$(_GET_HEX .ansi.gray.bright )
local FOREGROUND=$(_GET_HEX .foreground )
local BACKGROUND=$(_GET_HEX .background )
local CURSOR=$(_GET_HEX .cursor )
for CONFIG_TYPE in ${CONFIG_TYPES[@]}
do
STATUS "updating $CONFIG_TYPE theme" \
&& _GENERATE_THEME__$CONFIG_TYPE \
&& _SET_THEME__$CONFIG_TYPE \
&& SUCCESS "emulator $CONFIG_TYPE successfully updated to $THEME_NAME" \
|| ERROR "error setting theme $THEME_NAME for $CONFIG_TYPE"
[[ $CONFIG_TYPE =~ ^getty$ ]] && [[ $TERM =~ ^linux$ ]] && {
STATUS 'loading getty theme now' \
&& NO_CLEAR=1 source "$ACTIVE_THEME_PATH/getty.sh" \
&& SUCCESS 'getty theme loaded' \
|| ERROR 'getty theme loading error (see above)'
}
done
CHECK_ERRORS --no-usage
}
#####################################################################
_LIST_THEMES() {
ls "$_COLORSCHEME_DIR" | sed -n 's/.yaml$//p'
}
_GET_YAML_LOOKUP_FOR_ANSI_COLOR() {
echo "
0: .ansi.gray.black
1: .ansi.red.regular
2: .ansi.green.regular
3: .ansi.yellow.regular
4: .ansi.blue.regular
5: .ansi.magenta.regular
6: .ansi.cyan.regular
7: .ansi.gray.white
8: .ansi.gray.regular
9: .ansi.red.bright
10: .ansi.green.bright
11: .ansi.yellow.bright
12: .ansi.blue.bright
13: .ansi.magenta.bright
14: .ansi.cyan.bright
15: .ansi.gray.bright
" | YQ -r ".$1"
}

View File

@ -0,0 +1,36 @@
_COLORSCHEME_FILE__getty="$ACTIVE_THEME_PATH/getty.sh"
_GENERATE_THEME__getty() {
echo "#!/bin/sh
# do not edit; generated by scwrypts
# theme : $THEME_NAME
#
# source this file to apply colorscheme to linux getty
#
[[ \"\$TERM\" =~ ^linux$ ]] || return 0
/bin/echo -e \" \
\\e]P0$BACKGROUND \
\\e]P1$RED \
\\e]P2$GREEN \
\\e]P3$YELLOW \
\\e]P4$BLUE \
\\e]P5$MAGENTA \
\\e]P6$CYAN \
\\e]P7$FOREGROUND \
\\e]P8$BRIGHT_RED \
\\e]P9$BRIGHT_GREEN \
\\e]PA$BRIGHT_YELLOW \
\\e]PB$BRIGHT_BLUE \
\\e]PC$BRIGHT_MAGENTA \
\\e]PD$BRIGHT_CYAN \
\\e]PE$WHITE \
\\e]PF$BRIGHT_WHITE \
\"
[ ! \$NO_CLEAR ] && clear
return 0
" sed '$d' > "$_COLORSCHEME_FILE__getty"
}
_SET_THEME__getty() {
ln -sf "$_COLORSCHEME_FILE__getty" "$HOME/.config/wryn/tty-colorscheme"
}

View File

@ -0,0 +1,32 @@
_COLORSCHEME_FILE__kitty="$ACTIVE_THEME_PATH/kitty.conf"
_GENERATE_THEME__kitty() {
echo "# do not edit; generated by scwrypts
# theme : $THEME_NAME
color0 #$BLACK
color1 #$RED
color2 #$GREEN
color3 #$YELLOW
color4 #$BLUE
color5 #$MAGENTA
color6 #$CYAN
color7 #$WHITE
color8 #$BRIGHT_BLACK
color9 #$BRIGHT_RED
color10 #$BRIGHT_GREEN
color11 #$BRIGHT_YELLOW
color12 #$BRIGHT_BLUE
color13 #$BRIGHT_MAGENTA
color14 #$BRIGHT_CYAN
color15 #$BRIGHT_WHITE
cursor #$CURSOR
background #$BACKGROUND
foreground #$FOREGROUND
selection_background #$SELECTION_BACKGROUND
selection_foreground #$SELECTION_FOREGROUND
" | sed '$d' > "$_COLORSCHEME_FILE__kitty"
}
_SET_THEME__kitty() {
ln -sf "$_COLORSCHEME_FILE__kitty" "$HOME/.config/kitty/theme.conf"
}

View File

@ -0,0 +1,19 @@
_COLORSCHEME_FILE__polybar="$ACTIVE_THEME_PATH/polybar.ini"
_GENERATE_THEME__polybar() {
echo "# do not edit; generated by scwrypts
# theme : $THEME_NAME
[colors]
background = #$(_GET_HEX .polybar.background .background)
background-alt = #$(_GET_HEX .polybar.background-alt .selection.background)
foreground = #$(_GET_HEX .polybar.foreground .foreground)
primary = #$(_GET_HEX .polybar.primary .material.base.primary .ansi.green.regular)
secondary = #$(_GET_HEX .polybar.secondary .material.base.secondary .ansi.blue.regular)
alert = #$(_GET_HEX .polybar.alert .material.base.error .ansi.red.regular)
disabled = #$(_GET_HEX .polybar.disabled .ansi.gray.regular)
" | sed '$d' > "$_COLORSCHEME_FILE__polybar"
}
_SET_THEME__polybar() {
return 0 # theme is referenced explicitly after generation
}

View File

@ -0,0 +1,22 @@
_COLORSCHEME_FILE__rofi="$ACTIVE_THEME_PATH/rofi.rasi"
_GENERATE_THEME__rofi() {
echo "/**
* do not edit; generated by scwrypts
* theme : $THEME_NAME
**/
*{
background: #$(_GET_HEX .rofi.background .background);
foreground: #$(_GET_HEX .rofi.foreground .foreground);
background-alt: #$(_GET_HEX .rofi.background-alt .material.primary.300 .selection.background);
selected: #$(_GET_HEX .rofi.selected .material.foreground.primary.300 .selection.foreground);
active: #$(_GET_HEX .rofi.active .material.base.primary .ansi.green.regular);
urgent: #$(_GET_HEX .rofi.urgent .material.base.error .ansi.red.regular );
}
" | sed '$d' > "$_COLORSCHEME_FILE__rofi"
}
_SET_THEME__rofi() {
return 0 # theme is referenced explicitly after generation
}

View File

@ -0,0 +1,149 @@
#####################################################################
use desktop/colorscheme --group dotwryn
DEPENDENCIES+=(basename readlink sed yq)
#####################################################################
I3__GENERATE_CUSTOM_CONFIG__USAGE() {
USAGE__options+="
--safe preserve old config (or fail if old conf does not exist)
--override-file fully qualified path to the override yaml file (default ~/.config/i3/local.yaml)
"
USAGE__description+="
Since i3wm does not provide a way to load config values dynamically,
I run this script to generate colorscheme values and other per-machine
overrides.
Uses the current, active colorscheme and local overrides specified in
~/.config/i3/local.yaml
"
}
#####################################################################
I3__GENERATE_CUSTOM_CONFIG() {
local SAFE=false
local CONFIG_DEFAULT_FILE="$DOTWRYN/config/i3.config.yaml"
local CONFIG_OVERRIDE_FILE="$HOME/.config/i3/local.yaml"
while [[ $# -gt 0 ]]
do
case $1 in
--safe ) SAFE=true ;;
--override-file )
[ -f "$2" ] || ERROR "no file '$2' can be found"
CONFIG_OVERRIDE_FILE="$2"
;;
esac
done
CHECK_ERRORS
[ -f "$CONFIG_OVERRIDE_FILE" ] || {
mkdir -p "$(dirname $CONFIG_OVERRIDE_FILE)"
echo '---' > "$CONFIG_OVERRIDE_FILE"
}
local CONFIG="$(YQ eval-all '. as $item ireduce ({}; . * $item)' "$CONFIG_DEFAULT_FILE" "$CONFIG_OVERRIDE_FILE")"
[ $CONFIG ] \
|| ERROR "unable to retrieve i3 config yaml (see above)" \
|| return 1 \
;
GET() { echo "$CONFIG" | YQ -r $@; }
COLOR() { GET_COLORSCHEME_HEX $@; }
local I3_CONFIG="$HOME/.config/i3/config"
: \
&& STATUS "generating configuration" \
&& {
echo "# i3 config file (v4)"
echo "# generated by 'scwrypts generate i3 config' (do not edit directly)"
echo "# sources: "
echo "# - i3 config base : $DOTWRYN/config/i3.conf"
echo "# - custom values : $CONFIG_DEFAULT_FILE"
echo "# - override values : $CONFIG_OVERRIDE_FILE"
} > "$I3_CONFIG.temp" \
&& sed "
/Legacy Defaults/,\$d
/^#/d
/^\s*$/d
s/\s\+/ /g
s/^\(font\) .*[0-9]\+$/\1 $(GET .font.family) $(GET .font.size)/
s^\(bindsym \$mod+space exec --no-startup-id\).*$\1 $(GET .application-launcher)
s^\([ ]\+status_command\) .*$\1 $(GET .bar.status)
s^\(set \$refresh_statusbar\) .*$\1 $(GET .bar.refresh)
s/^\(gaps inner\) .*$/\1 $(GET .gaps.inner)/
s/^\(gaps outer\) .*$/\1 $(GET .gaps.outer)/
s/^\(# color settings\).*$/\1 (theme '$(basename $(readlink -f "$DOTWRYN/colorschemes/active/main.conf") | sed 's/\.conf//')')/
s/\(^set \$FOCUSED_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.secondary.500 .ansi.green.bright)/
s/\(^set \$FOCUSED_INDICATOR.*#\).*/\1$(COLOR .material.secondary.700 .ansi.green.regular)/
s/\(^set \$FOCUSED_TEXT.*#\).*/\1$(COLOR .material.foreground.secondary.500 .foreground)/
s/\(^set \$INACTIVE_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.primary.500 .ansi.blue.bright)/
s/\(^set \$INACTIVE_INDICATOR.*#\).*/\1$(COLOR .material.primary.600 .ansi.blue.regular)/
s/\(^set \$INACTIVE_TEXT.*#\).*/\1$(COLOR .material.foreground.primary.500 .foreground)/
s/\(^set \$UNFOCUSED_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.primary.700 .ansi.yellow.bright)/
s/\(^set \$UNFOCUSED_INDICATOR.*#\).*/\1$(COLOR .material.primary.900 .ansi.yellow.regular)/
s/\(^set \$UNFOCUSED_TEXT.*#\).*/\1$(COLOR .material.foreground.primary.700 .foreground)/
s/\(^set \$URGENT_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.error.500 .ansi.red.bright)/
s/\(^set \$URGENT_INDICATOR.*#\).*/\1$(COLOR .material.error.700 .ansi.red.regular)/
s/\(^set \$URGENT_TEXT.*#\).*/\1$(COLOR .material.foreground.error.500 .foreground)/
s/\(^set \$PLACEHOLDER_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.primary.300 .ansi.cyan.bright)/
s/\(^set \$PLACEHOLDER_INDICATOR.*#\).*/\1$(COLOR .material.primary.100 .ansi.cyan.regular)/
s/\(^set \$PLACEHOLDER_TEXT.*#\).*/\1$(COLOR .material.foreground.primary.300 .foreground)/
" "$DOTWRYN/config/i3.conf" > "$I3_CONFIG.temp2" \
&& grep "^font " "$I3_CONFIG.temp2" >> "$I3_CONFIG.temp" \
&& grep "^set " "$I3_CONFIG.temp2" >> "$I3_CONFIG.temp" \
&& grep "^bindsym " "$I3_CONFIG.temp2" | sort -u >> "$I3_CONFIG.temp" \
&& grep -v "^\(bindsym\|set\|font\) " "$I3_CONFIG.temp2" >> "$I3_CONFIG.temp" \
&& { GET '.i3configs[]' 2>/dev/null >> "$I3_CONFIG.temp"; true }\
&& rm "$I3_CONFIG.temp2" \
&& STATUS "validating config" \
&& i3 -C -c "$I3_CONFIG.temp" \
|| ERROR "unable to produce config, or produced an invalid config (see above or '$I3_CONFIG.temp')" \
|| return 1
[[ $SAFE =~ true ]] && [ -f "$I3_CONFIG" ] && {
local BACKUP_FILE BACKUP_FILE_BASE="$I3_CONFIG.bak"
for x in {0..99}
do
BACKUP_FILE="$BACKUP_FILE_BASE.$x"
[ ! -f "$BACKUP_FILE" ] && break
done
mv "$I3_CONFIG" "$BACKUP_FILE" && {
SUCCESS "saved old config to '$BACKUP_FILE'"
} || {
WARNING 'failed to preserve old config'
yN 'any existing config will be overwritten; continue?'
}
}
: \
&& mv "$I3_CONFIG.temp" "$I3_CONFIG" \
&& SUCCESS "successfully generated i3 config" \
|| ERROR "something went wrong when moving config (check '$(dirname $I3_CONFIG)')" \
|| return 1 \
;
: \
&& pgrep i3 &>/dev/null \
&& i3-msg restart &>/dev/null \
&& STATUS 'reloaded config for current session' \
;
return 0
}

View File

@ -1,12 +1,10 @@
##################################################################### #####################################################################
DEPENDENCIES+=(
canberra-gtk-play
)
REQUIRED_ENV+=()
use desktop/notify --group dotwryn use desktop/notify --group dotwryn
DEPENDENCIES+=(canberra-gtk-play)
REQUIRED_ENV+=()
##################################################################### #####################################################################
MEDIA__PLAY_SFX() { MEDIA__PLAY_SFX() {