Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 76 additions & 3 deletions .bashaliasrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ function editandsource(){
sourcefile $1
}
alias esfile="editandsource"
function salias(){
sourcefile ~/.bashaliasrc
}

function ebash(){
editandsource ~/.bashrc
Expand All @@ -20,6 +17,18 @@ function evim(){
function envim(){
nvimfolder ~/.config/nvim
}
function etmux(){
nvimfolder ~/.config/tmux
}
function ewezterm(){
nvimfolder ~/.config/wezterm
}
function erego(){
nvimfolder ~/.config/regolith3
}
function e.conf(){
nvimfolder ~/.config
}
function ei3(){
nvim ~/.config/i3/config
}
Expand All @@ -36,6 +45,50 @@ function sbash(){
function ealias(){
editandsource $DOTFILES_PATH/.bashaliasrc
}
function salias(){
sourcefile $DOTFILES_PATH/.bashaliasrc
}

source $DOTFILES_PATH/aliasfunctions/.bashgitrc

function compass-teleport(){
mongodb-compass mongodb://localhost:27017/%2A?directConnection=true&serverSelectionTimeoutMS=5000
tsh proxy db --tunnel --port 27017 --db-user role/teleport-write $1 --db-name "*"
}
function tlp-p-app(){
tsh proxy app $1 --port $2
}
function tlp-mgmt-open(){
local addr=$($DOTFILES_PATH/scripts/tsh-cache.sh mgmt --resolve "$1")
xdg-open "http://$addr"
}
declare -A _tsh_complete_map=(
[compass-teleport]=db
[tlp-p-app]=apps
[tlp-mgmt-open]=mgmt
)
_tsh_fzf_complete() {
if [[ $COMP_CWORD -eq 1 ]]; then
local resource="${_tsh_complete_map[${COMP_WORDS[0]}]}"
local apps
apps=$($DOTFILES_PATH/scripts/tsh-cache.sh "$resource")

if command -v fzf &>/dev/null; then
local selected
selected=$(echo "$apps" | fzf --prompt="${COMP_WORDS[0]}> " --query="${COMP_WORDS[COMP_CWORD]}")
if [[ -n "$selected" ]]; then
COMPREPLY=("$selected")
fi
else
COMPREPLY=($(compgen -W "$apps" -- "${COMP_WORDS[COMP_CWORD]}"))
fi
fi
}
complete -F _tsh_fzf_complete compass-teleport
complete -F _tsh_fzf_complete tlp-p-app
complete -F _tsh_fzf_complete tlp-mgmt-open

alias forceTlpAppsRefresh="$DOTFILES_PATH/scripts/tsh-cache.sh apps -f"

# Directory aliases
alias ..="cd .."
Expand All @@ -48,15 +101,20 @@ alias damn="fuck"
# docker compose alias
alias dcu="docker compose up"
alias dcub="docker compose up --build"
alias dcs="docker compose stop"
alias dcd="docker compose down"
alias dcdf="docker compose down -v --remove-orphans"

# mvn alias
alias mvnquarkus="mvn clean quarkus:dev -P.env"
alias mvnquarkusnoconsole="mvn clean quarkus:dev -P.env -Dquarkus.console.enabled='false'"
alias mvnquarkusnoconsolenotclean="mvn quarkus:dev -P.env -Dquarkus.console.enabled='false'"

# xclip alias (clipboard)
alias xc="xclip -selection clipboard"

# dunst refresh
alias dreset="killall dunst && notify-send test"
# did not work as expected
#function xc(){
# sh $1 | xclip -selection clipboard
Expand All @@ -66,6 +124,16 @@ alias xc="xclip -selection clipboard"
alias k9s-cluster-tools="k9s --kubeconfig ~/.kube/configThLiveToolsProd"
alias k9s-eu-broker="k9s --kubeconfig ~/.kube/configeubrokermasterblaster"
alias k9s-staging="k9s --kubeconfig ~/.kube/configstagmaster"
alias k9s-demo="k9s --kubeconfig ~/.kube/configdemo"
alias k9s-staging-gi="k9s --kubeconfig ~/.kube/configstagmastergi"
alias k9s-gmklocal="k9s --kubeconfig ~/.kube/configgmklocal"
alias k9s-idp-de-dev="KUBECONFIG=~/.kube/teleport-kubeconfig.yaml k9s"
alias k9s-idp-de-preprod="KUBECONFIG=~/.kube/teleport-kubeconfig-preprod.yaml k9s"
alias k9s-idp-de-prod="KUBECONFIG=~/.kube/teleport-kubeconfig-prod.yaml k9s"
alias ktlp="KUBECONFIG=~/.kube/teleport-kubeconfig.yaml kubectl"
alias ktlppre="KUBECONFIG=~/.kube/teleport-kubeconfig-preprod.yaml kubectl"
alias ktlpprod="KUBECONFIG=~/.kube/teleport-kubeconfig-prod.yaml kubectl"
alias kstg="KUBECONFIG=~/.kube/configstagmaster kubectl"

alias watcher="ag -l | entr -rc"

Expand All @@ -75,3 +143,8 @@ alias lg="lazygit"
alias monitorDualLeft="xrandr --output HDMI1 --auto --left-of eDP1"
alias monitorSingle="xrandr --auto"

alias howlongivebeenawake="uptime | awk -F'( |,|:)+' '{print \$6,\$7\",\",\$8,\"hours,\",\$9,\"minutes.\"}'"

alias lgb="lazygit -p ~/bolttech/bgs-domain-collections"

alias deb-install-from-folder="$DOTFILES_PATH/scripts/auto-deb-update.sh --confirm"
76 changes: 76 additions & 0 deletions aliasfunctions/.bashgitrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
function dalemarcio() {
local output
output=$(git push 2>&1)
local exit_code=$?

echo "$output"

if [ $exit_code -eq 0 ]; then
gpr-url
fi
}

function git-pr() {
local branch remote host owner repo path url

branch=$(git symbolic-ref --short HEAD) || return 1
remote=$(git config --get remote.origin.url) || return 1

# Shared parse: handles https://host/owner/repo(.git) and git@host:owner/repo(.git)
if [[ $remote =~ ^(https?|ssh)://[^/]+/(.+)/(.+?)(\.git)?$ ]]; then
host=$(sed -E 's#^[a-z]+://([^/]+)/.*#\1#' <<<"$remote")
owner="${BASH_REMATCH[2]}"; repo="${BASH_REMATCH[3]%.git}"
elif [[ $remote =~ ^.*@([^:]+):/*(.+)/(.+?)(\.git)?$ ]]; then
host="${BASH_REMATCH[1]}"; owner="${BASH_REMATCH[2]}"; repo="${BASH_REMATCH[3]%.git}"
else
echo "Unrecognized remote: $remote" >&2; return 1
fi

path="${owner}/${repo}"
# URL-encode the branch (handles feature/foo, etc.)
local from; from=$(_urlencode "$branch")

# Ask where the PR should target: default branch or a selected one
local dest to=""
dest=$(printf '%s\n' "$branch -> Default branch" "$branch -> Select branch" "Cancel" \
| fzf --prompt="Open PR: " --height=40%)
case "$dest" in
"$branch -> Select branch")
local target
target=$(git branch -r --format='%(refname:short)' \
| sed 's#^origin/##' | grep -vx "HEAD\|$branch" | sort -u \
| fzf --prompt="destination> " --height=40%)
[[ -z "$target" ]] && return 1
to=$(_urlencode "$target") ;;
"$branch -> Default branch") ;;
*) return 1 ;;
esac

case "$host" in
*github.com|*gitea*|*codeberg.org)
if [[ -n "$to" ]]; then url="https://${host}/${path}/compare/${to}...${from}?expand=1"
else url="https://${host}/${path}/compare/${from}?expand=1"; fi ;;
*gitlab.com)
url="https://${host}/${path}/-/merge_requests/new?merge_request%5Bsource_branch%5D=${from}"
[[ -n "$to" ]] && url+="&merge_request%5Btarget_branch%5D=${to}" ;;
*bitbucket.org)
url="https://${host}/${path}/pull-requests/new?source=${from}&t=1"
[[ -n "$to" ]] && url+="&dest=${to}" ;;
*) echo "Unknown host '$host' — remote: $remote" >&2; return 1 ;;
esac

echo "$url"
xdg-open "$url" 2>/dev/null || open "$url" 2>/dev/null
}

function _urlencode() {
local s="$1" out= c i
for (( i=0; i<${#s}; i++ )); do
c="${s:i:1}"
case "$c" in
[a-zA-Z0-9.~_-]) out+="$c" ;;
*) printf -v c '%%%02X' "'$c"; out+="$c" ;;
esac
done
printf '%s' "$out"
}
75 changes: 61 additions & 14 deletions i3/config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
focus_on_window_activation urgent

set $mod Mod4

Expand Down Expand Up @@ -41,23 +42,39 @@ bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status

# Use Script to adjust spotify volume
bindsym $mod+XF86AudioRaiseVolume exec --no-startup-id sh $HOME/spotify_control vup 0.05 && $refresh_i3status
bindsym $mod+XF86AudioLowerVolume exec --no-startup-id sh $HOME/spotify_control vdown 0.05 && $refresh_i3status
bindsym $mod+Ctrl+Mod2+KP_2 exec --no-startup-id sh $HOME/spotify_control playpause

bindsym $mod+Shift+period exec --no-startup-id sh $HOME/spotify_control vup 0.05 && $refresh_i3status
bindsym $mod+Shift+m exec --no-startup-id sh $HOME/spotify_control vdown 0.05 && $refresh_i3status
bindsym $mod+Shift+comma exec --no-startup-id sh $HOME/spotify_control playpause

# Use playerctl to control music players
bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause
bindsym XF86AudioNext exec --no-startup-id playerctl next && $refresh_i3status
bindsym XF86AudioPrev exec --no-startup-id playerctl previous

bindsym $mod+z exec env XDG_CURRENT_DESKTOP=GNOME gnome-control-center

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
# tiling_drag modifier titlebar
tiling_drag modifier titlebar

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Ctrl+Return exec kitty

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id dmenu_run
bindsym $mod+Shift+d exec --no-startup-id i3-dmenu-desktop

# A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
# There also is i3-dmenu-desktop which only displays applications shipping a
Expand Down Expand Up @@ -188,10 +205,11 @@ bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3status
status_command i3status | ~/dev/dotfiles/i3statusWrapper.py
}

set $Locker i3lock -c 111111 && sleep 1
# set $Locker i3lock -c 111111 && sleep 1
set $Locker ~/dev/dotfiles/i3lockImage.sh

set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
Expand All @@ -213,10 +231,10 @@ bindsym $mod+Ctrl+Shift+x mode "$mode_system"
# Set the shortcuts and what they do
set $mode_display Ext Screen (h) HDMI ON LEFT, (u) HDMI ON TOP, (k) HDMI ON RIGHT, (j) HDMI OFF
mode "$mode_display" {
bindsym h exec --no-startup-id xrandr --output HDMI-1 --auto --left-of eDP-1, mode "default"
bindsym u exec --no-startup-id xrandr --output HDMI-1 --auto --above eDP-1, mode "default"
bindsym k exec --no-startup-id xrandr --output HDMI-1 --auto --right-of eDP-1, mode "default"
bindsym j exec --no-startup-id xrandr --output HDMI-1 --auto --off, mode "default"
bindsym h exec --no-startup-id xrandr --output HDMI1 --auto --left-of eDP1, mode "default"
bindsym k exec --no-startup-id xrandr --output HDMI1 --auto --above eDP1, mode "default"
bindsym l exec --no-startup-id xrandr --output HDMI1 --auto --right-of eDP1, mode "default"
bindsym j exec --no-startup-id xrandr --output HDMI1 --auto --off, mode "default"

# back to normal: Enter or Escape
bindsym Return mode "default"
Expand All @@ -226,34 +244,63 @@ mode "$mode_display" {
bindsym $mod+x mode "$mode_display"

# Moving workspaces between screens
bindsym $mod+p move workspace to output left
bindsym $mod+p move workspace to output next

# Notification system configuration for dunst (config @ ~/.config/dunst/dunstrc)
bindsym $mod+n exec --no-startup-id dunstctl action
bindsym $mod+Shift+n exec --no-startup-id dunstctl history-pop
bindsym $mod+Ctrl+n exec --no-startup-id dunstctl close-all
bindsym $mod+Ctrl+Shift+n exec --no-startup-id dunstctl set-paused toggle && $refresh_i3status

# General bindings
bindsym $mod+Shift+s exec --no-startup-id flameshot gui
bindsym $mod+Ctrl+l exec --no-startup-id $Locker

# Specific containers for applications
for_window [class="Spotify"] move container to workspace $ws9
for_window [class="Spotify"] move container to workspace $ws8
for_window [class="(?i)discord"] move container to workspace $ws10
for_window [class="Slack"] move container to workspace $ws8
for_window [class="Slack"] move container to workspace $ws9
# for_window [class="Slack"] move container to scratchpad, [class="Slack"] scratchpad show
for_window [class="(?i)teams-for-linux"] move container to workspace $ws7

# Scratchpads
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
# Scratchpads for applications
bindsym $mod+Mod2+KP_1 [title="Slack$"] scratchpad show
# Scratchpads for applications (Mod2 is NumLock)
bindsym $mod+Mod2+KP_1 [class="Slack"] scratchpad show
bindsym $mod+u [class="Slack"] scratchpad show
bindsym $mod+Mod2+KP_2 [class="Spotify"] scratchpad show
bindsym $mod+i [class="Spotify"] scratchpad show
bindsym $mod+Mod2+KP_3 [title="(?i)teams"] scratchpad show
bindsym $mod+o [title="(?i)teams"] scratchpad show
bindsym XF86Calculator exec --no-startup-id rofi -show calc -modi calc -no-show-match -no-sort
bindsym $mod+Mod2+KP_9 exec --no-startup-id rofi -show calc -modi calc -no-show-match -no-sort

# emoji picker
bindsym $mod+period exec --no-startup-id rofimoji

# Terminal shortcuts, still needs to improove, leaving what kinda works for now
# Only works when there is already a terminal open
# set $terminal_shortcuts Open Notes (e)
# mode "$terminal_shortcuts" {
# bindsym e exec i3-sensible-terminal -e 'nvim $HOME/bolttech/Notes', mode "default"
#
# bindsym Return mode "default"
# bindsym Escape mode "default"
# }
# bindsym $mod+t mode "$terminal_shortcuts"

# Start applications
exec --no-startup-id nitrogen --restore
exec --no-startup-id blueman-applet
exec --no-startup-id blueman-tray
exec_always --no-startup-id compton
exec --no-startup-id compton
exec --no-startup-id /usr/bin/gnome-keyring-daemon --start --components=ssh,secrets,pkcs11,gpg

# Start Applications on Weekdays
exec --no-startup-id test $(date +%u) -lt 6 && slack
exec --no-startup-id test $(date +%u) -lt 6 && teams-for-linux
exec --no-startup-id discord

bindsym $mod+Shift+Return exec --no-startup-id terminator --working-directory "$(xcwd)"
# sway
Loading