Compare commits
1 Commits
main
...
80b0a63b3d
| Author | SHA1 | Date | |
|---|---|---|---|
|
80b0a63b3d
|
@@ -1,2 +0,0 @@
|
||||
# typos
|
||||
f148ab1559cbb4e0e46e05f8d151f74f64adb359
|
||||
85
.gitignore
vendored
85
.gitignore
vendored
@@ -4,17 +4,24 @@
|
||||
# allowed misc files
|
||||
!.gitmodules
|
||||
!.gitignore
|
||||
!.git-blame-ignore-revs
|
||||
!README.md
|
||||
|
||||
# allow some stuff to be pushed
|
||||
!alacritty
|
||||
!.pyenv
|
||||
|
||||
# zsh
|
||||
!zsh
|
||||
zsh/*
|
||||
!zsh/.zshrc
|
||||
!zsh/.zshenv
|
||||
!zsh/.zprofile
|
||||
!zsh/.zsh_plugins*.txt
|
||||
!zsh/scripts.zsh
|
||||
!zsh/aliases.zsh
|
||||
!zsh/completions/.keep
|
||||
!zsh/ssh-menu
|
||||
!zsh/get-dump
|
||||
|
||||
# starship
|
||||
!starship
|
||||
@@ -25,17 +32,17 @@ starship/*
|
||||
!tmux
|
||||
tmux/*
|
||||
!tmux/tmux.conf
|
||||
!tmux/scripts
|
||||
!tmux/tmux-new-project
|
||||
!tmux/tmux-sessionizer
|
||||
!tmux/tmux-ggclone
|
||||
!tmux/tmux-ssher
|
||||
|
||||
# git
|
||||
!git
|
||||
git/*
|
||||
!git/config
|
||||
!git/ignore
|
||||
!git/config.d
|
||||
git/config.d/*
|
||||
!git/config.d/aflabs.conf
|
||||
!git/config.d/flare.conf
|
||||
!git/aflabs
|
||||
|
||||
# ghostty
|
||||
!ghostty
|
||||
@@ -58,68 +65,10 @@ swaylock/*
|
||||
swayidle/*
|
||||
!swayidle/config
|
||||
|
||||
# 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/ssh-menu
|
||||
|
||||
# swaync
|
||||
!swaync
|
||||
swaync/*
|
||||
!swaync/config.json
|
||||
!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
|
||||
# flameshot
|
||||
!flameshot
|
||||
flameshot/*
|
||||
!flameshot/flameshot.ini
|
||||
|
||||
5
.pyenv/default-packages
Normal file
5
.pyenv/default-packages
Normal 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
82
alacritty/alacritty.toml
Normal 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
|
||||
53
bin/ssh-menu
53
bin/ssh-menu
@@ -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
34
bin/waybar-custom-cider.sh
Executable 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'
|
||||
@@ -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
|
||||
@@ -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": {}
|
||||
}
|
||||
@@ -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
16
flameshot/flameshot.ini
Normal 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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
# cursor
|
||||
cursor-style = block
|
||||
cursor-style-blink = true
|
||||
|
||||
# mouse
|
||||
@@ -22,10 +25,20 @@ window-theme = dark
|
||||
window-height = 36
|
||||
window-width = 150
|
||||
|
||||
# macos send option as alt
|
||||
macos-option-as-alt = true
|
||||
|
||||
# no warning full close
|
||||
confirm-close-surface = false
|
||||
# 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-titlebar = false
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
palette = 0=#252423
|
||||
palette = 0=252423
|
||||
palette = 1=#ea6962
|
||||
palette = 2=#a9b665
|
||||
palette = 3=#d8a657
|
||||
|
||||
85
git/config
85
git/config
@@ -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]
|
||||
name = Matej Janežič
|
||||
email = janezic.mj@gmail.com
|
||||
signingkey = AF349EECC849D87B790E88FF6318FFB7DB374B7D
|
||||
|
||||
[commit]
|
||||
gpgsign = true
|
||||
verbose = true
|
||||
|
||||
; NOTE:(@janezicmatej) github/gitlab don't support these
|
||||
; [push]
|
||||
; gpgsign = true
|
||||
|
||||
[core]
|
||||
autocrlf = input
|
||||
editor = nvim
|
||||
|
||||
[user]
|
||||
signingkey = AF349EECC849D87B790E88FF6318FFB7DB374B7D
|
||||
|
||||
[commit]
|
||||
gpgsign = true
|
||||
|
||||
; NOTE:(@janezicmatej) github/gitlab don't support these
|
||||
; [push]
|
||||
; gpgsign = true
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[rebase]
|
||||
updateRefs = true
|
||||
[alias]
|
||||
blame = "!f() { [ -f .git-blame-ignore-revs ] && git blame --ignore-revs-file .git-blame-ignore-revs \"$@\" || git blame \"$@\"; }; f"
|
||||
|
||||
[rerere]
|
||||
enabled = true
|
||||
autoUpdate = true
|
||||
[diff]
|
||||
tool = "nvimdiff"
|
||||
|
||||
[difftool]
|
||||
prompt = true
|
||||
|
||||
[difftool "nvimdiff"]
|
||||
cmd = nvim -d "$LOCAL" "$REMOTE"
|
||||
|
||||
[maintenance]
|
||||
auto = true
|
||||
strategy = incremental
|
||||
|
||||
[merge]
|
||||
tool = nvimdiff
|
||||
conflictStyle = zdiff3
|
||||
tool = "nvimdiff"
|
||||
|
||||
[mergetool]
|
||||
prompt = true
|
||||
keepBackup = false
|
||||
writeToTemp = true
|
||||
|
||||
[mergetool "nvimdiff"]
|
||||
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
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[user]
|
||||
email = matej.janezic@aflabs.com
|
||||
@@ -1,2 +0,0 @@
|
||||
[user]
|
||||
email = matej@flare.network
|
||||
23
git/ignore
23
git/ignore
@@ -1,23 +1,22 @@
|
||||
# os
|
||||
# mac files
|
||||
.DS_Store
|
||||
|
||||
# editors
|
||||
# i don't like pushing .vscode and .idea folders, i will force add if needed
|
||||
.vscode
|
||||
.idea
|
||||
.ignore
|
||||
|
||||
# ai
|
||||
CLAUDE.local.md
|
||||
.claude
|
||||
|
||||
# languages
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# nix
|
||||
# nix venv hook
|
||||
.nix-venv
|
||||
.envrc
|
||||
.direnv/
|
||||
.dev
|
||||
|
||||
# project-local
|
||||
# i use .ignore for nvim
|
||||
.ignore
|
||||
|
||||
# todo files
|
||||
TODO.md
|
||||
|
||||
# db dumps files
|
||||
dumps
|
||||
|
||||
28
mako/config
28
mako/config
@@ -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
|
||||
@@ -1,55 +1,44 @@
|
||||
add_newline = false
|
||||
|
||||
format = """\
|
||||
$username\
|
||||
$hostname\
|
||||
$directory\
|
||||
[$directory](cyan)\
|
||||
$git_branch\
|
||||
$git_commit\
|
||||
$git_state\
|
||||
$git_status\
|
||||
$character\
|
||||
"""
|
||||
|
||||
right_format = """\
|
||||
$nix_shell\
|
||||
$golang\
|
||||
$lua\
|
||||
$nodejs\
|
||||
$python\
|
||||
$rust\
|
||||
$dotnet\
|
||||
$c\
|
||||
$solidity\
|
||||
$terraform\
|
||||
$kubernetes\
|
||||
$helm\
|
||||
$cmd_duration\
|
||||
$line_break\
|
||||
$character\
|
||||
"""
|
||||
|
||||
[username]
|
||||
show_always = true
|
||||
format = '[$user](bold yellow)'
|
||||
|
||||
[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
|
||||
[nix_shell]
|
||||
disabled = false
|
||||
format = '[n(\($name\))](bold blue) '
|
||||
|
||||
[character]
|
||||
success_symbol = '[>](bold green)'
|
||||
error_symbol = '[>](bold red)'
|
||||
|
||||
[git_branch]
|
||||
format = 'on [$branch(:$remote_branch)]($style) '
|
||||
symbol = ''
|
||||
[directory]
|
||||
truncation_length = 1
|
||||
truncate_to_repo = false
|
||||
fish_style_pwd_dir_length = 1
|
||||
|
||||
[git_commit]
|
||||
tag_symbol = ''
|
||||
|
||||
[git_branch]
|
||||
symbol = ''
|
||||
|
||||
[git_status]
|
||||
format = '[$all_status$ahead_behind]($style)'
|
||||
ahead = '[↑${count}](green) '
|
||||
@@ -62,47 +51,13 @@ stashed = '[*${count}](green) '
|
||||
deleted = '[x${count}](red) '
|
||||
renamed = '[r${count}](yellow) '
|
||||
|
||||
[nix_shell]
|
||||
disabled = false
|
||||
format = '[nix](bold blue) '
|
||||
|
||||
[golang]
|
||||
symbol = 'go-'
|
||||
|
||||
[lua]
|
||||
symbol = 'lua-'
|
||||
|
||||
[nodejs]
|
||||
symbol = 'node-'
|
||||
|
||||
[python]
|
||||
symbol = 'py-'
|
||||
format = '[${symbol}(${version})]($style) '
|
||||
format = 'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
|
||||
python_binary = 'python'
|
||||
pyenv_version_name = false
|
||||
detect_files = ['.python-version']
|
||||
detect_files = [ '.python-version' ]
|
||||
|
||||
[rust]
|
||||
symbol = 'rs-'
|
||||
|
||||
[c]
|
||||
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) '
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
style = 'bold yellow'
|
||||
format = '[$hostname]($style) on '
|
||||
|
||||
@@ -8,7 +8,7 @@ set $right l
|
||||
|
||||
# programs
|
||||
set $term ghostty
|
||||
set $menu fuzzel
|
||||
set $menu wofi --show drun -iIG -w 2
|
||||
set $browser google-chrome-stable
|
||||
set $lockscreen swaylock
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
input "type:keyboard" {
|
||||
xkb_options "fkeys:basic_13-24"
|
||||
repeat_delay 150
|
||||
repeat_rate 35
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# sway
|
||||
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
|
||||
|
||||
# programs
|
||||
@@ -8,16 +8,9 @@ bindsym $mod+Return exec $term
|
||||
bindsym $mod+d exec $menu
|
||||
bindsym $mod+u exec $lockscreen
|
||||
bindsym $mod+Shift+Ctrl+Alt+space exec 1password --quick-access
|
||||
bindsym Print exec ~/.config/sway/scripts/screenshot.sh
|
||||
bindsym Print exec flameshot gui
|
||||
|
||||
# notifications
|
||||
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
|
||||
# programs'
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# 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+0 move container to workspace number 10
|
||||
|
||||
bindsym $mod+Ctrl+1 exec ~/.config/sway/scripts/ws-to-current.sh 1
|
||||
bindsym $mod+Ctrl+2 exec ~/.config/sway/scripts/ws-to-current.sh 2
|
||||
bindsym $mod+Ctrl+3 exec ~/.config/sway/scripts/ws-to-current.sh 3
|
||||
bindsym $mod+Ctrl+4 exec ~/.config/sway/scripts/ws-to-current.sh 4
|
||||
bindsym $mod+Ctrl+5 exec ~/.config/sway/scripts/ws-to-current.sh 5
|
||||
bindsym $mod+Ctrl+6 exec ~/.config/sway/scripts/ws-to-current.sh 6
|
||||
bindsym $mod+Ctrl+7 exec ~/.config/sway/scripts/ws-to-current.sh 7
|
||||
bindsym $mod+Ctrl+8 exec ~/.config/sway/scripts/ws-to-current.sh 8
|
||||
bindsym $mod+Ctrl+9 exec ~/.config/sway/scripts/ws-to-current.sh 9
|
||||
bindsym $mod+Ctrl+0 exec ~/.config/sway/scripts/ws-to-current.sh 10
|
||||
bindsym $mod+Ctrl+1 workspace number 1 output current
|
||||
bindsym $mod+Ctrl+2 workspace number 2 output current
|
||||
bindsym $mod+Ctrl+3 workspace number 3 output current
|
||||
bindsym $mod+Ctrl+4 workspace number 4 output current
|
||||
bindsym $mod+Ctrl+5 workspace number 5 output current
|
||||
bindsym $mod+Ctrl+6 workspace number 6 output current
|
||||
bindsym $mod+Ctrl+7 workspace number 7 output current
|
||||
bindsym $mod+Ctrl+8 workspace number 8 output current
|
||||
bindsym $mod+Ctrl+9 workspace number 9 output current
|
||||
bindsym $mod+Ctrl+0 workspace number 10 output current
|
||||
|
||||
# layout
|
||||
bindsym $mod+b splith
|
||||
@@ -87,12 +80,11 @@ bindsym $mod+Shift+minus move scratchpad
|
||||
bindsym $mod+minus scratchpad show
|
||||
|
||||
# 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 XF86AudioRaiseVolume exec pamixer -i 5 && pamixer --get-volume > $wobs
|
||||
bindsym --locked F16 exec pamixer --default-source -t
|
||||
|
||||
# xf86-brightness
|
||||
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
|
||||
# xf86-brightnes
|
||||
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||
# xf86-audio
|
||||
|
||||
@@ -2,24 +2,17 @@
|
||||
for_window [floating] border pixel $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
|
||||
assign [app_id="google-chrome"] workspace 2
|
||||
assign [app_id="thunderbird"] workspace 3
|
||||
assign [app_id="Cider"] workspace 4
|
||||
assign [app_id=".*BoltLauncher.*"] workspace 5
|
||||
assign [class=".*BoltLauncher.*"] 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="org.telegram.desktop"] workspace 8
|
||||
assign [app_id="Rocket.Chat"] workspace 8
|
||||
assign [class="Rocket.Chat"] workspace 8
|
||||
|
||||
# rules
|
||||
for_window [app_id="com.gabm.satty"] fullscreen enable
|
||||
for_window [class="net-runelite.*"] floating enable
|
||||
no_focus [class="net-runelite.*"]
|
||||
|
||||
# idle
|
||||
for_window [app_id=".*"] inhibit_idle fullscreen
|
||||
for_window [class=".*"] inhibit_idle fullscreen
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
# daemon
|
||||
exec mako
|
||||
# deamon
|
||||
exec swayidle -w
|
||||
exec wlsunset -l 46.1 -L 14.5
|
||||
exec pkill -x wob; rm -f $wobs && mkfifo $wobs && tail -f $wobs | wob
|
||||
exec wl-paste --watch cliphist store
|
||||
exec ~/.config/sway/scripts/power-aware-effects.sh
|
||||
exec rm -f $wobs \
|
||||
&& mkfifo $wobs \
|
||||
&& tail -f $wobs \
|
||||
| wob
|
||||
exec protonmail-bridge -n
|
||||
|
||||
# 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 thunderbird
|
||||
exec cider-2
|
||||
exec bolt-launcher
|
||||
exec discord
|
||||
exec vesktop
|
||||
exec slack
|
||||
exec Telegram
|
||||
exec rocketchat-desktop
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
output DP-7 resolution 2560x1440 position 2560,-1200
|
||||
output eDP-1 resolution 2560x1600@165Hz position 0,0 adaptive_sync on
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -1,4 +1,3 @@
|
||||
lock 'swaylock -f'
|
||||
timeout 300 'swaylock -f'
|
||||
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"'
|
||||
before-sleep 'swaylock -f'
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
ignore-empty-password
|
||||
show-failed-attempts
|
||||
|
||||
image=~/.assets/wallpaper.png
|
||||
image=~/.assets/lockscreen.png
|
||||
|
||||
clock
|
||||
datestr=%A, %d/%m/%y
|
||||
@@ -12,24 +9,23 @@ indicator-idle-visible
|
||||
indicator-y-position=300
|
||||
indicator-x-position=1200
|
||||
|
||||
# gruvbox-material-soft-dark
|
||||
inside-color=#32302f
|
||||
text-color=#d4be98
|
||||
ring-color=#928374
|
||||
inside-color=000000
|
||||
text-color=ffffff
|
||||
ring-color=ffffff
|
||||
|
||||
inside-ver-color=#32302f
|
||||
text-ver-color=#a9b665
|
||||
ring-ver-color=#a9b665
|
||||
inside-ver-color=000000
|
||||
text-ver-color=000000
|
||||
ring-ver-color=ffffff
|
||||
|
||||
inside-clear-color=#32302f
|
||||
text-clear-color=#d8a657
|
||||
ring-clear-color=#d8a657
|
||||
inside-clear-color=000000
|
||||
text-clear-color=ffffff
|
||||
ring-clear-color=ffffff
|
||||
|
||||
inside-wrong-color=#32302f
|
||||
text-wrong-color=#ea6962
|
||||
ring-wrong-color=#ea6962
|
||||
inside-wrong-color=000000
|
||||
text-wrong-color=ffffff
|
||||
ring-wrong-color=ffffff
|
||||
|
||||
key-hl-color=#7daea3
|
||||
bs-hl-color=#ea6962
|
||||
caps-lock-key-hl-color=#d8a657
|
||||
caps-lock-bs-hl-color=#ea6962
|
||||
key-hl-color=000000
|
||||
bs-hl-color=000000
|
||||
caps-lock-key-hl-color=000000
|
||||
caps-lock-bs-hl-color=000000
|
||||
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected=$1
|
||||
else
|
||||
@@ -10,7 +12,7 @@ if [[ -z $selected ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ggman clone "$selected"
|
||||
ggman clone $selected
|
||||
|
||||
echo ""
|
||||
read -p "press enter to continue..."
|
||||
@@ -6,6 +6,8 @@ if [[ -z ${NAME:+x} ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
|
||||
|
||||
read -p "name: " project_name
|
||||
|
||||
if [[ -z $project_name ]]; then
|
||||
@@ -17,16 +19,16 @@ if [[ -d "$GGROOT/no-remote/$project_name" ]]; then
|
||||
fi
|
||||
|
||||
project="$GGROOT/no-remote/$project_name"
|
||||
git init "$project"
|
||||
git init $project
|
||||
echo "# $project_name" >>"$project/README.md"
|
||||
|
||||
gitignore_template=$(
|
||||
find "$GGROOT"/github.com/github/gitignore/*.gitignore -exec basename {} \; \
|
||||
| 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"
|
||||
echo "$gitignore"
|
||||
echo "$project/.gitignore"
|
||||
@@ -36,11 +38,13 @@ fi
|
||||
license_template=$(
|
||||
find "$GGROOT"/git.janezic.dev/janezicmatej/license/*.license -exec basename {} \; \
|
||||
| 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"
|
||||
export YEAR="$(date '+%Y')"
|
||||
envsubst <"$license" >"$project/LICENSE"
|
||||
fi
|
||||
|
||||
ggcompile
|
||||
34
tmux/tmux-sessionizer
Executable file
34
tmux/tmux-sessionizer
Executable 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
77
tmux/tmux-ssher
Executable 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 "$@"
|
||||
@@ -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
|
||||
|
||||
# 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"
|
||||
|
||||
# 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-left-length 20
|
||||
|
||||
# window options
|
||||
set -wg mode-keys vi
|
||||
set -g pane-base-index 1
|
||||
set -g renumber-windows on
|
||||
|
||||
# prefix
|
||||
unbind C-b
|
||||
|
||||
# copy mode
|
||||
set-window-option -g mode-keys vi
|
||||
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 k select-pane -U
|
||||
bind j select-pane -D
|
||||
bind h select-pane -L
|
||||
bind l select-pane -R
|
||||
|
||||
# reload
|
||||
bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"
|
||||
|
||||
# sessionizer
|
||||
bind f run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer"
|
||||
bind R run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer ~"
|
||||
bind g run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer ~/.config"
|
||||
bind T run-shell "tmux neww ~/.config/tmux/scripts/tmux-sessionizer ~/temp"
|
||||
bind-key f run-shell "tmux neww ~/.config/tmux/tmux-sessionizer"
|
||||
bind-key R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~"
|
||||
bind-key g run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/.config"
|
||||
bind-key T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp"
|
||||
|
||||
# clone
|
||||
bind G run-shell "tmux neww ~/.config/tmux/scripts/tmux-ggclone"
|
||||
bind-key G run-shell "tmux neww ~/.config/tmux/tmux-ggclone"
|
||||
|
||||
# ssh
|
||||
bind F run-shell "tmux neww ~/.config/tmux/scripts/tmux-ssher"
|
||||
bind-key F run-shell "tmux neww ~/.config/tmux/tmux-ssher"
|
||||
|
||||
# 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"
|
||||
|
||||
@@ -1,142 +1,201 @@
|
||||
[
|
||||
{
|
||||
"layer": "top",
|
||||
"position": "top",
|
||||
"height": 30,
|
||||
"spacing": 1,
|
||||
"margin": 0,
|
||||
"modules-left": [
|
||||
"sway/workspaces",
|
||||
"sway/mode"
|
||||
],
|
||||
"modules-center": [
|
||||
"custom/ssh",
|
||||
"systemd-failed-units"
|
||||
],
|
||||
"modules-right": [
|
||||
"mpris",
|
||||
"cpu",
|
||||
"memory",
|
||||
"battery",
|
||||
"wireplumber",
|
||||
"custom/mic",
|
||||
"backlight",
|
||||
"sway/language",
|
||||
"bluetooth",
|
||||
"custom/network",
|
||||
"clock"
|
||||
],
|
||||
{
|
||||
"layer": "top",
|
||||
"position": "top",
|
||||
"height": 45,
|
||||
"spacing": 1,
|
||||
"margin": 0,
|
||||
"modules-left": [
|
||||
"clock",
|
||||
],
|
||||
"modules-center": [
|
||||
"sway/workspaces",
|
||||
"sway/mode",
|
||||
"sway/scratchpad",
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/cider",
|
||||
"pulseaudio",
|
||||
"network",
|
||||
"power-profiles-daemon",
|
||||
"cpu",
|
||||
"memory",
|
||||
"temperature",
|
||||
"backlight",
|
||||
"battery",
|
||||
"tray",
|
||||
"custom/notification"
|
||||
],
|
||||
// Modules configuration
|
||||
"sway/workspaces": {
|
||||
"disable-scroll": true,
|
||||
// "all-outputs": true,
|
||||
"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/workspaces": {
|
||||
"disable-scroll": true,
|
||||
"format": "{name}"
|
||||
},
|
||||
|
||||
"sway/mode": {
|
||||
"format": "{}"
|
||||
},
|
||||
|
||||
"sway/language": {
|
||||
"format": "{short}",
|
||||
"on-click": "swaymsg input type:keyboard xkb_switch_layout next"
|
||||
},
|
||||
|
||||
"custom/ssh": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"interval": 15,
|
||||
"exec": "~/.config/waybar/scripts/ssh-session.sh",
|
||||
"on-click": "~/.config/waybar/scripts/ssh-session.sh disconnect"
|
||||
},
|
||||
|
||||
"systemd-failed-units": {
|
||||
"hide-on-ok": true,
|
||||
"format": "!{nr_failed}",
|
||||
"format-ok": "",
|
||||
"system": true,
|
||||
"user": true,
|
||||
"on-click": "ghostty -e sh -c 'systemctl --failed; systemctl --user --failed; read'"
|
||||
},
|
||||
|
||||
"mpris": {
|
||||
"format": "{artist} - {title}",
|
||||
"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": {
|
||||
"format": " {usage}%",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"memory": {
|
||||
"interval": 10,
|
||||
"format": " {percentage}%",
|
||||
"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"
|
||||
},
|
||||
|
||||
"battery": {
|
||||
"states": {
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": " {capacity}%",
|
||||
"format-charging": " {capacity}%",
|
||||
"format-plugged": " {capacity}%",
|
||||
"format-full": " full",
|
||||
"format-alt": "{time}",
|
||||
"tooltip-format": "{timeTo}\n{power}W",
|
||||
"on-click": "p=$(powerprofilesctl get); case $p in power-saver) n=balanced;; balanced) n=performance;; *) n=power-saver;; esac; powerprofilesctl set $n"
|
||||
},
|
||||
|
||||
"wireplumber": {
|
||||
"format": " {volume}%",
|
||||
"format-muted": " muted",
|
||||
"on-click": "pamixer -t",
|
||||
"on-scroll-up": "pamixer -i 5",
|
||||
"on-scroll-down": "pamixer -d 5",
|
||||
"tooltip-format": "{node_name}: {volume}%"
|
||||
},
|
||||
|
||||
"custom/mic": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"interval": 2,
|
||||
"exec": "~/.config/waybar/scripts/mic-status.sh",
|
||||
"on-click": "pamixer --default-source -t",
|
||||
"on-scroll-up": "pamixer --default-source -i 5",
|
||||
"on-scroll-down": "pamixer --default-source -d 5"
|
||||
},
|
||||
|
||||
"backlight": {
|
||||
"format": " {percent}%",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"clock": {
|
||||
"interval": 1,
|
||||
"format": "{:%d/%m %H:%M:%S}",
|
||||
"tooltip-format": "<big><tt>{calendar}</tt></big>"
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
"sway/mode": {
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"sway/scratchpad": {
|
||||
"format": "{icon} {count}",
|
||||
"show-empty": false,
|
||||
"format-icons": ["", ""],
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{app}: {title}"
|
||||
},
|
||||
"custom/cider": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"max-length": 18,
|
||||
"interval": 1,
|
||||
"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",
|
||||
},
|
||||
"tray": {
|
||||
"icon-size": 18,
|
||||
"spacing": 10
|
||||
},
|
||||
"clock": {
|
||||
"interval": 1,
|
||||
"format": "{:%Y/%m/%d %H:%M:%S}",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
},
|
||||
"cpu": {
|
||||
"format": "cpu:{usage}%",
|
||||
"tooltip": false,
|
||||
"on-click": "ghostty -e htop"
|
||||
},
|
||||
"memory": {
|
||||
"interval": 10,
|
||||
"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",
|
||||
"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": {
|
||||
"states": {
|
||||
// "good": 95,
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "{capacity}% {icon}",
|
||||
"format-full": "{capacity}% {icon}",
|
||||
"format-charging": "{capacity}% ",
|
||||
"format-plugged": "{capacity}% ",
|
||||
"format-alt": "{time} {icon}",
|
||||
// "format-good": "", // An empty format will hide the module
|
||||
// "format-full": "",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
"power-profiles-daemon": {
|
||||
"format": "{icon}",
|
||||
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
|
||||
"tooltip": true,
|
||||
"format-icons": {
|
||||
"default": "",
|
||||
"performance": "",
|
||||
"balanced": "",
|
||||
"power-saver": ""
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||
"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",
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"spotify": "",
|
||||
"default": "🎜"
|
||||
},
|
||||
"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": {
|
||||
"format" : "⏻ ",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"custom/notification": {
|
||||
"tooltip": true,
|
||||
"format": "<span size='16pt'>{0} {icon} </span>",
|
||||
"format-icons": {
|
||||
"notification": "",
|
||||
"none": "",
|
||||
"dnd-notification": "",
|
||||
"dnd-none": "",
|
||||
"inhibited-notification": "",
|
||||
"inhibited-none": "",
|
||||
"dnd-inhibited-notification": "",
|
||||
"dnd-inhibited-none": ""
|
||||
},
|
||||
"return-type": "json",
|
||||
"exec-if": "which swaync-client",
|
||||
"exec": "swaync-client -swb",
|
||||
"on-click": "swaync-client -t -sw",
|
||||
"on-click-right": "swaync-client -d -sw",
|
||||
"escape": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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}'
|
||||
@@ -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
|
||||
379
waybar/style.css
379
waybar/style.css
@@ -1,37 +1,78 @@
|
||||
/* gruvbox-material-soft-dark palette
|
||||
* mapped from ghostty/themes/gruvbox-material-soft-dark
|
||||
* ansi 0=#252423 1=#ea6962 2=#a9b665 3=#d8a657
|
||||
* 4=#7daea3 5=#d3869b 6=#89b482 7=#d4be98
|
||||
* bg=#32302f fg=#d4be98 selection=#45403d */
|
||||
@define-color bg #32302f;
|
||||
@define-color bg_dim #252423;
|
||||
@define-color bg_sel #45403d;
|
||||
@define-color fg #d4be98;
|
||||
@define-color red #ea6962;
|
||||
@define-color green #a9b665;
|
||||
@define-color yellow #d8a657;
|
||||
@define-color blue #7daea3;
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Gruvbox Material Dark Palette
|
||||
* ----------------------------------------------------------------------------- */
|
||||
@define-color background #282828;
|
||||
@define-color background-light #3c3836;
|
||||
@define-color foreground #d4be98;
|
||||
@define-color black #1d2021;
|
||||
@define-color gray #928374;
|
||||
@define-color red #ea6962;
|
||||
@define-color green #a9b665;
|
||||
@define-color yellow #d8a657;
|
||||
@define-color blue #7daea3;
|
||||
@define-color magenta #d3869b;
|
||||
@define-color cyan #89b482;
|
||||
@define-color gray #928374;
|
||||
@define-color cyan #89b482;
|
||||
@define-color white #ddc7a1;
|
||||
@define-color orange #e78a4e;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Module Colors (Neovim/Muted Style)
|
||||
* ----------------------------------------------------------------------------- */
|
||||
@define-color workspaces-color @gray;
|
||||
@define-color workspaces-focused-bg @background-light;
|
||||
@define-color workspaces-focused-fg @foreground;
|
||||
@define-color workspaces-urgent-bg @red;
|
||||
@define-color workspaces-urgent-fg @background;
|
||||
|
||||
@define-color cider-color @red;
|
||||
@define-color clock-color @foreground;
|
||||
@define-color pulseaudio-color @blue;
|
||||
@define-color pulseaudio-muted-color @gray;
|
||||
@define-color network-color @magenta;
|
||||
@define-color network-disconnected-color @red;
|
||||
@define-color cpu-color @orange;
|
||||
@define-color memory-color @cyan;
|
||||
@define-color temperature-color @yellow;
|
||||
@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;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Global Setup
|
||||
* ----------------------------------------------------------------------------- */
|
||||
* {
|
||||
font-family: "JetBrainsMono Nerd Font";
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* bar: dark background, modules float inside */
|
||||
window#waybar {
|
||||
background-color: @bg_dim;
|
||||
color: @fg;
|
||||
min-height: 30px;
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
transition-property: background-color;
|
||||
transition-duration: .5s;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/* This targets every module */
|
||||
#waybar .module {
|
||||
background-color: #1e1e2e; /* Your desired module color */
|
||||
border-radius: 7px;
|
||||
border: 2px solid #d4be98;
|
||||
}
|
||||
|
||||
/* Specific grouping (Optional: if you want modules to stick together in islands) */
|
||||
.modules-left, .modules-center, .modules-right {
|
||||
background: transparent;
|
||||
margin: 12px 10px 5px 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
@@ -43,148 +84,99 @@ button:hover {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* workspaces */
|
||||
#workspaces {
|
||||
background-color: @bg;
|
||||
border-radius: 8px;
|
||||
margin: 3px 2px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Workspaces
|
||||
* ----------------------------------------------------------------------------- */
|
||||
#workspaces button {
|
||||
padding: 0 8px;
|
||||
background-color: transparent;
|
||||
color: @gray;
|
||||
color: @workspaces-color;
|
||||
margin: 0;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background-color: @bg_sel;
|
||||
color: @fg;
|
||||
background: @background-light;
|
||||
color: @foreground;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* The "Neovim Buffer" Look:
|
||||
Active workspace is lighter background + cream text.
|
||||
No flashy underlines. */
|
||||
#workspaces button.focused {
|
||||
background-color: @bg_sel;
|
||||
color: @fg;
|
||||
background-color: @background-light;
|
||||
color: @workspaces-focused-fg;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background-color: @red;
|
||||
color: @bg_dim;
|
||||
background-color: @workspaces-urgent-bg;
|
||||
color: @workspaces-urgent-fg;
|
||||
}
|
||||
|
||||
/* floating pill style for all modules */
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Modules
|
||||
* ----------------------------------------------------------------------------- */
|
||||
#mode,
|
||||
#clock,
|
||||
#battery,
|
||||
#cpu,
|
||||
#memory,
|
||||
#disk,
|
||||
#temperature,
|
||||
#backlight,
|
||||
#network,
|
||||
#pulseaudio,
|
||||
#wireplumber,
|
||||
#mpris,
|
||||
#bluetooth,
|
||||
#language,
|
||||
#custom-mic,
|
||||
#custom-network,
|
||||
#custom-ssh,
|
||||
#custom-notification,
|
||||
#systemd-failed-units {
|
||||
background-color: @bg;
|
||||
border-radius: 8px;
|
||||
color: @fg;
|
||||
#custom-media,
|
||||
#tray,
|
||||
#idle_inhibitor,
|
||||
#scratchpad,
|
||||
#power-profiles-daemon,
|
||||
#mpd,
|
||||
#custom-cider {
|
||||
color: @clock-color;
|
||||
font-weight: bold;
|
||||
padding: 0 10px;
|
||||
margin: 3px 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;
|
||||
margin: 0 2px;
|
||||
background-color: transparent;
|
||||
color: @green;
|
||||
border: none; /* Removed the underlines for a cleaner look */
|
||||
}
|
||||
|
||||
#mpris.playing {
|
||||
padding: 0 10px;
|
||||
margin: 3px 2px;
|
||||
background-color: @bg;
|
||||
#window,
|
||||
#workspaces {
|
||||
margin: 0 4px;
|
||||
}
|
||||
|
||||
#mpris.paused {
|
||||
padding: 0 10px;
|
||||
margin: 3px 2px;
|
||||
background-color: @bg;
|
||||
color: @gray;
|
||||
.modules-left > widget:first-child > #workspaces { margin-left: 0; }
|
||||
.modules-right > widget:last-child > #workspaces { margin-right: 0; }
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Module Specifics
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#battery {
|
||||
color: @battery-color;
|
||||
}
|
||||
|
||||
/* right: connectivity */
|
||||
#custom-network.disconnected {
|
||||
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.charging, #battery.plugged {
|
||||
color: @battery-charging-color;
|
||||
}
|
||||
|
||||
#battery.warning:not(.charging) {
|
||||
color: @yellow;
|
||||
color: @battery-warning-color;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
background-color: @red;
|
||||
color: @bg_dim;
|
||||
color: @background;
|
||||
}
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
color: @red;
|
||||
color: @battery-critical-color;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: steps(12);
|
||||
@@ -192,40 +184,147 @@ button:hover {
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
/* right: audio */
|
||||
#wireplumber.muted {
|
||||
/* #cpu { */
|
||||
/* 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;
|
||||
}
|
||||
|
||||
#custom-mic.muted {
|
||||
#idle_inhibitor {
|
||||
color: @gray;
|
||||
}
|
||||
|
||||
#idle_inhibitor.activated {
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
#mpd {
|
||||
color: @green;
|
||||
}
|
||||
|
||||
#mpd.disconnected {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
/* right: audio group (volume + mic + brightness) */
|
||||
#wireplumber {
|
||||
margin-right: 0;
|
||||
border-radius: 8px 0 0 8px;
|
||||
#mpd.stopped {
|
||||
color: @gray;
|
||||
}
|
||||
|
||||
#custom-mic {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
border-radius: 0;
|
||||
#mpd.paused {
|
||||
color: @blue;
|
||||
}
|
||||
|
||||
#backlight {
|
||||
margin-left: 0;
|
||||
border-radius: 0 8px 8px 0;
|
||||
#language {
|
||||
background: @background-light;
|
||||
color: @foreground;
|
||||
padding: 0 5px;
|
||||
margin: 0 5px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
/* right: clock */
|
||||
#clock {
|
||||
color: @fg;
|
||||
#keyboard-state {
|
||||
color: @foreground;
|
||||
padding: 0 0px;
|
||||
margin: 0 5px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
/* mode highlight */
|
||||
#mode {
|
||||
color: @bg_dim;
|
||||
background-color: @yellow;
|
||||
padding: 0 10px;
|
||||
#keyboard-state > label.locked {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
/* #custom-cider { */
|
||||
/* color: @cider-color; */
|
||||
/* } */
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
path=(
|
||||
"$HOME/.local/bin"
|
||||
"$GOPATH/bin"
|
||||
$path
|
||||
)
|
||||
export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/neovim/bin:$HOME/bin:${PATH}"
|
||||
|
||||
|
||||
11
zsh/.zsh_plugins.txt
Normal file
11
zsh/.zsh_plugins.txt
Normal 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
|
||||
1
zsh/.zsh_plugins_darwin.txt
Normal file
1
zsh/.zsh_plugins_darwin.txt
Normal file
@@ -0,0 +1 @@
|
||||
lukechilds/zsh-nvm
|
||||
55
zsh/.zshenv
55
zsh/.zshenv
@@ -4,8 +4,22 @@ export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
export XDG_STATE_HOME="$HOME/.local/state"
|
||||
|
||||
# deduplicate path
|
||||
typeset -U path
|
||||
# ~/.local/bin
|
||||
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
|
||||
export EDITOR=nvim
|
||||
@@ -13,24 +27,35 @@ export EDITOR=nvim
|
||||
# go
|
||||
export GOPATH="$XDG_DATA_HOME/go"
|
||||
export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
|
||||
# ggman
|
||||
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
|
||||
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"
|
||||
|
||||
# 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"
|
||||
|
||||
115
zsh/.zshrc
115
zsh/.zshrc
@@ -1,101 +1,46 @@
|
||||
# shell options
|
||||
bindkey -e # emacs line editing
|
||||
unsetopt autocd # don't cd into directories by name
|
||||
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 (#, ~, ^)
|
||||
# zsh history file
|
||||
export HISTFILE="$XDG_STATE_HOME/zsh/history"
|
||||
export HISTSIZE=100
|
||||
|
||||
# history
|
||||
HISTFILE="$XDG_STATE_HOME/zsh/history"
|
||||
mkdir -p "${HISTFILE:h}"
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
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
|
||||
## pre plugin load
|
||||
# nvm
|
||||
export NVM_COMPLETION=true
|
||||
# zsh autosugestions
|
||||
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
|
||||
|
||||
# -- plugins --
|
||||
# auto-cloned on first launch, auto-updated weekly in background
|
||||
PLUGIN_DIR="$XDG_DATA_HOME/zsh/plugins"
|
||||
_plugin_stamp="$XDG_CACHE_HOME/zsh/plugins-updated"
|
||||
_plugin_needs_update=0
|
||||
# source antidote
|
||||
source $ZDOTDIR/.antidote/antidote.zsh
|
||||
antidote load
|
||||
|
||||
# check if a week (168h) has passed since last update
|
||||
if [[ ! -f "$_plugin_stamp" ]] || [[ -n $_plugin_stamp(#qN.mh+168) ]]; then
|
||||
mkdir -p "${_plugin_stamp:h}"
|
||||
touch "$_plugin_stamp"
|
||||
_plugin_needs_update=1
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
antidote load ${ZDOTDIR:-~}/.zsh_plugins_darwin.txt
|
||||
fi
|
||||
|
||||
function ensure_plugin() {
|
||||
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
|
||||
}
|
||||
unsetopt autocd
|
||||
|
||||
ensure_plugin zsh-users/zsh-completions
|
||||
ensure_plugin zsh-users/zsh-autosuggestions
|
||||
ensure_plugin romkatv/zsh-no-ps2
|
||||
(( _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
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
eval "$(pyenv init - zsh)"
|
||||
eval "$(pyenv virtualenv-init - zsh)"
|
||||
fi
|
||||
|
||||
# key bindings
|
||||
[[ -n "${terminfo[kcuu1]}" ]] && bindkey -- "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
[[ -n "${terminfo[kcud1]}" ]] && bindkey -- "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
[[ -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
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||
fi
|
||||
|
||||
# aliases and functions
|
||||
# ggman
|
||||
eval "$(ggman shellrc)"
|
||||
|
||||
# custom functions and aliases
|
||||
source "$ZDOTDIR/aliases.zsh"
|
||||
source "$ZDOTDIR/scripts.zsh"
|
||||
|
||||
# completion
|
||||
fpath=("$XDG_DATA_HOME/zsh/completions" $fpath)
|
||||
fpath=($ZDOTDIR/completions $fpath)
|
||||
autoload -Uz compinit
|
||||
# only regenerate dump once per day
|
||||
local _zcompdump="$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION"
|
||||
if [[ -n $_zcompdump(#qN.mh+24) ]]; then
|
||||
compinit -d "$_zcompdump"
|
||||
else
|
||||
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}'
|
||||
compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
|
||||
zstyle ':completion:*' cache-path $XDG_CACHE_HOME/zsh/zcompcache
|
||||
|
||||
# opam configuration
|
||||
# [[ ! -r /Users/janezicmatej/.opam/opam-init/init.zsh ]] || source /Users/janezicmatej/.opam/opam-init/init.zsh > /dev/null 2> /dev/null
|
||||
|
||||
# tool hooks
|
||||
eval "$(ggman shellrc)"
|
||||
eval "$(starship init zsh)"
|
||||
eval "$(direnv hook zsh)"
|
||||
|
||||
# gnupg
|
||||
export GPG_TTY=$(tty)
|
||||
|
||||
@@ -1,74 +1,41 @@
|
||||
alias z="exec zsh"
|
||||
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
|
||||
alias dp="docker ps --format 'table {{.Names}}\t{{.Ports}}'"
|
||||
alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'"
|
||||
|
||||
# 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
|
||||
alias gst="git status"
|
||||
alias gd="git diff"
|
||||
alias gds="git diff --staged"
|
||||
alias gdup="git diff @{upstream}"
|
||||
alias glog="git log --oneline --decorate --graph"
|
||||
alias gloga="git log --oneline --decorate --graph --all"
|
||||
# apple specific
|
||||
alias accenton="defaults write -g ApplePressAndHoldEnabled -bool true"
|
||||
alias accentoff="defaults write -g ApplePressAndHoldEnabled -bool false"
|
||||
|
||||
# git
|
||||
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\""
|
||||
|
||||
# git staging/commit
|
||||
alias ga="git add"
|
||||
alias gc="git commit -v"
|
||||
alias gc!="git commit -v --amend"
|
||||
alias gcan="git commit -v --amend --no-edit"
|
||||
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 .)"'
|
||||
# unsorted
|
||||
alias ci="glab ci list"
|
||||
alias bm=batman
|
||||
alias grow="~/.local/bin/cbonsai -liWC -M 15 -t 2 -w 60 -s $(date +%s)"
|
||||
alias clean_ds_store='find . -name ".DS_Store" -type f -delete -print'
|
||||
|
||||
# ruff
|
||||
alias ruffme="ruff check --fix && ruff format"
|
||||
|
||||
# clipboard
|
||||
alias xcp="xclip -selection c"
|
||||
|
||||
0
zsh/completions/.keep
Normal file
0
zsh/completions/.keep
Normal file
51
zsh/get-dump
Executable file
51
zsh/get-dump
Executable 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 "$@"
|
||||
@@ -1,32 +1,94 @@
|
||||
# git helpers for aliases
|
||||
function git_current_branch {
|
||||
command git rev-parse --abbrev-ref HEAD 2>/dev/null
|
||||
function nvim_ve {
|
||||
if [[ -e $VIRTUAL_ENV && -f "$VIRTUAL_ENV/bin/activate" ]]; then
|
||||
source "$VIRTUAL_ENV/bin/activate"
|
||||
command nvim $@
|
||||
deactivate
|
||||
else
|
||||
command nvim $@
|
||||
fi
|
||||
}
|
||||
|
||||
function git_main_branch {
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
local ref
|
||||
for ref in refs/{heads,remotes/{origin,upstream}}/{main,master,trunk}; do
|
||||
if command git show-ref -q --verify "$ref"; then
|
||||
echo ${ref:t}
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo main
|
||||
function afm {
|
||||
RES=$(curl -s "https://$1/api/monitoring/requirements")
|
||||
COUNT=$(echo "$RES" | grep -c $2)
|
||||
if [[ $COUNT -ge 0 ]]; then
|
||||
VER=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).version')
|
||||
# OP=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).requirement?[0][0]')
|
||||
# echo "$2""$(echo "$OP" | tr -d '"')""$(echo "$VER" | tr -d '"')"
|
||||
echo "${2}==$(echo "$VER" | tr -d '"')"
|
||||
fi
|
||||
}
|
||||
|
||||
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 {
|
||||
local tmux_running
|
||||
tmux_running=$(pgrep tmux)
|
||||
|
||||
if [[ -n ${TMUX} ]]; then
|
||||
if ! [[ -z ${TMUX} ]]; then
|
||||
echo "already attached; refreshing env"
|
||||
source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p')
|
||||
return 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -z $tmux_running ]]; then
|
||||
~/.config/tmux/scripts/tmux-sessionizer ~
|
||||
~/.config/tmux/tmux-sessionizer ~
|
||||
else
|
||||
tmux a
|
||||
fi
|
||||
|
||||
75
zsh/ssh-menu
Executable file
75
zsh/ssh-menu
Executable 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
|
||||
Reference in New Issue
Block a user