From 3a4be20e6341ebc58fa6521116599cee4fb73e14 Mon Sep 17 00:00:00 2001 From: claymorwan Date: Sun, 29 Jun 2025 17:48:28 +0000 Subject: [PATCH 1/6] feat: service --- README.md | 28 +++++- config/hypr/restart_shell.sh | 11 +++ config/settings_utils.py | 4 +- install.sh | 170 +++++++++++++++++++++-------------- run_shell.sh | 4 + uninstall.sh | 8 +- 6 files changed, 149 insertions(+), 76 deletions(-) create mode 100755 config/hypr/restart_shell.sh create mode 100755 run_shell.sh diff --git a/README.md b/README.md index a4d78a38..3068dfde 100644 --- a/README.md +++ b/README.md @@ -105,10 +105,34 @@ curl -fsSL https://raw.githubusercontent.com/Axenide/Ax-Shell/main/install.sh | - Zed Sans - Tabler Icons -2. Download and run Ax-Shell: +2. Download: ```bash git clone https://github.com/Axenide/Ax-Shell.git ~/.config/Ax-Shell - uwsm -- app python ~/.config/Ax-Shell/main.py > /dev/null 2>&1 & disown + ln -s ~/.config/Ax-Shell/run_shell.sh ~/.local/bin/ax-shell # make sure to have ~/.local/bin/ in your PATH + ``` +- If using uwsm, install te service: + ```bash + install -Dm0644 /dev/stdin "$XDG_CONFIG_HOME/systemd/user/ax-shell.service" <Rocket Roadmap diff --git a/config/hypr/restart_shell.sh b/config/hypr/restart_shell.sh new file mode 100755 index 00000000..d866295b --- /dev/null +++ b/config/hypr/restart_shell.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Get exit code +uwsm check is-active + +if [[ $? == 0 ]]; then + systemctl --user restart ax-shell.service +else + killall ax-shell + $HOME/.local/bin/ax-shell +fi diff --git a/config/settings_utils.py b/config/settings_utils.py index fb23d0fd..bc09aec4 100644 --- a/config/settings_utils.py +++ b/config/settings_utils.py @@ -243,7 +243,7 @@ def generate_hyprconf() -> str: is_vertical = bar_position in ["Left", "Right"] animation_type = "slidefadevert" if is_vertical else "slidefade" - return f"""exec-once = uwsm-app $(python {home}/.config/{APP_NAME_CAP}/main.py) + return f"""{"exec-once = ax-shell" if subprocess.run(["uwsm", "check", "is-active"]).returncode == 0 else ""} exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle exec = uwsm app -- swww-daemon exec-once = wl-paste --type text --watch cliphist store @@ -252,7 +252,7 @@ def generate_hyprconf() -> str: $fabricSend = fabric-cli exec {APP_NAME} $axMessage = notify-send "Axenide" "FIRE IN THE HOLE‼️🗣️🔥🕳️" -i "{home}/.config/{APP_NAME_CAP}/assets/ax.png" -A "🗣️" -A "🔥" -A "🕳️" -a "Source Code" -bind = {bind_vars.get('prefix_restart', 'SUPER ALT')}, {bind_vars.get('suffix_restart', 'B')}, exec, killall {APP_NAME}; uwsm-app $(python {home}/.config/{APP_NAME_CAP}/main.py) # Reload {APP_NAME_CAP} +bind = {bind_vars.get('prefix_restart', 'SUPER ALT')}, {bind_vars.get('suffix_restart', 'B')}, exec, {home}/.config/{APP_NAME_CAP}/config/hypr/restart_shell.sh # Reload {APP_NAME_CAP} bind = {bind_vars.get('prefix_axmsg', 'SUPER')}, {bind_vars.get('suffix_axmsg', 'A')}, exec, $axMessage # Message bind = {bind_vars.get('prefix_dash', 'SUPER')}, {bind_vars.get('suffix_dash', 'D')}, exec, $fabricSend 'notch.open_notch("dashboard")' # Dashboard bind = {bind_vars.get('prefix_bluetooth', 'SUPER')}, {bind_vars.get('suffix_bluetooth', 'B')}, exec, $fabricSend 'notch.open_notch("bluetooth")' # Bluetooth diff --git a/install.sh b/install.sh index ea54abd3..0d6b5e35 100755 --- a/install.sh +++ b/install.sh @@ -1,80 +1,81 @@ #!/bin/bash -set -e # Exit immediately if a command fails -set -u # Treat unset variables as errors -set -o pipefail # Prevent errors in a pipeline from being masked +set -e # Exit immediately if a command fails +set -u # Treat unset variables as errors +set -o pipefail # Prevent errors in a pipeline from being masked REPO_URL="https://github.com/Axenide/Ax-Shell.git" INSTALL_DIR="$HOME/.config/Ax-Shell" +EXECUTABLE_PATH="$HOME/.local/bin/ax-shell" PACKAGES=( - brightnessctl - cava - cliphist - fabric-cli-git - gnome-bluetooth-3.0 - gobject-introspection - gpu-screen-recorder - hypridle - hyprlock - hyprpicker - hyprshot - hyprsunset - imagemagick - libnotify - matugen-bin - noto-fonts-emoji - nvtop - playerctl - python-fabric-git - python-gobject - python-ijson - python-numpy - python-pillow - python-psutil - python-pywayland - python-requests - python-setproctitle - python-toml - python-watchdog - swappy - swww-git - tesseract - tmux - ttf-nerd-fonts-symbols-mono - unzip - upower - uwsm - vte3 - webp-pixbuf-loader - wl-clipboard + brightnessctl + cava + cliphist + fabric-cli-git + gnome-bluetooth-3.0 + gobject-introspection + gpu-screen-recorder + hypridle + hyprlock + hyprpicker + hyprshot + hyprsunset + imagemagick + libnotify + matugen-bin + noto-fonts-emoji + nvtop + playerctl + python-fabric-git + python-gobject + python-ijson + python-numpy + python-pillow + python-psutil + python-pywayland + python-requests + python-setproctitle + python-toml + python-watchdog + swappy + swww-git + tesseract + tmux + ttf-nerd-fonts-symbols-mono + unzip + upower + uwsm + vte3 + webp-pixbuf-loader + wl-clipboard ) # Prevent running as root if [ "$(id -u)" -eq 0 ]; then - echo "Please do not run this script as root." - exit 1 + echo "Please do not run this script as root." + exit 1 fi aur_helper="yay" # Check if paru exists, otherwise use yay if command -v paru &>/dev/null; then - aur_helper="paru" + aur_helper="paru" elif ! command -v yay &>/dev/null; then - echo "Installing yay-bin..." - tmpdir=$(mktemp -d) - git clone --depth=1 https://aur.archlinux.org/yay-bin.git "$tmpdir/yay-bin" - (cd "$tmpdir/yay-bin" && makepkg -si --noconfirm) - rm -rf "$tmpdir" + echo "Installing yay-bin..." + tmpdir=$(mktemp -d) + git clone --depth=1 https://aur.archlinux.org/yay-bin.git "$tmpdir/yay-bin" + (cd "$tmpdir/yay-bin" && makepkg -si --noconfirm) + rm -rf "$tmpdir" fi # Clone or update the repository if [ -d "$INSTALL_DIR" ]; then - echo "Updating Ax-Shell..." - git -C "$INSTALL_DIR" pull + echo "Updating Ax-Shell..." + git -C "$INSTALL_DIR" pull else - echo "Cloning Ax-Shell..." - git clone --depth=1 "$REPO_URL" "$INSTALL_DIR" + echo "Cloning Ax-Shell..." + git clone --depth=1 "$REPO_URL" "$INSTALL_DIR" fi # Install required packages using the detected AUR helper (only if missing) @@ -92,31 +93,62 @@ TEMP_ZIP="/tmp/zed-sans-1.2.0.zip" # Check if fonts are already installed if [ ! -d "$FONT_DIR" ]; then - echo "Downloading fonts from $FONT_URL..." - curl -L -o "$TEMP_ZIP" "$FONT_URL" + echo "Downloading fonts from $FONT_URL..." + curl -L -o "$TEMP_ZIP" "$FONT_URL" - echo "Extracting fonts to $FONT_DIR..." - mkdir -p "$FONT_DIR" - unzip -o "$TEMP_ZIP" -d "$FONT_DIR" + echo "Extracting fonts to $FONT_DIR..." + mkdir -p "$FONT_DIR" + unzip -o "$TEMP_ZIP" -d "$FONT_DIR" - echo "Cleaning up..." - rm "$TEMP_ZIP" + echo "Cleaning up..." + rm "$TEMP_ZIP" else - echo "Fonts are already installed. Skipping download and extraction." + echo "Fonts are already installed. Skipping download and extraction." fi # Copy local fonts if not already present if [ ! -d "$HOME/.fonts/tabler-icons" ]; then - echo "Copying local fonts to $HOME/.fonts/tabler-icons..." - mkdir -p "$HOME/.fonts/tabler-icons" - cp -r "$INSTALL_DIR/assets/fonts/"* "$HOME/.fonts" + echo "Copying local fonts to $HOME/.fonts/tabler-icons..." + mkdir -p "$HOME/.fonts/tabler-icons" + cp -r "$INSTALL_DIR/assets/fonts/"* "$HOME/.fonts" else - echo "Local fonts are already installed. Skipping copy." + echo "Local fonts are already installed. Skipping copy." +fi + +# Symlinks the executable to run the shell +if [ ! $(test $EXECUTABLE_PATH) ]; then + echo "Symlinking executable" + ln -s "$INSTALL_DIR/run_shell.sh" "$EXECUTABLE_PATH" +fi + +# Installs service if uwsm is installed +if [ $(which uwm) ]; then + echo "Installing service" + install -Dm0644 /dev/stdin "$XDG_CONFIG_HOME/systemd/user/ax-shell.service" </dev/null || true -uwsm app -- python "$INSTALL_DIR/main.py" > /dev/null 2>&1 & disown +uwsm check is-active +if [ $? ]; then + systemctl --user stop ax-shell.service + systemctl --user enable --now ax-shell.service +else + killall ax-shell 2>/dev/null || true + $EXECUTABLE_PATH >/dev/null 2>&1 & + disown echo "Installation complete." diff --git a/run_shell.sh b/run_shell.sh new file mode 100755 index 00000000..a500d796 --- /dev/null +++ b/run_shell.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +python_path=$(which python) # Get python executable path +$python_path "$XDG_CONFIG_HOME/Ax-Shell/main.py" diff --git a/uninstall.sh b/uninstall.sh index 32e15b72..4cc29e5f 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -4,12 +4,14 @@ echo "This will permanently delete Ax-Shell cache, configuration, and remove its read -p "Are you sure you want to continue? [y/N] " confirm if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then - echo "Aborted." - exit 1 + echo "Aborted." + exit 1 fi rm -rf ~/.cache/ax-shell rm -rf ~/.config/Ax-Shell +rm ~/.local/bin/ax-shell +rm ~/.config/systemd/user/ax-shell.service conf_file=~/.config/hypr/hyprland.conf tmp_file=$(mktemp) @@ -26,6 +28,6 @@ BEGIN { found_comment=0 } next } print -}' "$conf_file" > "$tmp_file" && mv "$tmp_file" "$conf_file" +}' "$conf_file" >"$tmp_file" && mv "$tmp_file" "$conf_file" echo "Ax-Shell data and config removed successfully." From bab5407a43bb32f46dedee571d804532de47298b Mon Sep 17 00:00:00 2001 From: claymorwan Date: Sun, 29 Jun 2025 18:24:00 +0000 Subject: [PATCH 2/6] fix: change where shell is started if not service --- config/settings_constants.py | 1 + config/settings_utils.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/settings_constants.py b/config/settings_constants.py index eb1854af..d0ef5c77 100644 --- a/config/settings_constants.py +++ b/config/settings_constants.py @@ -4,6 +4,7 @@ SOURCE_STRING = f""" # {APP_NAME_CAP} +{"exec-once = ax-shell" if not subprocess.run(["uwsm", "check", "is-active"]).returncode == 0 else ""} source = ~/.config/{APP_NAME_CAP}/config/hypr/{APP_NAME}.conf """ diff --git a/config/settings_utils.py b/config/settings_utils.py index bc09aec4..2f90cf95 100644 --- a/config/settings_utils.py +++ b/config/settings_utils.py @@ -243,8 +243,7 @@ def generate_hyprconf() -> str: is_vertical = bar_position in ["Left", "Right"] animation_type = "slidefadevert" if is_vertical else "slidefade" - return f"""{"exec-once = ax-shell" if subprocess.run(["uwsm", "check", "is-active"]).returncode == 0 else ""} -exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle + return f"""exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle exec = uwsm app -- swww-daemon exec-once = wl-paste --type text --watch cliphist store exec-once = wl-paste --type image --watch cliphist store From 2babd4ad93e4a3718411c6a5dfc30cfe7b51c681 Mon Sep 17 00:00:00 2001 From: claymorwan Date: Mon, 7 Jul 2025 13:30:52 +0000 Subject: [PATCH 3/6] fix: forgot the updater --- config/settings_constants.py | 2 ++ config/settings_utils.py | 3 +-- install.sh | 1 + modules/updater.py | 29 ++++++++++++++++++++++++++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/config/settings_constants.py b/config/settings_constants.py index eb1854af..55e92a22 100644 --- a/config/settings_constants.py +++ b/config/settings_constants.py @@ -1,9 +1,11 @@ +import subprocess from .data import (APP_NAME, APP_NAME_CAP, NOTIF_POS_DEFAULT, NOTIF_POS_KEY, PANEL_POSITION_DEFAULT, PANEL_POSITION_KEY, WALLPAPERS_DIR_DEFAULT) SOURCE_STRING = f""" # {APP_NAME_CAP} +{"exec-once = ax-shell" if not subprocess.run(["uwsm", "check", "is-active"]).returncode == 0 else ""} source = ~/.config/{APP_NAME_CAP}/config/hypr/{APP_NAME}.conf """ diff --git a/config/settings_utils.py b/config/settings_utils.py index bc09aec4..2f90cf95 100644 --- a/config/settings_utils.py +++ b/config/settings_utils.py @@ -243,8 +243,7 @@ def generate_hyprconf() -> str: is_vertical = bar_position in ["Left", "Right"] animation_type = "slidefadevert" if is_vertical else "slidefade" - return f"""{"exec-once = ax-shell" if subprocess.run(["uwsm", "check", "is-active"]).returncode == 0 else ""} -exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle + return f"""exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle exec = uwsm app -- swww-daemon exec-once = wl-paste --type text --watch cliphist store exec-once = wl-paste --type image --watch cliphist store diff --git a/install.sh b/install.sh index 0d6b5e35..0597106f 100755 --- a/install.sh +++ b/install.sh @@ -150,5 +150,6 @@ else killall ax-shell 2>/dev/null || true $EXECUTABLE_PATH >/dev/null 2>&1 & disown +fi echo "Installation complete." diff --git a/modules/updater.py b/modules/updater.py index cc5c63c1..cfe10990 100644 --- a/modules/updater.py +++ b/modules/updater.py @@ -318,7 +318,34 @@ def on_update_clicked(self, _widget): update_command = "curl -fsSL https://raw.githubusercontent.com/Axenide/Ax-Shell/main/install.sh | bash" else: # Ensure REPO_DIR is correctly defined at the top of the file. - update_command = f"git -C \"{REPO_DIR}\" pull && echo 'Reloading in 3...' && sleep 1 && echo '2...' && sleep 1 && echo '1...' && sleep 1 && killall {data.APP_NAME} && setsid python \"{REPO_DIR}main.py\"" + update_command = f"""git -C \"{REPO_DIR}\" pull +if [ ! $(test $HOME/.local/bin/{data.APP_NAME}) ]; then + echo 'Symlinking executable' + ln -s \"{REPO_DIR}run_shell.sh\" \"$HOME/.local/bin/{data.APP_NAME}\" +fi +if [ $(which uwm) ]; then + install -Dm0644 /dev/stdin \"$XDG_CONFIG_HOME/systemd/user/{data.APP_NAME}.service\" < Date: Mon, 7 Jul 2025 13:38:45 +0000 Subject: [PATCH 4/6] fix: conflict --- config/settings_constants.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config/settings_constants.py b/config/settings_constants.py index 55e92a22..9850e941 100644 --- a/config/settings_constants.py +++ b/config/settings_constants.py @@ -1,7 +1,13 @@ +from .data import ( + APP_NAME, + APP_NAME_CAP, + NOTIF_POS_DEFAULT, + NOTIF_POS_KEY, + PANEL_POSITION_DEFAULT, + PANEL_POSITION_KEY, + WALLPAPERS_DIR_DEFAULT, +) import subprocess -from .data import (APP_NAME, APP_NAME_CAP, NOTIF_POS_DEFAULT, NOTIF_POS_KEY, - PANEL_POSITION_DEFAULT, PANEL_POSITION_KEY, - WALLPAPERS_DIR_DEFAULT) SOURCE_STRING = f""" # {APP_NAME_CAP} From 9667a38676033639d02038bfedad28555104abf4 Mon Sep 17 00:00:00 2001 From: claymorwan Date: Mon, 7 Jul 2025 13:40:00 +0000 Subject: [PATCH 5/6] fix: conflict again --- config/settings_constants.py | 1 - 1 file changed, 1 deletion(-) diff --git a/config/settings_constants.py b/config/settings_constants.py index 9850e941..5fec43b6 100644 --- a/config/settings_constants.py +++ b/config/settings_constants.py @@ -7,7 +7,6 @@ PANEL_POSITION_KEY, WALLPAPERS_DIR_DEFAULT, ) -import subprocess SOURCE_STRING = f""" # {APP_NAME_CAP} From ac66d1a54a5f3fdeec986ecf5401a33642609b03 Mon Sep 17 00:00:00 2001 From: claymorwan Date: Mon, 7 Jul 2025 13:41:07 +0000 Subject: [PATCH 6/6] fix: conflict again again --- config/settings_constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config/settings_constants.py b/config/settings_constants.py index 8bcf9fa1..a8bed7c8 100644 --- a/config/settings_constants.py +++ b/config/settings_constants.py @@ -1,3 +1,4 @@ +import subprocess from .data import ( APP_NAME, APP_NAME_CAP,