mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 14:42:37 +00:00
Compare commits
3 Commits
ef933bd3aa
...
0636832796
| Author | SHA1 | Date | |
|---|---|---|---|
|
0636832796
|
|||
|
05cb700cb1
|
|||
|
a03617608d
|
1
env/.config/git/config
vendored
1
env/.config/git/config
vendored
@@ -8,6 +8,7 @@
|
|||||||
[user]
|
[user]
|
||||||
name = Michael Housh
|
name = Michael Housh
|
||||||
email = michael@mhoush.com
|
email = michael@mhoush.com
|
||||||
|
signingkey = 0x90D3EB6274D5B7CF
|
||||||
|
|
||||||
[commit]
|
[commit]
|
||||||
gpgsign = true
|
gpgsign = true
|
||||||
|
|||||||
2
env/.config/nvim/lua/config/autocmds.lua
vendored
2
env/.config/nvim/lua/config/autocmds.lua
vendored
@@ -74,7 +74,7 @@ createCmd("TextYankPost", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Force zsh scripts to use bash syntax hyighlighting.
|
-- Force zsh scripts to use bash syntax highlighting.
|
||||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
|
|||||||
7
env/.config/systemd/user/tmux-kill-sessions.service
vendored
Normal file
7
env/.config/systemd/user/tmux-kill-sessions.service
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Tmux kill sessions service
|
||||||
|
After=graphical-session.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=%h/.local/scripts/tmux-kill-old-sessions
|
||||||
11
env/.config/systemd/user/tmux-kill-sessions.timer
vendored
Normal file
11
env/.config/systemd/user/tmux-kill-sessions.timer
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Tmux kill sessions timer
|
||||||
|
Requires=tmux-kill-sessions.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=2h
|
||||||
|
OnUnitActiveSec=2h
|
||||||
|
AccuracySec=10sec
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
43
env/.local/scripts/tmux-kill-old-sessions
vendored
Executable file
43
env/.local/scripts/tmux-kill-old-sessions
vendored
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Kills tmux sessions that are past the threshold to free up resources.
|
||||||
|
#
|
||||||
|
# Adapted from https://gist.github.com/dhulihan/4c65e868851660fb0d8bfa2d059e7967
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
|
||||||
|
|
||||||
|
# Threshold
|
||||||
|
TOO_OLD_THRESHOLD=7200 # 2 hours
|
||||||
|
NOW=$(date +%s)
|
||||||
|
|
||||||
|
# Logging utility function, use in place of echo.
|
||||||
|
log() {
|
||||||
|
logging log --source "$THIS_FILE" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MAIN
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Setup logging file and label.
|
||||||
|
source "$SCRIPTS/hypr/logging"
|
||||||
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
|
tmux ls -F '#{session_name}:#{session_activity}' | while read -r line; do
|
||||||
|
session_name=${line%:*}
|
||||||
|
last_activity=${line#*:}
|
||||||
|
elapsed=$((NOW - last_activity))
|
||||||
|
|
||||||
|
if [[ "$elapsed" -gt "$TOO_OLD_THRESHOLD" ]]; then
|
||||||
|
log "$session_name is ${elapsed}s inactive, killing..."
|
||||||
|
tmux kill-session -t "$session_name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
2
env/.local/scripts/tmux-sessionator
vendored
2
env/.local/scripts/tmux-sessionator
vendored
@@ -55,7 +55,9 @@ function create_session() {
|
|||||||
function create_email_session() {
|
function create_email_session() {
|
||||||
tmux new-session -ds email -n work neomutt
|
tmux new-session -ds email -n work neomutt
|
||||||
tmux new-window -t email -d -n personal neomutt
|
tmux new-window -t email -d -n personal neomutt
|
||||||
|
tmux new-window -t email -d -n iCloud neomutt
|
||||||
tmux send-keys -t email.1 'i2'
|
tmux send-keys -t email.1 'i2'
|
||||||
|
tmux send-keys -t email.3 'i3'
|
||||||
}
|
}
|
||||||
|
|
||||||
############################## MAIN ##############################
|
############################## MAIN ##############################
|
||||||
|
|||||||
5
system
5
system
@@ -22,10 +22,10 @@ log() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_and_run() {
|
log_and_run() {
|
||||||
log "Running: \"$@\""
|
log "Running: \"$*\""
|
||||||
|
|
||||||
if [[ $dry_run == "0" ]]; then
|
if [[ $dry_run == "0" ]]; then
|
||||||
eval $1
|
eval "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,5 +37,6 @@ log_and_run "sudo setcap "cap_dac_override+p" $(which espanso)"
|
|||||||
|
|
||||||
log_and_run "systemctl --user enable --now logout-task.service"
|
log_and_run "systemctl --user enable --now logout-task.service"
|
||||||
log_and_run "systemctl --user enable --now battery-monitor.timer"
|
log_and_run "systemctl --user enable --now battery-monitor.timer"
|
||||||
|
log_and_run "systemctl --user enable --now tmux-kill-sessions.timer"
|
||||||
log_and_run "sudo systemctl enable --now pcscd.service"
|
log_and_run "sudo systemctl enable --now pcscd.service"
|
||||||
log_and_run "sudo systemctl enable --now firewalld.service"
|
log_and_run "sudo systemctl enable --now firewalld.service"
|
||||||
|
|||||||
Reference in New Issue
Block a user