Compare commits

..

2 Commits

Author SHA1 Message Date
f7624bccda wip 2026-02-10 08:37:02 +01:00
3d35219b98 wip 2026-02-10 08:37:00 +01:00
54 changed files with 1131 additions and 1138 deletions

View File

@@ -1,2 +0,0 @@
# typos
f148ab1559cbb4e0e46e05f8d151f74f64adb359

85
.gitignore vendored
View File

@@ -4,17 +4,24 @@
# allowed misc files # allowed misc files
!.gitmodules !.gitmodules
!.gitignore !.gitignore
!.git-blame-ignore-revs
!README.md !README.md
# allow some stuff to be pushed
!alacritty
!.pyenv
# zsh # zsh
!zsh !zsh
zsh/* zsh/*
!zsh/.zshrc !zsh/.zshrc
!zsh/.zshenv !zsh/.zshenv
!zsh/.zprofile !zsh/.zprofile
!zsh/.zsh_plugins*.txt
!zsh/scripts.zsh !zsh/scripts.zsh
!zsh/aliases.zsh !zsh/aliases.zsh
!zsh/completions/.keep
!zsh/ssh-menu
!zsh/get-dump
# starship # starship
!starship !starship
@@ -25,17 +32,17 @@ starship/*
!tmux !tmux
tmux/* tmux/*
!tmux/tmux.conf !tmux/tmux.conf
!tmux/scripts !tmux/tmux-new-project
!tmux/tmux-sessionizer
!tmux/tmux-ggclone
!tmux/tmux-ssher
# git # git
!git !git
git/* git/*
!git/config !git/config
!git/ignore !git/ignore
!git/config.d !git/aflabs
git/config.d/*
!git/config.d/aflabs.conf
!git/config.d/flare.conf
# ghostty # ghostty
!ghostty !ghostty
@@ -58,68 +65,10 @@ swaylock/*
swayidle/* swayidle/*
!swayidle/config !swayidle/config
# waybar
!waybar !waybar
waybar/*
!waybar/config.jsonc
!waybar/style.css
!waybar/scripts
waybar/scripts/*
!waybar/scripts/ssh-session.sh
!waybar/scripts/vpn-status.sh
!waybar/scripts/notification-status.sh
!waybar/scripts/mic-status.sh
!waybar/scripts/network-status.sh
# eww
!eww
eww/*
!eww/eww.yuck
!eww/eww.scss
!eww/scripts
eww/scripts/*
!eww/scripts/popup.sh
!eww/scripts/system.sh
!eww/scripts/battery.sh
!eww/scripts/volume.sh
!eww/scripts/bluetooth.sh
!eww/scripts/network.sh
!eww/scripts/vpn.sh
!eww/scripts/keyboard.sh
!eww/scripts/media.sh
# sway scripts
!sway/scripts
sway/scripts/*
!sway/scripts/power-menu.sh
!sway/scripts/screenshot.sh
!sway/scripts/ws-to-current.sh
!sway/scripts/power-aware-effects.sh
# bin
!bin !bin
bin/*
!bin/ssh-menu
# swaync # flameshot
!swaync !flameshot
swaync/* flameshot/*
!swaync/config.json !flameshot/flameshot.ini
!swaync/style.css
# fuzzel
!fuzzel
fuzzel/*
!fuzzel/fuzzel.ini
# mako
!mako
mako/*
!mako/config
# claude
!claude
claude/*
!claude/CLAUDE.md
!claude/settings.json
!claude/statusline-command.sh

5
.pyenv/default-packages Normal file
View File

@@ -0,0 +1,5 @@
# Neovim should be able to run anywhere
pynvim
# Upgrade pip while we're at it.
pip

82
alacritty/alacritty.toml Normal file
View File

@@ -0,0 +1,82 @@
[colors]
draw_bold_text_with_bright_colors = true
[colors.bright]
black = "0x45403d"
blue = "0x7daea3"
cyan = "0x89b482"
green = "0xa9b665"
magenta = "0xd3869b"
red = "0xea6962"
white = "0xd4be98"
yellow = "0xd8a657"
[colors.normal]
black = "0x45403d"
blue = "0x7daea3"
cyan = "0x89b482"
green = "0xa9b665"
magenta = "0xd3869b"
red = "0xea6962"
white = "0xd4be98"
yellow = "0xd8a657"
[colors.primary]
background = "0x32302f"
foreground = "0xd4be98"
[cursor]
unfocused_hollow = true
[cursor.style]
blinking = "On"
shape = "Block"
[env]
TERM = "xterm-256color"
[font]
size = 15
[font.bold]
family = "JetBrainsMono Nerd Font"
style = "Bold"
[font.bold_italic]
family = "JetBrainsMono Nerd Font"
style = "Bold Italic"
[font.italic]
family = "JetBrainsMono Nerd Font"
style = "Italic"
[font.normal]
family = "JetBrainsMono Nerd Font"
style = "Regular"
[[keyboard.bindings]]
chars = "\f"
key = "R"
mode = "~Vi|~Search"
mods = "Command"
[[keyboard.bindings]]
action = "ScrollPageUp"
key = "PageUp"
mode = "~Alt"
[[keyboard.bindings]]
action = "ScrollPageDown"
key = "PageDown"
mode = "~Alt"
[scrolling]
history = 10000
[window]
dynamic_title = true
option_as_alt = "Both"
[window.dimensions]
columns = 150
lines = 36

View File

@@ -1,53 +0,0 @@
#!/usr/bin/env bash
function _ssh_menu_preview {
file=$1; shift
host=$1; shift
# show host block from ssh config
awk -v h="$host" '
$0 == "Host " h { found=1 }
found && /^[^ \t]/ && $0 != "Host " h { exit }
found
' "$file"
echo ""
# resolve hostname for reachability check
hostname=$(awk -v h="$host" '
$0 == "Host " h { found=1; next }
found && /^[^ \t]/ { exit }
found && /HostName/ { print $2 }
' "$file")
if command -v host &>/dev/null; then
host "${hostname:-$host}"
echo ""
fi
ping -c 1 -W 1 "${hostname:-$host}" &>/dev/null \
&& echo "reachable" \
|| echo "not reachable"
}
export -f _ssh_menu_preview
function _ssh_menu_select {
rg -N --no-heading '^Host .*' ~/.ssh \
| sed 's/Host \(.*\)/\1/' | sort \
| SHELL=$(which bash) fzf \
--delimiter ':' \
--with-nth 2 \
--preview "_ssh_menu_preview {1} {2}" \
--preview-label "ssh config info" \
--border-label "ssh-menu" \
| cut -d ":" -f2
}
case "${1:-}" in
-s) _ssh_menu_select ;;
*)
selected="$(_ssh_menu_select)"
[[ -n $selected ]] && ssh "$selected"
;;
esac

34
bin/waybar-custom-cider.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
url="http://localhost:10767/api/v1/playback"
status_raw=$(curl -s --max-time 2 "$url/is-playing")
# CASE 1: API is totally unreachable (App closed)
if [[ -z "$status_raw" ]]; then
echo '{"text": "offline", "class": "offline", "alt": "offline"}'
exit 0
fi
# Extract playing status, defaulting to false if null
is_playing=$(echo "$status_raw" | jq -r '.is_playing // false')
# 2. Get song info
info_raw=$(curl -s --max-time 2 "$url/now-playing")
# CASE 2 & 3: Handle empty metadata vs. active metadata
echo "$info_raw" | jq -c \
--argjson is_playing "$is_playing" \
'
# Helper function to escape & for Pango
def pango_escape: sub("&"; "&"; "g");
if (.info.name == null or .info.name == "") then
{text: "idle", class: "paused"}
else
{
text: "\(.info.name | pango_escape) - \(.info.artistName | pango_escape)",
tooltip: "\(.info.albumName | pango_escape // "Unknown")",
class: (if $is_playing then "playing" else "paused" end)
}
end'

View File

@@ -1,38 +0,0 @@
# Global CLAUDE.md
## Comments
Comments must be one of two forms:
```
# descriptive but non-verbose comment
# KEYWORD:(@janezicmatej) descriptive but non-verbose comment
```
Rules:
- always lowercase
- no trailing punctuation
- keywords: WARN, FIX, NOTE, TODO, PERF, TEST, HACK
- keyword comments must include attribution `(@janezicmatej)`
## Git
- commit only when asked or when delegating to agents
- agents MUST commit with `--no-gpg-sign`
## Workflow
- implement changes directly; don't use sub-agents/Task for simple operations like renames, file moves, or single-file edits; only use Task for genuinely complex parallel exploration or research
- when redirected or interrupted, immediately stop the current approach and follow the new direction; don't explain or defend the previous approach
- focus on one goal per session; don't drift into unrelated improvements
- use Task agents for research and exploration, not for straightforward implementation
## Scope
- NEVER modify anything outside the scope of what was asked
- don't introduce unrelated changes, touch unrelated configs, or change defaults not mentioned
- if something related should change, ask first
## Config locations
- MCP server configs go in `.claude.json` (project) or `$CLAUDE_CONFIG_DIR/.claude.json` (global, defaults to `~/.claude.json`), not `settings.json`
- `settings.json` is for permissions, hooks, and behavior settings
## Code quality
- after making changes, check if the project has linters/formatters and run them

View File

@@ -1,18 +0,0 @@
{
"permissions": {
"allow": [
"mcp__todo-mcp__*",
"mcp__nixos__*",
"Bash(git remote get-url origin)"
]
},
"hooks": {},
"statusLine": {
"type": "command",
"command": "sh \"${CLAUDE_CONFIG_DIR:-$HOME/.claude}/statusline-command.sh\""
},
"effortLevel": "xhigh",
"skipDangerousModePermissionPrompt": true,
"voiceEnabled": true,
"mcpServers": {}
}

View File

@@ -1,52 +0,0 @@
#!/bin/sh
input=$(cat)
model=$(echo "$input" | jq -r '.model.display_name // empty')
total_in=$(echo "$input" | jq -r '.context_window.total_input_tokens // 0')
total_out=$(echo "$input" | jq -r '.context_window.total_output_tokens // 0')
ctx=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
five_hr=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty')
five_hr_reset=$(echo "$input" | jq -r '.rate_limits.five_hour.resets_at // empty')
seven_day=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')
seven_day_reset=$(echo "$input" | jq -r '.rate_limits.seven_day.resets_at // empty')
# format seconds until reset as human-readable
fmt_remaining() {
now=$(date +%s)
diff=$(( $1 - now ))
[ "$diff" -le 0 ] && return
h=$(( diff / 3600 ))
m=$(( (diff % 3600) / 60 ))
if [ "$h" -gt 0 ]; then
printf '%dh%dm' "$h" "$m"
else
printf '%dm' "$m"
fi
}
parts=""
[ -n "$model" ] && parts="$model"
if [ -n "$total_in" ] && [ "$total_in" != "0" ]; then
total=$((total_in + total_out))
parts="${parts:+$parts | }tokens:${total}"
fi
if [ -n "$ctx" ]; then
parts="${parts:+$parts | }ctx:$(printf '%.0f' "$ctx")%"
fi
if [ -n "$five_hr" ]; then
five_hr_ttl=""
[ -n "$five_hr_reset" ] && five_hr_ttl=$(fmt_remaining "$five_hr_reset")
parts="${parts:+$parts | }5h:$(printf '%.0f' "$five_hr")%${five_hr_ttl:+($five_hr_ttl)}"
fi
if [ -n "$seven_day" ]; then
seven_day_ttl=""
[ -n "$seven_day_reset" ] && seven_day_ttl=$(fmt_remaining "$seven_day_reset")
parts="${parts:+$parts | }7d:$(printf '%.0f' "$seven_day")%${seven_day_ttl:+($seven_day_ttl)}"
fi
[ -n "$parts" ] && printf '%s' "$parts"

16
flameshot/flameshot.ini Normal file
View File

@@ -0,0 +1,16 @@
[General]
contrastOpacity=188
contrastUiColor=#000000
disabledGrimWarning=true
drawColor=#00ffff
saveAfterCopy=true
savePath=/home/matej/screens
showHelp=false
showMagnifier=true
showSelectionGeometryHideTime=3000
uiColor=#ffffff
useGrimAdapter=true
[Shortcuts]
TYPE_ACCEPT=
TYPE_COPY=Space

View File

@@ -1,22 +0,0 @@
[main]
font=JetBrainsMono Nerd Font:size=10
prompt=" "
icons=no
terminal=ghostty -e
width=40
lines=12
layer=overlay
exit-on-keyboard-focus-loss=yes
[colors]
background=252423ff
text=d4be98ff
match=a9b665ff
selection=45403dff
selection-text=d4be98ff
selection-match=a9b665ff
border=45403dff
[border]
width=2
radius=8

View File

@@ -1,8 +1,11 @@
theme = light:gruvbox-material-soft-light,dark:gruvbox-material-soft-dark # theme
# theme = light:gruvbox-material-soft-light,dark:gruvbox-material-soft-dark
theme = gruvbox-material-soft-dark
minimum-contrast = 1.1 minimum-contrast = 1.1
# cursor # cursor
cursor-style = block
cursor-style-blink = true cursor-style-blink = true
# mouse # mouse
@@ -22,10 +25,20 @@ window-theme = dark
window-height = 36 window-height = 36
window-width = 150 window-width = 150
# macos send option as alt
macos-option-as-alt = true
# no warning full close # no warning full close
confirm-close-surface = false confirm-close-surface = false
# quit-after-last-window-closed = true # quit-after-last-window-closed = true
# keybinds
keybind = global:cmd+enter=new_window
# shell integrations for zsh
# https://ghostty.org/docs/features/shell-integration
shell-integration = zsh
# gtk # gtk
gtk-titlebar = false gtk-titlebar = false

View File

@@ -1,4 +1,4 @@
palette = 0=#252423 palette = 0=252423
palette = 1=#ea6962 palette = 1=#ea6962
palette = 2=#a9b665 palette = 2=#a9b665
palette = 3=#d8a657 palette = 3=#d8a657

View File

@@ -1,71 +1,56 @@
[includeIf "gitdir:~/Desktop/git/git.aflabs.org/"]
path = ~/.config/git/config.d/aflabs.conf
[includeIf "gitdir:~/Desktop/git/gitlab.com/flarenetwork"]
path = ~/.config/git/config.d/flare.conf
[includeIf "gitdir:~/Desktop/git/gitlab.com/flare-foundation"]
path = ~/.config/git/config.d/flare.conf
[user] [user]
name = Matej Janežič name = Matej Janežič
email = janezic.mj@gmail.com email = janezic.mj@gmail.com
signingkey = AF349EECC849D87B790E88FF6318FFB7DB374B7D
[commit]
gpgsign = true
verbose = true
; NOTE:(@janezicmatej) github/gitlab don't support these
; [push]
; gpgsign = true
[core] [core]
autocrlf = input autocrlf = input
editor = nvim editor = nvim
[user]
signingkey = AF349EECC849D87B790E88FF6318FFB7DB374B7D
[commit]
gpgsign = true
; NOTE:(@janezicmatej) github/gitlab don't support these
; [push]
; gpgsign = true
[init] [init]
defaultBranch = main defaultBranch = main
[rebase] [alias]
updateRefs = true blame = "!f() { [ -f .git-blame-ignore-revs ] && git blame --ignore-revs-file .git-blame-ignore-revs \"$@\" || git blame \"$@\"; }; f"
[rerere] [diff]
enabled = true tool = "nvimdiff"
autoUpdate = true
[difftool]
prompt = true
[difftool "nvimdiff"]
cmd = nvim -d "$LOCAL" "$REMOTE"
[maintenance]
auto = true
strategy = incremental
[merge] [merge]
tool = nvimdiff tool = "nvimdiff"
conflictStyle = zdiff3
[mergetool] [mergetool]
prompt = true
keepBackup = false keepBackup = false
writeToTemp = true writeToTemp = true
[mergetool "nvimdiff"] [mergetool "nvimdiff"]
layout = "LOCAL,BASE,REMOTE / MERGED" layout = "LOCAL,BASE,REMOTE / MERGED"
[diff]
tool = nvimdiff
algorithm = histogram
colorMoved = plain
mnemonicPrefix = true
[difftool "nvimdiff"]
cmd = nvim -d "$LOCAL" "$REMOTE"
[alias]
blame-ignore = "config blame.ignoreRevsFile .git-blame-ignore-revs"
[branch]
sort = -committerdate
[tag]
sort = version:refname
[help]
autoCorrect = prompt
[maintenance]
auto = true
strategy = incremental
[includeIf "gitdir:~/git/git.aflabs.org/"]
path = ~/.config/git/config.d/aflabs.conf
[includeIf "gitdir:~/git/gitlab.com/flarenetwork/"]
path = ~/.config/git/config.d/flare.conf
[includeIf "gitdir:~/git/gitlab.com/flare-foundation/"]
path = ~/.config/git/config.d/flare.conf

View File

@@ -1,2 +0,0 @@
[user]
email = matej.janezic@aflabs.com

View File

@@ -1,2 +0,0 @@
[user]
email = matej@flare.network

View File

@@ -1,23 +1,22 @@
# os # mac files
.DS_Store .DS_Store
# editors # i don't like pushing .vscode and .idea folders, i will force add if needed
.vscode .vscode
.idea .idea
.ignore
# ai # pyenv
CLAUDE.local.md
.claude
# languages
.python-version .python-version
# nix # nix venv hook
.nix-venv .nix-venv
.envrc .dev
.direnv/
# project-local # i use .ignore for nvim
.ignore
# todo files
TODO.md TODO.md
# db dumps files
dumps dumps

View File

@@ -1,28 +0,0 @@
# gruvbox-material-soft-dark
font=JetBrainsMono Nerd Font 11
background-color=#252423
text-color=#d4be98
border-color=#45403d
border-size=2
border-radius=8
padding=12
width=450
height=300
margin=8
max-visible=3
default-timeout=10000
ignore-timeout=0
group-by=app-name
max-icon-size=32
icon-path=/usr/share/icons/Adwaita
layer=overlay
anchor=top-right
[urgency=low]
default-timeout=5000
[urgency=critical]
default-timeout=0
border-color=#ea6962

View File

@@ -1,55 +1,44 @@
add_newline = false add_newline = false
format = """\ format = """\
$username\
$hostname\ $hostname\
$directory\ [$directory](cyan)\
$git_branch\ $git_branch\
$git_commit\ $git_commit\
$git_state\ $git_state\
$git_status\ $git_status\
$character\
"""
right_format = """\
$nix_shell\ $nix_shell\
$golang\ $golang\
$lua\ $lua\
$nodejs\ $nodejs\
$python\ $python\
$rust\ $rust\
$dotnet\
$c\
$solidity\
$terraform\
$kubernetes\
$helm\
$cmd_duration\ $cmd_duration\
$line_break\
$character\
""" """
[username] [nix_shell]
show_always = true disabled = false
format = '[$user](bold yellow)' format = '[n(\($name\))](bold blue) '
[hostname]
ssh_only = false
format = '[@$hostname](bold yellow) '
[directory]
style = 'bold cyan'
truncation_length = 1
truncate_to_repo = false
fish_style_pwd_dir_length = 1
[character] [character]
success_symbol = '[>](bold green)' success_symbol = '[>](bold green)'
error_symbol = '[>](bold red)' error_symbol = '[>](bold red)'
[git_branch] [directory]
format = 'on [$branch(:$remote_branch)]($style) ' truncation_length = 1
symbol = '' truncate_to_repo = false
fish_style_pwd_dir_length = 1
[git_commit] [git_commit]
tag_symbol = '' tag_symbol = ''
[git_branch]
symbol = ''
[git_status] [git_status]
format = '[$all_status$ahead_behind]($style)' format = '[$all_status$ahead_behind]($style)'
ahead = '[↑${count}](green) ' ahead = '[↑${count}](green) '
@@ -62,47 +51,13 @@ stashed = '[*${count}](green) '
deleted = '[x${count}](red) ' deleted = '[x${count}](red) '
renamed = '[r${count}](yellow) ' renamed = '[r${count}](yellow) '
[nix_shell]
disabled = false
format = '[nix](bold blue) '
[golang]
symbol = 'go-'
[lua]
symbol = 'lua-'
[nodejs]
symbol = 'node-'
[python] [python]
symbol = 'py-' format = 'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
format = '[${symbol}(${version})]($style) '
python_binary = 'python' python_binary = 'python'
pyenv_version_name = false pyenv_version_name = false
detect_files = ['.python-version'] detect_files = [ '.python-version' ]
[rust] [hostname]
symbol = 'rs-' ssh_only = false
style = 'bold yellow'
[c] format = '[$hostname]($style) on '
symbol = 'c-'
[dotnet]
symbol = 'net-'
[solidity]
symbol = 'sol-'
[terraform]
symbol = 'tf-'
[kubernetes]
disabled = false
symbol = 'k8s-'
[helm]
symbol = 'helm-'
[cmd_duration]
format = '[took $duration]($style) '

View File

@@ -8,7 +8,7 @@ set $right l
# programs # programs
set $term ghostty set $term ghostty
set $menu fuzzel set $menu wofi --show drun -iIG -w 2
set $browser google-chrome-stable set $browser google-chrome-stable
set $lockscreen swaylock set $lockscreen swaylock

View File

@@ -1,5 +1,4 @@
input "type:keyboard" { input "type:keyboard" {
xkb_options "fkeys:basic_13-24"
repeat_delay 150 repeat_delay 150
repeat_rate 35 repeat_rate 35
} }

View File

@@ -1,6 +1,6 @@
# sway # sway
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
bindsym $mod+Shift+e exec ~/.config/sway/scripts/power-menu.sh bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
floating_modifier $mod normal floating_modifier $mod normal
# programs # programs
@@ -8,16 +8,9 @@ bindsym $mod+Return exec $term
bindsym $mod+d exec $menu bindsym $mod+d exec $menu
bindsym $mod+u exec $lockscreen bindsym $mod+u exec $lockscreen
bindsym $mod+Shift+Ctrl+Alt+space exec 1password --quick-access bindsym $mod+Shift+Ctrl+Alt+space exec 1password --quick-access
bindsym Print exec ~/.config/sway/scripts/screenshot.sh bindsym Print exec flameshot gui
# notifications # programs'
bindsym $mod+n exec makoctl dismiss
bindsym $mod+Shift+n exec makoctl dismiss --all
# clipboard
bindsym $mod+c exec cliphist list | fuzzel -d | cliphist decode | wl-copy
# window
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# move focus # move focus
@@ -56,16 +49,16 @@ bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9 bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10 bindsym $mod+Shift+0 move container to workspace number 10
bindsym $mod+Ctrl+1 exec ~/.config/sway/scripts/ws-to-current.sh 1 bindsym $mod+Ctrl+1 workspace number 1 output current
bindsym $mod+Ctrl+2 exec ~/.config/sway/scripts/ws-to-current.sh 2 bindsym $mod+Ctrl+2 workspace number 2 output current
bindsym $mod+Ctrl+3 exec ~/.config/sway/scripts/ws-to-current.sh 3 bindsym $mod+Ctrl+3 workspace number 3 output current
bindsym $mod+Ctrl+4 exec ~/.config/sway/scripts/ws-to-current.sh 4 bindsym $mod+Ctrl+4 workspace number 4 output current
bindsym $mod+Ctrl+5 exec ~/.config/sway/scripts/ws-to-current.sh 5 bindsym $mod+Ctrl+5 workspace number 5 output current
bindsym $mod+Ctrl+6 exec ~/.config/sway/scripts/ws-to-current.sh 6 bindsym $mod+Ctrl+6 workspace number 6 output current
bindsym $mod+Ctrl+7 exec ~/.config/sway/scripts/ws-to-current.sh 7 bindsym $mod+Ctrl+7 workspace number 7 output current
bindsym $mod+Ctrl+8 exec ~/.config/sway/scripts/ws-to-current.sh 8 bindsym $mod+Ctrl+8 workspace number 8 output current
bindsym $mod+Ctrl+9 exec ~/.config/sway/scripts/ws-to-current.sh 9 bindsym $mod+Ctrl+9 workspace number 9 output current
bindsym $mod+Ctrl+0 exec ~/.config/sway/scripts/ws-to-current.sh 10 bindsym $mod+Ctrl+0 workspace number 10 output current
# layout # layout
bindsym $mod+b splith bindsym $mod+b splith
@@ -87,12 +80,11 @@ bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show bindsym $mod+minus scratchpad show
# xf86-volume # xf86-volume
bindsym --locked XF86AudioMute exec pamixer -t && ( pamixer --get-mute && echo 0 > $wobs || pamixer --get-volume > $wobs ) bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
bindsym --locked XF86AudioLowerVolume exec pamixer -d 5 && pamixer --get-volume > $wobs bindsym --locked XF86AudioLowerVolume exec pamixer -d 5 && pamixer --get-volume > $wobs
bindsym --locked XF86AudioRaiseVolume exec pamixer -i 5 && pamixer --get-volume > $wobs bindsym --locked XF86AudioRaiseVolume exec pamixer -i 5 && pamixer --get-volume > $wobs
bindsym --locked F16 exec pamixer --default-source -t bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
# xf86-brightnes
# xf86-brightness
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%- bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+ bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
# xf86-audio # xf86-audio

View File

@@ -2,24 +2,17 @@
for_window [floating] border pixel $border for_window [floating] border pixel $border
for_window [tiling] border normal $border for_window [tiling] border normal $border
for_window [app_id="com.mitchellh.ghostty" title="fastfetch"] floating enable, focus, move position 50 50
# workspace assignment # workspace assignment
assign [app_id="google-chrome"] workspace 2 assign [app_id="google-chrome"] workspace 2
assign [app_id="thunderbird"] workspace 3 assign [app_id="thunderbird"] workspace 3
assign [app_id="Cider"] workspace 4 assign [app_id="Cider"] workspace 4
assign [app_id=".*BoltLauncher.*"] workspace 5 assign [class=".*BoltLauncher.*"] workspace 5
assign [class="net-runelite.*"] workspace 5 assign [class="net-runelite.*"] workspace 5
assign [app_id="discord"] workspace 8 assign [app_id="vesktop"] workspace 8
assign [app_id="Slack"] workspace 8 assign [app_id="Slack"] workspace 8
assign [app_id="org.telegram.desktop"] workspace 8 assign [app_id="org.telegram.desktop"] workspace 8
assign [app_id="Rocket.Chat"] workspace 8 assign [class="Rocket.Chat"] workspace 8
# rules # rules
for_window [app_id="com.gabm.satty"] fullscreen enable
for_window [class="net-runelite.*"] floating enable for_window [class="net-runelite.*"] floating enable
no_focus [class="net-runelite.*"] no_focus [class="net-runelite.*"]
# idle
for_window [app_id=".*"] inhibit_idle fullscreen
for_window [class=".*"] inhibit_idle fullscreen

View File

@@ -1,19 +1,19 @@
# daemon # deamon
exec mako exec swayidle -w
exec swayidle -w
exec wlsunset -l 46.1 -L 14.5 exec wlsunset -l 46.1 -L 14.5
exec pkill -x wob; rm -f $wobs && mkfifo $wobs && tail -f $wobs | wob exec rm -f $wobs \
exec wl-paste --watch cliphist store && mkfifo $wobs \
exec ~/.config/sway/scripts/power-aware-effects.sh && tail -f $wobs \
| wob
exec protonmail-bridge -n exec protonmail-bridge -n
# traditional "start when os starts" programs # traditional "start when os starts" programs
exec ghostty --title=fastfetch --window-width=105 --window-height=27 -e bash -c 'nix run nixpkgs#fastfetch; read -rsn1' && ghostty exec $term
exec $browser exec $browser
exec thunderbird exec thunderbird
exec cider-2 exec cider-2
exec bolt-launcher exec bolt-launcher
exec discord exec vesktop
exec slack exec slack
exec Telegram exec Telegram
exec rocketchat-desktop exec rocketchat-desktop

View File

@@ -1,2 +0,0 @@
output DP-7 resolution 2560x1440 position 2560,-1200
output eDP-1 resolution 2560x1600@165Hz position 0,0 adaptive_sync on

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
# toggle swayfx blur and shadows based on battery state
while true; do
status=$(cat /sys/class/power_supply/BAT1/status 2>/dev/null || cat /sys/class/power_supply/BAT0/status)
if [ "$status" = "Discharging" ]; then
swaymsg blur off
swaymsg shadows off
else
swaymsg blur on
swaymsg shadows on
fi
sleep 30
done

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env bash
# power menu via fuzzel
choice=$(printf "lock\nlogout\nsuspend\nreboot\nshutdown" | fuzzel -d -p "power: ")
case "$choice" in
lock) swaylock ;;
logout) swaymsg exit ;;
suspend) systemctl suspend ;;
reboot) systemctl reboot ;;
shutdown) systemctl poweroff ;;
esac

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
# screenshot focused monitor with satty
output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
grim -o "$output" - | satty -f - --fullscreen --early-exit

View File

@@ -1,4 +0,0 @@
#!/bin/sh
# switch to workspace and move it to the currently focused output
output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
swaymsg "workspace number $1, move workspace to output $output"

View File

@@ -1,4 +1,3 @@
lock 'swaylock -f'
timeout 300 'swaylock -f' timeout 300 'swaylock -f'
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"'
before-sleep 'swaylock -f' before-sleep 'swaylock -f'

View File

@@ -1,7 +1,4 @@
ignore-empty-password image=~/.assets/lockscreen.png
show-failed-attempts
image=~/.assets/wallpaper.png
clock clock
datestr=%A, %d/%m/%y datestr=%A, %d/%m/%y
@@ -12,24 +9,23 @@ indicator-idle-visible
indicator-y-position=300 indicator-y-position=300
indicator-x-position=1200 indicator-x-position=1200
# gruvbox-material-soft-dark inside-color=000000
inside-color=#32302f text-color=ffffff
text-color=#d4be98 ring-color=ffffff
ring-color=#928374
inside-ver-color=#32302f inside-ver-color=000000
text-ver-color=#a9b665 text-ver-color=000000
ring-ver-color=#a9b665 ring-ver-color=ffffff
inside-clear-color=#32302f inside-clear-color=000000
text-clear-color=#d8a657 text-clear-color=ffffff
ring-clear-color=#d8a657 ring-clear-color=ffffff
inside-wrong-color=#32302f inside-wrong-color=000000
text-wrong-color=#ea6962 text-wrong-color=ffffff
ring-wrong-color=#ea6962 ring-wrong-color=ffffff
key-hl-color=#7daea3 key-hl-color=000000
bs-hl-color=#ea6962 bs-hl-color=000000
caps-lock-key-hl-color=#d8a657 caps-lock-key-hl-color=000000
caps-lock-bs-hl-color=#ea6962 caps-lock-bs-hl-color=000000

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(ggman ls \
| fzf \
--border-label "tmux-sessionizer" \
)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name="$(echo "$selected" | shasum -a 256 | head -c 4)_$(basename "$selected" | tr . _ | head -c 10)"
if [[ -z $TMUX ]] && ! tmux list-sessions 2>/dev/null; then
tmux new-session -s "$selected_name" -c "$selected"
exit 0
fi
if ! tmux has-session -t="$selected_name" 2>/dev/null; then
tmux new-session -ds "$selected_name" -c "$selected"
fi
tmux switch-client -t "$selected_name"

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected="$(~/.config/bin/ssh-menu -s)"
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name="ssh_$selected"
if [[ -z $TMUX ]] && ! tmux list-sessions 2>/dev/null; then
tmux new-session -s "$selected_name" ssh "$selected"
exit 0
fi
if ! tmux has-session -t="$selected_name" 2>/dev/null; then
tmux new-session -ds "$selected_name" ssh "$selected"
fi
tmux switch-client -t "$selected_name"

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
if [[ $# -eq 1 ]]; then if [[ $# -eq 1 ]]; then
selected=$1 selected=$1
else else
@@ -10,7 +12,7 @@ if [[ -z $selected ]]; then
exit 0 exit 0
fi fi
ggman clone "$selected" ggman clone $selected
echo "" echo ""
read -p "press enter to continue..." read -p "press enter to continue..."

View File

@@ -6,6 +6,8 @@ if [[ -z ${NAME:+x} ]]; then
exit 1 exit 1
fi fi
source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
read -p "name: " project_name read -p "name: " project_name
if [[ -z $project_name ]]; then if [[ -z $project_name ]]; then
@@ -17,16 +19,16 @@ if [[ -d "$GGROOT/no-remote/$project_name" ]]; then
fi fi
project="$GGROOT/no-remote/$project_name" project="$GGROOT/no-remote/$project_name"
git init "$project" git init $project
echo "# $project_name" >>"$project/README.md" echo "# $project_name" >>"$project/README.md"
gitignore_template=$( gitignore_template=$(
find "$GGROOT"/github.com/github/gitignore/*.gitignore -exec basename {} \; \ find "$GGROOT"/github.com/github/gitignore/*.gitignore -exec basename {} \; \
| sed 's/\(.*\)\.gitignore/\1/' \ | sed 's/\(.*\)\.gitignore/\1/' \
| fzf | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down'
) )
if [[ -n $gitignore_template ]]; then if ! [[ -z $gitignore_template ]]; then
gitignore="$GGROOT/github.com/github/gitignore/$gitignore_template.gitignore" gitignore="$GGROOT/github.com/github/gitignore/$gitignore_template.gitignore"
echo "$gitignore" echo "$gitignore"
echo "$project/.gitignore" echo "$project/.gitignore"
@@ -36,11 +38,13 @@ fi
license_template=$( license_template=$(
find "$GGROOT"/git.janezic.dev/janezicmatej/license/*.license -exec basename {} \; \ find "$GGROOT"/git.janezic.dev/janezicmatej/license/*.license -exec basename {} \; \
| sed 's/\(.*\)\.license/\1/' \ | sed 's/\(.*\)\.license/\1/' \
| fzf | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down'
) )
if [[ -n $license_template ]]; then if ! [[ -z $license_template ]]; then
license="$GGROOT/git.janezic.dev/janezicmatej/license/$license_template.license" license="$GGROOT/git.janezic.dev/janezicmatej/license/$license_template.license"
export YEAR="$(date '+%Y')" export YEAR="$(date '+%Y')"
envsubst <"$license" >"$project/LICENSE" envsubst <"$license" >"$project/LICENSE"
fi fi
ggcompile

34
tmux/tmux-sessionizer Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(ggman ls \
| fzf --cycle \
--bind 'tab:toggle-up,btab:toggle-down' \
--header "Navigate with ARROW KEYS or TAB/S-TAB. Select with ENTER." \
--border "double" \
--border-label "tmux-sessionizer" \
--ansi \
--highlight-line \
)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name="$(echo $selected | shasum -a 256 | head -c 4)_$(basename $selected | tr . _ | head -c 10)"
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected
exit 0
fi
if ! tmux has-session -t=$selected_name 2> /dev/null; then
tmux new-session -ds $selected_name -c $selected
fi
tmux switch-client -t $selected_name

77
tmux/tmux-ssher Executable file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env bash
function _preview {
file=$1; shift
host=$1; shift
j=$(cat $file \
| jc --ssh-conf \
| jq -r ".[] \
| select(.host == \"$host\") \
| .jumps = (if (.proxyjump | type == \"array\" and length > 0) then (.proxyjump | join(\",\")) else \"null\" end)" \
)
user=$(jq -r '.user' <<<$j)
port=$(jq -r '.port' <<<$j)
hostname=$(jq -r '.hostname' <<<$j)
jumps=$(jq -r '.jumps' <<<$j)
echo "$(cat <<EOF
User $user
HostName $hostname\
$([[ $port != "null" ]] && echo -e "\nPort $port")\
$([[ $jumps != "null" ]] && echo -e "\nProxyJump $jumps")
command:
ssh $user@$hostname$([[ $port != "null" ]] && echo -n " -p $port")$([[ $jumps != "null" ]] && echo -n " -J $jumps")
EOF)"
echo ""
host $hostname
echo ""
ping -c 1 -W 1 $hostname &>/dev/null \
&& echo "Host is reachable!" \
|| echo "Host is not reachable!"
}
export -f _preview
function main() {
if [[ $# -eq 1 ]]; then
selected=$1
else
selected="$(rg -N --no-heading '^Host .*' ~/.ssh \
| sed 's/Host \(.*\)/\1/' \
| SHELL=$(which bash) fzf --cycle \
--bind 'tab:toggle-up,btab:toggle-down' \
--delimiter ':' \
--with-nth 2 \
--preview "_preview {1} {2}" \
| cut -d ":" -f2
)"
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name="ssh_$selected"
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected ssh "$selected"
exit 0
fi
if ! tmux has-session -t=$selected_name 2> /dev/null; then
tmux new-session -ds $selected_name -c $selected ssh "$selected"
fi
tmux switch-client -t $selected_name
}
main "$@"

View File

@@ -1,56 +1,53 @@
# server options set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:RGB"
set -ga terminal-features ",xterm-256color:clipboard"
set -g allow-passthrough on
set -g set-clipboard on
set -s escape-time 0 set -s escape-time 0
# terminal
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-ghostty:RGB,xterm-256color:RGB"
set -ga terminal-features ",xterm-ghostty:clipboard,xterm-256color:clipboard"
set -g set-clipboard on
set -g allow-passthrough on
# general
set -g prefix C-s
set -g base-index 1
set -g focus-events on
set -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION SSH_TTY DISPLAY" set -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION SSH_TTY DISPLAY"
# status bar unbind C-b
set-option -g prefix C-s
bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"
set -g base-index 1
set -g status-style 'bg=default fg=default' set -g status-style 'bg=default fg=default'
set -g status-left-length 20 set -g status-left-length 20
# window options set-window-option -g mode-keys vi
set -wg mode-keys vi
set -g pane-base-index 1
set -g renumber-windows on
# prefix
unbind C-b
# copy mode
bind -T copy-mode-vi v send-keys -X begin-selection bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# navigation # differentiate copy on linux and max
if-shell -b '[ "$(uname -s)" = "Linux" ]' {
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
}
if-shell -b '[ "$(uname -s)" = "Darwin" ]' {
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'
}
# vim-like pane switching
bind ^ last-window bind ^ last-window
bind k select-pane -U bind k select-pane -U
bind j select-pane -D bind j select-pane -D
bind h select-pane -L bind h select-pane -L
bind l select-pane -R bind l select-pane -R
# reload
bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"
# sessionizer # sessionizer
bind f run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer" bind-key f run-shell "tmux neww ~/.config/tmux/tmux-sessionizer"
bind R run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer ~" bind-key R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~"
bind g run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer ~/.config" bind-key g run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/.config"
bind T run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer ~/temp" bind-key T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp"
# clone # clone
bind G run-shell "tmux neww ~/.config/tmux/scripts/tmux-ggclone" bind-key G run-shell "tmux neww ~/.config/tmux/tmux-ggclone"
# ssh # ssh
bind F run-shell "tmux neww ~/.config/tmux/scripts/tmux-ssher" bind-key F run-shell "tmux neww ~/.config/tmux/tmux-ssher"
# project # project
bind N run-shell "tmux neww ~/.config/tmux/scripts/tmux-new-project" bind-key N run-shell "tmux neww ~/.config/tmux/tmux-new-project"

View File

@@ -6,137 +6,213 @@
"spacing": 1, "spacing": 1,
"margin": 0, "margin": 0,
"modules-left": [ "modules-left": [
"sway/workspaces", "sway/workspaces", "sway/mode"
"sway/mode"
], ],
"modules-center": [ "modules-center": [
"custom/ssh", "privacy"
"systemd-failed-units"
], ],
"modules-right": [ "modules-right": [
"mpris", "custom/cider",
"pulseaudio",
"power-profiles-daemon",
"cpu", "cpu",
"memory", "memory",
"battery", "temperature",
"wireplumber",
"custom/mic",
"backlight", "backlight",
"sway/language", "battery",
"bluetooth", "tray",
"custom/network",
"clock"
], ],
//
"sway/workspaces": { "sway/workspaces": {
"disable-scroll": true, "disable-scroll": true,
"format": "{name}" "format": "{icon}",
"format-icons": {
"1": "I",
"2": "II",
"3": "III",
"4": "IV",
"5": "V",
"6": "VI",
"7": "VII",
"8": "VIII",
"9": "IX",
"10": "X",
},
}, },
"sway/mode": { "sway/mode": {
"format": "{}" "format": "{}",
}, },
"custom/cider": {
"sway/language": {
"format": "{short}",
"on-click": "swaymsg input type:keyboard xkb_switch_layout next"
},
"custom/ssh": {
"format": "{}", "format": "{}",
"return-type": "json", "return-type": "json",
"interval": 15, "max-length": 18,
"exec": "~/.config/waybar/scripts/ssh-session.sh", "interval": 1,
"on-click": "~/.config/waybar/scripts/ssh-session.sh disconnect" "tooltip": true,
"exec": "~/.config/bin/waybar-custom-cider.sh",
"on-click": "curl -s -X POST http://localhost:10767/api/v1/playback/playpause",
"on-click-right": "curl -s -X POST http://localhost:10767/api/v1/playback/next",
}, },
"privacy": {
"systemd-failed-units": { "icon-spacing": 4,
"hide-on-ok": true, "icon-size": 18,
"format": "!{nr_failed}", "transition-duration": 250,
"format-ok": "", "modules": [
"system": true, {
"user": true, "type": "screenshare",
"on-click": "ghostty -e sh -c 'systemctl --failed; systemctl --user --failed; read'" "tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-out",
"tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-in",
"tooltip": true,
"tooltip-icon-size": 24
}
],
"ignore-monitor": true,
"ignore": [
{
"type": "audio-in",
"name": "cava"
},
{
"type": "screenshare",
"name": "obs"
}
]
}, },
"tray": {
"mpris": { "icon-size": 18,
"format": "{artist} - {title}", "spacing": 10,
"format-paused": "{artist} - {title} [paused]",
"format-stopped": "",
"max-length": 35,
"tooltip-format": "{player}: {artist} - {title} ({album})",
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous"
}, },
"custom/network": {
"format": "{}",
"return-type": "json",
"interval": 5,
"exec": "~/.config/waybar/scripts/network-status.sh"
},
"bluetooth": {
"format": "󰂯",
"format-connected": "󰂯 {num_connections}",
"format-connected-battery": "󰂯 {num_connections}",
"tooltip-format-connected": "{device_enumerate}"
},
"cpu": { "cpu": {
"format": "󰻠 {usage}%", "format": "cpu:{usage}%",
"tooltip": false "tooltip": false,
"on-click": "ghostty -e htop",
}, },
"memory": { "memory": {
"interval": 10, "interval": 10,
"format": "󰍛 {percentage}%", "format": "ram:{}%",
"tooltip-format": "total: {total:0.2f}GiB\nused: {used:0.2f}GiB\navailable: {avail:0.2f}GiB\nswap: {swapUsed:0.2f}/{swapTotal:0.2f}GiB" "tooltip-format": "total: {total:0.2f}GiB\nused: {used:0.2f}GiB\navailable: {avail:0.2f}GiB\nswap: {swapUsed:0.2f}/{swapTotal:0.2f}GiB",
"on-click": "ghostty -e htop",
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""],
"on-click": "ghostty -e s-tui",
"tooltip": false,
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""],
"tooltip": false,
}, },
"battery": { "battery": {
"states": { "states": {
// "good": 95,
"warning": 30, "warning": 30,
"critical": 15 "critical": 15,
}, },
"format": "󰁹 {capacity}%", "format": "{capacity}% {icon}",
"format-charging": "󰂄 {capacity}%", "format-full": "{capacity}% {icon}",
"format-plugged": "󰚥 {capacity}%", "format-charging": "{capacity}%",
"format-full": "󰁹 full", "format-plugged": "{capacity}% ",
"format-alt": "{time}", "format-alt": "{time} {icon}",
"tooltip-format": "{timeTo}\n{power}W", // "format-good": "", // An empty format will hide the module
"on-click": "p=$(powerprofilesctl get); case $p in power-saver) n=balanced;; balanced) n=performance;; *) n=power-saver;; esac; powerprofilesctl set $n" // "format-full": "",
"format-icons": ["", "", "", "", ""],
}, },
"power-profiles-daemon": {
"wireplumber": { "format": "{icon}",
"format": "󰕾 {volume}%", "tooltip-format": "Power profile: {profile}\nDriver: {driver}",
"format-muted": "󰖁 muted", "tooltip": true,
"on-click": "pamixer -t", "format-icons": {
"on-scroll-up": "pamixer -i 5", "default": "",
"on-scroll-down": "pamixer -d 5", "performance": "",
"tooltip-format": "{node_name}: {volume}%" "balanced": "",
"power-saver": "",
},
}, },
"network": {
"custom/mic": { // "interface": "wlp2*", // (Optional) To force the use of this interface
"format": "{}", "format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "ipv4:{ipaddr}/{cidr}",
"tooltip-format": "{ifname} via {gwaddr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}",
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "vol:{volume}%/{format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-source": "{volume}%",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""],
},
"on-click": "pavucontrol",
},
"custom/media": {
"format": "{icon} {text}",
"return-type": "json", "return-type": "json",
"interval": 2, "max-length": 40,
"exec": "~/.config/waybar/scripts/mic-status.sh", "format-icons": {
"on-click": "pamixer --default-source -t", "spotify": "",
"on-scroll-up": "pamixer --default-source -i 5", "default": "🎜",
"on-scroll-down": "pamixer --default-source -d 5" },
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null", // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
}, },
"custom/power": {
"backlight": { "format": "⏻ ",
"format": "󰃟 {percent}%", "tooltip": false,
"tooltip": false "menu": "on-click",
"menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder
"menu-actions": {
"shutdown": "shutdown",
"reboot": "reboot",
"suspend": "systemctl suspend",
"hibernate": "systemctl hibernate",
},
},
},
{
"layer": "top",
"position": "bottom",
"height": 30,
"spacing": 1,
"margin": 0,
"modules-right": [
"network",
"clock",
],
"network": {
"format-ethernet": "{ipaddr}/{cidr}",
"format-disconnected": "disconnected"
}, },
"clock": { "clock": {
"interval": 1, "interval": 1,
"format": "{:%d/%m %H:%M:%S}", "format": "{:%Y/%m/%d %H:%M:%S}",
"tooltip-format": "<big><tt>{calendar}</tt></big>" "tooltip-format": "<big><tt>{calendar}</tt></big>",
} },
} }
] ]

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
# mic volume for waybar custom module
vol=$(pamixer --default-source --get-volume 2>/dev/null || echo 0)
muted=$(pamixer --default-source --get-mute 2>/dev/null || echo false)
if [[ "$muted" == "true" ]]; then
printf '{"text": "󰍭", "class": "muted", "tooltip": "mic muted"}\n'
else
printf '{"text": "󰍬 %d%%", "class": "", "tooltip": "mic %d%%"}\n' "$vol" "$vol"
fi

View File

@@ -1,73 +0,0 @@
#!/usr/bin/env bash
# combined network + vpn status for waybar
# format: icon ip/cidr [vpn-name ...]
iface=$(ip route show default 2>/dev/null | awk '/default/ {print $5; exit}')
icon="󰖪"
class="disconnected"
net_text=""
vpn_names=()
tooltip_parts=()
# network
if [[ -n "$iface" ]]; then
cidr=$(ip -4 addr show "$iface" 2>/dev/null | awk '/inet / {print $2; exit}')
gw=$(ip route show default 2>/dev/null | awk '/default/ {print $3; exit}')
if [[ "$iface" == wl* ]]; then
icon="󰖩"
class="wifi"
ssid=$(nmcli -t -f active,ssid dev wifi 2>/dev/null | awk -F: '/^yes:/ {print $2}')
signal=$(nmcli -t -f active,signal dev wifi 2>/dev/null | awk -F: '/^yes:/ {print $2}')
tooltip_parts+=("$iface: $cidr via $gw")
[[ -n "$ssid" ]] && tooltip_parts+=("ssid: $ssid (${signal}%)")
else
icon="󰈀"
class="wired"
tooltip_parts+=("$iface: $cidr via $gw")
fi
net_text="$cidr"
else
tooltip_parts+=("no connection")
fi
# wireguard — show config name (interface name, e.g. wg-office)
if command -v wg &>/dev/null; then
for wg_iface in $(wg show interfaces 2>/dev/null); do
wg_cidr=$(ip -4 addr show "$wg_iface" 2>/dev/null | awk '/inet / {print $2; exit}')
vpn_names+=("$wg_iface")
tooltip_parts+=("wg: $wg_iface $wg_cidr")
done
fi
# tailscale — show exit node name if routed, otherwise tailnet name
if command -v tailscale &>/dev/null; then
ts_json=$(tailscale status --json 2>/dev/null)
ts_state=$(jq -r '.BackendState // empty' <<<"$ts_json")
if [[ "$ts_state" == "Running" ]]; then
ts_ip=$(jq -r '.TailscaleIPs[0] // empty' <<<"$ts_json")
ts_self=$(jq -r '.Self.HostName // empty' <<<"$ts_json")
ts_exit_id=$(jq -r '.ExitNodeStatus.ID // empty' <<<"$ts_json")
if [[ -n "$ts_exit_id" ]]; then
exit_name=$(jq -r --arg id "$ts_exit_id" '[.Peer[] | select(.ID == $id) | .HostName][0] // "exit"' <<<"$ts_json")
vpn_names+=("$exit_name")
tooltip_parts+=("ts: $ts_self $ts_ip$exit_name")
else
tooltip_parts+=("ts: $ts_self $ts_ip")
fi
fi
fi
# build text
text="$icon"
[[ -n "$net_text" ]] && text+=" $net_text"
if [[ ${#vpn_names[@]} -gt 0 ]]; then
text+=" [$(IFS=,; echo "${vpn_names[*]}")]"
fi
tooltip=$(printf '%s\n' "${tooltip_parts[@]}")
jq -nc --arg text "$text" --arg class "$class" --arg tooltip "$tooltip" \
'{$text,$class,$tooltip}'

View File

@@ -1,21 +0,0 @@
#!/usr/bin/env bash
# detect remote ssh sessions and optionally disconnect them
# outputs waybar JSON; empty when no remote sessions
if [[ "$1" == "disconnect" ]]; then
pkill -HUP -f 'sshd-session:.*@' 2>/dev/null
exit 0
fi
count=$(pgrep -cf '[s]shd-session:.*@' 2>/dev/null)
count=${count:-0}
if [[ "$count" -gt 0 ]]; then
sessions=$(who 2>/dev/null | awk '$NF ~ /\([0-9]/ {gsub(/[()]/, "", $NF); print $1 "@" $NF}')
label="session"; [[ "$count" -gt 1 ]] && label="sessions"
tooltip=${sessions:-"$count remote $label"}
tooltip=${tooltip//$'\n'/\\n}
tooltip=${tooltip//\"/\\\"}
printf '{"text": "●", "class": "active", "tooltip": "%s"}\n' "$tooltip"
fi

View File

@@ -1,19 +1,24 @@
/* gruvbox-material-soft-dark palette @define-color workspaces-color @gray;
* mapped from ghostty/themes/gruvbox-material-soft-dark @define-color workspaces-focused-bg @background-light;
* ansi 0=#252423 1=#ea6962 2=#a9b665 3=#d8a657 @define-color workspaces-focused-fg @foreground;
* 4=#7daea3 5=#d3869b 6=#89b482 7=#d4be98 @define-color workspaces-urgent-bg @red;
* bg=#32302f fg=#d4be98 selection=#45403d */ @define-color workspaces-urgent-fg @background;
@define-color bg #32302f;
@define-color bg_dim #252423; @define-color cider-color @red;
@define-color bg_sel #45403d; @define-color clock-color @foreground;
@define-color fg #d4be98; @define-color pulseaudio-color @blue;
@define-color red #ea6962; @define-color pulseaudio-muted-color @gray;
@define-color green #a9b665; @define-color network-color @magenta;
@define-color yellow #d8a657; @define-color network-disconnected-color @red;
@define-color blue #7daea3; @define-color cpu-color @orange;
@define-color magenta #d3869b; @define-color memory-color @cyan;
@define-color cyan #89b482; @define-color temperature-color @yellow;
@define-color gray #928374; @define-color temperature-critical-color @red;
@define-color backlight-color @white;
@define-color battery-color @foreground;
@define-color battery-charging-color @green;
@define-color battery-warning-color @yellow;
@define-color battery-critical-color @red;
* { * {
font-family: "JetBrainsMono Nerd Font"; font-family: "JetBrainsMono Nerd Font";
@@ -21,17 +26,24 @@
font-weight: bold; font-weight: bold;
} }
/* bar: dark background, modules float inside */
window#waybar { window#waybar {
background-color: @bg_dim; color: #ffffff;
color: @fg; transition-property: background-color;
min-height: 30px; transition-duration: .5s;
} }
window#waybar.hidden { window#waybar.hidden {
opacity: 0.2; opacity: 0.2;
} }
/* This targets every module */
#waybar .module {
background-color: #1e1e2e; /* Your desired module color */
}
/* Specific grouping (Optional: if you want modules to stick together in islands) */
.modules-left, .modules-center, .modules-right {}
button { button {
box-shadow: none; box-shadow: none;
border: none; border: none;
@@ -43,148 +55,99 @@ button:hover {
box-shadow: none; box-shadow: none;
} }
/* workspaces */ /* -----------------------------------------------------------------------------
#workspaces { * Workspaces
background-color: @bg; * ----------------------------------------------------------------------------- */
border-radius: 8px;
margin: 3px 2px;
padding: 0;
}
#workspaces button { #workspaces button {
padding: 0 8px; padding: 0 8px;
background-color: transparent; background-color: transparent;
color: @gray; color: @workspaces-color;
margin: 0; margin: 0;
border-radius: 8px;
} }
#workspaces button:hover { #workspaces button:hover {
background-color: @bg_sel; background: @background-light;
color: @fg; color: @foreground;
box-shadow: none; box-shadow: none;
} }
/* The "Neovim Buffer" Look:
Active workspace is lighter background + cream text.
No flashy underlines. */
#workspaces button.focused { #workspaces button.focused {
background-color: @bg_sel; background-color: @background-light;
color: @fg; color: @workspaces-focused-fg;
box-shadow: none; box-shadow: none;
} }
#workspaces button.urgent { #workspaces button.urgent {
background-color: @red; background-color: @workspaces-urgent-bg;
color: @bg_dim; color: @workspaces-urgent-fg;
} }
/* floating pill style for all modules */ /* -----------------------------------------------------------------------------
* Modules
* ----------------------------------------------------------------------------- */
#mode, #mode,
#clock, #clock,
#battery, #battery,
#cpu, #cpu,
#memory, #memory,
#disk,
#temperature,
#backlight, #backlight,
#network,
#pulseaudio,
#wireplumber, #wireplumber,
#mpris, #custom-media,
#bluetooth, #tray,
#language, #idle_inhibitor,
#custom-mic, #scratchpad,
#custom-network, #power-profiles-daemon,
#custom-ssh, #mpd,
#custom-notification, #custom-cider {
#systemd-failed-units { color: @clock-color;
background-color: @bg; font-weight: bold;
border-radius: 8px;
color: @fg;
padding: 0 10px; padding: 0 10px;
margin: 3px 2px; margin: 0 2px;
}
/* center: alert zone */
#custom-ssh.active {
color: @cyan;
font-size: 18px;
padding: 0 10px;
margin-top: -2px;
margin-bottom: -2px;
}
#custom-notification.notification {
color: @yellow;
}
#custom-notification.dnd-notification {
color: @red;
}
#custom-notification.dnd-none {
color: @gray;
}
#systemd-failed-units {
color: @red;
}
/* right: media (hidden by default, visible only when playing/paused) */
#mpris {
padding: 0;
margin: 0;
min-width: 0;
background-color: transparent; background-color: transparent;
color: @green; border: none; /* Removed the underlines for a cleaner look */
} }
#mpris.playing { #window,
padding: 0 10px; #workspaces {
margin: 3px 2px; margin: 0 4px;
background-color: @bg;
} }
#mpris.paused { .modules-left > widget:first-child > #workspaces { margin-left: 0; }
padding: 0 10px; .modules-right > widget:last-child > #workspaces { margin-right: 0; }
margin: 3px 2px;
background-color: @bg; /* -----------------------------------------------------------------------------
color: @gray; * Module Specifics
* ----------------------------------------------------------------------------- */
#battery {
color: @battery-color;
} }
/* right: connectivity */ #battery.charging, #battery.plugged {
#custom-network.disconnected { color: @battery-charging-color;
color: @red;
}
#bluetooth {
color: @blue;
}
/* right: system */
#cpu {
margin-right: 0;
border-radius: 8px 0 0 8px;
}
#memory {
margin-left: 0;
border-radius: 0 8px 8px 0;
}
/* right: battery */
#battery.charging,
#battery.plugged {
color: @green;
} }
#battery.warning:not(.charging) { #battery.warning:not(.charging) {
color: @yellow; color: @battery-warning-color;
} }
@keyframes blink { @keyframes blink {
to { to {
background-color: @red; background-color: @red;
color: @bg_dim; color: @background;
} }
} }
#battery.critical:not(.charging) { #battery.critical:not(.charging) {
color: @red; color: @battery-critical-color;
animation-name: blink; animation-name: blink;
animation-duration: 0.5s; animation-duration: 0.5s;
animation-timing-function: steps(12); animation-timing-function: steps(12);
@@ -192,40 +155,143 @@ button:hover {
animation-direction: alternate; animation-direction: alternate;
} }
/* right: audio */ /* #cpu { */
#wireplumber.muted { /* color: @cpu-color; */
/* } */
/**/
/* #memory { */
/* color: @memory-color; */
/* } */
/**/
/* #disk { */
/* color: @yellow; */
/* } */
/**/
/* #backlight { */
/* color: @backlight-color; */
/* } */
/**/
/* #network { */
/* color: @network-color; */
/* } */
/**/
/* #network.disconnected { */
/* color: @network-disconnected-color; */
/* } */
/**/
/* #pulseaudio { */
/* color: @pulseaudio-color; */
/* } */
/**/
/* #pulseaudio.muted { */
/* color: @pulseaudio-muted-color; */
/* } */
/**/
/* #wireplumber { */
/* color: @foreground; */
/* } */
/**/
/* #wireplumber.muted { */
/* color: @red; */
/* } */
#custom-media {
color: @green;
min-width: 100px;
}
#temperature {
color: @temperature-color;
}
#temperature.critical {
color: @temperature-critical-color;
}
#tray {
background-color: @background-light;
border-radius: 4px; /* Slight roundness for the tray container */
padding: 0 8px;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
color: @red; color: @red;
} }
#custom-mic.muted { #idle_inhibitor {
color: @gray;
}
#idle_inhibitor.activated {
color: @foreground;
}
#mpd {
color: @green;
}
#mpd.disconnected {
color: @red; color: @red;
} }
/* right: audio group (volume + mic + brightness) */ #mpd.stopped {
#wireplumber { color: @gray;
margin-right: 0;
border-radius: 8px 0 0 8px;
} }
#custom-mic { #mpd.paused {
margin-left: 0; color: @blue;
margin-right: 0;
border-radius: 0;
} }
#backlight { #language {
margin-left: 0; background: @background-light;
border-radius: 0 8px 8px 0; color: @foreground;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
} }
/* right: clock */ #keyboard-state {
#clock { color: @foreground;
color: @fg; padding: 0 0px;
margin: 0 5px;
min-width: 16px;
} }
/* mode highlight */ #keyboard-state > label.locked {
#mode { color: @red;
color: @bg_dim; }
background-color: @yellow;
padding: 0 10px; #scratchpad {
background: transparent;
color: @gray;
}
#scratchpad.empty {
background-color: transparent;
}
#privacy {
padding: 0;
}
#privacy-item {
padding: 0 5px;
color: @foreground;
}
#privacy-item.screenshare {
color: @orange;
}
#privacy-item.audio-in {
color: @green;
}
#privacy-item.audio-out {
color: @blue;
} }

