diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
| commit | ea127689e0ae2d39b49004be605e541ff80e2621 (patch) | |
| tree | abbe79e5e37792bd8ebea8f9ac788ff5b8aed704 | |
| download | openbsd-dotfiles-ea127689e0ae2d39b49004be605e541ff80e2621.zip | |
Initial Commit
43 files changed, 1341 insertions, 0 deletions
diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..d6f86af --- /dev/null +++ b/.Xresources @@ -0,0 +1,57 @@ +XTerm*loginShell:true +Xft.dpi: 120 +XTerm*faceName: Hack +XTerm*faceSize: 14 +XTerm*utf8: 1 +XTerm*cjkWidth: true +Xcursor.size: 48 +XTerm*cutToClipboard: true + +! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +! title Nord XResources + +! project nord-xresources + +! version 0.1.0 + +! repository https://github.com/arcticicestudio/nord-xresources + +! author Arctic Ice Studio + +! email development@arcticicestudio.com + +! copyright Copyright (C) 2016 + +! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +#define nord0 #2E3440 +#define nord1 #3B4252 +#define nord2 #434C5E +#define nord3 #4C566A +#define nord4 #D8DEE9 +#define nord5 #E5E9F0 +#define nord6 #ECEFF4 +#define nord7 #8FBCBB +#define nord8 #88C0D0 +#define nord9 #81A1C1 +#define nord10 #5E81AC +#define nord11 #BF616A +#define nord12 #D08770 +#define nord13 #EBCB8B +#define nord14 #A3BE8C +#define nord15 #B48EAD + +*.foreground: nord4 +*.background: nord0 +*.cursorColor: nord4 +*fading: 0 +*fadeColor: nord3 + +*.color0: nord1 +*.color1: nord11 +*.color2: nord14 +*.color3: nord13 +*.color4: nord9 +*.color5: nord15 +*.color6: nord8 +*.color7: nord5 +*.color8: nord3 +*.color9: nord11 +*.color10: nord14 +*.color11: nord13 +*.color12: nord9 +*.color13: nord15 +*.color14: nord7 +*.color15: nord6 diff --git a/.config/lemonbar-xft/bar.sh b/.config/lemonbar-xft/bar.sh new file mode 100755 index 0000000..6aad4b8 --- /dev/null +++ b/.config/lemonbar-xft/bar.sh @@ -0,0 +1,120 @@ +#!/bin/sh +set -o errexit + +RED="%{F#cd0000}" +YELLOW="%{F#cdcd00}" +RESET="%{F-}" + +main() { + while true; do + update_bar + sleep 5 + done +} + +update_bar() { + printf "%%{l} %s | %s | %s | %s | %s %%{r} %s | %s | %s \n" \ + "$(battery)" \ + "$(temp)" \ + "$(cpu)" \ + "$(memory)" \ + "$(brightness)" \ + "$(volume)" \ + "$(wifi)" \ + "$(datetime)" +} + +battery() { + apm_output=$(apm -al) + percent=$(echo "$apm_output" | sed -n '1p') + batt_state=$(echo "$apm_output" | sed -n '2p') + minutes=$(apm -m) + + filled=$((percent / 10)) + bar="" + i=0 + while [ $i -lt 10 ]; do + if [ $i -lt $filled ]; then + if [ "$batt_state" = "1" ]; then + bar="${bar}+" + else + bar="${bar}#" + fi + else + bar="${bar}-" + fi + i=$((i + 1)) + done + + if [ "$percent" -lt 30 ] && [ "$batt_state" != "1" ]; then + bar="${RED}${bar}${RESET}" + elif [ "$percent" -lt 50 ] && [ "$batt_state" != "1" ]; then + bar="${YELLOW}${bar}${RESET}" + fi + + printf "%s%% %s (%s min)" "$percent" "$bar" "$minutes" +} + +temp() { + avg=$(sysctl hw.sensors | awk -F'=' '/temp/ { + gsub(/degC.*/, "", $2); + sum += $2; + count++ + } END { + printf "%.0f", sum/count + }') + + if [ "$avg" -ge 85 ]; then + printf "%s%d°C%s" "$RED" "$avg" "$RESET" + else + printf "%d°C" "$avg" + fi +} + +cpu() { + apm -Pv | awk '{gsub(/\(|\)/, ""); print $5, $6, $4}' +} + +memory() { + top -n | awk '/^Memory:/ { + split($3, r, "/"); + printf "Used:%s Free:%s", r[2], $6 + }' +} + +net() { + ifconfig egress 2>/dev/null | awk '/inet / {print $2}' +} + +brightness() { + bright=$(xbacklight -get | cut -d. -f1) + printf "Bri: %d%%" "$bright" +} + +volume() { + vol=$(sndioctl -n output.level) + percent=$(printf "%.0f" "$(echo "$vol" | awk '{print $1 * 100}')") + + if sndioctl output.mute | grep -q "=1"; then + printf "Vol: MUTE" + else + printf "Vol: %d%%" "$percent" + fi +} + +wifi() { + wifi_info=$(ifconfig iwx0 2>/dev/null | grep "ieee80211:") + if [ -n "$wifi_info" ]; then + ssid=$(echo "$wifi_info" | sed -n 's/.*join \(.*\) chan.*/\1/p' | tr -d '"') + signal=$(ifconfig iwx0 | awk '/ieee80211:/ {for(i=1;i<=NF;i++) if($i ~ /%/) print $i}' | head -1) + printf "%s %s %s" "$ssid" "$signal" "$(net)" + else + net + fi +} + +datetime() { + date '+%Y-%m-%d %H:%M' +} + +main diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua new file mode 100644 index 0000000..11ed567 --- /dev/null +++ b/.config/nvim/after/ftplugin/c.lua @@ -0,0 +1 @@ +vim.opt_local.colorcolumn = '80' diff --git a/.config/nvim/after/ftplugin/lua.lua b/.config/nvim/after/ftplugin/lua.lua new file mode 100644 index 0000000..ad59a73 --- /dev/null +++ b/.config/nvim/after/ftplugin/lua.lua @@ -0,0 +1 @@ +vim.opt_local.commentstring = '-- %s' diff --git a/.config/nvim/after/ftplugin/makefile.lua b/.config/nvim/after/ftplugin/makefile.lua new file mode 100644 index 0000000..345d732 --- /dev/null +++ b/.config/nvim/after/ftplugin/makefile.lua @@ -0,0 +1,2 @@ +vim.opt_local.expandtab = false +vim.opt_local.tabstop = 4 diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..4f56524 --- /dev/null +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,19 @@ +local opt_local = vim.opt_local + +opt_local.textwidth = 80 +opt_local.formatoptions:append { 't' } +opt_local.formatoptions:remove { 'l' } + +opt_local.wrap = true +opt_local.linebreak = true +opt_local.breakindent = true + +opt_local.spell = true +opt_local.spelllang = 'en_us' + +opt_local.expandtab = true +opt_local.tabstop = 2 +opt_local.shiftwidth = 2 + +opt_local.list = true +opt_local.listchars = 'tab:»·,trail:·' diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..3fcff4e --- /dev/null +++ b/.config/nvim/after/ftplugin/python.lua @@ -0,0 +1,12 @@ +-- PEP 8 indentation settings +vim.opt_local.tabstop = 4 +vim.opt_local.softtabstop = 4 +vim.opt_local.shiftwidth = 4 +vim.opt_local.expandtab = true + +-- 88 character length lines for Black formatter +vim.opt_local.colorcolumn = '88' + +-- Google-style docstrings +vim.g.python_style = 'google' + diff --git a/.config/nvim/ftdetect/tmux.lua b/.config/nvim/ftdetect/tmux.lua new file mode 100644 index 0000000..d43c12a --- /dev/null +++ b/.config/nvim/ftdetect/tmux.lua @@ -0,0 +1,6 @@ +vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + pattern = '*.tmux', + callback = function() + vim.bo.filetype = 'tmux' + end, +}) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..4a5ce9f --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1 @@ +require 'eugenetriguba' diff --git a/.config/nvim/lsp/lua_ls.lua b/.config/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..c4cacae --- /dev/null +++ b/.config/nvim/lsp/lua_ls.lua @@ -0,0 +1,11 @@ +---@type vim.lsp.Config +return { + settings = { + Lua = { + codeLens = { enable = true }, + hint = { enable = true, semicolon = 'Disable' }, + completion = { callSnippet = 'Replace' }, + }, + }, +} + diff --git a/.config/nvim/lua/eugenetriguba/autocmds.lua b/.config/nvim/lua/eugenetriguba/autocmds.lua new file mode 100644 index 0000000..145d00a --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/autocmds.lua @@ -0,0 +1,8 @@ +-- Highlight when yanking (copying) text +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + end, +}) diff --git a/.config/nvim/lua/eugenetriguba/global.lua b/.config/nvim/lua/eugenetriguba/global.lua new file mode 100644 index 0000000..006fe5e --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/global.lua @@ -0,0 +1,4 @@ +-- Set <space> as the leader key +-- See `:help mapleader` +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' diff --git a/.config/nvim/lua/eugenetriguba/init.lua b/.config/nvim/lua/eugenetriguba/init.lua new file mode 100644 index 0000000..1d7d3ca --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/init.lua @@ -0,0 +1,5 @@ +require 'eugenetriguba.global' +require 'eugenetriguba.options' +require 'eugenetriguba.autocmds' +require 'eugenetriguba.keymaps' +require 'eugenetriguba.plugins' diff --git a/.config/nvim/lua/eugenetriguba/keymaps.lua b/.config/nvim/lua/eugenetriguba/keymaps.lua new file mode 100644 index 0000000..0954462 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/keymaps.lua @@ -0,0 +1,36 @@ +local map = vim.keymap.set + +-- Create split panes using leader key +map('n', '<leader>sh', ':split<CR>') +map('n', '<leader>sv', ':vsplit<CR>') + +-- Clear highlights on search when pressing <Esc> in normal mode +map('n', '<Esc>', '<cmd>nohlsearch<CR>') + +-- Diagnostic keymaps +map('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Cycle through buffers +map('n', '<Tab>', ':bnext<CR>') +map('n', '<S-Tab>', ':bprevious<CR>') + +-- Exit terminal mode in the builtin terminal with a +-- shortcut that is a bit easier to remember. +map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) + +-- Keybinds to make split navigation easier. +-- Use CTRL+<hjkl> to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +map('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) +map('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) +map('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) +map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) + +-- Delete the current buffer +vim.keymap.set('n', '<leader>bd', '<cmd>bdelete<cr>', { desc = 'Delete current buffer' }) +-- Force delete the current buffer (discard changes) +vim.keymap.set('n', '<leader>bD', '<cmd>bdelete!<cr>', { desc = 'Force delete current buffer' }) +-- Delete all buffers except the current one +vim.keymap.set('n', '<leader>ba', ':%bd|e#<cr>', { desc = 'Delete all other buffers' }) + diff --git a/.config/nvim/lua/eugenetriguba/options.lua b/.config/nvim/lua/eugenetriguba/options.lua new file mode 100644 index 0000000..6b70422 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/options.lua @@ -0,0 +1,96 @@ +local opt = vim.opt + +-- Make line numbers default +opt.number = true + +-- Use relative line numbers, to help with jumping. +opt.relativenumber = true + +-- In Insert mode, replace <Tab> with the appropriate +-- number of spaces. +opt.expandtab = true + +-- When starting a new line, use smart indentation to +-- figure out what indentation the new line should be +-- at. +opt.autoindent = true +opt.smartindent = true + +-- Number of spaces to use for each step of autoindentation. +opt.shiftwidth = 2 + +-- Number of spaces to use when using <Tab>. +opt.tabstop = 2 + +-- Case-insensitive searching UNLESS \C or one +-- or more capital letters in the search term +opt.ignorecase = true +opt.smartcase = true + +-- Keep signcolumn on by default +opt.signcolumn = 'yes' + +-- Show which line your cursor is on +opt.cursorline = true + +-- If performing an operation that would fail due to unsaved +-- changes in the buffer (like `:q`), instead raise a dialog +-- asking if you wish to save the current file(s) +-- +-- See `:help 'confirm'` +opt.confirm = true + +-- Save undo history +opt.undofile = true + +-- Minimal number of screen lines to keep above and below the cursor. +opt.scrolloff = 10 + +-- Enable mouse mode e.g. can be useful for resizing splits +opt.mouse = 'a' + +-- Don't show the mode, since it's already in the status line +opt.showmode = false + +-- Sync clipboard between OS and Neovim. +-- +-- Schedule the setting after `UiEnter` because it can increase +-- startup-time. Remove this option to keep the OS clipboard +-- independent from neovim. +-- +-- See `:help 'clipboard'` +vim.schedule(function() + opt.clipboard = 'unnamedplus' +end) + +-- Continue to visually indent wrapped lines +-- to preserve horizontal blocks of text +opt.breakindent = true + +-- Decrease update time +opt.updatetime = 250 + +-- Decrease mapped sequence wait time +opt.timeoutlen = 300 + +-- Configure how new splits should be opened +opt.splitright = true +opt.splitbelow = true + +-- Sets how neovim will display certain whitespace characters +-- in the editor. +-- +-- See `:help 'list'` and `:help 'listchars'` +opt.list = true +opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } + +-- Preview substitutions live, as you type! +opt.inccommand = 'split' + +-- Enable project-local configuration +vim.o.exrc = true + +-- Enable completions +vim.opt.complete:prepend 'o' -- include omnifunc (LSP) as a source +vim.opt.completeopt:append { 'menuone', 'noselect', 'popup', 'fuzzy' } +vim.o.autocomplete = true diff --git a/.config/nvim/lua/eugenetriguba/plugins/colorscheme.lua b/.config/nvim/lua/eugenetriguba/plugins/colorscheme.lua new file mode 100644 index 0000000..f93ae67 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/colorscheme.lua @@ -0,0 +1,16 @@ +vim.pack.add { + { + name = 'nord', + src = 'https://github.com/shaunsingh/nord.nvim', + }, +} + +vim.g.nord_contrast = true +vim.g.nord_borders = true +vim.g.nord_disable_background = true +vim.g.nord_uniform_diff_background = true +vim.g.nord_italic = false +vim.g.nord_bold = false + +require('nord').set() +vim.cmd.colorscheme 'nord' diff --git a/.config/nvim/lua/eugenetriguba/plugins/conform.lua b/.config/nvim/lua/eugenetriguba/plugins/conform.lua new file mode 100644 index 0000000..6d8571d --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/conform.lua @@ -0,0 +1,13 @@ +vim.pack.add { + { + name = 'conform.nvim', + src = 'https://github.com/stevearc/conform.nvim', + }, +} + +require('conform').setup { + formatters_by_ft = { + lua = { 'stylua' }, + sh = { 'shfmt' }, + }, +} diff --git a/.config/nvim/lua/eugenetriguba/plugins/fzf-lua.lua b/.config/nvim/lua/eugenetriguba/plugins/fzf-lua.lua new file mode 100644 index 0000000..6c02e9a --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/fzf-lua.lua @@ -0,0 +1,56 @@ +vim.pack.add { + { + name = 'mini.icons', + src = 'https://github.com/nvim-mini/mini.icons', + }, + { + name = 'fzf-lua', + src = 'https://github.com/ibhagwan/fzf-lua', + }, +} + +require 'mini.icons'.setup {} + +require('fzf-lua').setup { + winopts = { + preview = { + default = 'bat', + }, + }, + keymap = { + fzf = { + ['ctrl-q'] = 'select-all+accept', + }, + }, + files = { + fd_opts = '--type f --hidden --exclude .git', + }, + grep = { + rg_opts = "--color=never --no-heading --with-filename --line-number --column --smart-case --hidden --glob '!.git/*'", + rg_grep = true, + }, +} + +local fzf = require 'fzf-lua' +vim.keymap.set('n', '<leader>fh', fzf.helptags, { desc = '[F]ind [H]elp' }) +vim.keymap.set('n', '<leader>fk', fzf.keymaps, { desc = '[F]ind [K]eymaps' }) +vim.keymap.set('n', '<leader>ff', fzf.files, { desc = '[F]ind [F]iles' }) +vim.keymap.set('n', '<leader>fc', fzf.commands, { desc = '[F]ind [C]ommands' }) +vim.keymap.set('n', '<leader>fs', fzf.builtin, { desc = '[F]ind [S]elect fzf-lua' }) +vim.keymap.set('n', '<leader>fw', fzf.grep_cword, { desc = '[F]ind current [W]ord' }) +vim.keymap.set('n', '<leader>fg', fzf.live_grep, { desc = '[F]ind by [G]rep' }) +vim.keymap.set('n', '<leader>fd', fzf.diagnostics_document, { desc = '[F]ind [D]iagnostics' }) +vim.keymap.set('n', '<leader>fr', fzf.resume, { desc = '[F]ind [R]esume' }) +vim.keymap.set('n', '<leader>f.', fzf.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) +vim.keymap.set('n', '<leader><leader>', fzf.buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '<leader>/', fzf.blines, { desc = '[/] Fuzzily search in current buffer' }) +vim.keymap.set('n', '<leader>f/', function() + fzf.live_grep { + filespec = vim.fn.expand '%:p', + prompt = 'Live Grep in Open Files> ', + } +end, { desc = '[F]ind [/] in Open Files' }) +vim.keymap.set('n', '<leader>fn', function() + fzf.files { cwd = vim.fn.stdpath 'config' } +end, { desc = '[F]ind [N]eovim files' }) + diff --git a/.config/nvim/lua/eugenetriguba/plugins/init.lua b/.config/nvim/lua/eugenetriguba/plugins/init.lua new file mode 100644 index 0000000..200cc98 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/init.lua @@ -0,0 +1,8 @@ +require 'eugenetriguba.plugins.colorscheme' +require 'eugenetriguba.plugins.tree-sitter' +require 'eugenetriguba.plugins.fzf-lua' +require 'eugenetriguba.plugins.mini' +require 'eugenetriguba.plugins.oil' +require 'eugenetriguba.plugins.conform' +require 'eugenetriguba.plugins.lsp' +require 'eugenetriguba.plugins.vim-tmux-navigator' diff --git a/.config/nvim/lua/eugenetriguba/plugins/lsp.lua b/.config/nvim/lua/eugenetriguba/plugins/lsp.lua new file mode 100644 index 0000000..f5ff7d5 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/lsp.lua @@ -0,0 +1,113 @@ +vim.pack.add { + { + name = 'lazydev.nvim', + src = 'https://github.com/folke/lazydev.nvim', + }, + { + name = 'nvim-lspconfig', + src = 'https://github.com/neovim/nvim-lspconfig', + }, + { + name = 'fidget.nvim', + src = 'https://github.com/j-hui/fidget.nvim', + }, +} + +require('fidget').setup {} +require('lazydev').setup { + library = { + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, +} + +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + local fzf = require 'fzf-lua' + fzf.register_ui_select({}, true) + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', fzf.lsp_code_actions, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', fzf.lsp_references, '[G]oto [R]eferences') + map('gri', fzf.lsp_implementations, '[G]oto [I]mplementation') + map('grd', fzf.lsp_definitions, '[G]oto [D]efinition') + map('grD', fzf.lsp_declarations, '[G]oto [D]eclaration') + map('gO', fzf.lsp_document_symbols, 'Open Document Symbols') + map('gW', fzf.lsp_workspace_symbols, 'Open Workspace Symbols') + map('grt', fzf.lsp_typedefs, '[G]oto [T]ype Definition') + map('<C-space>', vim.lsp.completion.get, '[C]ompletion', 'i') + + local client = vim.lsp.get_client_by_id(event.data.client_id) + + if client and client:supports_method('textDocument/completion', event.buf) then + vim.lsp.completion.enable(true, client.id, event.buf, { + autotrigger = false, + convert = function(item) + return { abbr = item.label:gsub('%b()', '') } + end, + }) + end + + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf } + end, + }) + end + + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map('<leader>th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, +}) + +vim.api.nvim_create_autocmd('CursorHold', { + callback = function() + vim.diagnostic.open_float(nil, { + focus = false, + scope = 'cursor', + border = 'rounded', + source = 'if_many', + close_events = { 'CursorMoved', 'InsertEnter', 'BufLeave', 'WinLeave' }, + }) + end, +}) + +vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = ' ', + [vim.diagnostic.severity.WARN] = ' ', + [vim.diagnostic.severity.INFO] = ' ', + [vim.diagnostic.severity.HINT] = ' ', + }, + }, + virtual_text = false, +} + +vim.lsp.enable { 'lua_ls', 'clangd', 'bashls' } diff --git a/.config/nvim/lua/eugenetriguba/plugins/mini.lua b/.config/nvim/lua/eugenetriguba/plugins/mini.lua new file mode 100644 index 0000000..97290a7 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/mini.lua @@ -0,0 +1,73 @@ +vim.pack.add { + { + name = 'mini', + src = 'https://github.com/nvim-mini/mini.nvim', + version = 'main', + }, +} + +require('mini.statusline').setup() + +require('mini.indentscope').setup { + symbol = '│', + options = { try_as_border = true }, +} + +local miniclue = require 'mini.clue' +miniclue.setup { + triggers = { + -- Leader triggers + { mode = 'n', keys = '<Leader>' }, + { mode = 'x', keys = '<Leader>' }, + -- Built-in completion + { mode = 'i', keys = '<C-x>' }, + -- `g` key + { mode = 'n', keys = 'g' }, + { mode = 'x', keys = 'g' }, + -- Marks + { mode = 'n', keys = "'" }, + { mode = 'n', keys = '`' }, + { mode = 'x', keys = "'" }, + { mode = 'x', keys = '`' }, + -- Registers + { mode = 'n', keys = '"' }, + { mode = 'x', keys = '"' }, + { mode = 'i', keys = '<C-r>' }, + { mode = 'c', keys = '<C-r>' }, + -- Window commands + { mode = 'n', keys = '<C-w>' }, + -- `z` key + { mode = 'n', keys = 'z' }, + { mode = 'x', keys = 'z' }, + -- `s` surround keys + { mode = 'n', keys = 's' }, + }, + clues = { + -- Enhance this by adding descriptions for <Leader> mapping groups + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + miniclue.gen_clues.z(), + }, + window = { + delay = 300, + }, +} + +-- Better Around/Inside textobjects +-- +-- Examples: +-- - va) - [V]isually select [A]round [)]paren +-- - yinq - [Y]ank [I]nside [N]ext [Q]uote +-- - ci' - [C]hange [I]nside [']quote +require('mini.ai').setup { n_lines = 500 } + +-- Add/delete/replace surroundings (brackets, quotes, etc.) +-- +-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren +-- - sd' - [S]urround [D]elete [']quotes +-- - sr)' - [S]urround [R]eplace [)] ['] +require('mini.surround').setup() + diff --git a/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua b/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua new file mode 100644 index 0000000..4cdd7f7 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua @@ -0,0 +1,16 @@ +vim.pack.add { + { + name = 'nvim-lint', + src = 'https://github.com/mfussenegger/nvim-lint', + }, +} + +local lint = require 'lint' +lint.linters_by_ft = {} +lint.linters_by_ft['c'] = { 'clangtidy' } +lint.linters_by_ft['ksh'] = { 'ksh' } +lint.linters_by_ft['ansible.yaml'] = { 'ansible_lint' } +lint.linters_by_ft['terraform'] = { 'tofu', 'tflint', 'terraform_validate' } +lint.linters_by_ft['python'] = { 'ruff' } +lint.linters_by_ft['sh'] = { 'shellcheck' } +table.insert(lint.linters.shellcheck.args, '-x') diff --git a/.config/nvim/lua/eugenetriguba/plugins/oil.lua b/.config/nvim/lua/eugenetriguba/plugins/oil.lua new file mode 100644 index 0000000..4791c43 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/oil.lua @@ -0,0 +1,26 @@ +-- Replace netrw with Oil to work with the file hierarchy +-- as a regular vim buffer. +vim.pack.add { + { + name = 'mini.icons', + src = 'https://github.com/nvim-mini/mini.icons', + }, + { + name = 'oil', + src = 'https://github.com/stevearc/oil.nvim', + }, +} + +require('mini.icons').setup {} +require('oil').setup { + keymaps = { + -- Clashes with tmux navigator + ['<C-l>'] = false, + ['<C-h>'] = false, + -- Remap refresh to a new key, since we just disabled it. + ['<C-r>'] = 'actions.refresh', + }, +} +vim.keymap.set('n', '\\', '<CMD>Oil --float<CR>', { desc = 'Open parent directory in floating window' }) +vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }) + diff --git a/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua b/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua new file mode 100644 index 0000000..e01cfa4 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua @@ -0,0 +1,62 @@ +-- Treesitter adds understanding of the source code text +-- (e.g. fields, methods, classes). nvim has built-in support +-- for tree-sitter, however, nvim-treesitter makes it easier +-- to automatically install tree-sitter parser files for each +-- language. + +vim.api.nvim_create_autocmd('PackChanged', { + callback = function(event) + local name, kind = event.data.spec.name, event.data.kind + if name == 'nvim-treesitter' and (kind == 'update' or kind == 'install') then + vim.schedule(function() + -- If nvim-treesitter was updated, run ':TSUpdate' to + -- ensure the installed parsers are also updated. + vim.cmd 'TSUpdate all' + end) + end + end, +}) + +vim.pack.add { + { + name = 'nvim-treesitter', + src = 'https://github.com/nvim-treesitter/nvim-treesitter', + version = 'main', + }, + { + name = 'nvim-treesitter-context', + src = 'https://github.com/nvim-treesitter/nvim-treesitter-context', + }, +} + +local langs = { + 'bash', + 'c', + 'commonlisp', + 'css', + 'hcl', + 'html', + 'javascript', + 'json', + 'lua', + 'make', + 'python', + 'sh', + 'sql', + 'tsx', + 'typescript', + 'yaml', +} + +require 'nvim-treesitter'.install { ensure_installed = langs } + +vim.api.nvim_create_autocmd('FileType', { + pattern = langs, + callback = function() + vim.treesitter.start() + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, +}) + +require('treesitter-context').setup { multiline_threshold = 10} + diff --git a/.config/nvim/lua/eugenetriguba/plugins/vim-tmux-navigator.lua b/.config/nvim/lua/eugenetriguba/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..978f72a --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/vim-tmux-navigator.lua @@ -0,0 +1,13 @@ +-- Support navigating between tmux splits and vim splits +vim.pack.add { + { + name = 'vim-tmux-navigator', + src = 'https://github.com/christoomey/vim-tmux-navigator', + }, +} +vim.keymap.set('n', '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>') +vim.keymap.set('n', '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>') +vim.keymap.set('n', '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>') +vim.keymap.set('n', '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>') +vim.keymap.set('n', '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>') + diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..91e3f2d --- /dev/null +++ b/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,54 @@ +{ + "plugins": { + "conform.nvim": { + "rev": "016802de402556da54c36bd7359b441266b01cdd", + "src": "https://github.com/stevearc/conform.nvim" + }, + "fidget.nvim": { + "rev": "9e0201673e08e997e7cf52afca5565c70bd117f3", + "src": "https://github.com/j-hui/fidget.nvim" + }, + "fzf-lua": { + "rev": "c67fadd9a24230417267e4f9068227e093c0be2b", + "src": "https://github.com/ibhagwan/fzf-lua" + }, + "lazydev.nvim": { + "rev": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d", + "src": "https://github.com/folke/lazydev.nvim" + }, + "mini": { + "rev": "295af26358628c8ba8f007ff6a7e0aec2f642a31", + "src": "https://github.com/nvim-mini/mini.nvim", + "version": "'main'" + }, + "mini.icons": { + "rev": "f916635dc5ae2f479fbb9ab8184bb9444b62e86c", + "src": "https://github.com/nvim-mini/mini.icons" + }, + "nord": { + "rev": "80c1e5321505aeb22b7a9f23eb82f1e193c12470", + "src": "https://github.com/shaunsingh/nord.nvim" + }, + "nvim-lspconfig": { + "rev": "45a3a444b710511c39abca3b60bb6e23a21e3de5", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "ca581c3436fc2b236847f5b739ebc263739e5ca6", + "src": "https://github.com/nvim-treesitter/nvim-treesitter", + "version": "'main'" + }, + "nvim-treesitter-context": { + "rev": "8decd73460d26ef0a0befb745d022dd1fc2c38b8", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-context" + }, + "oil": { + "rev": "d3733d933833a0e59b813ecec99341527adf0c28", + "src": "https://github.com/stevearc/oil.nvim" + }, + "vim-tmux-navigator": { + "rev": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432", + "src": "https://github.com/christoomey/vim-tmux-navigator" + } + } +} diff --git a/.config/tmux/key-remappings.tmux b/.config/tmux/key-remappings.tmux new file mode 100644 index 0000000..103722f --- /dev/null +++ b/.config/tmux/key-remappings.tmux @@ -0,0 +1,19 @@ +# Remap prefix from 'C-b' to 'C-a' +# +# This works well if you remap the regular Caps Lock key to Ctrl. +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# Remap pane splits to something more sane than the default. +# +# Split panes using | for horizontal splits and - for vertical splits +bind-key | split-window -h -c "#{pane_current_path}" +bind-key - split-window -v -c "#{pane_current_path}" +unbind '"' +unbind % +bind-key c new-window -c "#{pane_current_path}" + +# Easier configuration reloading and pane killing +bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded!" +bind-key x kill-pane diff --git a/.config/tmux/options.tmux b/.config/tmux/options.tmux new file mode 100644 index 0000000..7cb9075 --- /dev/null +++ b/.config/tmux/options.tmux @@ -0,0 +1,40 @@ +# Don't rename windows automatically. +# +# I often will use the `,` key to rename windows. +# However, by default, tmux will update the window +# title to the last executed command. +set-option -g allow-rename off + +# Enable mouse support (clickable windows, panes, resizable panes) +set-option -g mouse on + +# Enable system clipboard integration +set-option -g set-clipboard on + +# Allow focus events (for editors like Neovim) +set -g focus-events on + +# Start windows and panes at 1, not 0 +set-option -g base-index 1 +set-option -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +set-option -g status-position top + +# Don't do anything when a 'bell' rings +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity off +set-option -g bell-action none + +# Enable hyperlinks +set-option -as terminal-features ",*:hyperlinks" + +# Enable true color support +set -ga terminal-overrides ",*256col*:Tc" +set -ga terminal-overrides ",tmux-256color:Tc" + +set -g default-terminal "tmux-256color" +set -g default-shell $SHELL diff --git a/.config/tmux/plugins.tmux b/.config/tmux/plugins.tmux new file mode 100644 index 0000000..9072828 --- /dev/null +++ b/.config/tmux/plugins.tmux @@ -0,0 +1,45 @@ +set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins/" +set-option -g @plugin 'tmux-plugins/tpm' + +# 'Sensible' set of defaults +set-option -g @plugin 'tmux-plugins/tmux-sensible' + +# Tmux FZF is a plugin that integrates FZF with tmux +TMUX_FZF_ORDER="session|window|pane|command|keybinding" +TMUX_FZF_OPTIONS="-p -w 90% -h 70% -m" +set-option -g @plugin 'sainnhe/tmux-fzf' + +# Resurrect is a plugin that saves and restores tmux sessions +set-option -g @plugin 'tmux-plugins/tmux-resurrect' +set-option -g @resurrect-save 'S' +set-option -g @resurrect-restore 'R' + +# Continuum is a plugin that automatically saves tmux sessions +# at regular intervals +set-option -g @plugin 'tmux-plugins/tmux-continuum' +set-option -g @continuum-restore 'on' +set-option -g @continuum-save-interval '15' +set-option -g @resurrect-strategy-nvim 'session' + +# Vim Tmux Navigator allows you to navigate between Vim and tmux panes +set-option -g @plugin 'christoomey/vim-tmux-navigator' + +set-option -g @plugin 'tmux-plugins/tmux-yank' +set-option -g @plugin 'tmux-plugins/tmux-open' + +set-option -g @plugin "janoamaral/tokyo-night-tmux" +set-option -g @tokyo-night-tmux_theme night +set-option -g @tokyo-night-tmux_transparent 1 +set-option -g @tokyo-night-tmux_window_id_style digital +set-option -g @tokyo-night-tmux_pane_id_style hsquare +set-option -g @tokyo-night-tmux_zoom_id_style dsquare +set-option -g @tokyo-night-tmux_terminal_icon +set-option -g @tokyo-night-tmux_active_terminal_icon +set-option -g @tokyo-night-tmux_window_tidy_icons 1 +set-option -g @tokyo-night-tmux_show_git 0 +set-option -g @tokyo-night-tmux_show_wbg 0 +set-option -g @tokyo-night-tmux_show_datetime 0 + +set-option -g @plugin 'https://git.sr.ht/~eugenetriguba/tmux-toggle-term' + +run '~/.tmux/plugins/tpm/tpm' diff --git a/.config/tmux/vi.tmux b/.config/tmux/vi.tmux new file mode 100644 index 0000000..85f2f37 --- /dev/null +++ b/.config/tmux/vi.tmux @@ -0,0 +1,6 @@ +set-window-option -g mode-keys vi + +# Use visual selection mode as vi +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel @@ -0,0 +1,104 @@ +# +# Appearance +# +fontname "monospace:pixelsize=14:bold" +color menubg "#32302f" +color menufg "#ebdbb2" +color font "#ebdbb2" +color selffont "#32302f" +gap 26 2 2 2 + +# +# Application Commands +# +command browser firefox +command terminal xterm +command top "xterm -e top" + +# +# Window Behavior +# +sticky yes +snapdist 10 +moveamount 5 + +# +# Unbind all defaults +# +unbind-key all +unbind-mouse all + +# +# Key Bindings +# +# bind-key: +# - 4 = super +# - M = alt +# - C = ctrl +# - S = shift +# +# bind-mouse: +# - 1 = left +# - 2 = middle +# - 3 = right +# + +# reload cwm (e.g. refresh config) +bind-key 4S-r restart + +# window management +bind-key 4-q window-delete +bind-key 4S-q quit +bind-key 4-f fullscreen +bind-key 4S-space window-stick +bind-key 4-m window-maximize + +# tiling/snapping +bind-key 4-h window-snap-left +bind-key 4-j window-snap-down +bind-key 4-k window-snap-up +bind-key 4-l window-snap-right +bind-key 4-v window-vtile +bind-key 4-b window-htile + +# focus movement +bind-key 4-Tab window-cycle +bind-key 4S-Tab window-rcycle + +# go to workspace +bind-key 4-1 group-only-1 +bind-key 4-2 group-only-2 +bind-key 4-3 group-only-3 +bind-key 4-4 group-only-4 +bind-key 4-5 group-only-5 +bind-key 4-6 group-only-6 +bind-key 4-7 group-only-7 +bind-key 4-8 group-only-8 +bind-key 4-9 group-only-9 + +# move window to workspace +bind-key 4S-1 window-movetogroup-1 +bind-key 4S-2 window-movetogroup-2 +bind-key 4S-3 window-movetogroup-3 +bind-key 4S-4 window-movetogroup-4 +bind-key 4S-5 window-movetogroup-5 +bind-key 4S-6 window-movetogroup-6 +bind-key 4S-7 window-movetogroup-7 +bind-key 4S-8 window-movetogroup-8 +bind-key 4S-9 window-movetogroup-9 + +# applications +bind-key 4-Return terminal +bind-key 4-a menu-cmd +bind-key 4-d menu-exec +bind-key 4-w menu-window +bind-key 4S-s menu-ssh + +# window hiding/unhiding +bind-key 4-x window-hide +bind-key 4S-x window-unhide + +# mouse +bind-mouse 4-1 window-move +bind-mouse 4-3 window-resize +bind-mouse 4S-3 window-lower @@ -0,0 +1,2 @@ +#!/bin/sh +feh --no-fehbg --bg-scale '/home/eugene/Pictures/Wallpapers/3840x2160-dark-openbsd.png' diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..eb3b4c5 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,13 @@ +[user] + name = Eugene Triguba + email = hello@eugenetriguba.com +[core] + editor = nvim +[pull] + ff = only +[push] + autoSetupRemote = true +[diff] + colorMoved = zebra +[init] + defaultBranch = main @@ -0,0 +1,84 @@ +#!/bin/ksh + +# PS1 with git branch support +git_branch() { + git branch 2>/dev/null | grep '^\*' | cut -d' ' -f2- +} +PS1='$( + p=$PWD + if [ $PWD = $HOME ]; then + printf " ~ " + else + dir_b="${p%/*}" # /home/user/projects + dir_b="${dir_b##*/}" # projects + dir_a="${p##*/}" # myfolder + result="$dir_b/$dir_a" + printf " %s " $result + fi + + branch=$(git_branch) + if [ -n "$branch" ]; then + printf "\033[32m(%s)\033[0m " "$branch" + fi + if [ "$(id -u)" -eq 0 ]; then + printf "# " + else + printf "$ " + fi +)' + +# +# Setup shell history +# +export HISTFILE=~/.ksh_history +export HISTSIZE=1000000 + +# +# Setup default env variables +# +export EDITOR="nvim" +export BROWSER="firefox" +export GPG_TTY=$(tty) +export PAGER="less" +export MANPAGER="less" +export BAT_THEME="tokyonight_night" +export LANG="en_US.UTF-8" +export LC_CTYPE="en_US.UTF-8" +export TERM="xterm-256color" + +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_STATE_HOME="$HOME/.local/state" + +# +# Append additional directories onto PATH +# +export PATH="$HOME/bin:$PATH" +export PATH="$HOME/.local/bin:$PATH" + +# +# Aliases +# +alias gs="git status" +alias gc="git commit" +alias ga="git add" +alias gd="git diff" +alias gds="git diff --staged" +alias gp="git push" +alias gpo="git push origin" +alias gpl="git pull" +alias gplrb="git pull --rebase" +alias gl="git log" +alias gv="git log --graph --decorate --oneline" +alias gch="git checkout" +alias gcb="git checkout -b" + +alias h="history 25" +alias j="jobs -l" +alias l="ls -al" + +alias vim="nvim" +alias vi="nvim" + +set -o emacs diff --git a/.profile b/.profile new file mode 100644 index 0000000..af44829 --- /dev/null +++ b/.profile @@ -0,0 +1,7 @@ +# $OpenBSD: dot.profile,v 1.8 2022/08/10 07:40:37 tb Exp $ +# +# sh/ksh initialization + +PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin +ENV=$HOME/.kshrc +export PATH HOME TERM ENV @@ -0,0 +1,7 @@ +#-quicklisp +(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) + +(ql:quickload :swank) +(swank:create-server :port 4005 :dont-close t) diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..deb2b88 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,4 @@ +source-file ~/.config/tmux/key-remappings.tmux +source-file ~/.config/tmux/options.tmux +source-file ~/.config/tmux/vi.tmux +source-file ~/.config/tmux/plugins.tmux diff --git a/.xsession b/.xsession new file mode 100644 index 0000000..3d35d92 --- /dev/null +++ b/.xsession @@ -0,0 +1,9 @@ +#!/bin/sh +export ENV=$HOME/.kshrc +export MOZ_ACCELERATED=1 +export MOZ_WEBRENDER=1 +xrdb -merge ~/.Xresources +~/.fehbg & +~/.config/lemonbar-xft/bar.sh | lemonbar-xft -f "Hack:size=12" -g x24 -B "#1c1c1c" -F "#d0d0d0" & +~/bin/sct-daemon & +exec cwm diff --git a/README.md b/README.md new file mode 100644 index 0000000..963c6d5 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# OpenBSD Dotfiles + +This repository comprises the dotfiles I'm using on OpenBSD. + +To install them, run: + +```sh +./link.sh +``` + +You'll likely need some packages installed: + +``` +$ pkg_info -m | awk '{ print $1 }' +bash-5.3.9 +bat-0.25.0 +clang-tools-extra-21.1.8p2 +fd-10.4.2 +feh-3.12.1 +firefox-157.0 +fzf-0.71.0 +git-2.53.0 +hack-fonts-3.003 +intel-firmware-20260925v0 +inteldrm-firmware-20260519 +iwx-firmware-20251021p0 +lemonbar-xft-1.1.20180416p0 +minisign-0.12 +neovim-0.12.1 +quirks-7.194 +ripgrep-15.1.0 +ruff-0.15.11 +sct-0.5 +shellcheck-0.11.0p0 +shfmt-3.6.0 +stylua-2.4.1 +tree-0.62 +tree-sitter-cli-0.26.5 +uvideo-firmware-1.2p3 +wget-1.25.0p0 +xsel-1.2.1 +zig-0.15.2p0 +``` diff --git a/bin/cwmbar b/bin/cwmbar new file mode 100755 index 0000000..7d723dd --- /dev/null +++ b/bin/cwmbar @@ -0,0 +1,37 @@ +#!/bin/sh +set -o errexit + +main() { + # Redraw when the active group or the window list changes. + # -spy prints once at startup too, so the bar draws immediately. + xprop -root -spy _NET_CURRENT_DESKTOP _NET_CLIENT_LIST | + while read -r _; do + groups + done | lemonbar-xft -g x18 -B '#222222' -F '#dddddd' | sh +} + +groups() { + cur=$(xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}') + num=$(xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}') + + # groups that currently contain windows + occ=$(for w in $(xprop -root _NET_CLIENT_LIST | cut -d'#' -f2 | tr -d ','); do + xprop -id "$w" _NET_WM_DESKTOP 2>/dev/null | awk '{print $3}' + done | sort -u) + + out="" + i=1 # skip 0 ("nogroup") + while [ "$i" -lt "$num" ]; do + if [ "$i" -eq "$cur" ]; then + out="$out%{R} $i %{R}" # active: reversed colors + elif echo "$occ" | grep -qx "$i"; then + out="$out%{A:xdotool set_desktop $i:} $i %{A}" # occupied, clickable + else + out="$out%{F#555}%{A:xdotool set_desktop $i:} $i %{A}%{F-}" # empty, dimmed + fi + i=$((i + 1)) + done + echo "%{l}$out" +} + +main diff --git a/bin/sct-daemon b/bin/sct-daemon new file mode 100755 index 0000000..f975081 --- /dev/null +++ b/bin/sct-daemon @@ -0,0 +1,23 @@ +#!/bin/sh +set -o errexit + +main() { + while true; do + hour=$(date +%H) + if is_day "$hour"; then + sct 6500 >/dev/null + elif is_evening "$hour"; then + sct 4500 >/dev/null + elif is_night "$hour"; then + sct 3500 >/dev/null + fi + sleep 600 & + wait $! + done +} + +is_day() { [ "$1" -ge 6 ] && [ "$1" -lt 17 ]; } +is_evening() { [ "$1" -ge 17 ] && [ "$1" -lt 20 ]; } +is_night() { [ "$1" -ge 20 ] && [ "$1" -lt 6 ]; } + +main diff --git a/bin/start-tmux b/bin/start-tmux new file mode 100755 index 0000000..12b22ad --- /dev/null +++ b/bin/start-tmux @@ -0,0 +1,13 @@ +#!/bin/sh +set -o errexit + +readonly SESSION_NAME="$USER" + +main() { + if ! tmux has-session -t "$SESSION_NAME" 2>/dev/null; then + tmux new-session -A -s "$SESSION_NAME" -d + fi + exec tmux attach-session -t "$SESSION_NAME" +} + +main @@ -0,0 +1,56 @@ +#!/bin/sh +set -o errexit +set -o nounset + +DOTFILES=${DOTFILES:-$HOME/.dotfiles} +DOTFILES=$(cd "$DOTFILES" && pwd) + +# Directories where we want the link the contents. +CONTAINERS='.config' + +main() { + cd "$DOTFILES" + walk '' +} + + +walk() { + for path in "$1".[!.]* "$1"..?* "$1"*; do + [ -e "$path" ] || [ -L "$path" ] || continue # unmatched glob + case $path in + .git|.gitignore|link.sh|README*) continue ;; + esac + if [ -d "$path" ] && is_container "$path"; then + walk "$path/" + else + link "$path" + fi + done +} + +is_container() { + for c in $CONTAINERS; do + case $c in + "$1"|"$1"/*) return 0 ;; + esac + done + return 1 +} + +link() { + src=$DOTFILES/$1 + dest=$HOME/$1 + + mkdir -p "$(dirname "$dest")" + + if [ -L "$dest" ]; then + rm "$dest" + elif [ -e "$dest" ]; then + mv "$dest" "$dest.bak.$(date +%Y%m%d%H%M%S)" + fi + + ln -s "$src" "$dest" + printf 'linked %s\n' "$1" +} + +main |