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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*

!.git*
!LICENSE.md
!README.md

!alacritty/
!clangd/
!git/
!highlight/
!i3/
!pgcli/
!ranger/
!remmina/
Expand Down
2 changes: 1 addition & 1 deletion alacritty/alacritty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ render_timer = false
TERM = "alacritty"

[font]
size = 11.0
size = 9.0

[font.normal]
family = "SourceCodePro"
Expand Down
Binary file modified git/config
Binary file not shown.
Binary file added i3/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
178 changes: 178 additions & 0 deletions i3/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
set $mod Mod1

set $left h
set $down j
set $up k
set $right l
set $LEFT H
set $DOWN J
set $UP K
set $RIGHT L

set $config config
set $term alacritty
set $system [l] lock, [e] exit, [h] hibernate, [r] reboot, [s] shutdown
set $scrot [w] clip window, [c-w] save window, [a] clip area, [c-a] save area
set $now $(date +%Y%m%d%H%M%S)
set $scripts $HOME/.config/scripts
set $background $HOME/.config/i3/background.png

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:SourceCodePro 10

# exec_always wired
exec_always xset r rate 300 50
exec_always xrandr --output eDP --mode 1440x900
exec_always setxkbmap gb
exec_always setxkbmap -option "ctrl:nocaps"
exec_always --no-startup-id xss-lock -l -- i3lock -i $background --nofork

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

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

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

# Reload the configuration file
bindsym $mod+Control+r reload

# Start a terminal
bindsym $mod+Return exec $term

# Start a tmux session in a new terminal
bindsym $mod+Shift+Return exec $term -e tmux -u

# Start launcher
bindsym $mod+d exec rofi -show drun -theme windows/run

# Open Kubernetes context menu
# bindsym $mod+c exec $scripts/context

# Open lpass password menu
bindsym $mod+p exec $scripts/lpass password

# Open lpass notes menu
bindsym $mod+o exec $scripts/lpass notes

bindsym $mod+i exec $scripts/lpass id

bindsym $mod+Shift+0 exec i3lock -i $background

bindsym $mod+Shift+i exec $scripts/lpass sh

# Generate password
bindsym $mod+Shift+p exec $scripts/pwgen

# A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
# There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed.
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right

bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right

# split in horizontal orientation
bindsym $mod+x split horizontal
bindsym $mod+v split vertical

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"

# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit?' -B 'Yes, exit i3' 'i3-msg exit'"

bindsym XF86MonBrightnessUp exec brightnessctl s +10
bindsym XF86MonBrightnessDown exec brightnessctl s 10-

