Skip to content

Adding UV #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Ax-Shell.code-workspace
.aider*
config/dock.json
config/dock.json.bak
.venv
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ curl -fsSL https://raw.githubusercontent.com/Axenide/Ax-Shell/main/install.sh |
2. Download and run Ax-Shell:
```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
cd ~/.config/Ax-Shell
uwsm -- app uv run main.py > /dev/null 2>&1 & disown
```

<h2><sub><img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Travel%20and%20places/Rocket.png" alt="Rocket" width="25" height="25" /></sub> Roadmap</h2>
Expand Down
6 changes: 3 additions & 3 deletions config/settings_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,9 @@ def _apply_and_reload_task_thread():
print(f"{time.time():.4f}: Finished start_config().")

print(f"{time.time():.4f}: Initiating Ax-Shell restart using Popen...")
main_py = os.path.expanduser(f"~/.config/{APP_NAME_CAP}/main.py")
main_folder = os.path.expanduser(f"~/.config/{APP_NAME_CAP}")
kill_cmd = f"killall {APP_NAME}"
start_cmd = ["uwsm", "app", "--", "python", main_py]
start_cmd = ["uwsm", "--", "app", "uv", "run", "main.py"]
try:
kill_proc = subprocess.Popen(kill_cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
kill_proc.wait(timeout=2)
Expand All @@ -771,7 +771,7 @@ def _apply_and_reload_task_thread():
except Exception as e: print(f"Error running killall: {e}")

try:
subprocess.Popen(start_cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=True)
subprocess.Popen(start_cmd, cwd=main_folder, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=True)
print(f"{APP_NAME_CAP} restart initiated via Popen.")
except FileNotFoundError as e: print(f"Error restarting {APP_NAME_CAP}: Command not found ({e})")
except Exception as e: print(f"Error restarting {APP_NAME_CAP} via Popen: {e}")
Expand Down
6 changes: 3 additions & 3 deletions config/settings_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = bash -c "cd ~/.config/{APP_NAME_CAP} && uwsm -- app uv run main.py > /dev/null"
exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle
exec = uwsm app -- swww-daemon
exec-once = wl-paste --type text --watch cliphist store
Expand All @@ -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, killall {APP_NAME}; bash -c "cd {home}/.config/{APP_NAME_CAP} && uwsm -- app uv run main.py > /dev/null" # 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
Expand All @@ -269,7 +269,7 @@ def generate_hyprconf() -> str:
bind = {bind_vars.get('prefix_power', 'SUPER')}, {bind_vars.get('suffix_power', 'ESCAPE')}, exec, $fabricSend 'notch.open_notch("power")' # Power Menu
bind = {bind_vars.get('prefix_caffeine', 'SUPER SHIFT')}, {bind_vars.get('suffix_caffeine', 'M')}, exec, $fabricSend 'notch.dashboard.widgets.buttons.caffeine_button.toggle_inhibit(external=True)' # Toggle Caffeine
bind = {bind_vars.get('prefix_css', 'SUPER SHIFT')}, {bind_vars.get('suffix_css', 'B')}, exec, $fabricSend 'app.set_css()' # Reload CSS
bind = {bind_vars.get('prefix_restart_inspector', 'SUPER CTRL ALT')}, {bind_vars.get('suffix_restart_inspector', 'B')}, exec, killall {APP_NAME}; uwsm-app $(GTK_DEBUG=interactive python {home}/.config/{APP_NAME_CAP}/main.py) # Restart with inspector
bind = {bind_vars.get('prefix_restart_inspector', 'SUPER CTRL ALT')}, {bind_vars.get('suffix_restart_inspector', 'B')}, exec, killall {APP_NAME}; bash -c \"cd {home}/.config/{APP_NAME_CAP} && uwsm -- app \$(GTK_DEBUG=interactive uv run main.py)" # Restart with inspector

# Wallpapers directory: {bind_vars.get('wallpapers_dir', '~/.config/Ax-Shell/assets/wallpapers_example')}

Expand Down
33 changes: 20 additions & 13 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ PACKAGES=(
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
python-fabric-git # needed for auxiliary packages
# python-gobject
# python-ijson
# python-numpy
# python-pillow
# python-psutil
# python-pywayland
# python-requests
# python-setproctitle
# python-toml
# python-watchdog
uv
swappy
swww-git
tesseract
Expand Down Expand Up @@ -114,9 +115,15 @@ else
echo "Local fonts are already installed. Skipping copy."
fi

python "$INSTALL_DIR/config/config.py"
cd "$INSTALL_DIR"
uv sync
uv pip uninstall fabric
uv pip install git+https://github.com/Fabric-Development/fabric
uv pip uninstall PyGObject
uv pip install PyGObject # TODO: Move the PyGObject installation into pyproject once its required version becomes available in UV.
uv run config/config.py
echo "Starting Ax-Shell..."
killall ax-shell 2>/dev/null || true
uwsm app -- python "$INSTALL_DIR/main.py" > /dev/null 2>&1 & disown
uwsm app -- uv run main.py > /dev/null 2>&1 & disown

echo "Installation complete."
3 changes: 2 additions & 1 deletion modules/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ 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 && 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 && echo 'Reloading in 3...' && sleep 1 && echo '2...' && sleep 1 && echo '1...' && sleep 1 && killall {data.APP_NAME} && setsid bash -c 'cd \"{REPO_DIR}\" && uv run main.py > /dev/null'" # TODO: maybe change this?


# Spawn the process asynchronously inside the terminal
Expand Down
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
name = "ax-shell"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"bs4>=0.0.2",
"dbus-python>=1.4.0",
"g4f>=0.5.5.5",
"ijson>=3.4.0",
"numpy>=2.3.1",
"pillow>=11.2.1",
"psutil>=7.0.0",
"pywayland>=0.4.18",
"requests>=2.32.4",
"setproctitle>=1.3.6",
"toml>=0.10.2",
"watchdog>=6.0.0",
]
Loading