View File

@@ -1,5 +1,2 @@
path=( export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/neovim/bin:$HOME/bin:${PATH}"
"$HOME/.local/bin"
"$GOPATH/bin"
$path
)

11
zsh/.zsh_plugins.txt Normal file
View File

@@ -0,0 +1,11 @@
# set up Zsh completions with plugins
# mattmc3/ez-compinit
zsh-users/zsh-completions kind:fpath path:src
# frameworks like oh-my-zsh are supported
getantidote/use-omz # handle OMZ dependencies
ohmyzsh/ohmyzsh path:lib # load OMZ's library
ohmyzsh/ohmyzsh path:plugins/git
# popular fish-like plugins
zsh-users/zsh-autosuggestions

View File

@@ -0,0 +1 @@
lukechilds/zsh-nvm

View File

@@ -4,8 +4,22 @@ export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share" export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state" export XDG_STATE_HOME="$HOME/.local/state"
# deduplicate path # ~/.local/bin
typeset -U path export PATH="$HOME/.local/bin:$PATH"
# brew sbin
export PATH="/opt/homebrew/sbin:$PATH"
# brew lib
export LIBRARY_PATH="$LIBRARY_PATH:/opt/homebrew/lib"
# cargo
if [[ "$OSTYPE" == "darwin"* ]]; then
source "$HOME/.cargo/env"
fi
# language environment
export LANG=en_US.UTF-8
# editor # editor
export EDITOR=nvim export EDITOR=nvim
@@ -13,24 +27,35 @@ export EDITOR=nvim
# go # go
export GOPATH="$XDG_DATA_HOME/go" export GOPATH="$XDG_DATA_HOME/go"
export GOMODCACHE="$XDG_CACHE_HOME/go/mod" export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
export PATH="$GOPATH/bin:$PATH"
# ggman # ggman
export GGROOT="$HOME/git" export GGROOT="$HOME/git"
# neovim
export PATH="$XDG_DATA_HOME/neovim/bin:$PATH"
# pyenv
export PYENV_ROOT="$XDG_DATA_HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
# pyenv-virtualenv
# leave python promt to starship
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
# poetry
export POETRY_HOME="$XDG_DATA_HOME/poetry"
command -v poetry >/dev/null || export PATH="$POETRY_HOME/bin:$PATH"
# gnupg
export GPG_TTY=$(tty)
# aflabs
export USER_UID=$(id -u)
export USER_GID=$(id -g)
# name # name
export NAME="Matej Janežič" export NAME="Matej Janežič"
# starship nest config into a folder, default is ~/.config/starship.toml # starship nest config into a folder, default is ~/.config/startship.toml
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"
# claude
export CLAUDE_CONFIG_DIR="$XDG_CONFIG_HOME/claude"
# cliphist
export CLIPHIST_DB_PATH="/tmp/cliphist-db"
# fzf
export FZF_DEFAULT_OPTS="--cycle --bind 'tab:toggle-up,btab:toggle-down' --pointer '>' --color '16' --border 'double' --ansi --highlight-line --header 'Navigate with ARROW KEYS or TAB/S-TAB. Select with ENTER.'"
# ephvm
export EPHVM_FLAKE="/home/matej/git/git.janezic.dev/janezicmatej/matej.nix"

View File

@@ -1,101 +1,46 @@
# shell options # zsh history file
bindkey -e # emacs line editing export HISTFILE="$XDG_STATE_HOME/zsh/history"
unsetopt autocd # don't cd into directories by name export HISTSIZE=100
setopt NO_BEEP # no terminal bell
setopt AUTO_PUSHD # cd pushes to directory stack
setopt PUSHD_IGNORE_DUPS # no duplicates in directory stack
setopt EXTENDED_GLOB # enable extended glob operators (#, ~, ^)
# history ## pre plugin load
HISTFILE="$XDG_STATE_HOME/zsh/history" # nvm
mkdir -p "${HISTFILE:h}" export NVM_COMPLETION=true
HISTSIZE=10000 # zsh autosugestions
SAVEHIST=10000 export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
setopt HIST_IGNORE_DUPS # skip consecutive duplicates
setopt HIST_IGNORE_SPACE # skip commands starting with space
setopt SHARE_HISTORY # share history across sessions
setopt HIST_REDUCE_BLANKS # strip extra whitespace
# -- plugins -- # source antidote
# auto-cloned on first launch, auto-updated weekly in background source $ZDOTDIR/.antidote/antidote.zsh
PLUGIN_DIR="$XDG_DATA_HOME/zsh/plugins" antidote load
_plugin_stamp="$XDG_CACHE_HOME/zsh/plugins-updated"
_plugin_needs_update=0
# check if a week (168h) has passed since last update if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ ! -f "$_plugin_stamp" ]] || [[ -n $_plugin_stamp(#qN.mh+168) ]]; then antidote load ${ZDOTDIR:-~}/.zsh_plugins_darwin.txt
mkdir -p "${_plugin_stamp:h}"
touch "$_plugin_stamp"
_plugin_needs_update=1
fi fi
function ensure_plugin() { unsetopt autocd
local repo=$1 dir="$PLUGIN_DIR/${1##*/}"
# clone if missing, pull if update is due
if [[ ! -d "$dir" ]]; then
git clone --depth=1 "https://github.com/$repo.git" "$dir"
elif (( _plugin_needs_update )); then
git -C "$dir" pull --quiet &
fi
fpath=("$dir" $fpath)
source "$dir/${dir##*/}.plugin.zsh" 2>/dev/null
}
ensure_plugin zsh-users/zsh-completions if [[ "$OSTYPE" == "darwin"* ]]; then
ensure_plugin zsh-users/zsh-autosuggestions eval "$(pyenv init - zsh)"
ensure_plugin romkatv/zsh-no-ps2 eval "$(pyenv virtualenv-init - zsh)"
(( _plugin_needs_update )) && wait
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
# line editing widgets
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search bracketed-paste-magic
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
zle -N bracketed-paste bracketed-paste-magic
# only use builtin widgets during paste to avoid autosuggestions conflict
zstyle ':bracketed-paste-magic' active-widgets '.self-*'
# terminal application mode for correct terminfo sequences
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx }
function zle_application_mode_stop { echoti rmkx }
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi fi
# key bindings if [[ "$OSTYPE" == "darwin"* ]]; then
[[ -n "${terminfo[kcuu1]}" ]] && bindkey -- "${terminfo[kcuu1]}" up-line-or-beginning-search export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
[[ -n "${terminfo[kcud1]}" ]] && bindkey -- "${terminfo[kcud1]}" down-line-or-beginning-search fi
[[ -n "${terminfo[khome]}" ]] && bindkey -- "${terminfo[khome]}" beginning-of-line
[[ -n "${terminfo[kend]}" ]] && bindkey -- "${terminfo[kend]}" end-of-line
[[ -n "${terminfo[kdch1]}" ]] && bindkey -- "${terminfo[kdch1]}" delete-char
[[ -n "${terminfo[kcbt]}" ]] && bindkey -- "${terminfo[kcbt]}" reverse-menu-complete
bindkey -- '^[[1;5C' forward-word # ctrl+right
bindkey -- '^[[1;5D' backward-word # ctrl+left
# aliases and functions # ggman
eval "$(ggman shellrc)"
# custom functions and aliases
source "$ZDOTDIR/aliases.zsh" source "$ZDOTDIR/aliases.zsh"
source "$ZDOTDIR/scripts.zsh" source "$ZDOTDIR/scripts.zsh"
# completion # completion
fpath=("$XDG_DATA_HOME/zsh/completions" $fpath) fpath=($ZDOTDIR/completions $fpath)
autoload -Uz compinit autoload -Uz compinit
# only regenerate dump once per day compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
local _zcompdump="$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" zstyle ':completion:*' cache-path $XDG_CACHE_HOME/zsh/zcompcache
if [[ -n $_zcompdump(#qN.mh+24) ]]; then
compinit -d "$_zcompdump" # opam configuration
else # [[ ! -r /Users/janezicmatej/.opam/opam-init/init.zsh ]] || source /Users/janezicmatej/.opam/opam-init/init.zsh > /dev/null 2> /dev/null
compinit -C -d "$_zcompdump"
fi
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache"
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# tool hooks
eval "$(ggman shellrc)"
eval "$(starship init zsh)" eval "$(starship init zsh)"
eval "$(direnv hook zsh)"
# gnupg
export GPG_TTY=$(tty)

View File

@@ -1,74 +1,42 @@
alias z="exec zsh" alias z="exec zsh"
alias t=tmux_attach alias t=tmux_attach
alias e="bash /home/matej/git/git.janezic.dev/janezicmatej/matej.nix/scripts/ephvm-run.sh"
alias n=nvim if [[ "$OSTYPE" == "darwin"* ]]; then
alias n=nvim_ve
alias vim=nvim_ve
elif [[ "$OSTYPE" == "linux"* ]]; then
alias n=nvim
fi
alias s="~/.config/bin/ssh-menu" alias s="ssh-menu"
# docker # docker
alias dp="docker ps --format 'table {{.Names}}\t{{.Ports}}'" alias dp="docker ps --format 'table {{.Names}}\t{{.Ports}}'"
alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'" alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'"
# navigation # navigation
alias cdgit='cd $GGROOT' alias cdgit="cd $GGROOT"
alias icloud="cd $HOME/Library/Mobile\ Documents/com\~apple\~CloudDocs"
alias temp="cd $HOME/Desktop/temp"
# git status/diff # apple specific
alias gst="git status" alias accenton="defaults write -g ApplePressAndHoldEnabled -bool true"
alias gd="git diff" alias accentoff="defaults write -g ApplePressAndHoldEnabled -bool false"
alias gds="git diff --staged"
alias gdup="git diff @{upstream}" # git
alias glog="git log --oneline --decorate --graph" alias gpo="git push origin"
alias gloga="git log --oneline --decorate --graph --all" alias gros="git reset origin/$(git_current_branch) --soft"
alias gcan="git commit -v --amend --no-edit"
alias glogaa="git log --oneline --graph --all --pretty=format:\"%C(auto)%h %C(blue)(%aL/%cL)%C(auto)%(decorate) %s%Creset\"" alias glogaa="git log --oneline --graph --all --pretty=format:\"%C(auto)%h %C(blue)(%aL/%cL)%C(auto)%(decorate) %s%Creset\""
# git staging/commit # unsorted
alias ga="git add" alias ci="glab ci list"
alias gc="git commit -v" alias bm=batman
alias gc!="git commit -v --amend" alias grow="~/.local/bin/cbonsai -liWC -M 15 -t 2 -w 60 -s $(date +%s)"
alias gcan="git commit -v --amend --no-edit" alias clean_ds_store='find . -name ".DS_Store" -type f -delete -print'
alias gcan!="git commit -v --all --no-edit --amend"
alias grs="git restore"
# git branch/checkout
alias gb="git branch"
alias gco="git checkout"
alias gcm='git checkout $(git_main_branch)'
alias gsw="git switch"
# git fetch/pull/push
alias gfa="git fetch --all --prune --tags"
alias gl="git pull"
alias gp="git push"
alias gpf="git push --force-with-lease"
alias gpf!="git push --force"
alias gpo="git push origin"
# git rebase
alias grb="git rebase"
alias grba="git rebase --abort"
alias grbc="git rebase --continue"
alias grbi="git rebase -i"
grbm() { git rebase "$(git_main_branch)" }
# git merge
alias gm="git merge"
alias gma="git merge --abort"
alias gmc="git merge --continue"
# git cherry-pick
alias gcp="git cherry-pick"
alias gcpa="git cherry-pick --abort"
alias gcpc="git cherry-pick --continue"
# git stash/reset
alias gstp="git stash pop"
alias grhh="git reset --hard HEAD"
gros() { git reset "origin/$(git_current_branch)" --soft }
groh() { git reset "origin/$(git_current_branch)" --hard }
# git navigation
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
# ruff # ruff
alias ruffme="ruff check --fix && ruff format" alias ruffme="ruff check --fix && ruff format"
# clipboard
alias xcp="xclip -selection c"

0
zsh/completions/.keep Normal file
View File

51
zsh/get-dump Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
function get-dump {
if [[ -z $1 ]]; then
host="$(rg -N --no-heading 'Host .*' ~/.ssh \
| sed 's/Host \(.*\)/\1/' \
| fzf --cycle \
--bind 'tab:toggle-up,btab:toggle-down' \
--delimiter ':' \
--with-nth 2 \
--header "Navigate with ARROW KEYS or TAB/S-TAB. Select with ENTER." \
--border "double" \
--border-label "get-dump" \
--ansi \
--highlight-line \
| cut -d ":" -f2
)"
if [[ -z $host ]]; then
return
fi
else
host=$1
fi
selected=$(ssh "$host" docker ps --format "{{.Names}}" \
| fzf --cycle \
--bind 'tab:toggle-up,btab:toggle-down' \
--header "Navigate with ARROW KEYS or TAB/S-TAB. Select with ENTER." \
--border "double" \
--border-label "get-dump" \
--ansi \
--highlight-line \
)
if [[ -z $selected ]]; then
echo "not provided"
return
fi
if ! [[ -d "./dumps" ]]; then
mkdir "./dumps"
fi
location="./dumps/${host}_${selected}_$(date +'%s')"
echo "dumping to $location"
ssh "$host" docker exec "$selected" pg_dump -U db --format=c db >"$location"
}
get-dump "$@"

View File

@@ -1,32 +1,94 @@
# git helpers for aliases function nvim_ve {
function git_current_branch { if [[ -e $VIRTUAL_ENV && -f "$VIRTUAL_ENV/bin/activate" ]]; then
command git rev-parse --abbrev-ref HEAD 2>/dev/null source "$VIRTUAL_ENV/bin/activate"
command nvim $@
deactivate
else
command nvim $@
fi
} }
function git_main_branch { function afm {
command git rev-parse --git-dir &>/dev/null || return RES=$(curl -s "https://$1/api/monitoring/requirements")
local ref COUNT=$(echo "$RES" | grep -c $2)
for ref in refs/{heads,remotes/{origin,upstream}}/{main,master,trunk}; do if [[ $COUNT -ge 0 ]]; then
if command git show-ref -q --verify "$ref"; then VER=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).version')
echo ${ref:t} # OP=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).requirement?[0][0]')
return 0 # echo "$2""$(echo "$OP" | tr -d '"')""$(echo "$VER" | tr -d '"')"
fi echo "${2}==$(echo "$VER" | tr -d '"')"
done fi
echo main
} }
function nukepip {
pip uninstall $(pip freeze) -y
pip install -r $(pyenv root)/default-packages
}
function pyinit {
if [[ -f .python-version ]]; then
echo "found .python-version, stopping"
return
fi
DIRNAME=$(basename "$PWD")
if [[ $(pyenv versions | grep -E "/${DIRNAME}$") ]]; then
echo "found existing version with this name, setting..."
pyenv local "$DIRNAME"
return
fi
if [[ -z $1 ]]; then
echo "no python version provided, defaulting to $(pyenv version-name)"
VERSION=$(pyenv version-name)
else
VERSION=$1
fi
pyenv virtualenv "$VERSION" "$DIRNAME"
pyenv local "$DIRNAME"
}
function lh {
if [[ -z $1 ]]; then
PORT=7999
else
PORT=$1
fi
open "http://localhost:$PORT"
}
function dps {
if [[ -z $1 ]]; then
docker ps --format table'{{ .ID }}\t{{ .Image }}\t{{ .Ports}}\t{{ .Names }}'
else
docker ps --format table'{{ .ID }}\t{{ .Image }}\t{{ .Ports}}\t{{ .Names }}' | grep $1
fi
}
function tssh {
if [[ -z $1 ]]; then
echo "provide ssh host"
return
fi
ssh -t "$@" "command -v tmux && (tmux a || tmux new-session -s gorazd -c ~) || bash"
}
function tmux_attach { function tmux_attach {
local tmux_running
tmux_running=$(pgrep tmux) tmux_running=$(pgrep tmux)
if [[ -n ${TMUX} ]]; then if ! [[ -z ${TMUX} ]]; then
echo "already attached; refreshing env" echo "already attached; refreshing env"
source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p') source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p')
return 0 return 1
fi fi
if [[ -z $tmux_running ]]; then if [[ -z $tmux_running ]]; then
~/.config/tmux/scripts/tmux-sessionizer ~ ~/.config/tmux/tmux-sessionizer ~
else else
tmux a tmux a
fi fi

75
zsh/ssh-menu Executable file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env bash
function _ssh_menu_preview {
file=$1; shift
host=$1; shift
j=$(cat $file \
| jc --ssh-conf \
| jq -r ".[] \
| select(.host == \"$host\") \
| .jumps = (\
if (.proxyjump | type == \"array\" and length > 0) then \
(.proxyjump | join(\",\")) \
else \
\"null\" \
end \
)" \
)
user=$(jq -r '.user' <<<$j)
port=$(jq -r '.port' <<<$j)
hostname=$(jq -r '.hostname' <<<$j)
jumps=$(jq -r '.jumps' <<<$j)
echo "$(cat <<EOF
User $user
HostName $hostname\
$([[ $port != "null" ]] && echo -e "\nPort $port")\
$([[ $jumps != "null" ]] && echo -e "\nProxyJump $jumps")
command:
ssh $user@$hostname$([[ $port != "null" ]] && echo -n " -p $port")$([[ $jumps != "null" ]] && echo -n " -J $jumps")
EOF
)"
echo ""
if command -v host 2>&1 >/dev/null; then
host $hostname
echo ""
fi
ping -c 1 -W 1 $hostname &>/dev/null \
&& echo "Host is reachable!" \
|| echo "Host is not reachable!"
}
export -f _ssh_menu_preview
function ssh-menu {
selected="$(rg -N --no-heading '^Host .*' ~/.ssh \
| sed 's/Host \(.*\)/\1/' | sort \
| SHELL=$(which bash) fzf --cycle \
--bind 'tab:toggle-up,btab:toggle-down' \
--delimiter ':' \
--with-nth 2 \
--preview "_ssh_menu_preview {1} {2}" \
--preview-label "ssh config info" \
--header "Navigate with ARROW KEYS or TAB/S-TAB. Select with ENTER." \
--border "double" \
--border-label "ssh-menu" \
--ansi \
--highlight-line \
| cut -d ":" -f2
)"
if [[ -z $selected ]]; then
return
fi
ssh "$selected"
}
ssh-menu