diff --git a/.bin/autostart-manage b/.bin/autostart-manage index ec8145a..d168ead 100755 --- a/.bin/autostart-manage +++ b/.bin/autostart-manage @@ -6,25 +6,17 @@ _systemctl () { systemctl --user "${@:2}" "autostart@$1.service" } -_dasel () { - dasel -f "$HOME/.config/autostart.toml" -r toml -w plain "${@}" +_query_autostart_toml() { + 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 () { - part_root='all().filter(not(equal(type(),object))).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 + _query_autostart_toml '.key' } _echo_table () { @@ -71,20 +63,7 @@ _autostart_manage_sync () { } _get_autostart_cmd () { - selector_base="all()" - 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" + _query_autostart_toml 'select(.key == "'"$1"'") | .value.command' } _autostart_manage_exec () { diff --git a/.config/autostart.toml b/.config/autostart.toml index 7622a81..ecaaafa 100644 --- a/.config/autostart.toml +++ b/.config/autostart.toml @@ -1,42 +1,127 @@ -# General -discord = 'flatpak run com.discordapp.Discord' -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' +[hosts.portalo] +groups = ['common', 'wayland', 'chat', 'messenger'] -#clipboard-manager = 'parcellite' # X11 -#clipboard-manager = 'wl-paste --watch cliphist store' # Wayland +[apps.ckb-next] +command = 'ckb-next --background' +hosts = ['portalo'] +group = '' -# X11 -conky-clock = 'conky --config="$HOME/.config/conky/clock.conf"' -conky-system = 'conky --config="$HOME/.config/conky/system.conf"' -sxhkd = 'sxhkd' -unclutter = 'unclutter --timeout=3 --ignore-scrolling --exclude-root' -xcompmgr = 'xcompmgr -cnfFn -D3' +[apps.clipboard-manager-wayland] +command = 'wl-paste --watch cliphist store' +hosts = [] +group = 'wayland' -# Wayland -hyprland-handler = '$XDG_CONFIG_HOME/hypr/handler.sh' -swww = 'swww init --no-daemon' -waybar = 'waybar' +[apps.clipboard-manager-x11] +command = 'parcellite' +hosts = [] +group = 'x11' +[apps.conky-clock] +command = 'conky --config="$HOME/.config/conky/clock.conf"' +hosts = [] +group = 'conky' -[portalo] -ckb-next = 'ckb-next --background' -qbittorrent = 'flatpak run org.qbittorrent.qBittorrent' -signal = 'flatpak run org.signal.Signal' -solaar = 'solaar --window hide' -steam = 'flatpak run com.valvesoftware.Steam -silent' +[apps.conky-system] +command = 'conky --config="$HOME/.config/conky/system.conf"' +hosts = [] +group = 'conky' -conky-clock = false -conky-system = false -sxhkd = false -unclutter = false -xcompmgr = false +[apps.discord] +command = 'flatpak run com.discordapp.discord' +hosts = [] +group = 'chat' -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' diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix index 831f295..265a1af 100644 --- a/.config/home-manager/common.nix +++ b/.config/home-manager/common.nix @@ -1,56 +1,57 @@ { config, pkgs, ... }: { - # Packages that should be installed to the user profile. - home.packages = with pkgs; [ - bat # cat-alternative - direnv # tool to load custom environments - docker-credential-helpers - doggo # dns client - exa # ls-alternative - faas-cli # cli for openfaas - fzf # fuzzy finder - git # git - gitflow # tool for git workflow - git-lfs # git support for large files - moar # moar is less - nix-direnv # allow better nix and direnv integration - libnotify # allows sending notifications - lsof # who uses that drive/directory - openssh # ssh client and server - pass # password-store - playerctl # control media players - p7zip # tool to extract 7z archives - rclone # tool for remote storages - restic # backup tool - ripgrep # grep-alternative - rmtrash # rm wrapper to use trash - shellcheck # tool for shell-syntax - (spotifyd.override { withMpris = true; }) # spotify-daemon - tokei # project-language statistics - trash-cli # trash utils - unzip # unzip - vimHugeX # vim with clipboard support - xdg-user-dirs # tool manage user directories - yq # tool for YAML - yt-dlp # tool to download videos from the internet - zip # zip - ]; + # Packages that should be installed to the user profile. + home.packages = with pkgs; [ + bat # cat-alternative + direnv # tool to load custom environments + docker-credential-helpers + dogdns # dns client + exa # ls-alternative + faas-cli # cli for openfaas + fzf # fuzzy finder + git # git + gitflow # tool for git workflow + git-lfs # git support for large files + jq # tool for json + moar # moar is less + nix-direnv # allow better nix and direnv integration + libnotify # allows sending notifications + lsof # who uses that drive/directory + openssh # ssh client and server + pass # password-store + playerctl # control media players + p7zip # tool to extract 7z archives + rclone # tool for remote storages + restic # backup tool + ripgrep # grep-alternative + rmtrash # rm wrapper to use trash + shellcheck # tool for shell-syntax + (spotifyd.override { withMpris = true; }) # spotify-daemon + tokei # project-language statistics + trash-cli # trash utils + unzip # unzip + vimHugeX # vim with clipboard support + xdg-user-dirs # tool manage user directories + yq # tool for YAML + yt-dlp # tool to download videos from the internet + zip # zip + ]; - # This value determines the Home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new Home Manager release introduces backwards - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = "22.11"; + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "22.11"; - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; - targets.genericLinux.enable = true; + targets.genericLinux.enable = true; - nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfree = true; }