From fbc2a58b57ae810129d059f52d510a44f60946c8 Mon Sep 17 00:00:00 2001 From: Tulili Date: Fri, 8 Mar 2024 13:07:39 -0300 Subject: [PATCH] feat: opentabletdriver setup + kde-wallpaper-engine --- config/common/plasma/scripts.yml | 3 + .../shared/libexec/atomic-studio-cli/add.nu | 8 +-- .../libexec/atomic-studio-cli/davinci.nu | 2 +- .../atomic-studio-cli/lib/distrobox.nu | 7 +++ .../shared/libexec/atomic-studio-cli/mod.nu | 1 + .../shared/libexec/atomic-studio-cli/setup.nu | 58 +++++++++++++++++++ .../shared/share/ublue-os/firstboot/yafti.yml | 9 ++- config/recipes/hardened/recipe-nvidia.yml | 1 + config/recipes/hardened/recipe.yml | 1 + config/recipes/recipe-nvidia.yml | 1 + config/recipes/recipe.yml | 1 + config/scripts/kde-wallpaper-engine.nu | 15 +++++ 12 files changed, 97 insertions(+), 10 deletions(-) create mode 100644 config/common/plasma/scripts.yml mode change 100644 => 100755 config/files/shared/libexec/atomic-studio-cli/mod.nu create mode 100755 config/files/shared/libexec/atomic-studio-cli/setup.nu create mode 100644 config/scripts/kde-wallpaper-engine.nu diff --git a/config/common/plasma/scripts.yml b/config/common/plasma/scripts.yml new file mode 100644 index 0000000..2bcfb65 --- /dev/null +++ b/config/common/plasma/scripts.yml @@ -0,0 +1,3 @@ +type: script-nu +scripts: + - kde-wallpaper-engine.nu diff --git a/config/files/shared/libexec/atomic-studio-cli/add.nu b/config/files/shared/libexec/atomic-studio-cli/add.nu index 630e28b..fbde933 100755 --- a/config/files/shared/libexec/atomic-studio-cli/add.nu +++ b/config/files/shared/libexec/atomic-studio-cli/add.nu @@ -1,15 +1,9 @@ #!/usr/bin/env -S nu -use lib/distrobox.nu [gen_export_string, DISTROBOX_DOWNLOAD_URL] +use lib/distrobox.nu [gen_export_string, DISTROBOX_DOWNLOAD_URL, distroboxes] use lib/std.nu [fancy_prompt_message, user_prompt] const valid_package_managers = ["apt", "brew", "nix", "dnf", "yum", "paru", "pacman", "pipx"] -const distroboxes = [ - ["aliases","name", "image", "description"]; - ["ubuntu", "ubuntubox", "ghcr.io/ublue-os/ubuntu-toolbox:latest", "Ubuntu based distrobox"] - ["arch", "archbox", "ghcr.io/ublue-os/arch-distrobox:latest", "Arch Linux based distrobox with paru pre-installed"] - ["fedora", "fedorabox", "ghcr.io/ublue-os/fedora-toolbox", "Fedora based distrobox"] -] # Export selected packages from selected subsystem to the host system export def "main add export" [ diff --git a/config/files/shared/libexec/atomic-studio-cli/davinci.nu b/config/files/shared/libexec/atomic-studio-cli/davinci.nu index c5bc765..e201631 100755 --- a/config/files/shared/libexec/atomic-studio-cli/davinci.nu +++ b/config/files/shared/libexec/atomic-studio-cli/davinci.nu @@ -34,7 +34,7 @@ export def "main davinci remove" [ # Install Davinci Resolve in a compatible distrobox export def "main davinci" [ - --yes (-y) # Skip all confirmation prompts, + --yes (-y) # Skip all confirmation prompts --box_name: string # Name of the distrobox where davinci-installer will be run from script_path: string # The script that will be run to install Davinci Resolve ] { diff --git a/config/files/shared/libexec/atomic-studio-cli/lib/distrobox.nu b/config/files/shared/libexec/atomic-studio-cli/lib/distrobox.nu index 551d4d1..d82bbe6 100644 --- a/config/files/shared/libexec/atomic-studio-cli/lib/distrobox.nu +++ b/config/files/shared/libexec/atomic-studio-cli/lib/distrobox.nu @@ -3,3 +3,10 @@ export const DISTROBOX_DOWNLOAD_URL = "https://raw.githubusercontent.com/89luca8 export def gen_export_string [package: string, export_Path: string] { return $"distrobox-export --app ($package) ; distrobox-export --export-path ($export_Path) --bin /usr/bin/($package)" } + +export const distroboxes = [ + ["aliases","name", "image", "description"]; + ["ubuntu", "ubuntubox", "ghcr.io/ublue-os/ubuntu-toolbox:latest", "Ubuntu based distrobox"] + ["arch", "archbox", "ghcr.io/ublue-os/arch-distrobox:latest", "Arch Linux based distrobox with paru pre-installed"] + ["fedora", "fedorabox", "ghcr.io/ublue-os/fedora-toolbox", "Fedora based distrobox"] +] diff --git a/config/files/shared/libexec/atomic-studio-cli/mod.nu b/config/files/shared/libexec/atomic-studio-cli/mod.nu old mode 100644 new mode 100755 index f652532..b968ee1 --- a/config/files/shared/libexec/atomic-studio-cli/mod.nu +++ b/config/files/shared/libexec/atomic-studio-cli/mod.nu @@ -5,3 +5,4 @@ export use reporter.nu * export use speaker-test.nu * export use update.nu * export use pw.nu * +export use setup.nu * diff --git a/config/files/shared/libexec/atomic-studio-cli/setup.nu b/config/files/shared/libexec/atomic-studio-cli/setup.nu new file mode 100755 index 0000000..1d4b389 --- /dev/null +++ b/config/files/shared/libexec/atomic-studio-cli/setup.nu @@ -0,0 +1,58 @@ +use lib/std.nu [user_prompt, fancy_prompt_message] +use lib/distrobox.nu [DISTROBOX_DOWNLOAD_URL, distroboxes] + +const opentabletdriver_service = " +[Unit] +Description=OpenTabletDriver Daemon +PartOf=graphical-session.target +After=graphical-session.target +ConditionEnvironment=|WAYLAND_DISPLAY +ConditionEnvironment=|DISPLAY + +[Service] +ExecStart=/usr/bin/distrobox-enter -n archbox -- ' /usr/bin/otd-daemon' +Restart=always +RestartSec=3 + +[Install] +WantedBy=graphical-session.target +" + +# Setup Atomic Studio supported apps +export def "main setup" [] { + echo "Usage setup ." +} + +# Install Davinci Resolve in a compatible distrobox +export def "main setup opentabletdriver" [ + --yes (-y) # Skip all confirmation prompts +] { + if (which distrobox | length) == 0 { + fancy_prompt_message "Distrobox" + if not (user_prompt $yes) { + return + } + curl -s $DISTROBOX_DOWNLOAD_URL | pkexec sh + } + + let archbox_entry = ($distroboxes | select aliases name image | where aliases == arch).0 + + try { distrobox ls | grep ($archbox_entry.name) } catch { + fancy_prompt_message "The Arch Linux subsystem" + if not (user_prompt $yes) { + return + } + distrobox create -i $archbox_entry.image --name $archbox_entry.name -Y --pull + } + + distrobox enter -n $archbox_entry.name -- ' paru -S opentabletdriver --noconfirm' + mkdir $"($env.HOME)/.config/systemd/user" + try { rm -f $"($env.HOME)/.config/systemd/user/($archbox_entry.name)-opentabletdriver.service" } catch { } + + $opentabletdriver_service | save -f $"($env.HOME)/.config/systemd/user/($archbox_entry.name)-opentabletdriver.service" + + systemctl --user daemon-reload + systemctl enable --user --now $"($archbox_entry.name)-opentabletdriver.service" + + distrobox enter -n $archbox_entry.name -- 'distrobox-export --app otd-gui' +} diff --git a/config/files/shared/share/ublue-os/firstboot/yafti.yml b/config/files/shared/share/ublue-os/firstboot/yafti.yml index 8ec3cda..34782dd 100644 --- a/config/files/shared/share/ublue-os/firstboot/yafti.yml +++ b/config/files/shared/share/ublue-os/firstboot/yafti.yml @@ -30,9 +30,14 @@ screens: description: Add certain user groups and kernel arguments for your user in order to use realtime applications properly default: false packages: - - Add realtime group: pkexec studio pw enable realtime + - Add realtime group: pkexec studio pw enable realtime + OpenTabletDriver: + description: Setup OpenTabletDriver, a FOSS alternative to the proprietary wacom drivers + default: true + packages: + - Setup OTD: studio setup opentabletdriver Davinci Box: - description: Reproducible and descartable environment for installing Davinci Resolve - Make sure to install Davinci Resolve inside of davincibox. + description: Reproducible and descartable environment for installing Davinci Resolve - Make sure to install Davinci Resolve inside of davincibox with the "studio davinci" command. default: false condition: run: distrobox list | grep -v davincibox diff --git a/config/recipes/hardened/recipe-nvidia.yml b/config/recipes/hardened/recipe-nvidia.yml index a1ea200..1055f8d 100644 --- a/config/recipes/hardened/recipe-nvidia.yml +++ b/config/recipes/hardened/recipe-nvidia.yml @@ -14,6 +14,7 @@ modules: - from-file: common/shared/services.yml - from-file: common/plasma/apps.yml - from-file: common/plasma/files.yml + - from-file: common/plasma/scripts.yml - from-file: common/audio/pipewire-packages.yml - from-file: common/audio/audinux.yml - type: yafti diff --git a/config/recipes/hardened/recipe.yml b/config/recipes/hardened/recipe.yml index ec8fb97..e00fc12 100644 --- a/config/recipes/hardened/recipe.yml +++ b/config/recipes/hardened/recipe.yml @@ -15,6 +15,7 @@ modules: - from-file: common/shared/services.yml - from-file: common/plasma/apps.yml - from-file: common/plasma/files.yml + - from-file: common/plasma/scripts.yml - from-file: common/audio/pipewire-packages.yml - from-file: common/audio/audinux.yml - type: yafti diff --git a/config/recipes/recipe-nvidia.yml b/config/recipes/recipe-nvidia.yml index 0e54060..d466aaa 100644 --- a/config/recipes/recipe-nvidia.yml +++ b/config/recipes/recipe-nvidia.yml @@ -14,6 +14,7 @@ modules: - from-file: common/shared/services.yml - from-file: common/plasma/apps.yml - from-file: common/plasma/files.yml + - from-file: common/plasma/scripts.yml - from-file: common/audio/pipewire-packages.yml - from-file: common/audio/audinux.yml - type: yafti diff --git a/config/recipes/recipe.yml b/config/recipes/recipe.yml index 477d036..621500b 100644 --- a/config/recipes/recipe.yml +++ b/config/recipes/recipe.yml @@ -15,6 +15,7 @@ modules: - from-file: common/shared/services.yml - from-file: common/plasma/apps.yml - from-file: common/plasma/files.yml + - from-file: common/plasma/scripts.yml - from-file: common/audio/pipewire-packages.yml - from-file: common/audio/audinux.yml - type: yafti diff --git a/config/scripts/kde-wallpaper-engine.nu b/config/scripts/kde-wallpaper-engine.nu new file mode 100644 index 0000000..9884b17 --- /dev/null +++ b/config/scripts/kde-wallpaper-engine.nu @@ -0,0 +1,15 @@ +#!/usr/bin/env -S nu +let FEDORA_MAJOR_VERSION = (run-external --redirect-combine rpm '-E' '%fedora' | complete).stdout +const COPR_FILE = "/etc/yum.repos.d/_copr_kylegospo-wallpaper-engine-kde-plugin.repo" + +http get $"https://copr.fedorainfracloud.org/coprs/kylegospo/wallpaper-engine-kde-plugin/repo/fedora-($FEDORA_MAJOR_VERSION)/kylegospo-wallpaper-engine-kde-plugin-fedora-($FEDORA_MAJOR_VERSION).repo" | save -f $COPR_FILE + +rpm-ostree install wallpaper-engine-kde-plugin + +rm -f $COPR_FILE + +git clone https://github.com/catsout/wallpaper-engine-kde-plugin.git --depth 1 /tmp/wallpaper-engine-kde-plugin && \ + +kpackagetool5 --type=Plasma/Wallpaper --global --install /tmp/wallpaper-engine-kde-plugin/plugin + +rm -rf /tmp/wallpaper-engine-kde-plugin