# resize window (you can also use the mouse for that)
mode "resize" {
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt

bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt

bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

bar {
position top
status_command $HOME/.config/scripts/status
}
2 changes: 1 addition & 1 deletion nvim
Submodule nvim updated from 4c4dea to 091077
31 changes: 16 additions & 15 deletions scripts/lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash

toggle_output() {
swaymsg output "DP-${1}" dpms toggle
}
i3lock -c 222222

toggle_vertical_displays() {
toggle_output 1
toggle_output 2
}

toggle_vertical_displays

trap "toggle_vertical_displays" SIGUSR1

swaylock -Fetc '#000000'

toggle_vertical_displays
# i3lock -c 222222 -e &
#
# pid=$$
#
# log() {
# echo "[$(date -I)] ${1}" >> /var/log/lock.log
# }
#
# until ! kill -0 $pid || fprintd-verify; do
# log "Fingerprint failure"
# done
#
# log "Login success"
#
# kill $pid
32 changes: 27 additions & 5 deletions scripts/status
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/env python

import re
from subprocess import run
from datetime import datetime, timedelta
from time import sleep
from sys import stdout
from typing import Callable

def future_time() -> datetime:
return datetime.now() + timedelta(seconds = 10)
# return datetime.now() + timedelta(seconds = 10)
return datetime.now() + timedelta(seconds = 1)

def cmd(args: list[str]) -> str:
proc = run(args, capture_output = True)
Expand All @@ -17,6 +19,23 @@ def cmd(args: list[str]) -> str:
def libvirtd_status() -> str:
return cmd(["systemctl", "is-active", "libvirtd.service"])

def bat_cap() -> str:
return cmd(["cat", "/sys/class/power_supply/BAT0/capacity"])

def wifi() -> str:
proc = run(["iwctl", "station", "wlan0", "show"], capture_output = True)
lines = proc.stdout.decode("utf-8").splitlines()
cols = re.split(r"\s+", lines[6])

return cols[3]

def brightness() -> str:
proc = run(["brightnessctl", "g"], capture_output = True)
level = int(proc.stdout.decode("utf-8"))
perc = (level / 255) * 100

return int(perc)

def virt_state(name: str) -> str:
return cmd(["virsh", "--connect", "qemu:///system", "domstate", name])

Expand All @@ -33,10 +52,13 @@ after: datetime = future_time()
state: dict[str, str | int] = dict()
deletions: list[str] = []
renderers: dict[str, Callable[[], str | int]] = {
"kubernetes": lambda: k_context(),
"bluetooth": lambda: dev_count(),
"bindows": lambda: virt_state("bindows"),
"libvirtd": lambda: libvirtd_status()
# "kubernetes": lambda: k_context(),
# "bluetooth": lambda: dev_count(),
# "bindows": lambda: virt_state("bindows"),
# "libvirtd": lambda: libvirtd_status(),
"wifi": lambda: wifi(),
"bat": lambda: bat_cap(),
"dim": lambda: brightness()
}

for k in renderers:
Expand Down
26 changes: 15 additions & 11 deletions zsh/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ plugins=(
fzf-marks
)

# Managers
source "${ZSH}/oh-my-zsh.sh"
source "${NVM_DIR}/nvm.sh"
# Omg My ZSH
if [[ -d "$ZSH" ]]; then
source "${ZSH}/oh-my-zsh.sh"
fi

# Modules
source "${ZSH_DIR}/aliases.zsh"
source "${ZSH_DIR}/utils.zsh"
# ZSH modules
if [[ -d "$ZSH_DIR" ]]; then
source "${ZSH_DIR}/aliases.zsh"
source "${ZSH_DIR}/utils.zsh"
fi

if [[ -d "$NVM_DIR" ]]; then
source "${NVM_DIR}/nvm.sh"
fi

# Google Cloud
if [[ -d "$GCLOUD_PATH" ]]; then
Expand Down Expand Up @@ -74,15 +81,12 @@ eval $(just --completions zsh)

ssh-add -q ~/.keys/ssh/marziply/prv.pem
lpass sync -b --color never
generate_marks
start_sway
genmarks
startwm

rm -rf \
"${HOME}/Documents" \
"${HOME}/Downloads" \
"${HOME}/Music" \
"${HOME}/Videos" \
"${HOME}/Pictures"

# bun completions
[ -s "/home/hayden/.config/bun/_bun" ] && source "/home/hayden/.config/bun/_bun"
20 changes: 10 additions & 10 deletions zsh/utils.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@ default_marks=(
"work : ${HOME}/dev/work"
)

start_sway() {
startwm() {
local current_tty="$(tty)"

if [[ "$current_tty" =~ ^/dev/tty[0-9]+$ ]]; then
if [[ "${current_tty: -1}" == "1" ]]; then
sway
startx /usr/bin/i3
fi
elif [[ -z "$SSH_CLIENT" && -z "$SSH_TTY" ]]; then
tmux source-file "${TMUX_DIR}/tmux.conf"
tmux source-file "${TMUX_DIR}/tmux.conf" &> /dev/null
else
echo "foo"
# @TODO: Possibly an SSH client
fi

# if ! systemctl -q is-active libvirtd.service; then
# systemctl -q start libvirtd.service
# fi
}

generate_marks() {
dirs=$(stat ${HOME}/dev/{lab,lib,work}/* -c '%Y %n' | sort -r)
genmarks() {
dirs=`find $HOME/* -maxdepth 2 -type d`
dirs_count=$(echo $dirs | wc -l)
total_marks=$(cat $marks_list | wc -l)
marks_count=$(($total_marks - ${#default_marks}))

if [[ "$dirs_count" != "$marks_count" ]]; then
printf '%s\n' "${default_marks[@]}" >$marks_list

echo "$dirs" |
cut -d ' ' -f 2 |
xargs -I % bash -c 'echo "$(grep -Po "[^/]+/[^/]+$" <<< "%") : %"' \
>>$marks_list
echo "$dirs" \
| cut -d ' ' -f 2 \
| xargs bash -c 'echo "$(grep -Po "[^/]+/[^/]+$" <<< "{}") : {}"' \
>> $marks_list
fi
}

Expand Down