diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 49725fb9..d4234d19 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -11,6 +11,6 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@97a652b80035363df47baee5031ec8670b8878ac + - uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb - name: Build the Docker image run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/snyk-container-analysis.yml b/.github/workflows/snyk-container-analysis.yml deleted file mode 100644 index 534d339d..00000000 --- a/.github/workflows/snyk-container-analysis.yml +++ /dev/null @@ -1,54 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# A sample workflow which checks out the code, builds a container -# image using Docker and scans that image for vulnerabilities using -# Snyk. The results are then uploaded to GitHub Security Code Scanning -# -# For more examples, including how to limit scans to only high-severity -# issues, monitor images for newly disclosed vulnerabilities in Snyk and -# fail PR checks for new vulnerabilities, see https://github.com/snyk/actions/ - -name: Snyk Container - -on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '38 15 * * 1' - -permissions: - contents: read - -jobs: - snyk: - permissions: - contents: read # for actions/checkout to fetch code - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@97a652b80035363df47baee5031ec8670b8878ac - - name: Build a Docker image - run: docker build -t mrmustash/homedir . - - name: Run Snyk to check Docker image for vulnerabilities - # Snyk can be used to break the build when it detects vulnerabilities. - # In this case we want to upload the issues to GitHub Code Scanning - continue-on-error: true - uses: snyk/actions/docker@3e2680e8df93a24b52d119b1305fb7cedc60ceae - env: - # In order to use the Snyk Action you will need to have a Snyk API token. - # More details in https://github.com/snyk/actions#getting-your-snyk-token - # or you can signup for free at https://snyk.io/login - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - with: - image: mrmustash/homedir - args: --file=Dockerfile --severity-threshold=high - - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@0b2a40fa4a512e979fb8d7c8c90dd396c35dcdbe - with: - sarif_file: snyk.sarif diff --git a/Darwin/defaults.sh b/Darwin/defaults.sh index 40d6ff6b..e29169b2 100755 --- a/Darwin/defaults.sh +++ b/Darwin/defaults.sh @@ -14,7 +14,7 @@ while true; do done 2>/dev/null & # Get all current update -#softwareupdate --download --verbose --all +softwareupdate --download --verbose --install --all # Agree to the Xcode license if /usr/bin/xcode-select -p; then @@ -140,14 +140,14 @@ defaults write com.apple.dock expose-animation-duration -float 0.1 # Speed up Mi # ========================================================================= }}} # Safari ================================================================== {{{ -defaults write com.apple.Safari HomePage -string "about:blank" # Set Safari’s home page to `about:blank` for faster loading -defaults write com.apple.Safari ShowFavoritesBar -bool false # Hide Safari’s bookmarks bar by default -defaults write com.apple.Safari ShowSidebarInTopSites -bool false # Hide Safari’s sidebar in Top Sites -defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true # Show the full URL in the address bar +# defaults write com.apple.Safari HomePage -string "about:blank" # Set Safari’s home page to `about:blank` for faster loading +# defaults write com.apple.Safari ShowFavoritesBar -bool false # Hide Safari’s bookmarks bar by default +# defaults write com.apple.Safari ShowSidebarInTopSites -bool false # Hide Safari’s sidebar in Top Sites +# defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true # Show the full URL in the address bar # Don’t send search queries to Apple -defaults write com.apple.Safari UniversalSearchEnabled -bool false -defaults write com.apple.Safari SuppressSearchSuggestions -bool true +# defaults write com.apple.Safari UniversalSearchEnabled -bool false +# defaults write com.apple.Safari SuppressSearchSuggestions -bool true # ========================================================================= }}} @@ -180,7 +180,6 @@ defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 # Time Machine ============================================================ {{{ exclusions=("$HOME/.local" - "$HOME/.Trash" "$HOME/Downloads" "$HOME/Dropbox" "$HOME/Library/Caches" diff --git a/Dockerfile b/Dockerfile index ac238073..1cb28003 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Patrick King's homedir container # Includes typical client utilities for percona, postgres and redis. -FROM ubuntu:22.04 +FROM ubuntu:24.04 ENV TZ=US/Pacific ENV DEBIAN_FRONTEND=noninteractive diff --git a/homemaker.toml b/homemaker.toml index 57f0ba0b..658e50e2 100644 --- a/homemaker.toml +++ b/homemaker.toml @@ -39,7 +39,7 @@ accepts = [["which", "npm"]] ["which", "fish"], ["echo", "$SHELL", "|", "grep", "fish"], ] - cmds = [["chsh", "-s", "/usr/bin/fish"]] + cmds = [["chsh", "-s", "/opt/homebrew/bin/fish"]] [tasks.terminfo] accepts = [["which", "tic"]] @@ -53,7 +53,8 @@ accepts = [["which", "npm"]] # ========================================================================= }}} # meta ==================================================================== {{{ [tasks.default] - deps = ["links", "systemconfig", "pip", "npm", "fish", "fish_completions", "terminfo"] + # deps = ["links", "systemconfig", "pip", "npm", "fish", "fish_completions", "terminfo"] + deps = ["links", "pip", "npm", "fish", "fish_completions", "terminfo"] # ========================================================================= }}} # macOS =================================================================== {{{ diff --git a/tilde/.config/fish/conf.d/env.fish b/tilde/.config/fish/conf.d/env.fish index 2c602cae..5c697004 100644 --- a/tilde/.config/fish/conf.d/env.fish +++ b/tilde/.config/fish/conf.d/env.fish @@ -39,12 +39,18 @@ set -gx QUBES_GPG_DOMAIN gpg set -gx HOMEBREW_PREFIX $__brew_prefix set -gx HOMEBREW_CELLAR $__brew_prefix/Cellar set -gx HOMEBREW_REPOSITORY $__brew_prefix +set -gx HOMEBREW_GNUBIN $__brew_prefix/opt/coreutils/libexec/gnubin +set -gx HOMEBREW_GNUMAN $__brew_prefix/opt/coreutils/libexec/gnuman + set -q PATH; or set PATH '' -set -gx PATH $__brew_prefix/opt/gnu-sed/libexec/gnubin $__brew_prefix/bin $__brew_prefix/sbin $PATH +set -gx PATH $HOMEBREW_GNUBIN $__brew_prefix/bin $__brew_prefix/sbin $PATH + set -q MANPATH; or set MANPATH '' -set -gx MANPATH /opt/homebrew/share/man $MANPATH +set -gx MANPATH $HOMEBREW_GNUMAN /opt/homebrew/share/man $MANPATH + set -q INFOPATH; or set INFOPATH '' set -gx INFOPATH $__brew_prefix/share/info $INFOPATH + if test -e $__brew_prefix/opt/fish/share/fish/__fish_build_paths.fish source $__brew_prefix/opt/fish/share/fish/__fish_build_paths.fish end @@ -55,6 +61,7 @@ fish_add_path --path $HOME/.yarn/bin fish_add_path --path $HOME/.config/yarn/global/node_modules/.bin fish_add_path --path $HOME/go/bin fish_add_path --path $HOME/.cargo/bin +fish_add_path --path $HOME/.local/bin # pipx path fish_add_path --path $__brew_prefix/opt/homebrew/opt/coreutils/libexec/gnubin fish_add_path --path $__brew_prefix/share/google-cloud-sdk/path.fish.inc diff --git a/tilde/.config/nvim/lua/pking/plugin/auto-session.lua b/tilde/.config/nvim/lua/pking/plugin/auto-session.lua index cda8bf19..6ec68161 100644 --- a/tilde/.config/nvim/lua/pking/plugin/auto-session.lua +++ b/tilde/.config/nvim/lua/pking/plugin/auto-session.lua @@ -5,6 +5,9 @@ return { auto_session_enabled = true, auto_session_create_enabled = true, auto_session_use_git_branch = true, + auto_session_enable_last_session = true, + auto_save_enabled = true, + auto_restore_enabled = true, auto_session_suppress_dirs = { "~/", "~/Downloads", "~/Library", "/"}, diff --git a/tilde/.config/nvim/lua/pking/plugin/lsp/lspconfig.lua b/tilde/.config/nvim/lua/pking/plugin/lsp/lspconfig.lua index eb18d36a..474a3e75 100644 --- a/tilde/.config/nvim/lua/pking/plugin/lsp/lspconfig.lua +++ b/tilde/.config/nvim/lua/pking/plugin/lsp/lspconfig.lua @@ -111,6 +111,7 @@ return { "bashls", "dockerls", "eslint", -- Javascript + "harper_ls", "jsonls", "lua_ls", "ruff_lsp", -- Python diff --git a/tilde/.config/nvim/lua/pking/plugin/lsp/null-ls.lua b/tilde/.config/nvim/lua/pking/plugin/lsp/null-ls.lua index 89dbae2f..9237635d 100644 --- a/tilde/.config/nvim/lua/pking/plugin/lsp/null-ls.lua +++ b/tilde/.config/nvim/lua/pking/plugin/lsp/null-ls.lua @@ -12,7 +12,12 @@ return { -- with mason-lspconfig in lspconfig.lua null_ls.setup({ sources = { + -- Everything but LSPs are listed here. All automatic LSP + -- installs can be found in lspconfig.lua under + -- `ensure_installed` for the mason-lspconfig setup. + -- Bash + null_ls.builtins.formatting.shellharden, null_ls.builtins.formatting.shfmt, @@ -33,11 +38,11 @@ return { null_ls.builtins.formatting.golines, -- Lua + null_ls.builtins.diagnostics.selene, null_ls.builtins.formatting.stylua, -- Markdown / Text null_ls.builtins.code_actions.proselint, - null_ls.builtins.diagnostics.vale, null_ls.builtins.diagnostics.write_good.with({ filetypes = { "markdown", "text" }}), null_ls.builtins.formatting.markdownlint, diff --git a/tilde/.config/nvim/lua/pking/plugin/lualine.lua b/tilde/.config/nvim/lua/pking/plugin/lualine.lua index 324a2ca1..1cef235c 100644 --- a/tilde/.config/nvim/lua/pking/plugin/lualine.lua +++ b/tilde/.config/nvim/lua/pking/plugin/lualine.lua @@ -7,7 +7,19 @@ return { event = { 'UIEnter' }, dependencies = { "nvim-tree/nvim-web-devicons", - "WhoIsSethDaniel/lualine-lsp-progress", + { + "linrongbin16/lsp-progress.nvim", + config = function() + require ('lsp-progress').setup() + + vim.api.nvim_create_augroup("lualine_augroup", { clear = true }) + vim.api.nvim_create_autocmd("User", { + group = "lualine_augroup", + pattern = "LspProgressStatusUpdated", + callback = require("lualine").refresh, + }) + end, + }, "AndreM222/copilot-lualine", }, config = function() @@ -127,6 +139,10 @@ return { end + local function auto_session() + return "󱎤 "..require('auto-session.lib').current_session_name() + end + require('lualine').setup { options = { icons_enabled = true, @@ -181,8 +197,10 @@ return { newfile = '  ', -- Text to show for new created file before first writting } }, + auto_session, 'location', require('auto-session.lib').current_session_name, + require('lsp-progress').progress, }, lualine_x = { { searchCount }, diff --git a/tilde/.config/terminal/dircolors/dircolors-solarized b/tilde/.config/terminal/dircolors/dircolors-solarized index 664dd4e9..6714ca06 160000 --- a/tilde/.config/terminal/dircolors/dircolors-solarized +++ b/tilde/.config/terminal/dircolors/dircolors-solarized @@ -1 +1 @@ -Subproject commit 664dd4e91ff9600a8e8640ef59bc45dd7c86f18f +Subproject commit 6714ca06aa98befd7d732e90bcf10bdcb3ea224e diff --git a/tilde/.gitconfig b/tilde/.gitconfig index a07a5ab9..29777b2f 100644 --- a/tilde/.gitconfig +++ b/tilde/.gitconfig @@ -5,10 +5,10 @@ name = Patrick King email = patrick@patrickcking.com username = mr-mustash - signingkey = 0x944E36F397047609 + #signingkey = 0x944E36F397047609 [gpg] - program = /usr/local/MacGPG2/bin/gpg + #program = /usr/local/MacGPG2/bin/gpg # Non-template things [alias] @@ -21,7 +21,7 @@ sort = -committerdate [commit] - gpgsign = true + #gpgsign = true [core] editor=nvim @@ -80,3 +80,5 @@ path = ~/.gitconfig.local # vim: set noexpandtab tabstop=4 nolist: +[credential] + helper = store diff --git a/tilde/.hammerspoon/init.lua b/tilde/.hammerspoon/init.lua index f2660943..b208fdd8 100644 --- a/tilde/.hammerspoon/init.lua +++ b/tilde/.hammerspoon/init.lua @@ -84,6 +84,8 @@ menubarLargeStyle = { font = { name = "DejaVuSansMono Nerd Font Mono", size = 20 defaultStyle = { font = { name = ".AppleSystemUIFont", size = 13 } } +Homedir = os.getenv( "HOME" ) + -- ========================================================================= }}} -- Important functions ===================================================== {{{ run = require("functions/run") @@ -109,6 +111,7 @@ display = require("system/display") Dock = require("system/dock") networking = require("system/networking") videoCalls = require("system/videoCalls") +-- Keytrap = require("system/keytrap") audioControl.init() @@ -118,6 +121,7 @@ display.init() Dock.init() networking.init() videoCalls.init() +-- Keytrap.init() -- ========================================================================= }}} -- App configuration ======================================================= {{{ diff --git a/tilde/.hammerspoon/spoon-config/urls.lua b/tilde/.hammerspoon/spoon-config/urls.lua index e8d716ae..4cd27baf 100644 --- a/tilde/.hammerspoon/spoon-config/urls.lua +++ b/tilde/.hammerspoon/spoon-config/urls.lua @@ -28,14 +28,16 @@ function urls.init() spoon.URLDispatcher.url_patterns = { {"https://captive.apple.com/", builtin}, {"https?://%w+.beatsense.com", builtin}, - {"https?://%w+.twitter.com/", builtin}, - {"https?://%w+.zoom.us/j/", meetings}, {"https?://%w+.tiktok.com", builtin}, + {"https?://%w+.twitter.com/", builtin}, {"https?://%w+.w2g.tv", builtin}, + {"https?://%w+.x.com/", builtin}, + {"https?://%w+.zoom.us/j/", meetings}, + {"https?://meet.google.com", builtin}, {"https?://tiktok.com", builtin}, - {"https?://twitter.com/", builtin}, {"https?://w2g.tv", builtin}, {"https?://www.beatsense.com", builtin}, + {"https?://x.com/", builtin}, {"https?://zoom.us/j/", meetings}, } diff --git a/tilde/.hammerspoon/system/audioControl.lua b/tilde/.hammerspoon/system/audioControl.lua index b3dcc3ea..c86721ba 100644 --- a/tilde/.hammerspoon/system/audioControl.lua +++ b/tilde/.hammerspoon/system/audioControl.lua @@ -50,6 +50,26 @@ local function internalOrExternalMic() _log("Unable to set any mic as default") return 1 end +local function perDeviceWatcher(dev_uid, event_name, event_scope, event_element) + local device = hs.audiodevice.findDeviceByUID(dev_uid) + if device and event_name == "mute" then + _log("\"" .. device:name() .. "\" mute state has changed.") + audioControl.matchInputMuteToOutputMute() + sleep(1) + end +end + +local function startOutputWatcher() + local defaultOutput = hs.audiodevice.defaultOutputDevice() + + if defaultOutput:watcherIsRunning() then + _log("Audio watcher for " .. defaultOutput:name() .. " already exists.") + else + _log("No audio watcher found for " .. defaultOutput:name() .. " starting one.") + defaultOutput:watcherCallback(perDeviceWatcher) + defaultOutput:watcherStart() + end +end local function audioDeviceChanged(arg) local outputRetval = 1 @@ -66,6 +86,7 @@ local function audioDeviceChanged(arg) sleep(5) _log("New audio device detected. Current values: Speaker: " .. hs.audiodevice.defaultOutputDevice():name() .. " Mic: " .. hs.audiodevice.defaultInputDevice():name()) + startOutputWatcher() outputRetval = internalOrExternalSpeaker() micRetval = internalOrExternalMic() @@ -89,25 +110,23 @@ local function trapVolumeControls() -- Send mute to external monitor if connected and it's the default audio output if event["key"] == "MUTE" then - if isMuted == false then - isMuted = true - run.cmd("/Users/patrickking/bin/m1ddc", { "set", "mute", "on" }) - _log("Muted external monitor.") - else - isMuted = false + if hs.audiodevice.defaultOutputDevice():outputMuted() then run.cmd("/Users/patrickking/bin/m1ddc", { "set", "mute", "off" }) _log("Unmuted external monitor.") + else + run.cmd("/Users/patrickking/bin/m1ddc", { "set", "mute", "on" }) + _log("Muted external monitor.") end return true end -- Send volume up to external monitor if connected and it's the default audio output if event["key"] == "SOUND_UP" then - run.cmd("/Users/patrickking/bin/m1ddc", { "chg", "volume", "+5" }) + run.cmd(string.format("%s/bin/m1ddc", Homedir), { "chg", "volume", "+5" }) return true end if event["key"] == "SOUND_DOWN" then - run.cmd("/Users/patrickking/bin/m1ddc", { "chg", "volume", "-5" }) + run.cmd(string.format("%s/bin/m1ddc", Homedir), { "chg", "volume", "-5" }) return true end end @@ -128,6 +147,7 @@ function audioControl.init() local initStart = os.clock() hs.audiodevice.watcher.setCallback(audioDeviceChanged) hs.audiodevice.watcher.start() + startOutputWatcher() trapVolumeControls() hs.hotkey.bind({'cmd', 'shift'}, "k", function() audioControl.mediaControls("PLAY") end) @@ -137,6 +157,14 @@ function audioControl.init() _log(debug.getinfo(1, "S").short_src:gsub(".*/", "") .. " loaded in " .. (os.clock() - initStart) .. " seconds.") end +function audioControl.matchInputMuteToOutputMute() + if hs.audiodevice.defaultOutputDevice():muted() then + audioControl.muteInputs() + else + audioControl.unmuteInputs() + end +end + function audioControl.muteInputs() for _, device in pairs(hs.audiodevice.allInputDevices()) do device:setInputMuted(true) @@ -158,7 +186,7 @@ end function audioControl.muteOutputs() for _, device in pairs(hs.audiodevice.allOutputDevices()) do if device:name() == secrets.audioControl.monitorOutput then - run.cmd("/Users/patrickking/bin/m1ddc", { "set", "mute", "on" }) + run.cmd(string.format("%s/bin/m1ddc", Homedir), { "set", "mute", "on" }) _log("External display " .. device:name() .. " muted") return end @@ -173,7 +201,7 @@ end function audioControl.unmuteOutputs() for _, device in pairs(hs.audiodevice.allOutputDevices()) do if device:name() == secrets.audioControl.monitorOutput then - run.cmd("/Users/patrickking/bin/m1ddc", { "set", "mute", "off" }) + run.cmd(string.format("%s/bin/m1ddc", Homedir), { "set", "mute", "off" }) _log("External display " .. device:name() .. " unmuted") return end diff --git a/tilde/.hammerspoon/system/display.lua b/tilde/.hammerspoon/system/display.lua index 367b9985..36c402c2 100644 --- a/tilde/.hammerspoon/system/display.lua +++ b/tilde/.hammerspoon/system/display.lua @@ -19,7 +19,7 @@ function display.setAllBrightness(brightness) else _log("Setting " .. display:name() .. " brightness to " .. brightness) -- Use ddcctl to set the brightness of all external displays - run.cmd("/Users/patrickking/bin/m1ddc", {"set", "luminance", tostring(brightness)}) + run.cmd(string.format("%s/bin/m1ddc", Homedir), {"set", "luminance", tostring(brightness)}) end end end diff --git a/tilde/.hammerspoon/system/keytrap.lua b/tilde/.hammerspoon/system/keytrap.lua new file mode 100644 index 00000000..067bcf11 --- /dev/null +++ b/tilde/.hammerspoon/system/keytrap.lua @@ -0,0 +1,16 @@ +local keytrap = {} + +local function keytrap_router() + systemeventtap = hs.eventtap.new({ hs.eventtap.event.types.systemDefined }, function(mainEvent) + local event = mainEvent:systemKey() + local flags = hs.eventtap.checkKeyboardModifiers() + + end) + systemeventtap:start() +end + +function keytrap.init() + keytrap_router() +end + +return keytrap