Skip to content

Commit

Permalink
update configs
Browse files Browse the repository at this point in the history
  • Loading branch information
beaussan committed Sep 23, 2023
1 parent 4ff00c8 commit d6071fd
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 72 deletions.
26 changes: 25 additions & 1 deletion general/font.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,29 @@
</pattern>
</rejectfont>
</selectfont>

<!-- Force apple emoji to noto. -->
<alias binding="strong">
<family>emoji</family>
<default><family>Noto Color Emoji</family></default>
</alias>
<alias binding="strong">
<family>Apple Color Emoji</family>
<prefer><family>Noto Color Emoji</family></prefer>
</alias>
<alias binding="strong">
<family>Segoe UI Emoji</family>
<prefer><family>Noto Color Emoji</family></prefer>
</alias>
<alias binding="strong">
<family>Emoji One</family>
<prefer><family>Noto Color Emoji</family></prefer>
</alias>
<!--
<match>
<test name="family"><string>Apple Color Emoji</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Noto Color Emoji</string>
</edit>
</match>
-->
</fontconfig>
2 changes: 2 additions & 0 deletions general/gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@
[credential "https://gist.github.com"]
helper =
helper = !/usr/bin/gh auth git-credential
[core]
autocrlf = input
2 changes: 1 addition & 1 deletion general/i3config
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ exec --no-startup-id jetbrains-toolbox --minimize --disable-seccomp-filter-sandb
exec_always --no-startup-id $HOME/.config/polybar/launch.sh

# load xressources
exec xrdb ~/.Xresources
exec --no-startup-id xrdb ~/.Xresources

# Load up screens and windows
exec --no-startup-id exec $HOME/scripts/init_workspace.sh
98 changes: 55 additions & 43 deletions general/scripts/init_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,66 @@ workspace6="6:"
#  random"
workspace7="7:"

# App you want to start :
apps=(
"telegram-desktop"
"obsidian"
"alacritty"
"slack"
)

# Which workspace to assign your wanted App :
workspaces=(
$workspace1
$workspace1
$workspace2
$workspace5
)

# counter of opened windows
owNB=-1

nativefier=$HOME/nativefier/bins

# add paths of apps to array
arr=()
arr+=(
'/usr/bin/'
'/usr/bin/'
'/usr/bin/'
'/usr/bin/'
)
function wait_for_window {
local window_title="$1"
local window_id=""

while [ -z "$window_id" ]; do
sleep 1
window_id=$(wmctrl -l | grep "$window_title" | cut -d ' ' -f 1)
done

return 0
}

for iwin in ${!apps[*]}
do
while [ "$owNB" -lt "$iwin" ] # wait before start other programs
do
owNB=$(wmctrl -l | wc -l) # Get number of actual opened windows
wait 5
function wait_for_network {
local start_time=$(date +%s)

# Wait for network to be online
while true; do
if ping -c 1 google.com &>/dev/null; then
return 0
fi

# Check if timeout has been reached
local end_time=$(date +%s)
local elapsed=$((end_time - start_time))
if [ $elapsed -gt 30 ]; then
echo "Timed out waiting for network to be online"
return 1
fi

sleep 1
done
i3-msg workspace ${workspaces[$iwin]} # move in wanted workspace
${arr[$iwin]}/${apps[$iwin]} & # start the wanted app
done
}


# Workspace 1 content
i3-msg workspace $workspace1
i3-msg move workspace to output primary
i3-msg move workspace to output left

"$(ls /home/beaussan/bin/*beeper*)" & wait_for_window "Beeper"
# /usr/bin/telegram-desktop & wait_for_window "Telegram"
/usr/bin/obsidian & wait_for_window "Obsidian"
i3-msg layout tabbed

i3-msg workspace $workspace5
i3-msg move workspace to output right
i3-msg move workspace to output right
if wait_for_network && sleep 1 && wait_for_network && sleep 1; then

# Workspace 5 content
i3-msg workspace $workspace5
i3-msg move workspace to output primary
i3-msg move workspace to output right
/usr/bin/slack & wait_for_window "Slack"

# Workspace 2
i3-msg workspace $workspace2
i3-msg move workspace to output primary

i3-msg workspace $workspace2
i3-msg move workspace to output right
# Network is online, continue script
/usr/bin/google-chrome-stable &
else
# Network is offline, handle error
notify-send -u critical "Network is offline, cannot continue script."
exit 1
fi
119 changes: 93 additions & 26 deletions general/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,77 @@ zmodload zsh/complist
###### Plugins
plugins=(git common-aliases gradle alias-tips gitignore zsh-autosuggestions yarn zsh-syntax-highlighting)

###### Utils

# Add file to path if the folder exists
pathIfExists() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="${PATH:+"$PATH:"}$1"
fi
}
# Same, but add it before the path
prePathIfExists() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="$1:${PATH}"
fi
}

# Source a file if it exists
sourceIfExists() {
[ -f $1 ] && source $1
}

###### Exports
# export PATH="~/scripts:~/bin:~/.npm-global/bin:$PATH:/usr/lib/jvm/default/bin/:~/bin/"
export PATH=/usr/local/bin/:${PATH}
export PATH=/home/${USER}/scripts:${PATH}
export PATH=/home/${USER}/bin:${PATH}

#LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:';
###### Exports

# export LS_COLORS=$LS_COLORS

export EDITOR="nvim"
export VISUAL="nvim"
export ZSH_PLUGINS_ALIAS_TIPS_EXCLUDES="_"
export ZSH_PLUGINS_ALIAS_TIPS_EXPAND=1
export ANDROID_HOME=/home/${USER}/Android/Sdk
export GOPATH=/home/${USER}/go

export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PATH=${PATH}:/home/${USER}/.yarn/bin:/home/${USER}/.config/yarn/global/node_modules/.bin/
export PATH=${PATH}:/home/${USER}/.local/bin
export PATH=${PATH}:/home/${USER}/nativefier/bins
export PATH=${PATH}:${GOPATH}/bin
export PATH=${PATH}

prePathIfExists "/usr/local/bin/"

prePathIfExists "/home/${USER}/scripts"

prePathIfExists "/home/${USER}/bin"

pathIfExists "/home/${USER}/.yarn/bin"

pathIfExists "/home/${USER}/.config/yarn/global/node_modules/.bin/"


pathIfExists "/home/${USER}/.local/bin"

pathIfExists "${GOPATH}/bin"

prePathIfExists "/home/${USER}/.local/share/JetBrains/Toolbox/scripts"

pathIfExists "/home/${USER}/nativefier/bins"


export VOLTA_HOME="$HOME/.volta"

prePathIfExists "$VOLTA_HOME/bin"

export BROWSER=/usr/bin/google-chrome-stable

export BAT_THEME=ansi

###### Alias

## Better standards

alias vi="nvim"
alias vim="nvim"
alias ls="lsd"
alias cat="bat"

## Shortcuts

alias wifiTerm='nmtui'

alias ys='yarn start'
Expand All @@ -64,8 +101,6 @@ alias fixkeys='sudo pacman-key --populate archlinux antergos && sudo pacman-key
alias sound="amixer sset 'Master' "
alias tb="nc termbin.com 9999"

alias bose="bluetoothctl power on && bluetoothctl connect 2C:41:A1:C7:50:25"

alias -g C="| xclip -selection c"

# conflicts with the fd command
Expand All @@ -83,6 +118,44 @@ function changeMac() {
echo "Your new physical address is $mac"
}

###### fzf utils

# fkill - kill processes - list only the ones you can kill.
fkill() {
local pid
if [ "$UID" != "0" ]; then
pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}')
else
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
fi

if [ "x$pid" != "x" ]
then
echo $pid | xargs kill -${1:-9}
fi
}


## Git aliases

# Delete multiple branches in bulk
alias fgitDeleteBranch="git branch --no-color | fzf -m | xargs -I {} git branch -D '{}'"

# Checkout a branch based on the lattest commited
alias fgitCheckout="git branch --sort=-committerdate | fzf | tr -d '[:space:]' | xargs -I {} git checkout '{}'"

## Docker aliases

# mark all docker container to unless-stopped
alias dockerSetAllUnlessStopped="docker update --restart=unless-stopped $(docker ps -qa)"

# stop docker container by fuzzy search
alias fdockerStop="docker ps --format "{{.Names}}" | fzf -m | xargs -I {} docker stop '{}'"

# rm docker container by fussy search
alias fdockerRm="docker ps --format "{{.Names}}" -a | fzf -m | xargs -I {} docker rm '{}'"


###### Setups

if [ -d ~/.zsh.d ]; then
Expand All @@ -91,19 +164,12 @@ if [ -d ~/.zsh.d ]; then
done
fi

if [ -d ${ZSH_CUSTOM1:-$ZSH/custom}/plugins/enhancd ]; then
source ${ZSH_CUSTOM1:-$ZSH/custom}/plugins/enhancd/init.sh
fi
sourceIfExists "${ZSH_CUSTOM1:-$ZSH/custom}/plugins/enhancd/init.sh"

#ENHANCD_FILTER=fzy:fzf:peco
ENHANCD_FILTER=fzf; export ENHANCD_FILTER

source $ZSH/oh-my-zsh.sh

sourceIfExists() {
[ -f $1 ] && source $1
}

# Load nvm init script
#[ -f /usr/share/nvm/init-nvm.sh ] && source /usr/share/nvm/init-nvm.sh

Expand All @@ -130,5 +196,6 @@ eval "$(starship init zsh)"

alias ls="lsd"
alias la="ls -alh"
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
alias vi="nvim"
alias vim="nvim"
alias cat="bat"
2 changes: 1 addition & 1 deletion setupStd.conf.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- shell:
- command: yay --needed --noconfirm -S pacman-contrib ttf-monoid ttf-unifont ttf-font-awesome nerd-fonts-complete noto-fonts-emoji
- command: yay --needed --noconfirm -S pacman-contrib ttf-monoid ttf-unifont ttf-font-awesome nerd-fonts-complete noto-fonts-emoji noto-color-emoji-fontconfig-no-binding
description: Installing fonts
stdin: true
stdout: true
Expand Down

0 comments on commit d6071fd

Please sign in to comment.