From 123157c925a10a2c93a9536ea45193dae8bdcbd8 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Mon, 26 Aug 2024 19:34:49 -0700 Subject: [PATCH] fixes --- .config/nvim/init.lua | 1 + .config/nvim/lazy-lock.json | 6 +++--- .config/nvim/lua/plugins/init.lua | 16 +++------------- .config/nvim/lua/theme.lua | 23 +++++++++++++++++++++++ .config/sway/config | 2 +- .ssh/config | 4 ++++ scripts/machine-specific-zsh/asuka.zsh | 9 +++++++++ scripts/theme/hooks/tmux.sh | 2 +- scripts/theme/hooks/waybar.sh | 8 ++++++++ scripts/waybar_with_theme.sh | 3 ++- 10 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 .config/nvim/lua/theme.lua create mode 100644 scripts/machine-specific-zsh/asuka.zsh create mode 100755 scripts/theme/hooks/waybar.sh diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 98c365e..68492ce 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -19,3 +19,4 @@ end vim.opt.rtp:prepend(lazypath) require "plugins" +require "theme" diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 8485c74..19cb160 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,7 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "878ace11983444d865a72e1759dbcc331d1ace4c" }, - "auto-dark-mode.nvim": { "branch": "master", "commit": "2b8c938da9a7c9432120266b92936b2c22e8cfb8" }, "bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" }, "catppuccin": { "branch": "main", "commit": "5215ea59df6d0a7e27da9a5cd1165e06d1b04cbe" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -11,9 +10,10 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" }, "friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" }, + "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, "gitsigns.nvim": { "branch": "main", "commit": "cdfcd9d39d23c46ae9a040de2c6a8b8bf868746e" }, "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, - "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "mason.nvim": { "branch": "main", "commit": "49ff59aded1047a773670651cfa40e76e63c6377" }, "mini.statusline": { "branch": "main", "commit": "b5d23c5356e837f9e6426ffeed9f5acd0629bc07" }, "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, @@ -24,4 +24,4 @@ "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "telescope.nvim": { "branch": "master", "commit": "349660c0d35da06459ee8589af77de2086b652ce" } -} \ No newline at end of file +} diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 133745e..a8468ef 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -154,20 +154,10 @@ local plugins = { end, }, - -- auto dark mode + -- fwatch { - "f-person/auto-dark-mode.nvim", - opts = { - update_interval = 1000, - set_dark_mode = function() - vim.api.nvim_set_option("background", "dark") - vim.cmd("colorscheme catppuccin-mocha") - end, - set_light_mode = function() - vim.api.nvim_set_option("background", "light") - vim.cmd("colorscheme catppuccin-latte") - end, - }, + "rktjmp/fwatch.nvim", + lazy = true, }, } diff --git a/.config/nvim/lua/theme.lua b/.config/nvim/lua/theme.lua new file mode 100644 index 0000000..b5864c3 --- /dev/null +++ b/.config/nvim/lua/theme.lua @@ -0,0 +1,23 @@ +local fwatch = require("fwatch") + +function Set_theme_at(path) + local f = io.open(path, "rb") + if not f then return nil end + local theme = f:read("*a") + theme = theme:gsub("%s+", "") + f:close() + vim.schedule(function() + if (theme == "light") then + vim.api.nvim_set_option("background", "light") + vim.cmd("colorscheme catppuccin-latte") + else + vim.api.nvim_set_option("background", "dark") + vim.cmd("colorscheme catppuccin-mocha") + end + end) +end + +fwatch.watch(os.getenv("HOME") .. "/theme", { + on_event = Set_theme_at +}) +Set_theme_at(os.getenv("HOME") .. "/theme") diff --git a/.config/sway/config b/.config/sway/config index 77555d2..b9207f2 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -8,7 +8,7 @@ set $down j set $up k set $right l # Your preferred terminal emulator -set $term "/home/lizzy/scripts/alacritty_with_theme.sh" +set $term alacritty set $lock swaylock-corrupter set $browser xdg-open "https://static.simponic.xyz/dvd-logo/" # Your preferred application launcher diff --git a/.ssh/config b/.ssh/config index 2f81998..8e2eca3 100644 --- a/.ssh/config +++ b/.ssh/config @@ -6,6 +6,10 @@ Host git.hatecomputers.club User git Port 222 +Host europa + Hostname frens.simponic.xyz + ForwardAgent yes + Host levi ForwardAgent yes diff --git a/scripts/machine-specific-zsh/asuka.zsh b/scripts/machine-specific-zsh/asuka.zsh new file mode 100644 index 0000000..b678190 --- /dev/null +++ b/scripts/machine-specific-zsh/asuka.zsh @@ -0,0 +1,9 @@ + +eval "$(zoxide init --cmd z zsh)" + +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +fi +export GPG_TTY=$(tty) + +. /opt/asdf-vm/asdf.sh diff --git a/scripts/theme/hooks/tmux.sh b/scripts/theme/hooks/tmux.sh index af0c8b4..92edc2b 100755 --- a/scripts/theme/hooks/tmux.sh +++ b/scripts/theme/hooks/tmux.sh @@ -11,5 +11,5 @@ function catflavor() { echo $flavor } -echo "set -g @catppuccin_flavour $(catflavor $NEW_THEME)" > ~/.tmux/colors +echo "set -g @catppuccin_flavor $(catflavor $NEW_THEME)" > ~/.tmux/colors tmux source-file ~/.tmux.conf diff --git a/scripts/theme/hooks/waybar.sh b/scripts/theme/hooks/waybar.sh new file mode 100755 index 0000000..c96efc4 --- /dev/null +++ b/scripts/theme/hooks/waybar.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +NEW_THEME=$2 + +STYLE=$([ "$NEW_THEME" = "light" ] && echo "style.css" || echo "style.dark.css") + +killall waybar +waybar --style=$HOME/.config/waybar/$STYLE & diff --git a/scripts/waybar_with_theme.sh b/scripts/waybar_with_theme.sh index 51e58d3..5f26659 100755 --- a/scripts/waybar_with_theme.sh +++ b/scripts/waybar_with_theme.sh @@ -1,5 +1,6 @@ #!/bin/bash -STYLE=$([ -z "$DARK_MODE" ] && echo "style.css" || echo "style.dark.css") +THEME=$(gsettings get org.gnome.desktop.interface gtk-theme | tr -d "'") +STYLE=$([ $THEME = "light" ] && echo "style.css" || echo "style.dark.css") waybar --style=$HOME/.config/waybar/$STYLE &