Add syncing with extra groups
This commit is contained in:
parent
f48b7c8690
commit
ab7c74f888
7 changed files with 23 additions and 18 deletions
|
@ -5,16 +5,21 @@ _systemctl () {
|
|||
}
|
||||
|
||||
_query_autostart_toml() {
|
||||
tomlq -r --arg host "$HOSTNAME" \
|
||||
groups_json=$(echo -n "$2" | tr "," "\n" | jq -R . | jq -s .)
|
||||
tomlq -r \
|
||||
--arg host "$HOSTNAME" \
|
||||
--argjson extra_groups "$groups_json" \
|
||||
'.hosts[$host].groups as $groups | .apps | to_entries[] | select(
|
||||
(.value.hosts | contains([$host])) or
|
||||
([.value.group] | inside($groups))
|
||||
([.value.group] | inside($groups)) or
|
||||
([.value.group] | inside($extra_groups)) or
|
||||
$extra_groups == ["*"]
|
||||
) | '"$1" \
|
||||
"$XDG_CONFIG_HOME/autostart.toml"
|
||||
}
|
||||
|
||||
_list () {
|
||||
_query_autostart_toml '.value.alias // .key'
|
||||
_query_autostart_toml '.value.alias // .key' "$1"
|
||||
}
|
||||
|
||||
_autostart_run_graphical () {
|
||||
|
@ -41,7 +46,7 @@ _autostart_run_graphical () {
|
|||
_echo_table () {
|
||||
for unit in "$@"
|
||||
do
|
||||
if _systemctl "$unit" is-enabled --quiet
|
||||
if [ "$(_systemctl "$unit" is-enabled)" = "enabled" ]
|
||||
then
|
||||
_enabled=$(green "enabled")
|
||||
else
|
||||
|
@ -64,9 +69,9 @@ _echo_table () {
|
|||
}
|
||||
|
||||
_get_autostart_cmd () {
|
||||
_query_autostart_toml 'select((.key == "'"$1"'") or (.value.alias == "'"$1"'")) | .value.command'
|
||||
_query_autostart_toml 'select((.key == "'"$1"'") or (.value.alias == "'"$1"'")) | .value.command' "*"
|
||||
}
|
||||
|
||||
_get_autostart_delay () {
|
||||
_query_autostart_toml 'select((.key == "'"$1"'") or (.value.alias == "'"$1"'")) | .value.delay // 0'
|
||||
_query_autostart_toml 'select((.key == "'"$1"'") or (.value.alias == "'"$1"'")) | .value.delay // 0' "*"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue