Switch from catppuccin to ayu mirage for various tools, switch from p10k to starship, self made tmux and sway statusbar update
This commit is contained in:
parent
886818cd1f
commit
93e41aef46
11 changed files with 412 additions and 1874 deletions
174
home/.config/confutils/get-battery.sh
Executable file
174
home/.config/confutils/get-battery.sh
Executable file
|
|
@ -0,0 +1,174 @@
|
|||
#!/bin/bash
|
||||
|
||||
#############################
|
||||
# Icons for Linux Battery
|
||||
#############################
|
||||
# This icon is used for macOS (no dynamic levels).
|
||||
MAC_BATTERY_ICON=""
|
||||
|
||||
# Charging icon (positive power_now)
|
||||
BATTERY_CHARGING_ICON=""
|
||||
|
||||
# Discharging icons based on capacity
|
||||
BATTERY_FULL_ICON="" # 80%–100%
|
||||
BATTERY_3QTR_ICON="" # 60%–79%
|
||||
BATTERY_HALF_ICON="" # 40%–59%
|
||||
BATTERY_QTR_ICON="" # 20%–39%
|
||||
BATTERY_EMPTY_ICON="" # 0%–19%
|
||||
|
||||
#############################
|
||||
# macOS Battery
|
||||
#############################
|
||||
get_battery_info_mac() {
|
||||
# pmset is the standard battery command on macOS
|
||||
if ! command -v pmset &>/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
capacity=$(pmset -g batt | grep -o "\d\+%" | head -n1 | tr -d '%')
|
||||
if [[ -n "$capacity" ]]; then
|
||||
# Just show generic icon + capacity on mac
|
||||
echo "$MAC_BATTERY_ICON $capacity%"
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#############################
|
||||
# Linux Battery
|
||||
#############################
|
||||
get_battery_info_linux() {
|
||||
local path="$1"
|
||||
|
||||
# Early return if path is not valid
|
||||
if [ -z "$path" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# capacity
|
||||
if [ -r "$path/capacity" ]; then
|
||||
capacity=$(cat "$path/capacity")
|
||||
else
|
||||
capacity=""
|
||||
fi
|
||||
|
||||
# power_now
|
||||
power_now=""
|
||||
if [ -r "$path/power_now" ]; then
|
||||
power_now=$(cat "$path/power_now")
|
||||
elif [ -r "$path/current_now" ] && [ -r "$path/voltage_now" ]; then
|
||||
# Some systems use current_now and voltage_now
|
||||
current_now=$(cat "$path/current_now")
|
||||
voltage_now=$(cat "$path/voltage_now")
|
||||
if [[ -n "$current_now" && -n "$voltage_now" ]]; then
|
||||
# (current_now * voltage_now) / 1e6 => watts
|
||||
power_now=$(echo "scale=2; ($current_now * $voltage_now) / 1000000" | bc)
|
||||
fi
|
||||
fi
|
||||
|
||||
# If we got capacity at all
|
||||
if [[ -n "$capacity" ]]; then
|
||||
|
||||
# Figure out numeric or empty power
|
||||
if [[ -n "$power_now" ]]; then
|
||||
# Determine if power_now is micro- or milliwatts
|
||||
abs_power_now=${power_now#-} # remove leading '-' if present
|
||||
if (( abs_power_now > 10000 )); then
|
||||
# microwatts -> W
|
||||
power_consumption_watts=$(echo "scale=2; $power_now / 1000000" | bc)
|
||||
else
|
||||
# milliwatts -> W
|
||||
power_consumption_watts=$(echo "scale=2; $power_now / 1000" | bc)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Decide if charging or discharging
|
||||
# (If power_now > 0 => charging, < 0 => discharging)
|
||||
local battery_icon
|
||||
if [[ -n "$power_now" ]]; then
|
||||
# numeric check: is it > 0 or < 0?
|
||||
float_power=$(echo "$power_now" | sed 's/^+//; s/,/./')
|
||||
# strip any trailing newline, just in case
|
||||
if (( $(echo "$float_power > 0" | bc -l) )); then
|
||||
# CHARGING
|
||||
battery_icon="$BATTERY_CHARGING_ICON"
|
||||
else
|
||||
# DISCHARGING - pick icon by capacity
|
||||
battery_icon=$(pick_battery_icon "$capacity")
|
||||
fi
|
||||
else
|
||||
# Unknown or no power_now => treat as discharging
|
||||
battery_icon=$(pick_battery_icon "$capacity")
|
||||
fi
|
||||
|
||||
# Build the final string
|
||||
if [[ -n "$power_consumption_watts" ]]; then
|
||||
echo "$battery_icon $capacity% (${power_consumption_watts} W)"
|
||||
else
|
||||
echo "$battery_icon $capacity%"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#############################
|
||||
# Helper to pick icon by capacity
|
||||
#############################
|
||||
pick_battery_icon() {
|
||||
local cap="$1"
|
||||
# convert to integer
|
||||
if [ "$cap" -ge 80 ]; then
|
||||
echo "$BATTERY_FULL_ICON"
|
||||
elif [ "$cap" -ge 60 ]; then
|
||||
echo "$BATTERY_3QTR_ICON"
|
||||
elif [ "$cap" -ge 40 ]; then
|
||||
echo "$BATTERY_HALF_ICON"
|
||||
elif [ "$cap" -ge 20 ]; then
|
||||
echo "$BATTERY_QTR_ICON"
|
||||
else
|
||||
echo "$BATTERY_EMPTY_ICON"
|
||||
fi
|
||||
}
|
||||
|
||||
#############################
|
||||
# Gather battery info
|
||||
#############################
|
||||
get_battery_info_linux_main() {
|
||||
battery_paths=(
|
||||
"/sys/class/power_supply/macsmc-battery" # Asahi (M1) Fedora Remix
|
||||
"/sys/class/power_supply/BAT0" # Standard Linux
|
||||
"/sys/class/power_supply/BAT1" # Common secondary
|
||||
)
|
||||
|
||||
for path in "${battery_paths[@]}"; do
|
||||
if [ -d "$path" ]; then
|
||||
battery_info=$(get_battery_info_linux "$path")
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$battery_info"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#############################
|
||||
# Main logic
|
||||
#############################
|
||||
OS="$(uname)"
|
||||
case "$OS" in
|
||||
Darwin)
|
||||
battery=$(get_battery_info_mac)
|
||||
;;
|
||||
Linux)
|
||||
battery=$(get_battery_info_linux_main)
|
||||
;;
|
||||
*)
|
||||
# Unsupported OS, no output
|
||||
battery=""
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$battery"
|
||||
4
home/.config/starship.toml
Normal file
4
home/.config/starship.toml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Get editor completions based on the config schema
|
||||
"$schema" = 'https://starship.rs/config-schema.json'
|
||||
|
||||
add_newline = true
|
||||
44
home/.config/tmux/tmux-rename-window.sh
Executable file
44
home/.config/tmux/tmux-rename-window.sh
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/zsh
|
||||
# program blacklist
|
||||
# program=$(
|
||||
# ps -o comm= -t "$(tmux display-message -p '#{pane_tty}')" 2>/dev/null \
|
||||
# | grep -v '^ps$' \
|
||||
# | grep -v 'tmux-rename-window' \
|
||||
# | grep -v 'tail' \
|
||||
# | grep -v 'head' \
|
||||
# | grep -v 'grep' \
|
||||
# | grep -v 'find' \
|
||||
# | grep -v 'rg' \
|
||||
# | grep -v 'jq' \
|
||||
# | grep -v 'perl' \
|
||||
# | grep -v 'fzf' \
|
||||
# | grep -v 'bat' \
|
||||
# | grep -v 'cat' \
|
||||
# | grep -v 'tldr' \
|
||||
# | grep -v 'man' \
|
||||
# | tail -n1
|
||||
# )
|
||||
|
||||
# Fallback if empty:
|
||||
# [[ -z "$program" ]] && program="zsh"
|
||||
|
||||
# Get the current working directory
|
||||
cwd=$(tmux display-message -p '#{pane_current_path}')
|
||||
|
||||
# If the program is zsh (or bash, etc.), show dir name
|
||||
# if [[ "$program" == "zsh" || "$program" == "bash" || "$program" == "sh" ]]; then
|
||||
[[ "$cwd" == "$HOME" ]] && dirname="~" || dirname=$(basename "$cwd")
|
||||
name="$dirname/"
|
||||
# else
|
||||
# name="$program"
|
||||
# fi
|
||||
|
||||
# Now do your truncation/padding
|
||||
MAX_WIDTH=15
|
||||
if [ "${#name}" -gt "$MAX_WIDTH" ]; then
|
||||
truncated="${name:0:$(($MAX_WIDTH-2))}…/"
|
||||
echo "$truncated"
|
||||
else
|
||||
echo "$name"
|
||||
fi
|
||||
|
||||
15
home/.config/tmux/tmux-status-right.sh
Executable file
15
home/.config/tmux/tmux-status-right.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
format_for_tmux() {
|
||||
fg="#1F2430"
|
||||
bg="#73D0FF"
|
||||
text_col="#CCCAC2"
|
||||
echo $1 | awk -v bg="$bg" -v fg="$fg" -v text_col="$text_col" '{printf("#[default]#[fg="bg"]#[default]#[bg="bg", fg="fg"]%s#[default]#[fg="bg"]#[default]#[fg="text_col"] %s", substr($0, 1, 1), substr($0, 2))}'
|
||||
}
|
||||
|
||||
battery_result=$($HOME/.config/confutils/get-battery.sh)
|
||||
|
||||
space=" "
|
||||
session=$(format_for_tmux "#S")
|
||||
battery=$(format_for_tmux "$battery_result")
|
||||
calendar=$(format_for_tmux " $(date +"%a %b %d")")
|
||||
|
||||
echo $session$space$battery$space$calendar
|
||||
1719
home/.p10k.zsh
1719
home/.p10k.zsh
File diff suppressed because it is too large
Load diff
|
|
@ -81,15 +81,6 @@ set-option -ga terminal-overrides ',*:Tc'
|
|||
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
|
||||
set -as terminal-overrides ',*:Setulc=\E[58::2::::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
|
||||
|
||||
# Set the default terminal to support 256 colors
|
||||
# set -g default-terminal "xterm-ghostty"
|
||||
|
||||
# Ensure tmux uses true color
|
||||
# set-option -ga terminal-features 'xterm-256color:RGB'
|
||||
# set-option -ga terminal-overrides ',xterm-256color:Tc'
|
||||
# set-option -ga terminal-features 'xterm-ghostty:RGB'
|
||||
# set-option -ga terminal-overrides ',xterm-ghostty:Tc'
|
||||
|
||||
# Make sure that the index of windows and panes starts at 1
|
||||
set -g base-index 1
|
||||
set -g pane-base-index 1
|
||||
|
|
@ -97,15 +88,44 @@ set -g renumber-windows on
|
|||
|
||||
set -g mode-keys vi
|
||||
|
||||
set -g history-limit 10000
|
||||
|
||||
set-option -g status-position top
|
||||
|
||||
set -g @catppuccin_flavour "macchiato"
|
||||
set -g @catppuccin_status_background "#1e2030"
|
||||
set -g @plugin "catppuccin/tmux"
|
||||
# Address vim mode switching delay (http://superuser.com/a/252717/65504)
|
||||
set -s escape-time 0
|
||||
|
||||
set -g @plugin "tmux-plugins/tmux-sensible"
|
||||
# Increase scrollback buffer size from 2000 to 50000 lines
|
||||
set -g history-limit 50000
|
||||
|
||||
# Increase tmux messages display duration from 750ms to 4s
|
||||
set -g display-time 2500
|
||||
|
||||
# Refresh 'status-left' and 'status-right' more often, from every 15s to 5s
|
||||
set -g status-interval 2
|
||||
|
||||
# Focus events enabled for terminals that support them
|
||||
set -g focus-events on
|
||||
|
||||
# Super useful when using "grouped sessions" and multi-monitor setup
|
||||
setw -g aggressive-resize on
|
||||
|
||||
# Set the left status: Tabs (window names)
|
||||
set -g status-left ""
|
||||
setw -g automatic-rename off
|
||||
set-hook -g after-new-window "run-shell '~/.config/tmux/tmux-rename-window.sh | xargs tmux rename-window'"
|
||||
set-hook -g pane-focus-in "run-shell '~/.config/tmux/tmux-rename-window.sh | xargs tmux rename-window'"
|
||||
|
||||
setw -g window-status-format "#[bg=#171B24,fg=#CCCAC2] #[bold]#I #[default] #[fg=#73D0FF]#W #[default]"
|
||||
setw -g window-status-current-format "#[bg=#757B84,fg=#EFEDE7] #[bold]#I #[default] #[fg=#FFAD66]#W #[default]"
|
||||
|
||||
# Set the right status: Battery, date and time, session name
|
||||
set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh) | #S#[default]"
|
||||
|
||||
set -g status-bg "#171B24"
|
||||
set -g status-style bold
|
||||
|
||||
# set -g @catppuccin_flavour "macchiato"
|
||||
# set -g @catppuccin_status_background "#1e2030"
|
||||
# set -g @plugin "catppuccin/tmux"
|
||||
|
||||
set -g @plugin "tmux-plugins/tpm"
|
||||
run "~/dev/git/tpm/tpm"
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
# Catppuccin Macchiato Theme (for zsh-syntax-highlighting)
|
||||
#
|
||||
# Paste this files contents inside your ~/.zshrc before you activate zsh-syntax-highlighting
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main cursor)
|
||||
typeset -gA ZSH_HIGHLIGHT_STYLES
|
||||
|
||||
# Main highlighter styling: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md
|
||||
#
|
||||
## General
|
||||
### Diffs
|
||||
### Markup
|
||||
## Classes
|
||||
## Comments
|
||||
ZSH_HIGHLIGHT_STYLES[comment]='fg=#5b6078'
|
||||
## Constants
|
||||
## Entitites
|
||||
## Functions/methods
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=#a6da95'
|
||||
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=#a6da95'
|
||||
ZSH_HIGHLIGHT_STYLES[global-alias]='fg=#a6da95'
|
||||
ZSH_HIGHLIGHT_STYLES[function]='fg=#a6da95'
|
||||
ZSH_HIGHLIGHT_STYLES[command]='fg=#a6da95'
|
||||
ZSH_HIGHLIGHT_STYLES[precommand]='fg=#a6da95,italic'
|
||||
ZSH_HIGHLIGHT_STYLES[autodirectory]='fg=#f5a97f,italic'
|
||||
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=#f5a97f'
|
||||
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=#f5a97f'
|
||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=#c6a0f6'
|
||||
## Keywords
|
||||
## Built ins
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=#a6da95'
|
||||
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=#a6da95'
|
||||
ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=#a6da95'
|
||||
## Punctuation
|
||||
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#ed8796'
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-unquoted]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]='fg=#ed8796'
|
||||
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=#ed8796'
|
||||
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=#ed8796'
|
||||
## Serializable / Configuration Languages
|
||||
## Storage
|
||||
## Strings
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-quoted]='fg=#eed49f'
|
||||
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-quoted]='fg=#eed49f'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#eed49f'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]='fg=#ee99a0'
|
||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#eed49f'
|
||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]='fg=#ee99a0'
|
||||
ZSH_HIGHLIGHT_STYLES[rc-quote]='fg=#eed49f'
|
||||
## Variables
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument-unclosed]='fg=#ee99a0'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[assign]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[named-fd]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[numeric-fd]='fg=#cad3f5'
|
||||
## No category relevant in spec
|
||||
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#ee99a0'
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=#cad3f5,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[path_pathseparator]='fg=#ed8796,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=#cad3f5,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]='fg=#ed8796,underline'
|
||||
ZSH_HIGHLIGHT_STYLES[globbing]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=#c6a0f6'
|
||||
#ZSH_HIGHLIGHT_STYLES[command-substitution]='fg=?'
|
||||
#ZSH_HIGHLIGHT_STYLES[command-substitution-unquoted]='fg=?'
|
||||
#ZSH_HIGHLIGHT_STYLES[process-substitution]='fg=?'
|
||||
#ZSH_HIGHLIGHT_STYLES[arithmetic-expansion]='fg=?'
|
||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-unclosed]='fg=#ee99a0'
|
||||
ZSH_HIGHLIGHT_STYLES[redirection]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[arg0]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[default]='fg=#cad3f5'
|
||||
ZSH_HIGHLIGHT_STYLES[cursor]='fg=#cad3f5'
|
||||
27
home/.zshrc
27
home/.zshrc
|
|
@ -59,7 +59,8 @@ fi
|
|||
source "${ZINIT_HOME}/zinit.zsh"
|
||||
|
||||
# Add powerlevel10k prompt
|
||||
zinit ice depth=1; zinit light romkatv/powerlevel10k
|
||||
zinit ice depth=1;
|
||||
# zinit light romkatv/powerlevel10k
|
||||
|
||||
# Add in zsh plugins
|
||||
zinit light zsh-users/zsh-completions
|
||||
|
|
@ -76,16 +77,12 @@ zinit snippet OMZP::command-not-found
|
|||
|
||||
zinit cdreplay -q
|
||||
|
||||
# Load powerlevel10k
|
||||
[ -f ~/.p10k.zsh ] && source ~/.p10k.zsh
|
||||
|
||||
# Catppuccin for zsh-syntax-highlighting
|
||||
source ~/.zsh/catppuccin_macchiato-zsh-syntax-highlighting.zsh
|
||||
# Catppuccin for fzf
|
||||
export FZF_DEFAULT_OPTS=" \
|
||||
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
|
||||
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
|
||||
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8"
|
||||
# Check that the function `starship_zle-keymap-select()` is defined.
|
||||
# xref: https://github.com/starship/starship/issues/3418
|
||||
type starship_zle-keymap-select-wrapped >/dev/null || \
|
||||
{
|
||||
eval "$(starship init zsh)"
|
||||
}
|
||||
|
||||
# History settings
|
||||
HISTFILE=~/.zsh_history
|
||||
|
|
@ -191,4 +188,12 @@ if [[ -z "$TMUX" ]] && [[ $- == *i* ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$TMUX" ]]; then
|
||||
precmd() {
|
||||
local name
|
||||
name="$("$HOME/.config/tmux/tmux-rename-window.sh")"
|
||||
tmux rename-window "$name"
|
||||
}
|
||||
fi
|
||||
|
||||
fastfetch
|
||||
|
|
|
|||
51
linux_home/.config/sway/ayu_mirage
Normal file
51
linux_home/.config/sway/ayu_mirage
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# colors.ayu
|
||||
|
||||
# Primary Colors
|
||||
set $ayu_accent #FFCC66
|
||||
set $ayu_bg #1F2430
|
||||
set $ayu_fg #CCCAC2
|
||||
set $ayu_ui #707A8C
|
||||
|
||||
# Functional Colors
|
||||
set $ayu_tag #5CCFE6
|
||||
set $ayu_func #FFD173
|
||||
set $ayu_entity #73D0FF
|
||||
set $ayu_string #D5FF80
|
||||
set $ayu_regexp #95E6CB
|
||||
set $ayu_markup #F28779
|
||||
set $ayu_keyword #FFAD66
|
||||
set $ayu_special #FFDFB3
|
||||
set $ayu_comment #6C7A8B
|
||||
set $ayu_constant #DFBFFF
|
||||
set $ayu_operator #F29E74
|
||||
set $ayu_error #FF6666
|
||||
set $ayu_lsp_parameter #D3B8F9
|
||||
|
||||
# Layout & UI Colors
|
||||
set $ayu_line #171B24
|
||||
set $ayu_panel_bg #1C212B
|
||||
set $ayu_panel_shadow #161922
|
||||
set $ayu_panel_border #101521
|
||||
|
||||
set $ayu_gutter_normal #4A505A
|
||||
set $ayu_gutter_active #757B84
|
||||
|
||||
set $ayu_selection_bg #274364
|
||||
set $ayu_selection_inactive #23344B
|
||||
set $ayu_selection_border #232A4C
|
||||
|
||||
set $ayu_guide_active #444A55
|
||||
set $ayu_guide_normal #323843
|
||||
|
||||
# Version Control Colors
|
||||
set $ayu_vcs_added #87D96C
|
||||
set $ayu_vcs_modified #80BFFF
|
||||
set $ayu_vcs_removed #F27983
|
||||
|
||||
set $ayu_vcs_added_bg #313D37
|
||||
set $ayu_vcs_removed_bg #3E373A
|
||||
|
||||
# Miscellaneous Colors
|
||||
set $ayu_fg_idle #707A8C
|
||||
set $ayu_warning #FFA759
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
include catppuccin_macchiato
|
||||
include ayu_mirage
|
||||
|
||||
# Remap caps lock to escape
|
||||
input * {
|
||||
|
|
@ -131,35 +131,41 @@ mode "resize" {
|
|||
}
|
||||
bindsym $mod+space mode "resize"
|
||||
|
||||
font pango:JetBrains Mono Nerd Font Regular 12
|
||||
#
|
||||
# Status Bar:
|
||||
#
|
||||
# Rea# target title bg text indicator border
|
||||
client.focused $lavender $base $text $rosewater $lavender
|
||||
client.focused_inactive $overlay0 $base $text $rosewater $overlay0
|
||||
client.unfocused $overlay0 $base $text $rosewater $overlay0
|
||||
client.urgent $peach $base $peach $overlay0 $peach
|
||||
client.placeholder $overlay0 $base $text $overlay0 $overlay0
|
||||
client.background $based `man 5 sway-bar` for more information about this section.
|
||||
client.focused $ayu_regexp $ayu_regexp $ayu_regexp $ayu_entity $ayu_regexp
|
||||
client.focused_inactive $ayu_ui $ayu_ui $ayu_ui $ayu_entity $ayu_ui
|
||||
client.unfocused $ayu_bg $ayu_bg $ayu_bg $ayu_entity $ayu_bg
|
||||
client.urgent $ayu_keyword $ayu_bg $ayu_fg $ayu_ui $ayu_keyword
|
||||
client.placeholder $ayu_ui $ayu_ui $ayu_fg $ayu_ui $ayu_ui
|
||||
client.background $ayu_bg `man 5 sway-bar` for more information about this section.
|
||||
|
||||
# Hack to remove the titlebar or minimizing it.
|
||||
font pango:CaskaydiaCove NFM SemiLight 1
|
||||
default_border none
|
||||
default_floating_border none
|
||||
titlebar_padding 1
|
||||
titlebar_border_thickness 0
|
||||
|
||||
bar {
|
||||
position bottom
|
||||
font pango:JetBrains Mono Nerd Font Regular 12
|
||||
font pango:CaskaydiaCove NFM SemiLight 14
|
||||
# When the status_command prints a new line to stdout, swaybar updates.
|
||||
# status_command while date +'%Y-%m-%d %X'; do sleep 1; done
|
||||
status_command ~/.config/sway/status.sh
|
||||
|
||||
colors {
|
||||
background $base
|
||||
statusline $text
|
||||
focused_statusline $text
|
||||
focused_separator $base
|
||||
focused_workspace $base $base $green
|
||||
active_workspace $base $base $blue
|
||||
inactive_workspace $base $base $surface1
|
||||
urgent_workspace $base $base $surface1
|
||||
binding_mode $base $base $surface1
|
||||
background $ayu_bg
|
||||
statusline $ayu_fg
|
||||
focused_statusline $ayu_fg
|
||||
focused_separator $ayu_bg
|
||||
focused_workspace $ayu_bg $ayu_bg $ayu_accent
|
||||
active_workspace $ayu_bg $ayu_bg $ayu_tag
|
||||
inactive_workspace $ayu_bg $ayu_bg $ayu_ui
|
||||
urgent_workspace $ayu_bg $ayu_bg $ayu_ui
|
||||
binding_mode $ayu_bg $ayu_bg $ayu_ui
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,64 +1,76 @@
|
|||
#!/bin/sh
|
||||
#!/bin/zsh
|
||||
# Icons
|
||||
vpn_icon=""
|
||||
wifi_icon=" "
|
||||
brightness_icon=""
|
||||
bluetooth_icon=""
|
||||
keyboard_icon="⌨"
|
||||
date_icon=""
|
||||
|
||||
while true; do
|
||||
# VPN (Mullvad)
|
||||
vpn_status=$(mullvad status)
|
||||
# Example output:
|
||||
# -------------------------
|
||||
# Connected
|
||||
# Relay: se-mma-wg-101
|
||||
# Features: Quantum Resistance
|
||||
# Visible location: Sweden, Malmö. IPv4: 45.83.220.204
|
||||
# -------------------------
|
||||
is_connected=$(echo "$vpn_status" | grep -oP "Connected" | wc -l)
|
||||
if [ $is_connected -eq 1 ]; then
|
||||
is_connected=$(echo "$vpn_status" | grep -c "Connected")
|
||||
if [ "$is_connected" -eq 1 ]; then
|
||||
visible_location=$(echo "$vpn_status" | grep -oP "Visible location:\s+\K.*" | cut -d. -f1)
|
||||
vpn_status="VPN: $visible_location"
|
||||
vpn_display="$vpn_icon $visible_location"
|
||||
else
|
||||
vpn_status="VPN: Disconnected"
|
||||
vpn_display="$vpn_icon Disconnected"
|
||||
fi
|
||||
|
||||
# Network status
|
||||
ssid=$(nmcli -t -f ACTIVE,SSID dev wifi | grep -E '^yes' | cut -d: -f2)
|
||||
if [ -z "$ssid" ]; then
|
||||
network_status="WiFi: Disconnected"
|
||||
network_display="$wifi_icon Disconnected"
|
||||
else
|
||||
network_status="WiFi: $ssid"
|
||||
network_display="$wifi_icon $ssid"
|
||||
fi
|
||||
|
||||
# Date and time
|
||||
date_time=$(date +"%Y-%m-%d %H:%M")
|
||||
# Date/time
|
||||
date_time_icon="$date_icon $(date +"%a %b %d, %H:%M")"
|
||||
|
||||
# Battery status and power consumption
|
||||
battery_path="/sys/class/power_supply/macsmc-battery"
|
||||
if [ -d "$battery_path" ]; then
|
||||
battery_capacity=$(cat $battery_path/capacity)
|
||||
power_consumption=$(cat $battery_path/power_now) # in microwatts
|
||||
power_consumption_watts=$(echo "scale=2; $power_consumption / 1000000" | bc)
|
||||
battery="Battery: $battery_capacity% ($power_consumption_watts W)"
|
||||
else
|
||||
battery="Battery: N/A"
|
||||
fi
|
||||
# Battery
|
||||
battery=$("$HOME/.config/confutils/get-battery.sh")
|
||||
|
||||
# Brightness status
|
||||
# Brightness
|
||||
brightness=$(brightnessctl | grep -oP '[0-9]+(?=%)')
|
||||
brightness_status="Brightness: $brightness%"
|
||||
brightness_display="$brightness_icon $brightness%"
|
||||
|
||||
bluetooth_device=$(bluetoothctl devices Connected | awk '{$1=$2=""; print $0}' | sed 's/^ *//g')
|
||||
# Bluetooth
|
||||
bluetooth_device=$(bluetoothctl devices Connected \
|
||||
| awk '{$1=$2=""; print $0}' \
|
||||
| sed 's/^ *//g')
|
||||
if [ -z "$bluetooth_device" ]; then
|
||||
bluetooth_status=""
|
||||
bluetooth_display=""
|
||||
else
|
||||
bluetooth_status="Bluetooth: $bluetooth_device"
|
||||
bluetooth_display="$bluetooth_icon $bluetooth_device"
|
||||
fi
|
||||
|
||||
# Combine all statuses
|
||||
# Keyboard layout
|
||||
language_index=$(swaymsg -t get_inputs | jq -r '.[] | select(.type=="keyboard") | .xkb_active_layout_index' | head -n 1)
|
||||
if [ "$language_index" -eq 0 ]; then
|
||||
keyboard_layout="US"
|
||||
else
|
||||
keyboard_layout="SE"
|
||||
fi
|
||||
keyboard_display="$keyboard_icon $keyboard_layout"
|
||||
|
||||
# Combine all statuses, separated by tabs (\t).
|
||||
# - In zsh, you can do literal tabs with $'\t'
|
||||
final_status=""
|
||||
if [ -n "$bluetooth_status" ]; then
|
||||
final_status="$bluetooth_status | "
|
||||
if [ -n "$bluetooth_display" ]; then
|
||||
final_status="$bluetooth_display"
|
||||
fi
|
||||
final_status="$final_status$brightness_status | $battery | $vpn_status | $network_status | $date_time "
|
||||
echo "$final_status"
|
||||
|
||||
space=" "
|
||||
final_status="$final_status$space$brightness_display"
|
||||
final_status="$final_status$space$battery"
|
||||
final_status="$final_status$space$keyboard_display"
|
||||
final_status="$final_status$space$vpn_display"
|
||||
final_status="$final_status$space$network_display"
|
||||
final_status="$final_status$space$date_time_icon"
|
||||
final_status="$final_status "
|
||||
|
||||
echo "$final_status"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue