Compare commits
39 Commits
a1b422e29e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
a41d24ab47
|
|||
|
5c8f94abd6
|
|||
|
58e9f2cc91
|
|||
|
654916042a
|
|||
|
bd1c560b03
|
|||
|
5091854f84
|
|||
|
63358a8f89
|
|||
|
54deab7cab
|
|||
|
af1fe008a1
|
|||
|
00ba9863bc
|
|||
|
374d4a6100
|
|||
|
ce2181f9c2
|
|||
|
621572a3db
|
|||
|
73eaef8411
|
|||
|
3aa8bd8ff1
|
|||
|
e65c556cc5
|
|||
|
360afecb75
|
|||
|
5fb9b3618b
|
|||
|
41fb0c639a
|
|||
|
4b17d5db2d
|
|||
|
cf85fb6372
|
|||
|
475c183ff7
|
|||
|
f39f21b624
|
|||
|
afef09e9a8
|
|||
|
290ed36719
|
|||
|
5fbc0bca6b
|
|||
|
6120bd900f
|
|||
|
71fa00e26b
|
|||
|
1507b0c3c4
|
|||
|
9837828c72
|
|||
|
dbc860d89d
|
|||
|
5cc4dac594
|
|||
|
5de5edca67
|
|||
|
875ee44e7c
|
|||
|
781edd5bf2
|
|||
|
90c71a0316
|
|||
|
d7f8b52c98
|
|||
|
a9fe95254a
|
|||
|
0cadba2ad4
|
33
.gitignore
vendored
33
.gitignore
vendored
@@ -8,7 +8,6 @@
|
||||
|
||||
# allow some stuff to be pushed
|
||||
!alacritty
|
||||
!nvim
|
||||
!.pyenv
|
||||
|
||||
# zsh
|
||||
@@ -17,15 +16,23 @@ zsh/*
|
||||
!zsh/.zshrc
|
||||
!zsh/.zshenv
|
||||
!zsh/.zprofile
|
||||
!zsh/.zsh_plugins*.txt
|
||||
!zsh/scripts.zsh
|
||||
!zsh/aliases.zsh
|
||||
!zsh/completions/.keep
|
||||
!zsh/.p10k.zsh
|
||||
!zsh/ssh-menu
|
||||
!zsh/get-dump
|
||||
|
||||
# starship
|
||||
!starship
|
||||
starship/*
|
||||
!starship/config.toml
|
||||
|
||||
# tmux
|
||||
!tmux
|
||||
tmux/*
|
||||
!tmux/tmux.conf
|
||||
!tmux/tmux-new-project
|
||||
!tmux/tmux-sessionizer
|
||||
!tmux/tmux-ggclone
|
||||
!tmux/tmux-ssher
|
||||
@@ -34,5 +41,25 @@ tmux/*
|
||||
!git
|
||||
git/*
|
||||
!git/config
|
||||
!git/gitignore
|
||||
!git/ignore
|
||||
!git/aflabs
|
||||
|
||||
# ghostty
|
||||
!ghostty
|
||||
ghostty/*
|
||||
!ghostty/config
|
||||
!ghostty/themes
|
||||
|
||||
# sway
|
||||
!sway
|
||||
sway/*
|
||||
!sway/config
|
||||
!sway/config.d
|
||||
|
||||
!swaylock
|
||||
swaylock/*
|
||||
!swaylock/config
|
||||
|
||||
!swayidle
|
||||
swayidle/*
|
||||
!swayidle/config
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "nvim"]
|
||||
path = nvim
|
||||
url = git@git.janezic.dev:janezicmatej/nvim.git
|
||||
@@ -75,6 +75,7 @@ history = 10000
|
||||
|
||||
[window]
|
||||
dynamic_title = true
|
||||
option_as_alt = "Both"
|
||||
|
||||
[window.dimensions]
|
||||
columns = 150
|
||||
|
||||
46
ghostty/config
Normal file
46
ghostty/config
Normal file
@@ -0,0 +1,46 @@
|
||||
# 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
|
||||
mouse-hide-while-typing = true
|
||||
|
||||
# font stuff
|
||||
font-family = JetBrainsMono Nerd Font
|
||||
font-size = 15
|
||||
|
||||
# disable ligatures
|
||||
font-feature=-calt
|
||||
font-feature=-liga
|
||||
font-feature=-dlig
|
||||
|
||||
# window
|
||||
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
|
||||
|
||||
# paste protection
|
||||
clipboard-paste-protection = false
|
||||
21
ghostty/themes/gruvbox-material-soft-dark
Normal file
21
ghostty/themes/gruvbox-material-soft-dark
Normal file
@@ -0,0 +1,21 @@
|
||||
palette = 0=252423
|
||||
palette = 1=#ea6962
|
||||
palette = 2=#a9b665
|
||||
palette = 3=#d8a657
|
||||
palette = 4=#7daea3
|
||||
palette = 5=#d3869b
|
||||
palette = 6=#89b482
|
||||
palette = 7=#d4be98
|
||||
palette = 8=#32302f
|
||||
palette = 9=#ea6962
|
||||
palette = 10=#a9b665
|
||||
palette = 11=#d8a657
|
||||
palette = 12=#7daea3
|
||||
palette = 13=#d3869b
|
||||
palette = 14=#89b482
|
||||
palette = 15=#d4be98
|
||||
background = #32302f
|
||||
foreground = #d4be98
|
||||
cursor-color = #d4be98
|
||||
selection-background = #45403d
|
||||
selection-foreground = #d4be98
|
||||
21
ghostty/themes/gruvbox-material-soft-light
Normal file
21
ghostty/themes/gruvbox-material-soft-light
Normal file
@@ -0,0 +1,21 @@
|
||||
palette = 0=#ebdbb2
|
||||
palette = 1=#c14a4a
|
||||
palette = 2=#6c782e
|
||||
palette = 3=#b47109
|
||||
palette = 4=#45707a
|
||||
palette = 5=#945e80
|
||||
palette = 6=#4c7a5d
|
||||
palette = 7=#654735
|
||||
palette = 8=#f3eac7
|
||||
palette = 9=#c14a4a
|
||||
palette = 10=#6c782e
|
||||
palette = 11=#b47109
|
||||
palette = 12=#45707a
|
||||
palette = 13=#945e80
|
||||
palette = 14=#4c7a5d
|
||||
palette = 15=#654735
|
||||
background = #f2e5bc
|
||||
foreground = #654735
|
||||
cursor-color = #654735
|
||||
selection-background = #ebdbb2
|
||||
selection-foreground = #654735
|
||||
@@ -1,3 +0,0 @@
|
||||
[user]
|
||||
name = Matej Janežič
|
||||
email = matej.janezic@aflabs.si
|
||||
58
git/config
58
git/config
@@ -1,16 +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/aflabs.conf
|
||||
|
||||
[includeIf "gitdir:~/Desktop/git/gitlab.com/flare-foundation"]
|
||||
path = ~/.config/git/flare
|
||||
|
||||
[user]
|
||||
name = Matej Janežič
|
||||
email = janezic.mj@gmail.com
|
||||
|
||||
[core]
|
||||
autocrlf = input
|
||||
excludesfile = ~/.config/git/gitignore
|
||||
editor = nvim
|
||||
[init]
|
||||
defaultBranch = master
|
||||
[include]
|
||||
path = ~/.config/git/alias
|
||||
[include]
|
||||
path = ~/.config/git/commitsign
|
||||
[includeIf "gitdir:~/Desktop/git/git.aflabs.org/"]
|
||||
path = ~/.config/git/aflabs
|
||||
|
||||
[user]
|
||||
signingkey = AF349EECC849D87B790E88FF6318FFB7DB374B7D
|
||||
|
||||
[commit]
|
||||
gpgsign = true
|
||||
|
||||
; NOTE:(@janezicmatej) github/gitlab don't support these
|
||||
; [push]
|
||||
; gpgsign = true
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[alias]
|
||||
blame = "!f() { [ -f .git-blame-ignore-revs ] && git blame --ignore-revs-file .git-blame-ignore-revs \"$@\" || git blame \"$@\"; }; f"
|
||||
|
||||
[diff]
|
||||
tool = "nvimdiff"
|
||||
|
||||
[difftool]
|
||||
prompt = true
|
||||
|
||||
[difftool "nvimdiff"]
|
||||
cmd = nvim -d "$LOCAL" "$REMOTE"
|
||||
|
||||
[maintenance]
|
||||
auto = true
|
||||
strategy = incremental
|
||||
|
||||
[merge]
|
||||
tool = "nvimdiff"
|
||||
|
||||
[mergetool]
|
||||
prompt = true
|
||||
keepBackup = false
|
||||
writeToTemp = true
|
||||
|
||||
[mergetool "nvimdiff"]
|
||||
layout = "LOCAL,BASE,REMOTE / MERGED"
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
# mac files
|
||||
.DS_Store
|
||||
|
||||
# i usually make test.* files for local testing
|
||||
# test.*
|
||||
# test
|
||||
|
||||
# i don't like pushing .vscode and .idea folders, i will force add if needed
|
||||
.vscode
|
||||
.idea
|
||||
@@ -12,6 +8,10 @@
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# nix venv hook
|
||||
.nix-venv
|
||||
.dev
|
||||
|
||||
# i use .ignore for nvim
|
||||
.ignore
|
||||
|
||||
1
nvim
1
nvim
Submodule nvim deleted from b087eaa1ef
63
starship/config.toml
Normal file
63
starship/config.toml
Normal file
@@ -0,0 +1,63 @@
|
||||
add_newline = false
|
||||
|
||||
format = """\
|
||||
$hostname\
|
||||
[$directory](cyan)\
|
||||
$git_branch\
|
||||
$git_commit\
|
||||
$git_state\
|
||||
$git_status\
|
||||
$character\
|
||||
"""
|
||||
|
||||
right_format = """\
|
||||
$nix_shell\
|
||||
$golang\
|
||||
$lua\
|
||||
$nodejs\
|
||||
$python\
|
||||
$rust\
|
||||
$cmd_duration\
|
||||
"""
|
||||
|
||||
[nix_shell]
|
||||
disabled = false
|
||||
format = '[n(\($name\))](bold blue) '
|
||||
|
||||
[character]
|
||||
success_symbol = '[>](bold green)'
|
||||
error_symbol = '[>](bold red)'
|
||||
|
||||
[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) '
|
||||
diverged = '[↑${ahead_count}↓${behind_count}](red) '
|
||||
behind = '[↓${count}](green) '
|
||||
modified = '[!${count}](yellow) '
|
||||
untracked = '[?${count}](blue) '
|
||||
staged = '[+${count}](yellow) '
|
||||
stashed = '[*${count}](green) '
|
||||
deleted = '[x${count}](red) '
|
||||
renamed = '[r${count}](yellow) '
|
||||
|
||||
[python]
|
||||
format = 'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
|
||||
python_binary = 'python'
|
||||
pyenv_version_name = false
|
||||
detect_files = [ '.python-version' ]
|
||||
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
style = 'bold yellow'
|
||||
format = '[$hostname]($style) on '
|
||||
201
sway/config
Normal file
201
sway/config
Normal file
@@ -0,0 +1,201 @@
|
||||
include config.d/*
|
||||
|
||||
### Output configuration
|
||||
#
|
||||
# Default wallpaper (more resolutions are available in /run/current-system/sw/share/backgrounds/sway/)
|
||||
output * bg ~/.assets/wallpaper.png fill
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# output HDMI-A-1 resolution 1920x1080 position 1920,0
|
||||
#
|
||||
# You can get the names of your outputs by running: swaymsg -t get_outputs
|
||||
|
||||
### Idle configuration
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
set $wobs /tmp/wob.sock
|
||||
exec rm -f $wobs && mkfifo $wobs && tail -f $wobs | wob
|
||||
exec swayidle -w
|
||||
# This will lock your screen after 300 seconds of inactivity, then turn off
|
||||
# your displays after another 300 seconds, and turn your screens back on when
|
||||
# resumed. It will also lock your screen before your computer goes to sleep.
|
||||
|
||||
### Input configuration
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# input type:touchpad {
|
||||
# dwt enabled
|
||||
# tap enabled
|
||||
# natural_scroll enabled
|
||||
# middle_emulation enabled
|
||||
# }
|
||||
#
|
||||
# input type:keyboard {
|
||||
# xkb_layout "eu"
|
||||
# }
|
||||
#
|
||||
# You can also configure each device individually.
|
||||
# Read `man 5 sway-input` for more information about this section.
|
||||
|
||||
### Key bindings
|
||||
#
|
||||
# Basics:
|
||||
#
|
||||
# Start a terminal
|
||||
|
||||
# Kill focused window
|
||||
|
||||
# Start your launcher
|
||||
|
||||
# Drag floating windows by holding down $mod and left mouse button.
|
||||
# Resize them with right mouse button + $mod.
|
||||
# Despite the name, also works for non-floating windows.
|
||||
# Change normal to inverse to use left mouse button for resizing and right
|
||||
# mouse button for dragging.
|
||||
floating_modifier $mod normal
|
||||
|
||||
# Reload the configuration file
|
||||
|
||||
# Exit sway (logs you out of your Wayland session)
|
||||
#
|
||||
# Moving around:
|
||||
#
|
||||
# Move your focus around
|
||||
bindsym $mod+$left focus left
|
||||
bindsym $mod+$down focus down
|
||||
bindsym $mod+$up focus up
|
||||
bindsym $mod+$right focus right
|
||||
|
||||
# Move the focused window with the same, but add Shift
|
||||
bindsym $mod+Shift+$left move left
|
||||
bindsym $mod+Shift+$down move down
|
||||
bindsym $mod+Shift+$up move up
|
||||
bindsym $mod+Shift+$right move right
|
||||
#
|
||||
# Workspaces:
|
||||
#
|
||||
# Switch to workspace
|
||||
bindsym $mod+1 workspace number 1
|
||||
bindsym $mod+2 workspace number 2
|
||||
bindsym $mod+3 workspace number 3
|
||||
bindsym $mod+4 workspace number 4
|
||||
bindsym $mod+5 workspace number 5
|
||||
bindsym $mod+6 workspace number 6
|
||||
bindsym $mod+7 workspace number 7
|
||||
bindsym $mod+8 workspace number 8
|
||||
bindsym $mod+9 workspace number 9
|
||||
bindsym $mod+0 workspace number 10
|
||||
# Move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number 1
|
||||
bindsym $mod+Shift+2 move container to workspace number 2
|
||||
bindsym $mod+Shift+3 move container to workspace number 3
|
||||
bindsym $mod+Shift+4 move container to workspace number 4
|
||||
bindsym $mod+Shift+5 move container to workspace number 5
|
||||
bindsym $mod+Shift+6 move container to workspace number 6
|
||||
bindsym $mod+Shift+7 move container to workspace number 7
|
||||
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
|
||||
# Note: workspaces can have any name you want, not just numbers.
|
||||
# We just use 1-10 as the default.
|
||||
#
|
||||
# Layout stuff:
|
||||
#
|
||||
# You can "split" the current object of your focus with
|
||||
# $mod+b or $mod+v, for horizontal and vertical splits
|
||||
# respectively.
|
||||
bindsym $mod+b splith
|
||||
bindsym $mod+v splitv
|
||||
|
||||
# Switch the current container between different layout styles
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# Make the current focus fullscreen
|
||||
bindsym $mod+f fullscreen
|
||||
|
||||
# Toggle the current focus between tiling and floating mode
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# Swap focus between the tiling area and the floating area
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# Move focus to the parent container
|
||||
bindsym $mod+a focus parent
|
||||
#
|
||||
# Scratchpad:
|
||||
#
|
||||
# Sway has a "scratchpad", which is a bag of holding for windows.
|
||||
# You can send windows there and get them back later.
|
||||
|
||||
# Move the currently focused window to the scratchpad
|
||||
bindsym $mod+Shift+minus move scratchpad
|
||||
|
||||
# Show the next scratchpad window or hide the focused scratchpad window.
|
||||
# If there are multiple scratchpad windows, this command cycles through them.
|
||||
bindsym $mod+minus scratchpad show
|
||||
#
|
||||
# Resizing containers:
|
||||
#
|
||||
mode "resize" {
|
||||
# left will shrink the containers width
|
||||
# right will grow the containers width
|
||||
# up will shrink the containers height
|
||||
# down will grow the containers height
|
||||
bindsym $left resize shrink width 10px
|
||||
bindsym $down resize grow height 10px
|
||||
bindsym $up resize shrink height 10px
|
||||
bindsym $right resize grow width 10px
|
||||
|
||||
# Ditto, with arrow keys
|
||||
bindsym Left resize shrink width 10px
|
||||
bindsym Down resize grow height 10px
|
||||
bindsym Up resize shrink height 10px
|
||||
bindsym Right resize grow width 10px
|
||||
|
||||
# Return to default mode
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
bindsym $mod+r mode "resize"
|
||||
#
|
||||
# Utilities:
|
||||
#
|
||||
# Special keys to adjust volume via PulseAudio
|
||||
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 XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
|
||||
# Special keys to adjust brightness via brightnessctl
|
||||
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||
# Special key to take a screenshot with grim
|
||||
|
||||
bindsym --locked XF86AudioNext exec playerctl next
|
||||
bindsym --locked XF86AudioPause exec playerctl play-pause
|
||||
bindsym --locked XF86AudioPlay exec playerctl play-pause
|
||||
bindsym --locked XF86AudioPrev exec playerctl previous
|
||||
|
||||
#
|
||||
# Status Bar:
|
||||
#
|
||||
# Read `man 5 sway-bar` for more information about this section.
|
||||
bar {
|
||||
position top
|
||||
|
||||
# When the status_command prints a new line to stdout, swaybar updates.
|
||||
# The default just shows the current date and time.
|
||||
status_command while date +'%Y-%m-%d %X'; do sleep 1; done
|
||||
|
||||
colors {
|
||||
statusline #ffffff
|
||||
background #323232
|
||||
inactive_workspace #32323200 #32323200 #5c5c5c
|
||||
}
|
||||
}
|
||||
|
||||
include /etc/sway/config.d/*
|
||||
11
sway/config.d/00-var.conf
Normal file
11
sway/config.d/00-var.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
set $mod Mod4
|
||||
|
||||
# vim style
|
||||
set $left h
|
||||
set $down j
|
||||
set $up k
|
||||
set $right l
|
||||
|
||||
# programs
|
||||
set $term ghostty
|
||||
set $menu wofi --show drun -iIG -w 2
|
||||
4
sway/config.d/10-input.conf
Normal file
4
sway/config.d/10-input.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
input "type:keyboard" {
|
||||
repeat_delay 150
|
||||
repeat_rate 35
|
||||
}
|
||||
22
sway/config.d/20-workspace.conf
Normal file
22
sway/config.d/20-workspace.conf
Normal file
@@ -0,0 +1,22 @@
|
||||
# ws2
|
||||
assign [app_id="google-chrome"] workspace 2
|
||||
|
||||
# ws3
|
||||
assign [app_id="thunderbird"] workspace 3
|
||||
|
||||
# ws4
|
||||
assign [app_id="Cider"] workspace 4
|
||||
|
||||
# ws5
|
||||
assign [class=".*BoltLauncher.*"] workspace 5
|
||||
assign [class="net-runelite-client-RuneLite"] workspace 5
|
||||
|
||||
# ws8
|
||||
assign [app_id="vesktop"] workspace 8
|
||||
assign [app_id="Slack"] workspace 8
|
||||
assign [app_id="org.telegram.desktop"] workspace 8
|
||||
assign [class="Rocket.Chat"] workspace 8
|
||||
|
||||
|
||||
# i also had these in hyprland
|
||||
# for_window [class=".*"] fullscreen disable
|
||||
16
sway/config.d/30-keybind.conf
Normal file
16
sway/config.d/30-keybind.conf
Normal file
@@ -0,0 +1,16 @@
|
||||
bindsym $mod+Return exec $term
|
||||
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
bindsym $mod+d exec $menu
|
||||
|
||||
bindsym $mod+Shift+c reload
|
||||
|
||||
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'
|
||||
|
||||
bindsym $mod+Shift+Ctrl+Alt+space exec 1password --quick-access
|
||||
|
||||
bindsym $mod+u exec swaylock
|
||||
|
||||
|
||||
bindsym Print exec grim -g "$(slurp -d)" - | wl-copy
|
||||
31
sway/config.d/40-autostart.conf
Normal file
31
sway/config.d/40-autostart.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
exec $term
|
||||
|
||||
exec google-chrome-stable
|
||||
|
||||
exec protonmail-bridge -n
|
||||
exec thunderbird
|
||||
|
||||
exec cider-2
|
||||
|
||||
exec TZ="Europe/Ljubljana" bolt-launcher
|
||||
|
||||
exec vesktop
|
||||
exec slack
|
||||
exec Telegram
|
||||
exec rocketchat-desktop
|
||||
|
||||
# for_window [app_id="discord"] mark discord
|
||||
# for_window [app_id="telegram-desktop"] mark telegram
|
||||
# for_window [app_id="Slack"] mark slack
|
||||
# for_window [app_id="rocketchat"] mark rocketchat
|
||||
#
|
||||
# workspace 8 layout splith
|
||||
#
|
||||
# exec_always {
|
||||
# swaymsg '[con_mark="discord"] focus'
|
||||
# swaymsg '[con_mark="telegram"] move right'
|
||||
# swaymsg '[con_mark="slack"] move right'
|
||||
# swaymsg '[con_mark="rocketchat"] move right'
|
||||
# }
|
||||
|
||||
exec 1password --silent
|
||||
3
swayidle/config
Normal file
3
swayidle/config
Normal file
@@ -0,0 +1,3 @@
|
||||
timeout 300 'swaylock -f'
|
||||
timeout 300 'swaymsg "output * power off"' resume 'swaymsg "output * power on"'
|
||||
before-sleep 'swaylock -f'
|
||||
31
swaylock/config
Normal file
31
swaylock/config
Normal file
@@ -0,0 +1,31 @@
|
||||
image=~/.assets/lockscreen.png
|
||||
|
||||
clock
|
||||
datestr=%A, %d/%m/%y
|
||||
|
||||
indicator-radius=150
|
||||
indicator-thickness=7
|
||||
indicator-idle-visible
|
||||
indicator-y-position=300
|
||||
indicator-x-position=1200
|
||||
|
||||
inside-color=ffffff
|
||||
text-color=000000
|
||||
ring-color=000000
|
||||
|
||||
inside-ver-color=ffffff
|
||||
text-ver-color=ffffff
|
||||
ring-ver-color=000000
|
||||
|
||||
inside-clear-color=ffffff
|
||||
text-clear-color=000000
|
||||
ring-clear-color=000000
|
||||
|
||||
inside-wrong-color=ffffff
|
||||
text-wrong-color=000000
|
||||
ring-wrong-color=000000
|
||||
|
||||
key-hl-color=ffffff
|
||||
bs-hl-color=ffffff
|
||||
caps-lock-key-hl-color=ffffff
|
||||
caps-lock-bs-hl-color=ffffff
|
||||
@@ -1,15 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected=$1
|
||||
else
|
||||
read -p "ssh url: " selected
|
||||
read -p "url: " selected
|
||||
fi
|
||||
|
||||
if [[ -z $selected ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ggman clone "$selected"
|
||||
find -L $GGROOT -mindepth 1 -maxdepth 5 -type d -name .git -prune | xargs -n 1 dirname > "$GGROOT/compiled"
|
||||
ggman clone $selected
|
||||
|
||||
echo ""
|
||||
read -p "press enter to continue..."
|
||||
|
||||
50
tmux/tmux-new-project
Executable file
50
tmux/tmux-new-project
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -z ${NAME:+x} ]]; then
|
||||
echo "missing name"
|
||||
sleep 2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
|
||||
|
||||
read -p "name: " project_name
|
||||
|
||||
if [[ -z $project_name ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -d "$GGROOT/no-remote/$project_name" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
project="$GGROOT/no-remote/$project_name"
|
||||
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 --cycle --bind 'tab:toggle-up,btab:toggle-down'
|
||||
)
|
||||
|
||||
if ! [[ -z $gitignore_template ]]; then
|
||||
gitignore="$GGROOT/github.com/github/gitignore/$gitignore_template.gitignore"
|
||||
echo "$gitignore"
|
||||
echo "$project/.gitignore"
|
||||
cat "$gitignore" >>"$project/.gitignore"
|
||||
fi
|
||||
|
||||
license_template=$(
|
||||
find "$GGROOT"/git.janezic.dev/janezicmatej/license/*.license -exec basename {} \; \
|
||||
| sed 's/\(.*\)\.license/\1/' \
|
||||
| fzf --cycle --bind 'tab:toggle-up,btab:toggle-down'
|
||||
)
|
||||
|
||||
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
|
||||
@@ -3,18 +3,23 @@
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected=$1
|
||||
else
|
||||
if ! [[ -f "$GGROOT/compiled" ]]; then
|
||||
find -L $GGROOT -mindepth 1 -maxdepth 5 -type d -name .git -prune | xargs -n 1 dirname > "$GGROOT/compiled"
|
||||
fi
|
||||
selected=$(cat "$GGROOT/compiled" | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down')
|
||||
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)"
|
||||
|
||||
selected_name=$(basename "$selected" | tr . _)
|
||||
tmux_running=$(pgrep tmux)
|
||||
|
||||
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
||||
|
||||
@@ -1,9 +1,58 @@
|
||||
#!/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="$(grep 'Host .*' ~/.ssh/config | grep -v '*' | sed 's/Host \(.*\)/\1/' | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down')"
|
||||
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
|
||||
@@ -23,3 +72,6 @@ if ! tmux has-session -t=$selected_name 2> /dev/null; then
|
||||
fi
|
||||
|
||||
tmux switch-client -t $selected_name
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
set -g default-terminal "xterm-256color"
|
||||
set -ag terminal-overrides ",xterm-256color:RGB"
|
||||
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-option -g focus-events on
|
||||
set -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION SSH_TTY DISPLAY"
|
||||
|
||||
set-option -g prefix2 C-s
|
||||
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=#45403d fg=#d4be98'
|
||||
set -g status-left-length 30
|
||||
set -g status-style 'bg=default fg=default'
|
||||
set -g status-left-length 20
|
||||
|
||||
set-window-option -g mode-keys vi
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
@@ -32,9 +37,17 @@ bind j select-pane -D
|
||||
bind h select-pane -L
|
||||
bind l select-pane -R
|
||||
|
||||
# sessionizer
|
||||
bind-key f run-shell "tmux neww ~/.config/tmux/tmux-sessionizer"
|
||||
bind-key F run-shell "tmux neww ~/.config/tmux/tmux-ssher"
|
||||
bind-key T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp"
|
||||
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-key G run-shell "tmux neww ~/.config/tmux/tmux-ggclone"
|
||||
|
||||
# ssh
|
||||
bind-key F run-shell "tmux neww ~/.config/tmux/tmux-ssher"
|
||||
|
||||
# project
|
||||
bind-key N run-shell "tmux neww ~/.config/tmux/tmux-new-project"
|
||||
|
||||
1697
zsh/.p10k.zsh
1697
zsh/.p10k.zsh
File diff suppressed because it is too large
Load Diff
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
|
||||
16
zsh/.zshenv
16
zsh/.zshenv
@@ -4,6 +4,9 @@ export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
export XDG_STATE_HOME="$HOME/.local/state"
|
||||
|
||||
# ~/.local/bin
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
# brew sbin
|
||||
export PATH="/opt/homebrew/sbin:$PATH"
|
||||
|
||||
@@ -11,7 +14,9 @@ export PATH="/opt/homebrew/sbin:$PATH"
|
||||
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
|
||||
@@ -34,14 +39,23 @@ export PATH="$XDG_DATA_HOME/neovim/bin:$PATH"
|
||||
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
|
||||
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/startship.toml
|
||||
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"
|
||||
|
||||
50
zsh/.zshrc
50
zsh/.zshrc
@@ -2,41 +2,30 @@
|
||||
export HISTFILE="$XDG_STATE_HOME/zsh/history"
|
||||
export HISTSIZE=100
|
||||
|
||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
|
||||
# Initialization code that may require console input (password prompts, [y/n]
|
||||
# confirmations, etc.) must go above this block; everything else may go below.
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
# pre plugin load
|
||||
## pre plugin load
|
||||
# nvm
|
||||
export NVM_COMPLETION=true
|
||||
# zsh autosugestions
|
||||
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline"
|
||||
|
||||
# load antigen
|
||||
typeset -a ANTIGEN_CHECK_FILES=(${ZDOTDIR:-~}/.zshrc ${ZDOTDIR:-~}/antigen.zsh)
|
||||
source $ZDOTDIR/antigen.zsh
|
||||
# source antidote
|
||||
source $ZDOTDIR/.antidote/antidote.zsh
|
||||
antidote load
|
||||
|
||||
# oh-my-zsh library and git plugin
|
||||
antigen use oh-my-zsh
|
||||
antigen bundle git
|
||||
|
||||
# zsh users plugin
|
||||
antigen bundle zsh-users/zsh-autosuggestions
|
||||
|
||||
# other
|
||||
antigen bundle lukechilds/zsh-nvm
|
||||
|
||||
# theme
|
||||
antigen theme romkatv/powerlevel10k
|
||||
|
||||
# apply plugin load
|
||||
antigen apply
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
antidote load ${ZDOTDIR:-~}/.zsh_plugins_darwin.txt
|
||||
fi
|
||||
|
||||
unsetopt autocd
|
||||
|
||||
# pyenv
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
eval "$(pyenv init - zsh)"
|
||||
eval "$(pyenv virtualenv-init - zsh)"
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||
fi
|
||||
|
||||
# ggman
|
||||
eval "$(ggman shellrc)"
|
||||
@@ -54,5 +43,4 @@ 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
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
||||
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
alias s="ssh"
|
||||
alias z="exec zsh"
|
||||
alias t="tmux a || tmux new-session -s $(whoami) -c ~"
|
||||
alias t=tmux_attach
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
alias n=nvim_ve
|
||||
# alias vim=nvim_ve
|
||||
alias ssh-hosts="grep -P \"^Host ([^*]+)$\" $HOME/.ssh/config | sed 's/Host //'"
|
||||
alias vim=nvim_ve
|
||||
elif [[ "$OSTYPE" == "linux"* ]]; then
|
||||
alias n=nvim
|
||||
fi
|
||||
|
||||
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"
|
||||
@@ -17,9 +26,16 @@ 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\""
|
||||
|
||||
# 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"
|
||||
|
||||
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,6 +1,5 @@
|
||||
|
||||
function nvim_ve {
|
||||
if [[ -e "$VIRTUAL_ENV" && -f "$VIRTUAL_ENV/bin/activate" ]]; then
|
||||
if [[ -e $VIRTUAL_ENV && -f "$VIRTUAL_ENV/bin/activate" ]]; then
|
||||
source "$VIRTUAL_ENV/bin/activate"
|
||||
command nvim $@
|
||||
deactivate
|
||||
@@ -9,25 +8,6 @@ function nvim_ve {
|
||||
fi
|
||||
}
|
||||
|
||||
alias nvim=nvim_ve
|
||||
|
||||
function ffb {
|
||||
if ! [[ -f package.json ]]; then
|
||||
echo "no package.json"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -f yarn.lock ]]; then
|
||||
PACKAGE_MANAGER=yarn
|
||||
else
|
||||
PACKAGE_MANAGER=npm
|
||||
fi
|
||||
|
||||
if [[ -n $(grep "react-scripts" package.json) ]]; then
|
||||
BROWSER=none FORCE_COLOR=true "$PACKAGE_MANAGER" start | cat
|
||||
fi
|
||||
}
|
||||
|
||||
function afm {
|
||||
RES=$(curl -s "https://$1/api/monitoring/requirements")
|
||||
COUNT=$(echo "$RES" | grep -c $2)
|
||||
@@ -35,11 +15,10 @@ function afm {
|
||||
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 '"')"
|
||||
echo "${2}==$(echo "$VER" | tr -d '"')"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function nukepip {
|
||||
pip uninstall $(pip freeze) -y
|
||||
pip install -r $(pyenv root)/default-packages
|
||||
@@ -73,7 +52,7 @@ function pyinit {
|
||||
|
||||
function lh {
|
||||
if [[ -z $1 ]]; then
|
||||
PORT=8000
|
||||
PORT=7999
|
||||
else
|
||||
PORT=$1
|
||||
fi
|
||||
@@ -89,32 +68,6 @@ function dps {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function get_dump {
|
||||
if [[ -z $1 ]]; then
|
||||
echo "provide ssh host"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -z $2 ]]; then
|
||||
echo "provide dump destination"
|
||||
return
|
||||
fi
|
||||
|
||||
selected=$(ssh "$1" docker ps --format "{{.Names}}" | fzf)
|
||||
|
||||
if [[ -z $selected ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
ssh "$1" docker exec "$selected" pg_dump -U db --format=c db > "$2$(date +'%Y-%m-%dT%H.%M.%S%z')"
|
||||
|
||||
}
|
||||
|
||||
function ggcompile {
|
||||
find -L $GGROOT -mindepth 1 -maxdepth 5 -type d -name .git -prune | xargs -n 1 dirname > "$GGROOT/compiled"
|
||||
}
|
||||
|
||||
function tssh {
|
||||
if [[ -z $1 ]]; then
|
||||
echo "provide ssh host"
|
||||
@@ -123,3 +76,20 @@ function tssh {
|
||||
|
||||
ssh -t "$@" "command -v tmux && (tmux a || tmux new-session -s gorazd -c ~) || bash"
|
||||
}
|
||||
|
||||
|
||||
function tmux_attach {
|
||||
tmux_running=$(pgrep tmux)
|
||||
|
||||
if ! [[ -z ${TMUX} ]]; then
|
||||
echo "already attached; refreshing env"
|
||||
source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p')
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -z $tmux_running ]]; then
|
||||
~/.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