Refactor autostart system
This commit is contained in:
parent
b1814d3a5f
commit
0d82914d42
3 changed files with 178 additions and 113 deletions
|
@ -6,25 +6,17 @@ _systemctl () {
|
||||||
systemctl --user "${@:2}" "autostart@$1.service"
|
systemctl --user "${@:2}" "autostart@$1.service"
|
||||||
}
|
}
|
||||||
|
|
||||||
_dasel () {
|
_query_autostart_toml() {
|
||||||
dasel -f "$HOME/.config/autostart.toml" -r toml -w plain "${@}"
|
tomlq -r --arg host "$hostname" \
|
||||||
|
'.hosts[$host].groups as $groups | .apps | to_entries[] | select(
|
||||||
|
(.value.hosts | contains([$host])) or
|
||||||
|
([.value.group] | inside($groups))
|
||||||
|
) | '"$1" \
|
||||||
|
"$HOME/.config/autostart.toml"
|
||||||
}
|
}
|
||||||
|
|
||||||
_list () {
|
_list () {
|
||||||
part_root='all().filter(not(equal(type(),object))).key()'
|
_query_autostart_toml '.key'
|
||||||
part_host="all().filter(equal(type(),object)).filter(equal(key(),$hostname)).all().key()"
|
|
||||||
query="merge($part_host,$part_root).all()"
|
|
||||||
programs=$(_dasel "$query" \
|
|
||||||
| sort \
|
|
||||||
| uniq)
|
|
||||||
|
|
||||||
for program in $programs
|
|
||||||
do
|
|
||||||
cmd=$(_get_autostart_cmd "$program")
|
|
||||||
if [ -n "$cmd" ]; then
|
|
||||||
echo "$program"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_echo_table () {
|
_echo_table () {
|
||||||
|
@ -71,20 +63,7 @@ _autostart_manage_sync () {
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_autostart_cmd () {
|
_get_autostart_cmd () {
|
||||||
selector_base="all()"
|
_query_autostart_toml 'select(.key == "'"$1"'") | .value.command'
|
||||||
selector_host="all().filter(equal(type(),object)).filter(equal(key(),$hostname)).all()"
|
|
||||||
selector_entry="filter(not(equal(type(),object))).filter(equal(key(),$1))"
|
|
||||||
cmd=$(_dasel "$selector_base.$selector_entry")
|
|
||||||
cmd_local=$(_dasel "$selector_host.$selector_entry")
|
|
||||||
|
|
||||||
if [ -n "$cmd_local" ]; then
|
|
||||||
if [ "$cmd_local" = "false" ]; then
|
|
||||||
cmd=""
|
|
||||||
else
|
|
||||||
cmd="$cmd_local"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo "$cmd"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_autostart_manage_exec () {
|
_autostart_manage_exec () {
|
||||||
|
|
|
@ -1,42 +1,127 @@
|
||||||
# General
|
[hosts.portalo]
|
||||||
discord = 'flatpak run com.discordapp.Discord'
|
groups = ['common', 'wayland', 'chat', 'messenger']
|
||||||
dunst = 'dunst'
|
|
||||||
element = 'flatpak run im.riot.Riot'
|
|
||||||
kdeconnect = '$HOME/.nix-profile/libexec/kdeconnectd'
|
|
||||||
polkit = '/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1'
|
|
||||||
qutebrowser = 'qutebrowser'
|
|
||||||
spotifyd = 'spotifyd --no-daemon'
|
|
||||||
syncthing = 'syncthing -no-browser'
|
|
||||||
teamspeak = 'flatpak run com.teamspeak.TeamSpeak -nosingleinstance'
|
|
||||||
thunderbird = 'thunderbird'
|
|
||||||
|
|
||||||
#clipboard-manager = 'parcellite' # X11
|
[apps.ckb-next]
|
||||||
#clipboard-manager = 'wl-paste --watch cliphist store' # Wayland
|
command = 'ckb-next --background'
|
||||||
|
hosts = ['portalo']
|
||||||
|
group = ''
|
||||||
|
|
||||||
# X11
|
[apps.clipboard-manager-wayland]
|
||||||
conky-clock = 'conky --config="$HOME/.config/conky/clock.conf"'
|
command = 'wl-paste --watch cliphist store'
|
||||||
conky-system = 'conky --config="$HOME/.config/conky/system.conf"'
|
hosts = []
|
||||||
sxhkd = 'sxhkd'
|
group = 'wayland'
|
||||||
unclutter = 'unclutter --timeout=3 --ignore-scrolling --exclude-root'
|
|
||||||
xcompmgr = 'xcompmgr -cnfFn -D3'
|
|
||||||
|
|
||||||
# Wayland
|
[apps.clipboard-manager-x11]
|
||||||
hyprland-handler = '$XDG_CONFIG_HOME/hypr/handler.sh'
|
command = 'parcellite'
|
||||||
swww = 'swww init --no-daemon'
|
hosts = []
|
||||||
waybar = 'waybar'
|
group = 'x11'
|
||||||
|
|
||||||
|
[apps.conky-clock]
|
||||||
|
command = 'conky --config="$HOME/.config/conky/clock.conf"'
|
||||||
|
hosts = []
|
||||||
|
group = 'conky'
|
||||||
|
|
||||||
[portalo]
|
[apps.conky-system]
|
||||||
ckb-next = 'ckb-next --background'
|
command = 'conky --config="$HOME/.config/conky/system.conf"'
|
||||||
qbittorrent = 'flatpak run org.qbittorrent.qBittorrent'
|
hosts = []
|
||||||
signal = 'flatpak run org.signal.Signal'
|
group = 'conky'
|
||||||
solaar = 'solaar --window hide'
|
|
||||||
steam = 'flatpak run com.valvesoftware.Steam -silent'
|
|
||||||
|
|
||||||
conky-clock = false
|
[apps.discord]
|
||||||
conky-system = false
|
command = 'flatpak run com.discordapp.discord'
|
||||||
sxhkd = false
|
hosts = []
|
||||||
unclutter = false
|
group = 'chat'
|
||||||
xcompmgr = false
|
|
||||||
|
|
||||||
clipboard-manager = 'wl-paste --watch cliphist store'
|
[apps.dunst]
|
||||||
|
command = 'dunst'
|
||||||
|
hosts = []
|
||||||
|
group = 'common'
|
||||||
|
|
||||||
|
[apps.element]
|
||||||
|
command = 'flatpak run im.riot.riot'
|
||||||
|
hosts = []
|
||||||
|
group = 'chat'
|
||||||
|
|
||||||
|
[apps.hyprland-handler]
|
||||||
|
command = 'hyprland-handler'
|
||||||
|
hosts = []
|
||||||
|
group = 'wayland'
|
||||||
|
|
||||||
|
[apps.kdeconnect]
|
||||||
|
command = '$HOME/.nix-profile/libexec/kdeconnectd'
|
||||||
|
hosts = ['portalo']
|
||||||
|
group = ''
|
||||||
|
|
||||||
|
[apps.polkit]
|
||||||
|
command = '/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1'
|
||||||
|
hosts = []
|
||||||
|
group = 'common'
|
||||||
|
|
||||||
|
[apps.qbittorrent]
|
||||||
|
command = 'flatpak run org.qbittorrent.qBittorrent'
|
||||||
|
hosts = ['portalo']
|
||||||
|
group = ''
|
||||||
|
|
||||||
|
[apps.qutebrowser]
|
||||||
|
command = 'qutebrowser'
|
||||||
|
hosts = []
|
||||||
|
group = 'common'
|
||||||
|
|
||||||
|
[apps.signal]
|
||||||
|
command = 'flatpak run org.signal.Signal'
|
||||||
|
hosts = []
|
||||||
|
group = 'messenger'
|
||||||
|
|
||||||
|
[apps.solaar]
|
||||||
|
command = 'solaar --window hide'
|
||||||
|
hosts = ['portalo']
|
||||||
|
group = ''
|
||||||
|
|
||||||
|
[apps.spotifyd]
|
||||||
|
command = 'spotifyd --no-daemon'
|
||||||
|
hosts = ['portalo']
|
||||||
|
group = ''
|
||||||
|
|
||||||
|
[apps.steam]
|
||||||
|
command = 'flatpak run com.valvesoftware.Steam -silent'
|
||||||
|
hosts = ['portalo']
|
||||||
|
group = ''
|
||||||
|
|
||||||
|
[apps.swww]
|
||||||
|
command = 'swww init --no-daemon'
|
||||||
|
hosts = []
|
||||||
|
group = 'wayland'
|
||||||
|
|
||||||
|
[apps.sxhkd]
|
||||||
|
command = 'sxhkd'
|
||||||
|
hosts = []
|
||||||
|
group = 'x11'
|
||||||
|
|
||||||
|
[apps.syncthing]
|
||||||
|
command = 'syncthing -no-browser'
|
||||||
|
hosts = ['portalo']
|
||||||
|
group = ''
|
||||||
|
|
||||||
|
[apps.teamspeak]
|
||||||
|
command = 'flatpak run com.teamspeak.TeamSpeak -nosingleinstance'
|
||||||
|
hosts = []
|
||||||
|
group = 'chat'
|
||||||
|
|
||||||
|
[apps.thunderbird]
|
||||||
|
command = 'thunderbird'
|
||||||
|
hosts = []
|
||||||
|
group = 'messenger'
|
||||||
|
|
||||||
|
[apps.unclutter]
|
||||||
|
command = 'unclutter --timeout=3 --ignore-scrolling --exclude-root'
|
||||||
|
hosts = []
|
||||||
|
group = 'x11'
|
||||||
|
|
||||||
|
[apps.xcompmgr]
|
||||||
|
command = 'xcompmgr -cnfFn -D3'
|
||||||
|
hosts = []
|
||||||
|
group = 'x11'
|
||||||
|
|
||||||
|
[apps.waybar]
|
||||||
|
command = 'waybar'
|
||||||
|
hosts = []
|
||||||
|
group = 'wayland'
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
bat # cat-alternative
|
bat # cat-alternative
|
||||||
direnv # tool to load custom environments
|
direnv # tool to load custom environments
|
||||||
docker-credential-helpers
|
docker-credential-helpers
|
||||||
doggo # dns client
|
dogdns # dns client
|
||||||
exa # ls-alternative
|
exa # ls-alternative
|
||||||
faas-cli # cli for openfaas
|
faas-cli # cli for openfaas
|
||||||
fzf # fuzzy finder
|
fzf # fuzzy finder
|
||||||
git # git
|
git # git
|
||||||
gitflow # tool for git workflow
|
gitflow # tool for git workflow
|
||||||
git-lfs # git support for large files
|
git-lfs # git support for large files
|
||||||
|
jq # tool for json
|
||||||
moar # moar is less
|
moar # moar is less
|
||||||
nix-direnv # allow better nix and direnv integration
|
nix-direnv # allow better nix and direnv integration
|
||||||
libnotify # allows sending notifications
|
libnotify # allows sending notifications
|
||||||
|
|
Loading…
Reference in a new issue