diff --git a/backups/cron/home/daily.sh b/backups/cron/home/daily.sh index 6f62c3b..169a802 100755 --- a/backups/cron/home/daily.sh +++ b/backups/cron/home/daily.sh @@ -1,19 +1,19 @@ - #!/bin/bash +#!/bin/bash USER=thomas export XDG_RUNTIME_DIR=/run/user/1000 source /home/thomas/.env -if mountpoint -q /media/backups-home; then - # sudo /usr/bin/rsnapshot daily - sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf daily - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ  Daily `/home` backup completed successfully.' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ  Daily `/home` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ  Error: `/home` backup drive not mounted.' +if mountpoint -q /media/samsung-T3; then + # sudo /usr/bin/rsnapshot daily + sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf daily + if [ $? -eq 0 ]; then + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ  Daily `/home` backup completed successfully.' + else + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ  Daily `/home` backup failed.' || exit $? + fi +else + echo "Backup drive not mounted" + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ  Error: `/home` backup drive not mounted.' fi diff --git a/backups/cron/home/hourly.sh b/backups/cron/home/hourly.sh index cb55bf6..67f435b 100755 --- a/backups/cron/home/hourly.sh +++ b/backups/cron/home/hourly.sh @@ -1,19 +1,18 @@ -#!/bin/bash +#!/bin/bash +THIS_FILE=${0} +SLACK_NOTIFIER="/home/thomas/dotfiles/scripts/slack_notifier.sh" USER=thomas export XDG_RUNTIME_DIR=/run/user/1000 - source /home/thomas/.env -if mountpoint -q /media/backups-home; then - sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf hourly - # sudo /usr/bin/rsnapshot hourly - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ  Hourly `/home` backup completed successfully' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ  Hourly `/home` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ  Error: `/home` backup drive not mounted.' +if mountpoint -q /media/samsung-T3; then + SNAPSHOT=$(sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf hourly 2>&1 1>/dev/null) + if [ $? -ne 0 ]; then + $SLACK_NOTIFIER "backups" "ERROR Hourly /home backup failed" "$SNAPSHOT" + else + $SLACK_NOTIFIER "backups" "SUCCESS Hourly /home backup completed." + fi +else + $SLACK_NOTIFIER "backups" "ERROR Hourly /home backup failed: disk not mounted." fi diff --git a/backups/cron/home/monthly.sh b/backups/cron/home/monthly.sh index 5b687d0..8be091c 100755 --- a/backups/cron/home/monthly.sh +++ b/backups/cron/home/monthly.sh @@ -1,19 +1,19 @@ -#!/bin/bash +#!/bin/bash USER=thomas export XDG_RUNTIME_DIR=/run/user/1000 source /home/thomas/.env -if mountpoint -q /media/backups-home; then - sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf monthly - # sudo /usr/bin/rsnapshot monthly - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ  Monthly `/home` backup completed successfully.' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ  Monthly `/home` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ  Error: `/home` backup drive not mounted.' +if mountpoint -q /media/samsung-T3; then + sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf monthly + # sudo /usr/bin/rsnapshot monthly + if [ $? -eq 0 ]; then + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ  Monthly `/home` backup completed successfully.' + else + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ  Weekly `/home` backup failed.' || exit $? + fi +else + echo "Backup drive not mounted" + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ  Error: `/home` backup drive not mounted.' fi diff --git a/backups/cron/home/weekly.sh b/backups/cron/home/weekly.sh index 8ceb681..acbfc69 100755 --- a/backups/cron/home/weekly.sh +++ b/backups/cron/home/weekly.sh @@ -1,20 +1,19 @@ -#!/bin/bash +#!/bin/bash USER=thomas export XDG_RUNTIME_DIR=/run/user/1000 - source /home/thomas/.env -if mountpoint -q /media/backups-home; then - sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf weekly - # sudo /usr/bin/rsnapshot weekly - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ  Weekly `/home` backup completed successfully.' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ  Weekly `/home` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ  Error: `/home` backup drive not mounted.' +if mountpoint -q /media/samsung-T3; then + sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf weekly + # sudo /usr/bin/rsnapshot weekly + if [ $? -eq 0 ]; then + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ  Weekly `/home` backup completed successfully.' + else + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ  Weekly `/home` backup failed.' || exit $? + fi +else + echo "Backup drive not mounted" + /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ  Error: `/home` backup drive not mounted.' fi diff --git a/backups/cron/root/daily.sh b/backups/cron/root/daily.sh deleted file mode 100755 index 2f21e9d..0000000 --- a/backups/cron/root/daily.sh +++ /dev/null @@ -1,18 +0,0 @@ - #!/bin/bash - -USER=thomas -export XDG_RUNTIME_DIR=/run/user/1000 - -source /home/thomas/.env - -if mountpoint -q /media/backups-home; then - sudo /usr/bin/rsnapshot -c /etc/rsnapshot_root.conf daily - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ«š Daily `/` backup completed successfully.' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ«š Daily `/` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ«š Error: `/` backup drive not mounted.' -fi diff --git a/backups/cron/root/hourly.sh b/backups/cron/root/hourly.sh deleted file mode 100755 index 6e5a0bc..0000000 --- a/backups/cron/root/hourly.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -USER=thomas -export XDG_RUNTIME_DIR=/run/user/1000 - -source /home/thomas/.env - -if mountpoint -q /media/backups-home; then - sudo /usr/bin/rsnapshot -c /etc/rsnapshot_root.conf hourly - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ«š Hourly `/` backup completed successfully' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ«š Hourly `/` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ«š Error: `/` backup drive not mounted.' -fi diff --git a/backups/cron/root/monthly.sh b/backups/cron/root/monthly.sh deleted file mode 100755 index 46e2e14..0000000 --- a/backups/cron/root/monthly.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -USER=thomas -export XDG_RUNTIME_DIR=/run/user/1000 - -source /home/thomas/.env - -if mountpoint -q /media/backups-home; then - sudo /usr/bin/rsnapshot -c /etc/rsnapshot_root.conf monthly - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ«š Monthly `/` backup completed successfully.' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ«š Monthly `/` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ«š Error: `/` backup drive not mounted.' -fi diff --git a/backups/cron/root/weekly.sh b/backups/cron/root/weekly.sh deleted file mode 100755 index a4ba73d..0000000 --- a/backups/cron/root/weekly.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -USER=thomas -export XDG_RUNTIME_DIR=/run/user/1000 - - -source /home/thomas/.env - -if mountpoint -q /media/backups-home; then - - sudo /usr/bin/rsnapshot -c /etc/rsnapshot_root.conf monthly - if [ $? -eq 0 ]; then - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'βœ…πŸ«š Weekly `/` backup completed successfully.' - else - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'β›”πŸ«š Weekly `/` backup failed.' - fi -else - echo "Backup drive not mounted" - /home/thomas/repos/slack-notifier/src/index.js 'backups' 'πŸ’ΎπŸ«š Error: `/` backup drive not mounted.' -fi diff --git a/backups/rsnapshot.conf b/backups/rsnapshot.conf index 1750315..a50b989 100644 --- a/backups/rsnapshot.conf +++ b/backups/rsnapshot.conf @@ -21,7 +21,7 @@ config_version 1.2 # All snapshots will be stored under this root directory. # -snapshot_root /media/backups-home +snapshot_root /media/samsung-T3 # If no_create_root is enabled, rsnapshot will not automatically create the # snapshot_root directory. This is particularly useful if you are backing @@ -164,7 +164,24 @@ lockfile /var/run/rsnapshot.pid #include ??? #include ??? #exclude ??? -#exclude ??? +exclude node_modules +exclude .npm +exclude .mozilla +exclude .config/chromium +exclude .config/google-chrome +exclude .local/share/Trash +exclude .thumbnails +exclude .android +exclude .docker +exclude tmp +exclude .vscode +exclude .electron +exclude .cargo +exclude .yarn +exclude .Trash +exclude .Trash-* +exclude .local/share/Trash +exclude lost+found # The include_file and exclude_file parameters, if enabled, simply get # passed directly to rsync. Please look up the --include-from and @@ -226,8 +243,7 @@ lockfile /var/run/rsnapshot.pid ############################### # LOCALHOST -backup /home/ home/ -exclude "/lost+found/" +backup /home/ home #backup /etc/ etc/ #backup /usr/local/ usr/local/ diff --git a/gruvbox-95/sounds/consolewarning.mp3 b/gruvbox-95/sounds/consolewarning.mp3 new file mode 100644 index 0000000..9ef236b Binary files /dev/null and b/gruvbox-95/sounds/consolewarning.mp3 differ diff --git a/gruvbox-95/sounds/success.mp3 b/gruvbox-95/sounds/success.mp3 new file mode 100644 index 0000000..68df867 Binary files /dev/null and b/gruvbox-95/sounds/success.mp3 differ diff --git a/kitty/kitty.conf b/kitty/kitty.conf index ebc7388..d008ba8 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -3,9 +3,10 @@ include ./theme.conf # font_family PragmataPro Mono Liga # bold_font PragmataPro Mono Liga Bold # italic_font PragmataPro Mono Liga Italic -# bold_italic_font PragmataPro Mono Liga Bold Italic +# bold_italic_font PragmataPro Mono Liga Bold Italic -font_family JetBrainsMonoNL Nerd Font + +font_family JetBrainsMono bold_font auto italic_font auto bold_italic_font auto @@ -21,6 +22,10 @@ bold_italic_font auto # italic_font TerminusTTF-Italic # bold_italic_font TerminusTTF-Bold-Italic +# font_family TerminusTTF +# bold_font TerminusTTF-Bold +# italic_font TerminusTTF-Italic + font_size 10 diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 221fb97..6611ece 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,9 +1,11 @@ { "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" }, "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, @@ -21,6 +23,7 @@ "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "neogit": { "branch": "master", "commit": "6d1bd94f7fca92a50a892f494920696b5defa8c8" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, @@ -39,8 +42,6 @@ "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" }, "vim-css-color": { "branch": "master", "commit": "950e80352b325ff26d3b0faf95b29e301c200f7d" }, "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, - "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-smoothie": { "branch": "master", "commit": "df1e324e9f3395c630c1c523d0555a01d2eb1b7e" }, - "vim-wakatime": { "branch": "master", "commit": "cf51327a9e08935569614d1cb24e779ee9f45519" }, "zk-nvim": { "branch": "main", "commit": "aa9b346f2b0ab0c822bef917ee7f607d5c99f7bc" } } diff --git a/nvim/lua/config/colourscheme.lua b/nvim/lua/config/colourscheme.lua index dde12b7..7d9362b 100644 --- a/nvim/lua/config/colourscheme.lua +++ b/nvim/lua/config/colourscheme.lua @@ -1,15 +1,15 @@ -local global = vim.g +-- local global = vim.g -global.gruvbox_material_background = "medium" -global.gruvbox_material_enable_bold = 0 -global.gruvbox_material_enable_italic = 1 +-- global.gruvbox_material_background = "medium" +-- global.gruvbox_material_enable_bold = 0 +-- global.gruvbox_material_enable_italic = 0 -local function update_highlight_group(group, tbl) - local old_hl = vim.api.nvim_get_hl_by_name(group, true) - local new_hl = vim.tbl_extend("force", old_hl, tbl) - vim.api.nvim_set_hl(0, group, new_hl) -end +-- local function update_highlight_group(group, tbl) +-- local old_hl = vim.api.nvim_get_hl_by_name(group, true) +-- local new_hl = vim.tbl_extend("force", old_hl, tbl) +-- vim.api.nvim_set_hl(0, group, new_hl) +-- end -update_highlight_group("Function", { bold = false }) -update_highlight_group("Comment", { italic = true }) -update_highlight_group("String", { italic = false }) +-- update_highlight_group("Function", { bold = false }) +-- update_highlight_group("Comment", { italic = false }) +-- update_highlight_group("String", { italic = false }) diff --git a/nvim/lua/config/keybindings.lua b/nvim/lua/config/keybindings.lua index 83cfc22..dea6ae0 100644 --- a/nvim/lua/config/keybindings.lua +++ b/nvim/lua/config/keybindings.lua @@ -23,3 +23,9 @@ keymap.set("n", "lh", function() local config = vim.diagnostic.config() vim.diagnostic.config({ virtual_text = not config.virtual_text }) end) + +-- Toggle spellcheck +keymap.set("n", "sp", function() + vim.opt.spell = not vim.opt.spell:get() + vim.opt.spelllang = "en_gb" +end, { desc = "Toggle spell check" }) diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua index 449e053..e847a1b 100644 --- a/nvim/lua/config/lazy.lua +++ b/nvim/lua/config/lazy.lua @@ -27,7 +27,7 @@ require("lazy").setup({ }, -- Configure any other settings here. See the documentation for more details. -- colorscheme that will be used when installing plugins. - install = { colorscheme = { "gruvbox" } }, + --install = { colorscheme = { "gruvbox-material" } }, -- automatically check for plugin updates checker = { enabled = false }, }) diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua index 224b157..0d7e1c2 100644 --- a/nvim/lua/config/options.lua +++ b/nvim/lua/config/options.lua @@ -2,7 +2,7 @@ local global = vim.g local opt = vim.opt local diagnostic = vim.diagnostic -vim.api.nvim_set_hl(0, "@keyword.function.python", { italic = true }) +--vim.api.nvim_set_hl(0, "@keyword.function.python", { italic = true }) global.mapleader = ";" global.maplocalleader = "\\" global.lazyvim_picker = "telescope" @@ -33,8 +33,14 @@ opt.formatoptions = "cro" opt.backspace = "indent,eol,start" opt.conceallevel = 0 opt.spelllang = "en_gb" +opt.number = true +opt.relativenumber = true vim.opt.spell = false +-- vim.g.gruvbox_material_enable_bold = 1 +-- vim.g.gruvbox_material_enable_italic = 0 +--vim.g.gruvbox_italic = false + diagnostic.config({ virtual_text = false, }) diff --git a/nvim/lua/plugins/gruvbox-material.lua b/nvim/lua/plugins/gruvbox-material.lua deleted file mode 100644 index 39d95a1..0000000 --- a/nvim/lua/plugins/gruvbox-material.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "sainnhe/gruvbox-material", - lazy = false, - priority = 1000, - config = function() - vim.cmd.colorscheme("gruvbox-material") - end, -} diff --git a/nvim/lua/plugins/gruvbox.lua b/nvim/lua/plugins/gruvbox.lua new file mode 100644 index 0000000..3bf0fdd --- /dev/null +++ b/nvim/lua/plugins/gruvbox.lua @@ -0,0 +1,46 @@ +return { + "sainnhe/gruvbox-material", + lazy = false, + priority = 1000, + config = function() + -- Optionally configure and load the colorscheme + -- directly inside the plugin declaration. + + -- vim.g.gruvbox_material_disable_italic_comment = true + vim.g.gruvbox_material_enable_bold = false + vim.g.gruvbox_material_enable_italic = false + vim.cmd.colorscheme("gruvbox-material") + end, +} + +-- return { +-- "https://github.com/ellisonleao/gruvbox.nvim", +-- lazy = false, +-- priority = 1000, +-- config = function() +-- require("gruvbox").setup({ +-- invert_tabline = true, +-- invert_selection = true, +-- terminal_colors = true, -- add neovim terminal colors +-- undercurl = true, +-- underline = true, +-- bold = true, +-- italic = { +-- comments = true, +-- emphasis = false, +-- strings = true, +-- operators = true, +-- folds = false, +-- }, +-- }) +-- vim.cmd.colorscheme("gruvbox") +-- end, +-- } + +-- return { +-- "f4z3r/gruvbox-material.nvim", +-- name = "gruvbox-material", +-- lazy = false, +-- priority = 1000, +-- opts = {}, +-- } diff --git a/nvim/lua/plugins/illuminate.lua b/nvim/lua/plugins/illuminate.lua deleted file mode 100644 index c32928d..0000000 --- a/nvim/lua/plugins/illuminate.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "RRethy/vim-illuminate", -} diff --git a/nvim/lua/plugins/lazygit.lua b/nvim/lua/plugins/lazygit.lua index c0c09f1..bd71419 100644 --- a/nvim/lua/plugins/lazygit.lua +++ b/nvim/lua/plugins/lazygit.lua @@ -1,7 +1,17 @@ -return { "kdheepak/lazygit.nvim", keys = { - { - "lg", - "LazyGit", +return { + "kdheepak/lazygit.nvim", + lazy = true, + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- }, + keys = { + { "lg", "LazyGit", desc = "LazyGit" }, }, } - } diff --git a/nvim/lua/plugins/neotree.lua b/nvim/lua/plugins/neotree.lua index 896f940..cd8f86a 100644 --- a/nvim/lua/plugins/neotree.lua +++ b/nvim/lua/plugins/neotree.lua @@ -10,4 +10,14 @@ return { keys = { { "fb", ":Neotree" }, }, + config = function() + require("neo-tree").setup({ + filesystem = { + filtered_items = { + visible = true, + hide_dotfiles = false, + }, + }, + }) + end, } diff --git a/nvim/lua/plugins/vim-wakatime.lua b/nvim/lua/plugins/vim-wakatime.lua deleted file mode 100644 index 0c9070e..0000000 --- a/nvim/lua/plugins/vim-wakatime.lua +++ /dev/null @@ -1 +0,0 @@ -return { "wakatime/vim-wakatime" } diff --git a/scripts/convert_img_grvubox.sh b/scripts/convert_img_grvubox.sh new file mode 100755 index 0000000..3ac044e --- /dev/null +++ b/scripts/convert_img_grvubox.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# Enable debug output +set -x + +# Expanded Gruvbox palette with more intermediate shades +colors=( + # Dark backgrounds + "#282828" # bg + "#32302f" # bg0 + "#3c3836" # bg1 + "#504945" # bg2 + "#665c54" # bg3 + "#7c6f64" # bg4 + + # Light colors + "#ebdbb2" # fg + "#d5c4a1" # fg2 + "#bdae93" # fg3 + "#a89984" # fg4 + + # Bright colors with variations + "#fb4934" # bright red + "#cc241d" # dark red + "#9d0006" # darker red + + "#b8bb26" # bright green + "#98971a" # dark green + "#79740e" # darker green + + "#fabd2f" # bright yellow + "#d79921" # dark yellow + "#b57614" # darker yellow + + "#83a598" # bright blue + "#458588" # dark blue + "#076678" # darker blue + + "#d3869b" # bright purple + "#b16286" # dark purple + "#8f3f71" # darker purple + + "#8ec07c" # bright aqua + "#689d6a" # dark aqua + "#427b58" # darker aqua + + "#fe8019" # bright orange + "#d65d0e" # dark orange + "#af3a03" # darker orange +) + +if [ -z "$1" ]; then + echo "Usage: $0 [output_image.png]" + exit 1 +fi + +input_file="$1" +output_file="${2:-${1%.*}_gruvbox.png}" + +echo "Processing $input_file..." + +# Create color palette file with all colors +palette_cmd="magick convert " +for color in "${colors[@]}"; do + palette_cmd+="xc:$color " +done +palette_cmd+="+append /tmp/palette.png" +eval $palette_cmd + +echo "Created palette..." + +# Process the image with refined parameters +magick convert "$input_file" \ + -colorspace RGB \ + -brightness-contrast 3x10 \ + -level 0%,100%,1.1 \ + -colors 128 \ + -dither None \ + -remap /tmp/palette.png \ + -define png:color-type=6 \ + "$output_file" + +echo "Conversion complete. Output saved to: $output_file" + +# Clean up +rm /tmp/palette.png diff --git a/scripts/dummy_error_script.sh b/scripts/dummy_error_script.sh new file mode 100755 index 0000000..3bcfe4e --- /dev/null +++ b/scripts/dummy_error_script.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +THIS_FILE=${0} +SLACK_NOTIFIER="/home/thomas/repos/utilities/slack_notifier.sh" +COMMAND=$(ls /nonexisting_dir 2>&1 1>/dev/null) +#COMMAND=$(ls . 2>&1 1>/dev/null) + +if ! $COMMAND; then + $SLACK_NOTIFIER "test" "error" "Something went wrong" "$COMMAND" "$THIS_FILE" +else + $SLACK_NOTIFIER "test" "success" "All good!" +fi diff --git a/scripts/monitor_mullvad.sh b/scripts/monitor_mullvad.sh new file mode 100755 index 0000000..58da07c --- /dev/null +++ b/scripts/monitor_mullvad.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +while true; do + # Check both Mullvad connection and internet connectivity + if ! mullvad status | grep -q "Connected"; then + echo "$(date '+%H:%M:%S') - Mullvad reports as disconnected. Reconnecting..." + mullvad disconnect + sleep 2 + mullvad connect + + # Wait a moment for connection to establish + sleep 2 + + # Verify and report the new connection status + if mullvad status | grep -q "Connected"; then + echo "$(date '+%H:%M:%S') - Successfully reconnected to Mullvad" + fi + elif ! ping -c 1 google.com &>/dev/null; then + echo "$(date '+%H:%M:%S') - Ping to google.com failed. Reconnecting..." + mullvad disconnect + sleep 2 + mullvad connect + + # Wait a moment for connection to establish + sleep 2 + + # Verify and report the new connection status + if mullvad status | grep -q "Connected" && ping -c 1 google.com &>/dev/null; then + echo "$(date '+%H:%M:%S') - Successfully reconnected to Mullvad with internet access" + fi + fi + sleep 1 +done diff --git a/scripts/slack_notifier.sh b/scripts/slack_notifier.sh new file mode 100644 index 0000000..6a8a919 --- /dev/null +++ b/scripts/slack_notifier.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# Check that this can be sourced by cron at actual runtime + +# Env vars: +# --- Webhook URLs for given channel, eg $SLACK_WEBHOOK_TEST, $SLACK_WEBHOOK_EOLAS +# --- sourced from `.env` file in Zsh path + +# Parameters: +# --- $1 = Slack channel, +# --- $2 = type 'error' | 'success' +# --- $3 = Message +# --- $4 = (Opt) Error details +# --- $5 = (Opt) Error source + +# Usage: +# --- ./slack_notifier.sh test 'SUCCESS: It worked' +# --- ./slack_notifier.sh test 'ERROR: Something went wrong' 'Error message' + +declare -A CHANNEL_TO_WEBHOOK +CHANNEL_TO_WEBHOOK["test"]=$SLACK_WEBHOOK_TEST +CHANNEL_TO_WEBHOOK["backups"]=$SLACK_WEBHOOK_BACKUPS +CHANNEL_TO_WEBHOOK["eolas"]=$SLACK_WEBHOOK_EOLAS +CHANNEL_TO_WEBHOOK["website"]=$SLACK_WEBHOOK_SYSTEMS_OBSCURE +CHANNEL_TO_WEBHOOK["time-tracking"]=$SLACK_WEBHOOK_TIME_TRACKING + +WEBHOOK=${CHANNEL_TO_WEBHOOK[$1]} + +ERROR_BLOCKS=$( + jq -n \ + --arg channel "$1" \ + --arg message "$3" \ + --arg details "$4" \ + --arg source "$5" \ + '{ + channel: $channel, + blocks: ([ + { + type: "section", + text: { + type: "plain_text", + text: "πŸ”΄" + $message + } + }, + { + type: "section", + text: { + type: "mrkdwn", + text: "```\n\($details)\n```" + } + }, + { + "type": "context", + "elements": [ + { + "type": "plain_text", + text: $source + } + ] + } + ]) + }' +) + +# Initialise sound playback +mpv --volume=0 --start=0 --length=0.1 /home/thomas/dotfiles/gruvbox-95/sounds/st-computer-on.mp3 +sleep 1 + +# Process notification +if [ "$2" != "error" ]; then + curl -X POST \ + -H 'Content-type: application/json' \ + --data '{"text":"🟒 '"$3"'"}' \ + "$WEBHOOK" + mpv --volume=100 /home/thomas/dotfiles/sounds/star-trek-computer-success.mp3 +else + curl -X POST \ + -H 'Content-type: application/json' \ + --json "$ERROR_BLOCKS" \ + "$WEBHOOK" + mpv --volume=100 /home/thomas/dotfiles/sounds/star-trek-computer-error.mp3 +fi diff --git a/sounds/star-trek-computer-error.mp3 b/sounds/star-trek-computer-error.mp3 new file mode 100644 index 0000000..92914cb Binary files /dev/null and b/sounds/star-trek-computer-error.mp3 differ diff --git a/sounds/star-trek-computer-success.mp3 b/sounds/star-trek-computer-success.mp3 new file mode 100644 index 0000000..035328f Binary files /dev/null and b/sounds/star-trek-computer-success.mp3 differ diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 31bf8de..c09c9b0 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -11,11 +11,11 @@ set -ga terminal-overrides ",*256col*:Tc" set-option -g status-position top set -g status-justify centre -# set -g window-status-current-style 'bg=#282828,fg=#ebdbb2' +set -g window-status-current-style 'bg=#282828,fg=#ebdbb2' -set-option -g status-left " Session #S " +set-option -g status-left " Session #S" -# set -g status-right 'tmux ' +set -g status-right 'tmux ' set -g window-status-format " #I:#W " set -g window-status-current-format " #I:#W " @@ -24,8 +24,10 @@ set -g window-status-current-format " #I:#W " # set -g status-bg colour8 # set -g status-fg colour7 # Split panes with \ and - -bind \\ split-window -h -c "#{pane_current_path}" +bind Β£ split-window -h -c "#{pane_current_path}" bind - split-window -v -c "#{pane_current_path}" + + # unbind \\ # unbind - bind h select-pane -L @@ -34,10 +36,10 @@ bind k select-pane -U bind l select-pane -R -bind-key -r C-Up resize-pane -U 5 -bind-key -r C-Down resize-pane -D 5 -bind-key -r C-Left resize-pane -L 5 -bind-key -r C-Right resize-pane -R 5 +bind-key -r Up resize-pane -U 5 +bind-key -r Down resize-pane -D 5 +bind-key -r Left resize-pane -L 5 +bind-key -r Right resize-pane -R 5 set -g mouse on # remove delay for exiting insert mode with ESC in Neovim diff --git a/zsh/thomas.zsh-theme b/zsh/thomas.zsh-theme index 083c8f6..ba55ed5 100644 --- a/zsh/thomas.zsh-theme +++ b/zsh/thomas.zsh-theme @@ -3,7 +3,26 @@ # PROMPT='%{$fg_bold[green]%}%n@%m %{$fg_bold[magenta]%}(%2~)$(git_prompt_info)%{$reset_color%}%(.) ' #PROMPT='%{$fg_bold[green]%}%n@%m %{$fg_bold[magenta]%}(%2~)$(git_prompt_info)%{$reset_color%}%(.) ' -PROMPT='%{$fg_bold[green]%}%{$fg_bold[magenta]%}(%2~)$(git_prompt_info)%{$reset_color%}%(.) ' +#PROMPT='%{$fg_bold[green]%}%{$fg_bold[magenta]%}(%2~)$(git_prompt_info)%{$reset_color%}%(.) ' +#PROMPT='%{$fg[cyan]%}%D{%H:%M:%S}%{$reset_color%} %{$fg_bold[magenta]%}(%2~)$(git_prompt_info)%{$reset_color%}%(.) ' +#PROMPT='%{$fg[yellow]%}[%D{%H:%M:%S}]%{$reset_color%} %{$fg_bold[magenta]%}(%2~)$(git_prompt_info)%{$reset_color%}%(.)$'\n' ' -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%} " +#PROMPT='%{$fg[yellow]%}[%D{%H:%M:%S}]%{$reset_color%} %{$fg_bold[magenta]%}(%2~)$(git_prompt_info)%{$reset_color%}%(.) +#%{$reset_color%}$ ' + +# PROMPT='%{$fg[cyan]%}%D{%H:%M:%S}%{$reset_color%} %{$fg_bold[magenta]%}%2~$(git_prompt_info)%{$reset_color%}%(.) +# %{$fg[green]%}$%{$reset_color%} ' + +# PROMPT='%{$fg[cyan]%}%D{%H:%M:%S}%{$reset_color%} %{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[magenta]%}%2~$(git_prompt_info)%{$reset_color%}%(.) +# %{$fg[green]%}$%{$reset_color%} ' + +# PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[magenta]%}%2~$(git_prompt_info)%{$reset_color%}%(.) +# %{$fg[green]%}$%{$reset_color%} ' + +PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%}$(git_prompt_info)%(.) +%{$fg[green]%}$%{$reset_color%} ' +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[magenta]%} " ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +#ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%} " +#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/zsh/zshrc b/zsh/zshrc index b8fbc1b..0a7cf73 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -12,6 +12,13 @@ alias dot="cd /home/thomas/dotfiles" alias ddb="aws dynamodb" alias zcom="/home/thomas/repos/eolas/scripts/auto_save.sh" alias sysobs="cd /home/thomas/repos/systems-obscure" +alias gs="git status" +alias ga="git add" +alias gc="git commit" +alias syncmus="/home/thomas/repos/utilities/music_sync/update_music_library.sh" +alias dc="docker compose" + + # alias xhd="cd /run/media/thomas" # alias cs-update="/home/thomas/repos/eolas/_scripts/auto_save.sh" # alias cs-query="/home/thomas/repos/eolas/_scripts/query.sh"