Merge pull request #3 from Mastermindzh/experiment/polybar

Experiment/polybar
This commit is contained in:
Rick van Lieshout 2024-03-04 11:35:05 +01:00 committed by GitHub
commit c584e93215
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 252 additions and 159 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config/.npmrc

View File

@ -1,23 +1,6 @@
# useful dockers
alias phpserver='docker run --rm -p 2000:80 -v "$PWD":/var/www/html mastermindzh/php-xdebug'
alias nodeserver='docker run --rm -p 3000:3000 -v "$PWD":/app mastermindzh/generic_node'
alias reactserver='docker run --rm -p 8080:8080 -v "$PWD":/app mastermindzh/generic_node'
alias mongoserver='docker run -d --rm -p 27017:27017 --name mongo-server -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=123 -v ~/.db/mongo:/data/db mongo'
alias sqlserver='docker run --rm --name sql-server -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Your_Password123" -p 1433:1433 -v ~/.db/mssql:/var/opt/mssql mcr.microsoft.com/mssql/server'
# useful docker commands
alias stop-dockers='docker stop $(docker ps -aq)'
alias docker-clean-containers='docker container prune -f --filter "until=48h"'
alias docker-clean-images='docker image prune -a -f --filter "until=48h"'
alias docker-clean-volumes='docker volume prune -f --filter "label!=keep"'
alias docker-clean-networks='docker network prune -f --filter "until=24h"'
alias docker-clean-all='stop-dockers && docker-clean-containers && docker-clean-images && docker-clean-volumes && docker-clean-networks'
# Kubernetes commands
alias mkubectl='microk8s.kubectl'
alias kubestart='microk8s.start'
alias kubestop='microk8s.stop'
alias kubecontexts='kubectl config get-contexts'
#!/bin/bash
# source program-specific aliases:
for f in ~/.aliases/*; do source "$f"; done
#dotnet core
alias efupdate="dotnet ef database update"
@ -36,8 +19,14 @@ alias aur='trizen --noconfirm'
alias update='trizen --sudo_remove_timestamp=0 --sudo_autorepeat=1 --sudo_autorepeat_at_runtime=1 -Syu --noconfirm'
alias remove-orphans='sudo pacman -Rns $(pacman -Qtdq)'
alias updatekeys='sudo pacman-key --refresh-key'
alias updatemirrors='sudo reflector --latest 20 --protocol http,https --sort rate --save /etc/pacman.d/mirrorlist'
alias clean-pacmancache='sudo paccache -rk 1 && sudo paccache -ruk0'
alias clean-all='sudo pacman -R $(pacman -Qtdq) && sudo paccache -rk 1 && sudo paccache -ruk0 && sudo journalctl --vacuum-time=2d && docker-clean-all && rm -rf ~/.local/share/Trash/'
alias clean-trizen-cache='sudo clean-trizen-cache'
alias clean-trash='sudo rm -rf ~/.local/share/Trash/*'
alias clean-journal='sudo journalctl --vacuum-time=2d'
alias clean-pacman-unused='sudo pacman -R $(pacman -Qtdq)'
alias clean-all='clean-pacman-unused && clean-pacmancache && clean-trizen-cache && docker-clean-all && clean-node_modules && clean-journal && clean-trash'
## systeminfo
alias meminfo='free -mth'
@ -50,7 +39,7 @@ alias preferredapps='exo-preferred-applications'
#show 5 most memory consuming apps
alias psmem='ps auxf | sort -nr -k 5 | head -n 5'
##utility
# utility
alias nmapscan='nmap -n -sP'
alias wifimenu='nm-connection-editor'
alias findcrlf='find . -path node_modules -prune -o -not -type d -exec file "{}" ";" | grep -E "BOM|CRLF"'
@ -59,15 +48,12 @@ alias enable-wifi='sudo ip link set wlp2s0 up'
alias scan-wifi='sudo iw dev wlp2s0 scan'
alias pretty-json='python -m json.tool'
alias addpgpkey='gpg --recv-keys'
alias clean-trash='sudo rm -rf ~/.local/share/Trash/*'
alias clean-journal='sudo journalctl --vacuum-time=2d'
alias clean-all='clean-trash && clean-journal && clean-pacmancache && docker-clean-all && clean-node-modules'
alias dotnet-install='~/.dotnet-install.sh --install-dir /usr/share/dotnet/ -channel Current -version '
alias mountshares='sudo bash ~/dotfiles/bash/mounts.sh'
alias echo-server='npx http-echo-server'
alias mountcalibre='sudo mount.cifs //10.10.1.11/books /mnt/calibre -o nobrl,user=mastermindzh,noperm,rw'
alias xpid="xprop _NET_WM_PID | cut -d' ' -f3"
alias clean-node-modules='find . -name "node_modules" -type d -print0 |xargs -0 rm -r --'
alias clean-obj-bin='sudo find . -name "bin" -o -name "obj" -exec rm -rf {} \;'
alias nomachine='/usr/NX/bin/nxplayer'
alias unlockuser='faillock --reset --user'
alias npm-list-links='npm ls -g --depth=0 --link=true'
@ -100,6 +86,10 @@ alias la='ls -al'
# show external ip
alias cmyip='curl -s http://ipecho.net/plain; echo'
# File merging
alias pngtopdf="convert *.png"
alias jpgtopdf="convert *.jpg"
## default command fixes :P
alias mkdir='mkdir -p'
alias wget='wget -c'
@ -137,19 +127,19 @@ up() {
}
# function to extract ... well anything really
extract() {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
if [ -f "$1" ]; then
case "$1" in
*.tar.bz2) tar xvjf "$1" ;;
*.tar.gz) tar xvzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar xvf "$1" ;;
*.tbz2) tar xvjf "$1" ;;
*.tgz) tar xvzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
@ -185,34 +175,27 @@ killport() {
if [ -z "$1" ]; then
echo "please specify a port to kill"
else
fuser -k $1/tcp
fuser -k "$1/tcp"
fi
}
# function to switch kubernetes namespace
kubenamespaceswitch() {
# merges all pdfs in current directory into a new pdf
mergepdf() {
if [ -z "$1" ]; then
echo "please specify a namespace to switch to"
echo "please provide an output name for your pdf file: mergepdf out.pdf"
else
kubectl config set-context --current --namespace=$1
pdfunite ./*.pdf "$1"
fi
}
# function to switch kubernetes context
kubecontextswitch() {
# sign a file using the signing key
signfile() {
if [ -z "$1" ]; then
echo "please specify a context to switch to, the following contexts are available:"
kubectl config get-contexts
echo "please provide a file to sign: signfile file-to-sign.pdf"
else
kubectl config use-context "$1"
ssh-keygen -Y sign -f ~/.ssh/signing-key.pub -n file "$1"
fi
}
# function to switch to a different azure kubernetes cluster
azkubeswitch() {
if [ -z "$2" ]; then
echo "please execute with the following params: azkubeswitch {resourcegroupname} {clustername}"
else
az aks get-credentials --resource-group $1 --name $2
fi
}
alias "set-timezone-romania"='timedatectl set-timezone Europe/Bucharest'
alias "set-timezone-netherlands"=' timedatectl set-timezone Europe/Amsterdam'

16
bash/.aliases/docker.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# useful docker commands
alias stop-dockers='docker stop $(docker ps -aq)'
alias docker-clean-containers='docker container prune -f --filter "until=48h"'
alias docker-clean-images='docker image prune -a -f --filter "until=48h"'
alias docker-clean-volumes='docker volume prune -f --filter "label!=keep"'
alias docker-clean-networks='docker network prune -f --filter "until=24h"'
alias docker-clean-all='stop-dockers && docker-clean-containers && docker-clean-images && docker-clean-volumes && docker-clean-networks'
# useful dockers
alias phpserver='docker run --rm -p 2000:80 -v "$PWD":/var/www/html mastermindzh/php-xdebug'
alias nodeserver='docker run --rm -p 3000:3000 -v "$PWD":/app mastermindzh/generic_node'
alias reactserver='docker run --rm -p 8080:8080 -v "$PWD":/app mastermindzh/generic_node'
alias mongoserver='docker run -d --rm -p 27017:27017 --name mongo-server -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=123 -v ~/.db/mongo:/data/db mongo'
alias sqlserver='docker run --rm --name sql-server -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Your_Password123" -p 1433:1433 -v ~/.db/mssql:/var/opt/mssql mcr.microsoft.com/mssql/server'
alias mailcatcher='docker run -d -p 1080:1080 -p 1025:1025 --name mailcatcher schickling/mailcatcher'

View File

@ -0,0 +1,50 @@
#!/bin/bash
# Kubernetes commands
alias mkubectl='microk8s.kubectl'
alias kubestart='microk8s.start'
alias kubestop='microk8s.stop'
alias kubecontexts='kubectl config get-contexts'
# function to switch kubernetes namespace
kubenamespaceswitch() {
if [ -z "$1" ]; then
echo "please specify a namespace to switch to"
else
kubectl config set-context --current --namespace="$1"
fi
}
# function to switch kubernetes context
kubecontextswitch() {
if [ -z "$1" ]; then
echo "please specify a context to switch to, the following contexts are available:"
kubectl config get-contexts
else
kubectl config use-context "$1"
fi
}
# function to switch to a different azure kubernetes cluster
azkubeswitch() {
if [ -z "$2" ]; then
echo "please execute with the following params: azkubeswitch {resourcegroupname} {clustername}"
else
az aks get-credentials --resource-group "$1" --name "$2"
fi
}
# get old resources from kubernetes
kube-get-old() {
if [ -z "$1" ]; then
echo "please provide a resource type, examples:"
echo " kube-get-old pods"
echo " kube-get-old namespaces"
echo ""
echo "you can pass extra arguments as the second param, examples:"
echo " kube-get-old pods --all-namespaces"
echo ' kube-get-old namespaces "--all-namespaces --second"'
else
kubectl get "$1" ${2:+"$2"} -o go-template --template '{{range .items}}{{.metadata.name}} {{.metadata.creationTimestamp}}{{"\n"}}{{end}}' | awk -v twoWeeksAgo="date -d '-14 days'" -F':' '$2<twoWeeksAgo' | awk '{print $1}'
fi
}

4
bash/.aliases/node.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
alias clean-node-modules='find . -name "node_modules" -type d -print0 |xargs -0 rm -r --'
alias organize-package-json='npx format-package -w && npx sort-package-json'

View File

@ -1,14 +1,14 @@
#!/bin/bash
# if powerline-shell is available use it.
function _update_ps1() {
if hash powerline-rs 2>/dev/null; then
PS1="$(powerline-rs --shell bash $?)"
fi
if hash powerline-rs 2>/dev/null; then
PS1="$(powerline-rs --shell bash $?)"
fi
}
# sourceIfExists
function sourceIfExists () {
[[ -f "$1" ]] && source "$1"
function sourceIfExists() {
[[ -f "$1" ]] && source "$1"
}
# If not running interactively, don't do anything
@ -22,28 +22,28 @@ eval "$(thefuck --alias)"
# load keychain with private key
if test -f "$HOME/.ssh/id_ed25519"; then
eval "$(keychain --eval --quiet ~/.ssh/id_ed25519)"
eval "$(keychain --eval --quiet ~/.ssh/id_ed25519)"
else
# fallback to older rsa
eval "$(keychain --eval --quiet ~/.ssh/id_rsa)"
# fallback to older rsa
eval "$(keychain --eval --quiet ~/.ssh/id_rsa)"
fi
eval "$(pyenv init -)"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if hash dotnet 2>/dev/null; then
export DOTNET_ROOT=/usr/share/dotnet
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH="${PATH}:${DOTNET_ROOT}:~/.dotnet/tools"
export DOTNET_ROOT=/usr/share/dotnet
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH="${PATH}:${DOTNET_ROOT}:~/.dotnet/tools"
fi
PS1='[\u@\h \W]\$ '
if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
export PATH=$PATH:/home/mastermindzh/bin

View File

@ -76,6 +76,16 @@ declare -A MOUNTS10=(
[share]="audiobooks"
[mount]="audiobooks"
)
declare -A MOUNTS11=(
[server]="$MY_SERVER_LOCATION"
[share]="games"
[mount]="games"
)
declare -A MOUNTS12=(
[server]="$MY_SERVER_LOCATION"
[share]="data"
[mount]="data"
)
# declare array with "objects"
declare -n MOUNTS

View File

@ -1,6 +1,6 @@
[user]
email = info@rickvanlieshout.com
name = Mastermindzh
name = Rick van Lieshout
[alias]
tree = log --graph --decorate --pretty=format:'%ar [%h] %an <%ae> - %s'
graph = log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative
@ -16,3 +16,8 @@
rebase = false
[init]
defaultBranch = master
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process

View File

@ -1,4 +0,0 @@
init-author-name=Rick van Lieshout
init-author-email=info@rickvanlieshout.com
init-author-url=http://rickvanlieshout.com/
init-license=MIT

View File

@ -141,12 +141,12 @@ click-left = firefox https://speedtest.net
[module/weather]
type = custom/script
interval = 900
exec = "curl -s wttr.in?format=1"
exec = "curl -s wttr.in/oss?format=1"
format = "<label>"
format-prefix-foreground = ${colors.accent}
label = %output%
click-left = xfce4-terminal -H -e "curl wttr.in"
click-left = xfce4-terminal -H -e "curl wttr.in/oss"
[module/i3]

View File

@ -24,3 +24,5 @@ gnome-text-editor
greenclip
kind
pulseaudio-ctl
seafile
seafile-client

View File

@ -1,49 +1,48 @@
#
# Core system
#
base-devel
git
xorg-server
xorg-xinit
mesa
i3-gaps
rsync
i3lock
feh
scrot
arandr
xfce4-terminal
ttf-font-awesome
libconfig
compton
lxappearance
rofi
i3blocks
wmctrl
zenity
xorg-xrandr
eog
python
python-pip
neofetch
git
scrot
acpi
imagemagick
docker
docker-compose
htop
powertop
network-manager-applet
pavucontrol
alsa-utils
ntp
xclip
openssh
gvfs-smb
sddm
polkit-gnome
gnome-keyring
libsecret
seahorse
i3-gaps
i3lock
#
# Programming
#
nodejs
npm
python
python-pip
pyenv
dotnet-host
dotnet-runtime
dotnet-sdk
#
# Codecs
#
a52dec
faac
faad2
flac
jasper
lame
libdca
libdv
libmad
@ -52,54 +51,73 @@ libtheora
libvorbis
libxv
wavpack
jasper
lame
x264
xvidcore
gvfs-smb
bash-completion
flameshot
otf-font-awesome
networkmanager
networkmanager-l2tp
strongswan
w3m
system-config-printer
wget
pyenv
jq
firefox
dotnet-host
dotnet-runtime
dotnet-sdk
#
# Applications
#
alsa-utils
arandr
aspnet-runtime
clamav
clamtk
keychain
thefuck
peek
blueman
pulseaudio-bluetooth
autorandr
bash-completion
bat
bitwarden
bluez
bluez-libs
sddm
polkit-gnome
gnome-keyring
libsecret
seahorse
mpv
gnome-themes-extra
bluez-utils
clamav
clamtk
ctop
cups
system-config-printer
docker
docker-compose
duf
engrampa
eog
feh
firefox
flameshot
gnome-themes-extra
htop
i3blocks
imagemagick
jq
keychain
lxappearance
mpv
neofetch
network-manager-applet
networkmanager
networkmanager-l2tp
noto-fonts-emoji
obsidian
otf-font-awesome
papirus-icon-theme
pavucontrol
peek
picom
ttf-ubuntu-font-family
xorg-xkill
polybar
poppler
powertop
pulseaudio-bluetooth
rofi
rsync
scrot
scrot
strongswan
system-config-printer
system-config-printer
thefuck
thunar
thunar-archive-plugin
engrampa
bat
ctop
polybar
noto-fonts-emoji
autorandr
papirus-icon-theme
bitwarden
ttf-font-awesome
ttf-ubuntu-font-family
w3m
wget
xclip
xfce4-terminal
xorg-xkill

View File

@ -61,6 +61,11 @@ bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# move focused workspace
bindsym $mod+Ctrl+Right move workspace to output right
bindsym $mod+Ctrl+Left move workspace to output left
# split in horizontal orientation
bindsym $mod+h split h
@ -123,7 +128,7 @@ mode "resize" {
bindsym $mod+r mode "resize"
# Lock the computer
bindsym $mod+l exec /bin/bash ~/.config/i3/scripts/i3lock.sh
bindsym $mod+l exec /bin/bash ~/.config/i3/scripts/lock.sh
# Suspend the computer
bindsym $mod+shift+l exec /bin/bash ~/.config/i3/scripts/suspend.sh
@ -132,13 +137,14 @@ bindsym $mod+shift+l exec /bin/bash ~/.config/i3/scripts/suspend.sh
# Application Keys #
############################################
bindsym $mod+Return exec xfce4-terminal # terminal
bindsym $mod+shift+Return exec xfce4-terminal --drop-down # terminal
bindsym $mod+e exec thunar # File manager
bindsym $mod+shift+Return exec xfce4-terminal --drop-down # terminal
bindsym $mod+e exec thunar # File manager
bindsym Print exec flameshot screen -d 0 -p ~/Pictures/Screenshots # Fullscreen screenshot
bindsym $mod+Print exec flameshot gui # Show screenshot window
bindsym $mod+shift+Print exec flameshot launcher # Show settings window (delay) then show screenshot window
bindsym $mod+shift+b exec /bin/bash ~/.config/i3/scripts/brightness.sh
bindsym control+shift+Escape exec sysmontask
bindsym $mod+Print exec flameshot gui # Show screenshot window
bindsym $mod+shift+Print exec flameshot launcher # Show settings window (delay) then show screenshot window
bindsym $mod+shift+b exec /bin/bash ~/.config/i3/scripts/brightness.sh # set brightness
bindsym control+shift+Escape exec sysmontask # system monitor
bindsym $mod+BackSpace exec autorandr --change undocked # reset to laptop view
# Rofi
bindsym $mod+d exec "rofi -show run -show-icons"
@ -254,7 +260,8 @@ assign [class="VirtualBox Machine"] $workspace11
# database stuff
assign [class="MongoDB Compass"] $workspace8
assign [class="robo3t"] $workspace8
assign [class="Brave-browser"] $workspace7
assign [class="Brave-browser"] $workspace9
assign [class="obsidian"] $workspace7
assign [class="Mysql-workbench-bin"] $workspace8
assign [class="azuredatastudio"] $workspace8
assign [class="beekeeper"] $workspace8
@ -326,12 +333,12 @@ mode "$mode_gaps_outer" {
# exec_always --no-startup-id picom -b
exec_always feh --bg-scale $(find ~/Pictures/wallpapers/ -type f -name "*" | shuf -n 1)
exec_always --no-startup-id ~/.config/polybar/launch.sh
exec_always --no-startup-id "autorandr --change"
exec --no-startup-id i3-msg 'workspace $workspace2; exec xfce4-terminal' && i3-msg 'workspace $workspace1'
exec --no-startup-id i3-msg 'workspace $workspace12; exec bitwarden-desktop'
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id nm-applet
exec --no-startup-id blueman-applet
exec /usr/bin/compton
exec /bin/bash ~/.config/i3/scripts/startup.sh
exec --no-startup-id greenclip daemon
exec --no-startup-id seafile-applet
exec --no-startup-id obsidian

View File

@ -22,7 +22,7 @@ else
i3lock -n -f -i "$tmpbg"
# if tidal was playing before we locked, resume.
if [ $isPlaying == "playing" ]; then
if [ "$isPlaying" == "playing" ]; then
~/.config/i3/scripts/tidal-cli.sh play
fi
rm -rf $tmpbg

View File

@ -45,7 +45,7 @@ function linkDir {
# replace line endings with a space (for use in package managers)
function fileToList {
echo $(cat "$1" | sed ':a;N;$!ba;s/\n/ /g')
echo $(cat "$1" | sed '/^\s*#\([^!]\|$\)/d' | sed ':a;N;$!ba;s/\n/ /g')
}
# create and copy files to directory
@ -91,6 +91,7 @@ function install_config {
linkDir "$PWD"/config/notify-osd/notify-osd ~/.notify-osd
linkDir "$PWD"/config/terminal/xfce4-term ~/.config/xfce4/terminal
linkDir "$PWD"/config/polybar ~/.config/polybar
linkDir "$PWD"/bash/.aliases ~/
# link user files
ln -sf "$PWD"/bash/.bashrc ~/.bashrc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 MiB

BIN
wallpapers/images/kitty.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 KiB