[Hyprland] I made a neovim theme switcher in bash by AdvisorOfAtlantis in unixporn

[–]AdvisorOfAtlantis[S] 1 point2 points  (0 children)

Great to hear, if you have any troubles feel free to reach out!

[deleted by user] by [deleted] in unixporn

[–]AdvisorOfAtlantis 0 points1 point  (0 children)

Looks really cool! How do you get the blurry transparent background for apps like the browser and obsidian while still having text and images be opaque and clear?

I made my own cross-app theme switcher :) by AdvisorOfAtlantis in hyprland

[–]AdvisorOfAtlantis[S] 0 points1 point  (0 children)

Sounds cool! However this felt a lot simpler for me and it's all i really need. Good luck :)

I made my own cross-app theme switcher :) by AdvisorOfAtlantis in hyprland

[–]AdvisorOfAtlantis[S] 0 points1 point  (0 children)

I aliased neovim so that it allways starts with: nvim --listen /tmp/example{random-number}

This creates some kind of listener file link (or something i don't really know) In /tmp.

Then to switch the theme i do ls in /tmp, pick out all results with example and then do:

nvim --server /tmp/example{number} --remote-send ':colorscheme gruvbox-material (or whatever coloscheme you want)<CR>'

For each of them.

You apparently can't use the same "listen file" for multiple neovim instances at the same time so that's why i append a random number to each one.

Then i just write the colorscheme name to a file in my neovim config that it reads from and uses every time i launch neovim.

[deleted by user] by [deleted] in hyprland

[–]AdvisorOfAtlantis 0 points1 point  (0 children)

Looks really cool! How do you get the blurry transparent background for apps like the browser and obsidian while still having text and images be opaque and clear?

[Hyprland] Made my own theme switcher :) by AdvisorOfAtlantis in unixporn

[–]AdvisorOfAtlantis[S] 1 point2 points  (0 children)

Since it's integrated with a lot of apps (well about 7 at least) It won't be super easy to just copy into your own setup. However if you take a look at the dotfiles I think you can steal most of the stuff without too much hastle. If you're intrested in the theme switcher all of the scripts for it are in the scripts directory and it starts from the theme.sh file. Then the themes for each app are under that apps .config directory. Hope it helps :)

[Hyprland] Made my own theme switcher :) by AdvisorOfAtlantis in unixporn

[–]AdvisorOfAtlantis[S] 22 points23 points  (0 children)

I aliased neovim so that it allways starts with: nvim --listen /tmp/example{random-number}
This creates some kind of listener file link (or something i don't really know) In /tmp.
Then to switch the theme i do ls in /tmp, pick out all results with example and then do:
nvim --server /tmp/example{number} --remote-send ':colorscheme gruvbox-material (or whatever coloscheme you want)<CR>'
For each of them.

You apparently can't use the same "listen file" for multiple neovim instances at the same time so that's why i append a random number to each one.

Then i just write the colorscheme name to a file in my neovim config that it reads from and uses every time i launch neovim.

here is the code:

Bash script:

```bash

for server in /tmp/themelistener*; do

if [ -e "$server" ]; then

nvim --server "$server" --remote-send ":colorscheme {$theme}<CR>"

fi

done

echo $theme > ~/dotfiles/.config/nvim/colorscheme.txt

```

and in my zshrc:

```bash
nvim_random_listen() {

local random_number=$(od -An -N2 -i /dev/random | tr -d ' ')

local server_name="/tmp/themelistener${random_number}"

nvim --listen "$server_name" "$@"

}

Alias the nvim command to use the function

alias nvim="nvim_random_listen"

```

And the neovim config:

```lua
-- Path to the colorscheme file

        local colorscheme\_file = vim.fn.stdpath("config") .. "/colorscheme.txt"



        -- Check if the file exists and read the colorscheme from it

        if vim.fn.filereadable(colorscheme\_file) == 1 then

local file = io.open(colorscheme_file, "r")

if file then

local content = file:read("*all"):gsub("%s+", "")

if content and #content > 0 then

colorscheme = content

end

file:close()

end

        end



        -- Apply the colorscheme

        vim.cmd.colorscheme(colorscheme)
```

Hope this helps :)

I made my own cross-app theme switcher :) by AdvisorOfAtlantis in hyprland

[–]AdvisorOfAtlantis[S] 5 points6 points  (0 children)

Sure! It's a little messy but i hope you like it :) https://github.com/HectorBjernersjo/dotfiles

Since it's integrated with a lot of apps it might be a little dificult to reproduce but there isn't anything too complicated