working theme changing

This commit is contained in:
2023-09-18 15:54:53 +02:00
parent 21550245c3
commit 9bbc679b81
10 changed files with 536 additions and 36 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"C_Cpp.dimInactiveRegions": true
}

View File

@@ -1,5 +1,39 @@
import:
- ~/.config/alacritty/catppuccin-macchiato.yml
# import:
# - ~/.config/alacritty/dynamic-theme.yml
# Colors
colors:
# Default colors
primary:
background: '0x24273a'
foreground: '0xcad3f5'
# Colors the cursor will use if `custom_cursor_colors` is true
cursor:
text: '0x000000'
cursor: '0xffffff'
# Normal colors
normal:
black: '0x181926'
red: '0xed8796'
green: '0xa6da95'
yellow: '0xeed49f'
blue: '0x8aadf4'
magenta: '0xf5bde6'
cyan: '0x8bd5ca'
white: '0xcad3f5'
# Bright colors
bright:
black: '0x181926'
red: '0xed8796'
green: '0xa6da95'
yellow: '0xeed49f'
blue: '0x8aadf4'
magenta: '0xf5bde6'
cyan: '0x8bd5ca'
white: '0xcad3f5'
scrolling:
history: 100000

View File

@@ -0,0 +1,252 @@
# import:
# - ~/.config/alacritty/dynamic-theme.yml
# Colors
colors:
# Default colors
primary:
background: %clbg%
foreground: %clfg%
# Colors the cursor will use if `custom_cursor_colors` is true
cursor:
text: '0x000000'
cursor: '0xffffff'
# Normal colors
normal:
black: %cl0%
red: %cl1%
green: %cl2%
yellow: %cl3%
blue: %cl4%
magenta: %cl5%
cyan: %cl6%
white: %cl7%
# Bright colors
bright:
black: %cl8%
red: %cl9%
green: %cl10%
yellow: %cl11%
blue: %cl12%
magenta: %cl13%
cyan: %cl14%
white: %cl15%
scrolling:
history: 100000
env:
TERM: alacritty
WINIT_X11_SCALE_FACTOR: '1.0'
window:
decorations: none
dynamic_title: true
opacity: 0.85
font:
# Normal (roman) font face
normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
family: Noto Color Emoji
family: SauceCodePro Nerd Font Mono
# The `style` can be specified to pick a specific face.
#style: Regular
# Bold font face
#bold:
# Font family
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Bold
# Italic font face
#italic:
# Font family
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Italic
# Bold italic font face
#bold_italic:
# Font family
#
# If the bold italic family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Bold Italic
# Point size
size: 12.0
# Offset is the extra space around each character. `offset.y` can be thought
# of as modifying the line spacing, and `offset.x` as modifying the letter
# spacing.
#offset:
# x: 0
# y: 0
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increasing `x` moves the glyph to the
# right, increasing `y` moves the glyph upward.
#glyph_offset:
# x: 0
# y: 0
# Bell
#
# The bell is rung every time the BEL control character is received.
bell:
# Visual Bell Animation
#
# Animation effect for flashing the screen when the visual bell is rung.
#
# Values for `animation`:
# - Ease
# - EaseOut
# - EaseOutSine
# - EaseOutQuad
# - EaseOutCubic
# - EaseOutQuart
# - EaseOutQuint
# - EaseOutExpo
# - EaseOutCirc
# - Linear
animation: EaseOutExpo
# Duration of the visual bell flash in milliseconds. A `duration` of `0` will
# disable the visual bell animation.
duration: 250
# Visual bell animation color.
color: '#4C566A'
# command:
# program: aplay
# args: ["/home/vectorkappa/Music/beeps/wav/erro.wav"]
hints:
# URL launcher
#
# This program is executed when clicking on a text which is recognized as a
# URL. The URL is always added to the command as the last parameter.
#
# When set to `launcher: None`, URL launching will be disabled completely.
#
# Default:
# - (macOS) open
# - (Linux/BSD) xdg-open
# - (Windows) explorer
enabled:
- regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"
command: xdg-open
post_processing: true
mouse:
enabled: true
mods: None
binding:
key: U
mods: Control|Shift
# launcher:
# program: xdg-open
#args: []
#key_bindings:
#- { key: Paste, action: Paste }
#- { key: Copy, action: Copy }
#- { key: L, mods: Control, action: ClearLogNotice }
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp, }
#- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown }
#- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, }
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
# Vi Mode
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
#- { key: G, mode: Vi|~Search, action: ScrollToTop }
#- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
#- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
#- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
#- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
#- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
#- { key: Y, mode: Vi|~Search, action: Copy }
#- { key: Y, mode: Vi|~Search, action: ClearSelection }
#- { key: Copy, mode: Vi|~Search, action: ClearSelection }
#- { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
#- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
#- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
#- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
#- { key: Return, mode: Vi|~Search, action: Open }
#- { key: K, mode: Vi|~Search, action: Up }
#- { key: J, mode: Vi|~Search, action: Down }
#- { key: H, mode: Vi|~Search, action: Left }
#- { key: L, mode: Vi|~Search, action: Right }
#- { key: Up, mode: Vi|~Search, action: Up }
#- { key: Down, mode: Vi|~Search, action: Down }
#- { key: Left, mode: Vi|~Search, action: Left }
#- { key: Right, mode: Vi|~Search, action: Right }
#- { key: Key0, mode: Vi|~Search, action: First }
#- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
#- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
#- { key: H, mods: Shift, mode: Vi|~Search, action: High }
#- { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
#- { key: L, mods: Shift, mode: Vi|~Search, action: Low }
#- { key: B, mode: Vi|~Search, action: SemanticLeft }
#- { key: W, mode: Vi|~Search, action: SemanticRight }
#- { key: E, mode: Vi|~Search, action: SemanticRightEnd }
#- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
#- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
#- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
#- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
#- { key: Slash, mode: Vi|~Search, action: SearchForward }
#- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
#- { key: N, mode: Vi|~Search, action: SearchNext }
#- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
# Search Mode
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
#- { key: Escape, mode: Search, action: SearchCancel }
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
#- { key: U, mods: Control, mode: Search, action: SearchClear }
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
#- { key: Down, mode: Search, action: SearchHistoryNext }
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only)
#- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
#- { key: C, mods: Control|Shift, action: Copy }
#- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward }
#- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward }
#- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection }
#- { key: Insert, mods: Shift, action: PasteSelection }
#- { key: Key0, mods: Control, action: ResetFontSize }
#- { key: Equals, mods: Control, action: IncreaseFontSize }
#- { key: Plus, mods: Control, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Control, action: IncreaseFontSize }
#- { key: Minus, mods: Control, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }

