Code Monkey home page Code Monkey logo

Comments (5)

terminatorbs avatar terminatorbs commented on September 27, 2024 1

For anyone else with similar goals, but unwilling to run facebook's 50k loc monstrosity for it:

i imagine most linux distributions have inotify-tools available, offering inotifywait as a much simpler way of doing this.

i wrote a short shell script to do what i need:

#!/bin/bash

WATCHED_DIR="$HOME/.local/share/remmina"

while inotifywait -e create -e modify "$WATCHED_DIR"; do
    chezmoi add "$WATCHED_DIR"
done

echo "inotifywait encountered an error, exiting the script"
exit 1

note: this currently also automatically adds it on editing the connections. i'll use it for now, but if there's too many commits happening due to autocommit i'll likely remove the -e modify and sync it manually again. in my case the connections don't change too often though. i just need to have all of them in there.

from chezmoi.

twpayne avatar twpayne commented on September 27, 2024

You can use Watchman for this. There's an example that's the opposite to what you want in chezmoi's documentation, but you should be able to adapt this to run chezmoi add --force whenever your Remmina config directory changes.

from chezmoi.

terminatorbs avatar terminatorbs commented on September 27, 2024

thanks. not sure if i want to run a massive facebook service on all my machines, but i'll check it out.

from chezmoi.

twpayne avatar twpayne commented on September 27, 2024

Thank you, that's a much better solution than using Watchman, and documenting it here will help lots of people in the future.

from chezmoi.

terminatorbs avatar terminatorbs commented on September 27, 2024

glad you like it.

of course it does have some limitations, mainly not being cross platform, so documenting watchman might still make sense. although syncing home directories is a very linux thing to do imo, i still get that people might want their configs on other systems.

also, a way to reliably run that script is needed. a simple way is to add it to something like .bash_profile, but i'm never exactly sure when and how often that file gets ran, so i made a systemd user unit:

~/.config/systemd/user/watch-remmina.sh

[Unit]
Description=Watch directory for file changes, add to chezmoi on change

[Service]
Type=simple
# Use %h for the home directory path in systemd service files, here the script is in ~/scripts/
ExecStart=/bin/bash %h/scripts/watch-remmina.sh

[Install]
WantedBy=default.target

and a chezmoi run once file to enable it: run_once_after_enable-watch-remmina.sh (in the chezmoi dir)

#!/bin/bash

systemctl --user daemon-reload

systemctl --user enable watch-remmina.service

systemctl --user start watch-remmina.service

from chezmoi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.