View File

@@ -0,0 +1,31 @@
#!/bin/bash
# Update alacritty config to apply Xresources color scheme
# Target file
target_file="$HOME/.config/alacritty/alacritty.yml"
# copy input file to temporary file for black magic fuckery
# (alacritty applies colors when the config file is written, so we want to do it
# all in one write)
cp $target_file.in $target_file.tmp
# Grab colors from Xresources
xrdb ~/.cache/wal/colors.Xresources
# Numbered colors
for i in {0..15}
do
v=`xrdb -query | awk '/*.color'"$i":'/ { print substr($2,2) }'`
#echo $v
eval "sed -i 's/%cl${i}%/\x270x${v}\x27/g' $target_file.tmp";
done
# Named colors
foreground=`xrdb -query | awk '/*.foreground/ { print substr($2,2) }'`
background=`xrdb -query | awk '/*.background/ { print substr($2,2) }'`
sed -i "s/%clfg%/\x270x${foreground}\x27/g" $target_file.tmp
sed -i "s/%clbg%/\x270x${background}\x27/g" $target_file.tmp
# Finally, replace target file with our updated one
rm $target_file
mv $target_file.tmp $target_file

View File

@@ -41,6 +41,35 @@ char cyan1[8];
char cyan2[8];
char white1[8];
char white2[8];
// new colors
char rosewater[8];
char flamingo[8];
char pink[8];
char mauve[8];
char red[8];
char maroon[8];
char peach[8];
char yellow[8];
char green[8];
char teal[8];
char sky[8];
char sapphire[8];
char blue[8];
char lavender[8];
char text[8];
char subtext1[8];
char subtext0[8];
char overlay2[8];
char overlay1[8];
char overlay0[8];
char surface2[8];
char surface1[8];
char surface0[8];
char base[8];
char mantle[8];
char crust[8];
char emacstheme[64];
char dwmtextbg[8];
char dwmtextfg[8];
@@ -89,6 +118,34 @@ void applypywal(){
cJSON_AddStringToObject(colors, "color14", cyan2);
cJSON_AddStringToObject(colors, "color15", white2);
// aditional catppuccin colors
cJSON_AddStringToObject(colors, "color16", rosewater);
cJSON_AddStringToObject(colors, "color17", flamingo);
cJSON_AddStringToObject(colors, "color18", pink);
cJSON_AddStringToObject(colors, "color19", mauve);
cJSON_AddStringToObject(colors, "color20", red);
cJSON_AddStringToObject(colors, "color21", maroon);
cJSON_AddStringToObject(colors, "color22", peach);
cJSON_AddStringToObject(colors, "color23", yellow);
cJSON_AddStringToObject(colors, "color24", green);
cJSON_AddStringToObject(colors, "color25", teal);
cJSON_AddStringToObject(colors, "color26", sky);
cJSON_AddStringToObject(colors, "color27", sapphire);
cJSON_AddStringToObject(colors, "color28", blue);
cJSON_AddStringToObject(colors, "color29", lavender);
cJSON_AddStringToObject(colors, "color30", text);
cJSON_AddStringToObject(colors, "color31", subtext1);
cJSON_AddStringToObject(colors, "color32", subtext0);
cJSON_AddStringToObject(colors, "color33", overlay2);
cJSON_AddStringToObject(colors, "color34", overlay1);
cJSON_AddStringToObject(colors, "color35", overlay0);
cJSON_AddStringToObject(colors, "color36", surface2);
cJSON_AddStringToObject(colors, "color37", surface1);
cJSON_AddStringToObject(colors, "color38", surface0);
cJSON_AddStringToObject(colors, "color39", base);
cJSON_AddStringToObject(colors, "color40", mantle);
cJSON_AddStringToObject(colors, "color41", crust);
/* Write JSON */
sprintf(buffer, "%s/.cache/dusk/pywal", getenv("HOME"));
@@ -151,8 +208,12 @@ void applydwm(){
system("~/.dwm/patch/dwmc xrdb");
/* Change x root window color */
sprintf(buffer, "xsetroot -solid \"%s\"", bg);
system(buffer);
system("pkill bar.sh");
system("~/.dwm/bar.sh &");
/* Change alacritty and rofi themes */
system("~/.config/alacritty/theme-patcher.sh &");
system("~/.config/rofi/theme-patcher.sh &");
}
void applygtk(){
@@ -181,6 +242,7 @@ void changescheme(int color){
strcpy(bg, LBASE);
strcpy(cursor, LTEXT);
strcpy(contrast, LGREEN);
strcpy(black1, LCRUST);
strcpy(black2, LCRUST);
strcpy(red1, LRED);
@@ -197,6 +259,43 @@ void changescheme(int color){
strcpy(cyan2, LTEAL);
strcpy(white1, LTEXT);
strcpy(white2, LTEXT);
/* Colors */
strcpy(rosewater, LROSEWATER);
strcpy(flamingo, LFLAMINGO);
strcpy(pink, LPINK);
strcpy(mauve, LMAUVE);
strcpy(red, LRED);
strcpy(maroon, LMAROON);
strcpy(peach, LPEACH);
strcpy(yellow, LYELLOW);
strcpy(green, LGREEN);
strcpy(teal, LTEAL);
strcpy(sky, LSKY);
strcpy(sapphire, LSAPPHIRE);
strcpy(blue, LBLUE);
strcpy(lavender, LLAVENDER);
/* Text and subtext colors */
strcpy(text, LTEXT);
strcpy(subtext1, LSUBTEXT1);
strcpy(subtext0, LSUBTEXT0);
/* Overlay colors */
strcpy(overlay2, LOVERLAY2);
strcpy(overlay1, LOVERLAY1);
strcpy(overlay0, LOVERLAY0);
/* Surface colors */
strcpy(surface2, LSURFACE2);
strcpy(surface1, LSURFACE1);
strcpy(surface0, LSURFACE0);
/* Base, mantle, and crust colors */
strcpy(base, LBASE);
strcpy(mantle, LMANTLE);
strcpy(crust, LCRUST);
strcpy(emacstheme, LEMACS);
strcpy(dwmtextbg, LDWMTEXTBG);
strcpy(dwmtextfg, LDWMTEXTFG);
@@ -236,6 +335,43 @@ void changescheme(int color){
strcpy(cyan2, DTEAL);
strcpy(white1, DTEXT);
strcpy(white2, DTEXT);
/* Colors */
strcpy(rosewater, DROSEWATER);
strcpy(flamingo, DFLAMINGO);
strcpy(pink, DPINK);
strcpy(mauve, DMAUVE);
strcpy(red, DRED);
strcpy(maroon, DMAROON);
strcpy(peach, DPEACH);
strcpy(yellow, DYELLOW);
strcpy(green, DGREEN);
strcpy(teal, DTEAL);
strcpy(sky, DSKY);
strcpy(sapphire, DSAPPHIRE);
strcpy(blue, DBLUE);
strcpy(lavender, DLAVENDER);
/* Text and subtext colors */
strcpy(text, DTEXT);
strcpy(subtext1, DSUBTEXT1);
strcpy(subtext0, DSUBTEXT0);
/* Overlay colors */
strcpy(overlay2, DOVERLAY2);
strcpy(overlay1, DOVERLAY1);
strcpy(overlay0, DOVERLAY0);
/* Surface colors */
strcpy(surface2, DSURFACE2);
strcpy(surface1, DSURFACE1);
strcpy(surface0, DSURFACE0);
/* Base, mantle, and crust colors */
strcpy(base, DBASE);
strcpy(mantle, DMANTLE);
strcpy(crust, DCRUST);
strcpy(emacstheme, DEMACS);
strcpy(dwmtextbg, DDWMTEXTBG);
strcpy(dwmtextfg, DDWMTEXTFG);

View File

@@ -1,41 +1,40 @@
#!/bin/bash
# ^c$var^ = fg color
# ^b$var^ = bg color
interval=0
# load colors
# . ~/.config/bar_themes/onedark
# colors
# dusk color palette path
dusk=$HOME/.cache/dusk/pywal
rosewater=#f4dbd6
flamingo=#f0c6c6
pink=#f5bde6
mauve=#c6a0f6
red=#ed8796
maroon=#ee99a0
peach=#f5a97f
yellow=#eed49f
green=#a6da95
teal=#8bd5ca
sky=#91d7e3
sapphire=#7dc4e4
blue=#8aadf4
lavender=#b7bdf8
text=#cad3f5
subtext1=#b8c0e0
subtext0=#a5adcb
overlay2=#939ab7
overlay1=#8087a2
overlay0=#6e738d
surface2=#5b6078
surface1=#494d64
surface0=#363a4f
base=#24273a
mantle=#1e2030
crust=#181926
# colors
rosewater=$(jq -r '.colors.color16' $dusk)
flamingo=$(jq -r '.colors.color17' $dusk)
pink=$(jq -r '.colors.color18' $dusk)
mauve=$(jq -r '.colors.color19' $dusk)
maroon=$(jq -r '.colors.color20' $dusk)
red=$(jq -r '.colors.color21' $dusk)
peach=$(jq -r '.colors.color22' $dusk)
yellow=$(jq -r '.colors.color23' $dusk)
green=$(jq -r '.colors.color24' $dusk)
teal=$(jq -r '.colors.color25' $dusk)
sky=$(jq -r '.colors.color26' $dusk)
sapphire=$(jq -r '.colors.color27' $dusk)
blue=$(jq -r '.colors.color28' $dusk)
lavender=$(jq -r '.colors.color29' $dusk)
text=$(jq -r '.colors.color30' $dusk)
subtext1=$(jq -r '.colors.color31' $dusk)
subtext0=$(jq -r '.colors.color32' $dusk)
overlay2=$(jq -r '.colors.color33' $dusk)
overlay1=$(jq -r '.colors.color34' $dusk)
overlay0=$(jq -r '.colors.color35' $dusk)
surface2=$(jq -r '.colors.color36' $dusk)
surface1=$(jq -r '.colors.color37' $dusk)
surface0=$(jq -r '.colors.color38' $dusk)
base=$(jq -r '.colors.color39' $dusk)
mantle=$(jq -r '.colors.color40' $dusk)
crust=$(jq -r '.colors.color41' $dusk)
pulse () {
VOL=$(pamixer --get-volume)

View File

@@ -94,6 +94,15 @@ easyeffects --gapplication-service &
# Emacs Server
emacs --daemon &
# Theme changing service
xsettingsd &
# Theming service
dusk &
# Alacritty config
$HOME/.config/alacritty/theme-patcher.sh &
## THINKPAD-SPECIFIC
hash dockd && dockd --daemon &

View File

@@ -15,5 +15,4 @@ configuration{
sidebar-mode: true;
}
@theme "catppuccin-mocha"
@theme "catppuccin-macchiato"

View File

@@ -0,0 +1,18 @@
configuration{
modi: "run,drun,window";
icon-theme: "Oranchelo";
show-icons: true;
terminal: "alacritty";
drun-display-format: "{icon} {name}";
location: 0;
disable-history: false;
hide-scrollbar: true;
display-drun: "  Apps ";
display-run: "  Run ";
display-window: " 﩯 Window";
display-Network: " 󰤨 Network";
display-calc: " Calc";
sidebar-mode: true;
}
@theme "catppuccin-%s%"

View File

@@ -0,0 +1,19 @@
#!/bin/bash
# Target file
target_file="$HOME/.config/rofi/config.rasi"
theme_file="$HOME/.cache/dusk/pywal"
cp $target_file.in $target_file.tmp
theme="macchiato"
if grep -q '#eff1f5' "$theme_file"; then
theme="latte"
fi
sed -i "s/%s%/${theme}/g" $target_file.tmp
# Finally, replace target file with our updated one
rm $target_file
mv $target_file.tmp $target_file