mirror of
https://github.com/AquaMorph/dotfiles.git
synced 2025-06-30 17:22:02 +00:00
Compare commits
27 Commits
7c1593e790
...
master
Author | SHA1 | Date | |
---|---|---|---|
5613fdefa9 | |||
08b48fa825 | |||
3f4190e95a | |||
d1d88aa7b3 | |||
981d514156 | |||
cce671b9fc | |||
bd8d5a96ad | |||
a54305b837 | |||
ee547a17ac | |||
2a4937053d | |||
22ff857994 | |||
3debbe1eb7 | |||
e242ba7c07 | |||
31f27a9c84 | |||
75e898b8f7 | |||
e253055758 | |||
577fde309b | |||
0a95cc86da | |||
660f4d366d | |||
9afabc82fe | |||
538016df16 | |||
776978c0f9 | |||
a6f8245241 | |||
49abb1b949 | |||
390daca277 | |||
6f807aa72f | |||
c19898373f |
@ -1,5 +1,3 @@
|
||||
live_config_reload = true
|
||||
working_directory = "None"
|
||||
|
||||
[bell]
|
||||
animation = "EaseOutExpo"
|
||||
@ -602,3 +600,7 @@ lines = 0
|
||||
[window.padding]
|
||||
x = 4
|
||||
y = 4
|
||||
|
||||
[general]
|
||||
live_config_reload = true
|
||||
working_directory = "None"
|
||||
|
@ -3,6 +3,7 @@
|
||||
email = christian@cacolglazier.com
|
||||
[core]
|
||||
editor = emacs
|
||||
excludesFile = ~/.gitignore
|
||||
[rerere]
|
||||
enabled = true
|
||||
[column]
|
||||
|
63
git/.gitignore
vendored
Normal file
63
git/.gitignore
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
#### Emacs ####
|
||||
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
# Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
# server auth directory
|
||||
/server/
|
||||
|
||||
# projectiles files
|
||||
.projectile
|
||||
|
||||
# directory configuration
|
||||
.dir-locals.el
|
||||
|
||||
#### vim ####
|
||||
# Swap
|
||||
[._]*.s[a-v][a-z]
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-v][a-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
|
||||
# Temporary
|
||||
.netrwhist
|
||||
*~
|
||||
# Auto-generated tag files
|
||||
tags
|
52
hyprland/.config/hypr/bind-all.conf
Normal file
52
hyprland/.config/hypr/bind-all.conf
Normal file
@ -0,0 +1,52 @@
|
||||
$mainMod = SUPER
|
||||
|
||||
# Keybindings
|
||||
bind = $mainMod, return, exec, $terminal
|
||||
bind = $mainMod, Q, killactive,
|
||||
bind = $mainMod, C, exit,
|
||||
bind = $mainMod, E, exec, $fileManager
|
||||
bind = $mainMod, V, togglefloating,
|
||||
bind = $mainMod, D, exec, $menu
|
||||
bind = $mainMod, P, pseudo, # dwindle
|
||||
bind = $mainMod, J, togglesplit, # dwindle
|
||||
bind = $mainMod, L, exec, hyprlock
|
||||
bind = $mainMod, F, fullscreen
|
||||
|
||||
|
||||
# Move focus window
|
||||
bind = $mainMod, left, movefocus, l
|
||||
bind = $mainMod, right, movefocus, r
|
||||
bind = $mainMod, up, movefocus, u
|
||||
bind = $mainMod, down, movefocus, d
|
||||
|
||||
# Switch workspaces
|
||||
bind = $mainMod, 1, workspace, 1
|
||||
bind = $mainMod, 2, workspace, 2
|
||||
bind = $mainMod, 3, workspace, 3
|
||||
bind = $mainMod, 4, workspace, 4
|
||||
bind = $mainMod, 5, workspace, 5
|
||||
bind = $mainMod, 6, workspace, 6
|
||||
bind = $mainMod, 7, workspace, 7
|
||||
bind = $mainMod, 8, workspace, 8
|
||||
bind = $mainMod, 9, workspace, 9
|
||||
bind = $mainMod, 0, workspace, 10
|
||||
|
||||
# Move active window to a workspace
|
||||
bind = $mainMod SHIFT, 1, movetoworkspace, 1
|
||||
bind = $mainMod SHIFT, 2, movetoworkspace, 2
|
||||
bind = $mainMod SHIFT, 3, movetoworkspace, 3
|
||||
bind = $mainMod SHIFT, 4, movetoworkspace, 4
|
||||
bind = $mainMod SHIFT, 5, movetoworkspace, 5
|
||||
bind = $mainMod SHIFT, 6, movetoworkspace, 6
|
||||
bind = $mainMod SHIFT, 7, movetoworkspace, 7
|
||||
bind = $mainMod SHIFT, 8, movetoworkspace, 8
|
||||
bind = $mainMod SHIFT, 9, movetoworkspace, 9
|
||||
bind = $mainMod SHIFT, 0, movetoworkspace, 10
|
||||
|
||||
# Scroll through existing workspaces with mainMod + scroll
|
||||
bind = $mainMod, mouse_down, workspace, e+1
|
||||
bind = $mainMod, mouse_up, workspace, e-1
|
||||
|
||||
# Move/resize windows with mainMod + LMB/RMB and dragging
|
||||
bindm = $mainMod, mouse:272, movewindow
|
||||
bindm = $mainMod, mouse:273, resizewindow
|
17
hyprland/.config/hypr/bind-framework.conf
Normal file
17
hyprland/.config/hypr/bind-framework.conf
Normal file
@ -0,0 +1,17 @@
|
||||
# Screen brightness controls
|
||||
exec-once = light -N 1
|
||||
bind = ,XF86MonBrightnessUp, exec, ~/bin/system/backlight-ctl.sh -i
|
||||
bind = ,XF86MonBrightnessDown, exec, ~/bin/system/backlight-ctl.sh -d
|
||||
|
||||
# Pulse Audio controls
|
||||
bind = ,XF86AudioRaiseVolume, exec, amixer set Master 3%+ #increase sound volume
|
||||
bind = ,XF86AudioLowerVolume, exec, amixer set Master 3%- #decrease sound volume
|
||||
bind = ,XF86AudioMute, exec, amixer set Master toggle # toggle sound
|
||||
|
||||
# Media controls
|
||||
bind = ,XF86AudioPrev, exec, playerctl previous
|
||||
bind = ,XF86AudioPlay, exec, playerctl play-pause
|
||||
bind = ,XF86AudioNext, exec, playerctl next
|
||||
|
||||
# Lockscreen
|
||||
bind = $mainMod, escape, exec, swaylock
|
4
hyprland/.config/hypr/env.conf
Normal file
4
hyprland/.config/hypr/env.conf
Normal file
@ -0,0 +1,4 @@
|
||||
# Programs
|
||||
$terminal = alacritty
|
||||
$fileManager = dolphin
|
||||
$menu = rofi -show combi
|
44
hyprland/.config/hypr/general.conf
Normal file
44
hyprland/.config/hypr/general.conf
Normal file
@ -0,0 +1,44 @@
|
||||
general {
|
||||
gaps_in = 5
|
||||
gaps_out = 5
|
||||
border_size = 2
|
||||
col.active_border = rgba(e91e63ee) rgba(ffcdd2ee) 45deg
|
||||
col.inactive_border = rgba(0288d1aa)
|
||||
layout = dwindle
|
||||
allow_tearing = false
|
||||
}
|
||||
|
||||
decoration {
|
||||
rounding = 5
|
||||
|
||||
blur {
|
||||
enabled = true
|
||||
size = 3
|
||||
passes = 1
|
||||
}
|
||||
}
|
||||
|
||||
animations {
|
||||
enabled = yes
|
||||
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
|
||||
animation = windows, 1, 3, myBezier
|
||||
animation = windowsOut, 1, 7, default, popin 80%
|
||||
animation = border, 1, 10, default
|
||||
animation = borderangle, 1, 8, default
|
||||
animation = fade, 1, 7, default
|
||||
animation = workspaces, 1, 2, default
|
||||
}
|
||||
|
||||
dwindle {
|
||||
pseudotile = yes
|
||||
preserve_split = yes
|
||||
force_split = 2
|
||||
}
|
||||
|
||||
master {
|
||||
orientation = right
|
||||
}
|
||||
|
||||
gestures {
|
||||
workspace_swipe = on
|
||||
}
|
40
hyprland/.config/hypr/hyprland.conf
Normal file
40
hyprland/.config/hypr/hyprland.conf
Normal file
@ -0,0 +1,40 @@
|
||||
monitor=eDP-1,2256x1504@60,auto,1.175
|
||||
|
||||
# Enviroment
|
||||
source = ~/.config/hypr/env.conf
|
||||
|
||||
# Startup programs
|
||||
source = ~/.config/hypr/startup-all.conf
|
||||
source = ~/.config/hypr/startup-framework.conf
|
||||
|
||||
# Default env vars
|
||||
env = XCURSOR_SIZE,24
|
||||
env = QT_QPA_PLATFORMTHEME,qt5ct
|
||||
|
||||
source = ~/.config/hypr/general.conf
|
||||
|
||||
input {
|
||||
kb_layout = us
|
||||
kb_variant =
|
||||
kb_model =
|
||||
kb_options =
|
||||
kb_rules =
|
||||
follow_mouse = 1
|
||||
touchpad {
|
||||
natural_scroll = yes
|
||||
}
|
||||
sensitivity = 0
|
||||
}
|
||||
|
||||
xwayland {
|
||||
force_zero_scaling = true
|
||||
}
|
||||
|
||||
misc {
|
||||
force_default_wallpaper = 0
|
||||
}
|
||||
|
||||
windowrulev2 = suppressevent maximize, class:.*
|
||||
|
||||
source = ~/.config/hypr/bind-all.conf
|
||||
source = ~/.config/hypr/bind-framework.conf
|
6
hyprland/.config/hypr/startup-all.conf
Normal file
6
hyprland/.config/hypr/startup-all.conf
Normal file
@ -0,0 +1,6 @@
|
||||
# Password manager update
|
||||
exec-once = pass git pull
|
||||
|
||||
# Start up script
|
||||
exec-once = ~/bin/system/system-start.sh
|
||||
|
2
hyprland/.config/hypr/startup-framework.conf
Normal file
2
hyprland/.config/hypr/startup-framework.conf
Normal file
@ -0,0 +1,2 @@
|
||||
exec-once = [workspace 1 silent] brave-browser
|
||||
exec-once = [workspace 2 silent] $terminal
|
@ -45,5 +45,5 @@ exec mako
|
||||
# Startup Programs
|
||||
exec "swaymsg 'workspace $wsSignal; exec flatpak run org.signal.Signal'"
|
||||
exec "swaymsg 'workspace $ws2; exec alacritty'"
|
||||
exec "swaymsg 'workspace $ws1; exec firefox'"
|
||||
exec "swaymsg 'workspace $ws1; exec brave-browser'"
|
||||
|
||||
|
@ -20,7 +20,7 @@ bindsym $mod+Return exec --no-startup-id alacritty
|
||||
bindsym $mod+q kill
|
||||
|
||||
# start program launcher
|
||||
bindsym $mod+d exec --no-startup-id rofi -show combi
|
||||
bindsym $mod+d exec --no-startup-id rofi -show combi
|
||||
# change focus
|
||||
bindsym $mod+j focus left
|
||||
bindsym $mod+k focus down
|
||||
@ -193,7 +193,7 @@ default_floating_border normal 3
|
||||
bindsym Print exec scrot '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Pictures/screenshots/'
|
||||
bindsym --release $mod+Print exec scrot '%Y:%m:%d:%H:%M:%S.png' -s -e 'mv $f ~/Pictures/screenshots/'
|
||||
bindsym $mod+s exec scrot '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Pictures/screenshots/'
|
||||
bindsym --release $mod+Shift+s exec scrot '%Y:%m:%d:%H:%M:%S.png' -s -e 'mv $f ~/Pictures/screenshots/'
|
||||
bindsym --release $mod+Shift+s exec grim -g "$(slurp)" - | wl-copy
|
||||
|
||||
bindsym $mod+n exec nautilus
|
||||
bindsym $mod+m exec nautilus ~/Videos
|
||||
|
@ -0,0 +1,5 @@
|
||||
sync_info = create
|
||||
user_id =
|
||||
setting_id =
|
||||
base_id = GFSA04
|
||||
updated_time = 1734886086
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"filament_flow_ratio": [
|
||||
"0.955"
|
||||
],
|
||||
"filament_settings_id": [
|
||||
"Voron Overture PETG"
|
||||
],
|
||||
"from": "User",
|
||||
"inherits": "Voron Generic PETG",
|
||||
"is_custom_defined": "0",
|
||||
"name": "Voron Overture PETG",
|
||||
"version": "2.2.0.4"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
sync_info = update
|
||||
user_id =
|
||||
setting_id =
|
||||
base_id = GM001
|
||||
updated_time = 1728686097
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"from": "User",
|
||||
"inherits": "Voron 2.4 350 0.4 nozzle",
|
||||
"is_custom_defined": "0",
|
||||
"machine_start_gcode": "PRINT_START BED_TEMP=[bed_temperature_initial_layer_single] EXTRUDER_TEMP=[nozzle_temperature_initial_layer]",
|
||||
"name": "AquaVoron 2.4 350 0.4 nozzle",
|
||||
"print_host": "192.168.20.21",
|
||||
"printer_settings_id": "AquaVoron 2.4 350 0.4 nozzle",
|
||||
"version": "1.8.0.0"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
sync_info = update
|
||||
user_id =
|
||||
setting_id =
|
||||
base_id = GM003
|
||||
updated_time = 1728686148
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"from": "User",
|
||||
"inherits": "Voron 2.4 350 0.6 nozzle",
|
||||
"is_custom_defined": "0",
|
||||
"machine_start_gcode": "PRINT_START BED_TEMP=[bed_temperature_initial_layer_single] EXTRUDER_TEMP=[nozzle_temperature_initial_layer]",
|
||||
"name": "AquaVoron 2.4 350 0.6 nozzle",
|
||||
"print_host": "http://192.168.20.21",
|
||||
"printer_settings_id": "AquaVoron 2.4 350 0.6 nozzle",
|
||||
"retraction_length": [
|
||||
"0.1"
|
||||
],
|
||||
"version": "1.8.0.0"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
sync_info = create
|
||||
user_id =
|
||||
setting_id =
|
||||
base_id = GM001
|
||||
updated_time = 1695585702
|
@ -0,0 +1,86 @@
|
||||
{
|
||||
"before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\n;{layer_z}\n\n",
|
||||
"from": "User",
|
||||
"inherits": "MyKlipper 0.4 nozzle",
|
||||
"is_custom_defined": "0",
|
||||
"machine_end_gcode": "END_PRINT",
|
||||
"machine_max_acceleration_extruding": [
|
||||
"500",
|
||||
"20000"
|
||||
],
|
||||
"machine_max_acceleration_retracting": [
|
||||
"1000",
|
||||
"5000"
|
||||
],
|
||||
"machine_max_acceleration_x": [
|
||||
"500",
|
||||
"20000"
|
||||
],
|
||||
"machine_max_acceleration_y": [
|
||||
"500",
|
||||
"20000"
|
||||
],
|
||||
"machine_max_acceleration_z": [
|
||||
"100",
|
||||
"200"
|
||||
],
|
||||
"machine_max_jerk_e": [
|
||||
"5",
|
||||
"2.5"
|
||||
],
|
||||
"machine_max_jerk_x": [
|
||||
"8",
|
||||
"9"
|
||||
],
|
||||
"machine_max_jerk_y": [
|
||||
"8",
|
||||
"9"
|
||||
],
|
||||
"machine_max_jerk_z": [
|
||||
"0.4",
|
||||
"0.4"
|
||||
],
|
||||
"machine_max_speed_e": [
|
||||
"60",
|
||||
"25"
|
||||
],
|
||||
"machine_max_speed_z": [
|
||||
"10",
|
||||
"12"
|
||||
],
|
||||
"machine_start_gcode": "START_PRINT BED_TEMP=[bed_temperature_initial_layer_single] EXTRUDER_TEMP=[nozzle_temperature_initial_layer]",
|
||||
"max_layer_height": [
|
||||
"0.48"
|
||||
],
|
||||
"name": "CR-10s 0.25 nozzle",
|
||||
"nozzle_diameter": [
|
||||
"0.25"
|
||||
],
|
||||
"nozzle_type": "brass",
|
||||
"print_host": "192.168.1.5",
|
||||
"printable_area": [
|
||||
"0x0",
|
||||
"300x0",
|
||||
"300x300",
|
||||
"0x300"
|
||||
],
|
||||
"printable_height": "400",
|
||||
"printer_settings_id": "CR-10s 0.25 nozzle",
|
||||
"retract_length_toolchange": [
|
||||
"1"
|
||||
],
|
||||
"retraction_length": [
|
||||
"0.5"
|
||||
],
|
||||
"retraction_minimum_travel": [
|
||||
"2"
|
||||
],
|
||||
"use_firmware_retraction": "1",
|
||||
"version": "1.6.1.0",
|
||||
"wipe": [
|
||||
"0"
|
||||
],
|
||||
"z_hop_types": [
|
||||
"Auto Lift"
|
||||
]
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
sync_info = create
|
||||
sync_info = update
|
||||
user_id =
|
||||
setting_id =
|
||||
base_id = GM001
|
||||
|
@ -54,7 +54,7 @@
|
||||
],
|
||||
"name": "CR-10s 0.4 nozzle",
|
||||
"nozzle_type": "brass",
|
||||
"print_host": "192.168.1.5",
|
||||
"print_host": "https://cr10.aquamorph.com",
|
||||
"printable_area": [
|
||||
"0x0",
|
||||
"300x0",
|
||||
@ -77,6 +77,9 @@
|
||||
"wipe": [
|
||||
"0"
|
||||
],
|
||||
"z_hop": [
|
||||
"0"
|
||||
],
|
||||
"z_hop_types": [
|
||||
"Auto Lift"
|
||||
]
|
||||
|
@ -57,7 +57,7 @@
|
||||
"0.6"
|
||||
],
|
||||
"nozzle_type": "brass",
|
||||
"print_host": "192.168.1.5",
|
||||
"print_host": "192.168.20.20",
|
||||
"printable_area": [
|
||||
"0x0",
|
||||
"300x0",
|
||||
|
@ -0,0 +1,5 @@
|
||||
sync_info =
|
||||
user_id =
|
||||
setting_id =
|
||||
base_id = GP004
|
||||
updated_time = 1735702877
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"brim_type": "no_brim",
|
||||
"from": "User",
|
||||
"inherits": "0.18mm Fine 0.6 nozzle @Voron",
|
||||
"is_custom_defined": "0",
|
||||
"name": "0.18mm Fine 0.6 nozzle @Voron - AquaMorph",
|
||||
"print_settings_id": "0.18mm Fine 0.6 nozzle @Voron - AquaMorph",
|
||||
"version": "2.2.0.4"
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
"brim_type": "no_brim",
|
||||
"brim_width": "10",
|
||||
"default_acceleration": "0",
|
||||
"enable_support": "1",
|
||||
"from": "User",
|
||||
"gap_infill_speed": "30",
|
||||
"infill_combination": "1",
|
||||
@ -12,7 +13,7 @@
|
||||
"initial_layer_speed": "20",
|
||||
"inner_wall_acceleration": "0",
|
||||
"inner_wall_line_width": "112%",
|
||||
"inner_wall_speed": "40",
|
||||
"inner_wall_speed": "35",
|
||||
"internal_solid_infill_line_width": "112%",
|
||||
"internal_solid_infill_speed": "50",
|
||||
"is_custom_defined": "0",
|
||||
@ -20,13 +21,15 @@
|
||||
"name": "0.20mm Standard CR-10s",
|
||||
"outer_wall_acceleration": "0",
|
||||
"outer_wall_line_width": "80%",
|
||||
"outer_wall_speed": "40",
|
||||
"outer_wall_speed": "35",
|
||||
"print_settings_id": "0.20mm Standard CR-10s",
|
||||
"sparse_infill_density": "30%",
|
||||
"sparse_infill_line_width": "107%",
|
||||
"sparse_infill_pattern": "adaptivecubic",
|
||||
"sparse_infill_speed": "60",
|
||||
"support_interface_speed": "30",
|
||||
"support_line_width": "95%",
|
||||
"support_object_xy_distance": "0.75",
|
||||
"support_speed": "30",
|
||||
"support_type": "tree(auto)",
|
||||
"top_surface_acceleration": "0",
|
||||
|
@ -0,0 +1,5 @@
|
||||
sync_info =
|
||||
user_id =
|
||||
setting_id =
|
||||
base_id = GP004
|
||||
updated_time = 1736606291
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"brim_type": "no_brim",
|
||||
"from": "User",
|
||||
"inherits": "0.30mm Standard 0.6 nozzle @Voron",
|
||||
"is_custom_defined": "0",
|
||||
"name": "0.30mm Standard 0.6 nozzle @Voron - AquaMorph",
|
||||
"print_settings_id": "0.30mm Standard 0.6 nozzle @Voron - AquaMorph",
|
||||
"version": "2.2.0.4"
|
||||
}
|
764
scripts/bin/aquaai.sh
Executable file
764
scripts/bin/aquaai.sh
Executable file
@ -0,0 +1,764 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This is a bash script to enable interacting with LLMs via the command line.
|
||||
|
||||
#===============================================================================
|
||||
|
||||
## Modes
|
||||
### Default mode
|
||||
# Default mode uses the default prompt and model for AquaAI. It's nothing
|
||||
# special.
|
||||
### Bash mode
|
||||
# This mode will help with writing bash scripts.
|
||||
### CLI mode
|
||||
# CLI mode prompts the AI with system information and will return terminal
|
||||
# commands. If you wish to run the command simply type run and it will end the
|
||||
# chat and run the command. You are responsible for validating what the command
|
||||
# does before running.
|
||||
### Code Review mode
|
||||
# This will ask you what changes to look at and will provide a code review of
|
||||
# the changes. This mode only works if you are currently in a git repo. It can
|
||||
# look at the past few commits as well as changes that have yet to be committed.
|
||||
### Reasoning mode
|
||||
# This uses the best available reasoning model with the default prompt.
|
||||
# Reasoning models take a task and break them up to subtask to pass to
|
||||
# specialized models. They are very yappy and take a while to run. Can be good
|
||||
# for complex tasks.
|
||||
### Regex mode
|
||||
# This mode will respond only with regex.
|
||||
### Git mode
|
||||
# This mode will respond only with git commands. If you wish to run the command
|
||||
# simply type run and it will end the chat and run the command. You are
|
||||
# responsible for validating what the command does before running.
|
||||
|
||||
## Special Input
|
||||
### Edit
|
||||
# You can type `edit` or `e` as a response and it will open your editor set with
|
||||
# the EDITOR variable in your shell session. You can then type your query and
|
||||
# save and exit. From there the program will send your query to the AI.
|
||||
### Exit
|
||||
# You can type `exit` or `q` to end the chat. Personally, I never do this just
|
||||
# use C-c.
|
||||
### Run
|
||||
# If you are in cli mode you can type `run` or `r` and the script will run the
|
||||
# given commands on your system. You are playing with fire with this, but fire
|
||||
# is useful and fun just be careful.
|
||||
### Save
|
||||
# You can type `save` or `s` as a response and the chat history will be saved
|
||||
# for use at another time. This will also end the chat. Chats are stored in
|
||||
# `~/.local/share/aquaai`
|
||||
|
||||
## Adding custom modes
|
||||
# There are two variables that need to be set to create a custom mode.
|
||||
### $selected_model will set the model to be used for the chat.
|
||||
### $system_prompt will be the prompt that controls how the AI behaves.
|
||||
# introduce more noise into text generation leading to more out there responses.
|
||||
#
|
||||
# Defaults are set for all these but to define a custom mode you should override
|
||||
# at least one of these in a function. Add a custom flag in the switch statement
|
||||
# at the bottom of this file and call the function there. See `--bash` as an
|
||||
# example of how to do this. From there add some documentation to the
|
||||
# print_help() function and then here.
|
||||
|
||||
#===============================================================================
|
||||
|
||||
# User configurable variables.
|
||||
#
|
||||
# The following are settings that can be overwritten by environment variables.
|
||||
# You can set these in your .bashrc to have them set each time you open a new
|
||||
# shell. This script is designed not to be modified so updates can be applied by
|
||||
# replacing the file with the newest version.
|
||||
#
|
||||
#
|
||||
# Set the url of the ollama server.
|
||||
#
|
||||
# export AQUAAI_OLLAMA_URL='192.168.1.156:11434'
|
||||
#
|
||||
ollama_url=${AQUAAI_OLLAMA_URL:='https://ollama.aquamorph.com'}
|
||||
#
|
||||
# Set the default model.
|
||||
#
|
||||
# export AQUAAI_DEFAULT_MODEL='qwen2.5-7b-instruct'
|
||||
#
|
||||
default_model=${AQUAAI_DEFAULT_MODEL:='qwen2.5:32b-instruct'}
|
||||
#
|
||||
# Set the default coding model.
|
||||
#
|
||||
# export AQUAAI_CODING_MODEL='qwen2.5-7b-coder'
|
||||
#
|
||||
coding_model=${AQUAAI_CODING_MODEL:='qwen2.5-32b-coder'}
|
||||
#
|
||||
# In multiline mode, users can input multiple lines of text by pressing the
|
||||
# Enter key. The message will be sent when the user presses C-d on the keyboard.
|
||||
#
|
||||
# export AQUAAI_MULTILINE_MODE=true
|
||||
#
|
||||
multiline_mode=${AQUAAI_MULTILINE_MODE:=false}
|
||||
#
|
||||
# Enable rich formatting for text output. A formatting program is required for
|
||||
# this see below.
|
||||
#
|
||||
# export AQUAAI_RICH_FORMAT_MODE=true
|
||||
#
|
||||
rich_format_mode=${AQUAAI_RICH_FORMAT_MODE:=false}
|
||||
#
|
||||
# Path to the program used for rich formatting. I am currently using streamdown
|
||||
# but you are free to use something different as long as it supports streaming
|
||||
# text and markdown. Go to the GitHub repo to learn to install streamdown and
|
||||
# configure: https://github.com/day50-dev/Streamdown
|
||||
#
|
||||
# export AQUAAI_RICH_FORMAT_PATH=~/.venv/bin/streamdown
|
||||
#
|
||||
rich_format_path=${AQUAAI_RICH_FORMAT_PATH:=streamdown}
|
||||
#
|
||||
# Ignore certificate checks.
|
||||
#
|
||||
# export AQUAAI_INSECURE_MODE=true
|
||||
#
|
||||
insecure_mode=${AQUAAI_INSECURE_MODE:=false}
|
||||
#===============================================================================
|
||||
|
||||
# Constants.
|
||||
OLLAMA_URL=${ollama_url}
|
||||
CURL_FLAGS='-sN'
|
||||
USER=$(whoami)
|
||||
DATA_DIR="${HOME}/.local/share/aquaai"
|
||||
RESPONSE_FIFO="${DATA_DIR}/.response"
|
||||
|
||||
# Colors.
|
||||
CLEAR='\033[0m'
|
||||
BLUE='\033[0;34m'
|
||||
RED='\e[1;31m'
|
||||
LIGHT_GRAY='\e[38;5;247m'
|
||||
|
||||
# Globals.
|
||||
message_history=''
|
||||
cli_mode=false
|
||||
code_review_start=false
|
||||
selected_model=${default_model}
|
||||
message_history="[]"
|
||||
|
||||
# Error Codes.
|
||||
ERROR_NO_SAVEFILE=1
|
||||
ERROR_INVALID_TEMP=2
|
||||
ERROR_UNKNOWN_OPTION=3
|
||||
ERROR_UNKNOWN_MODEL=4
|
||||
ERROR_NO_GIT_REPO=5
|
||||
ERROR_INVALID_INPUT=6
|
||||
ERROR_NO_AUTOSAVE=7
|
||||
ERROR_INVALID_SSL=8
|
||||
ERROR_UNKNOWN_SSL=9
|
||||
|
||||
#===============================================================================
|
||||
|
||||
# Set the default agent.
|
||||
function set_default_agent() {
|
||||
system_prompt='You are an AI assistant named AquaAI.'
|
||||
system_prompt+=' Follow the users instructions carefully.'
|
||||
system_prompt+=' Respond using extended markdown.'
|
||||
system_prompt+=' Be as concise as possible.'
|
||||
}
|
||||
|
||||
# Set chat to help with command line questions.
|
||||
function set_cli_agent() {
|
||||
local os_version=$(cat /etc/os-release | grep 'PRETTY_NAME' | \
|
||||
sed 's/PRETTY_NAME=//g' | tr -d '"')
|
||||
system_prompt='You are a large language model trained to assist users with an'
|
||||
system_prompt+=" ${os_version} OS. Only output terminal commands."
|
||||
system_prompt+=' Do not put commands in quotation marks.'
|
||||
system_prompt+=' Do not put commands in markdown.'
|
||||
}
|
||||
|
||||
# Set chat to help with bash questions.
|
||||
function set_bash_agent() {
|
||||
system_prompt='You are a large language model trained to assist users with'
|
||||
system_prompt+=' POSIXs bash. Format output for view in a command line. Do'
|
||||
system_prompt+=' not put commands in quotation marks. Use double spaces and'
|
||||
system_prompt+=' the function key word. Write documentation for a function'
|
||||
system_prompt+=' before the function declaration.'
|
||||
}
|
||||
|
||||
# Set ai to help with code reviews.
|
||||
function set_code_review_agent() {
|
||||
system_prompt='You are a senior software engineer performing a code review'
|
||||
system_prompt+=' for a colleague.'
|
||||
system_prompt+=''
|
||||
system_prompt+='Your report should have the following format:'
|
||||
system_prompt+='# Typos'
|
||||
system_prompt+='List of all typos you find.'
|
||||
system_prompt+='# Formatting and Readability Issues'
|
||||
system_prompt+='List of all formatting and readability issues you find.'
|
||||
system_prompt+='# Security Issues'
|
||||
system_prompt+='List of all security issues you find.'
|
||||
system_prompt+='# Other'
|
||||
system_prompt+='List of all other issues you find.'
|
||||
}
|
||||
|
||||
# Set chat to help with git.
|
||||
function set_git_agent() {
|
||||
system_prompt='You are a large language model trained to assist users with'
|
||||
system_prompt+=' git. Only output terminal commands.'
|
||||
system_prompt+=' Do not put commands in quotation marks.'
|
||||
}
|
||||
|
||||
# Set chat to help with regex.
|
||||
function set_regex_agent() {
|
||||
system_prompt='You are a large language model trained to assist users with'
|
||||
system_prompt+=' regex. Only output a single regex expression.'
|
||||
system_prompt+=' Use BRE and ERE regex.'
|
||||
system_prompt+=' Do not put commands in quotation marks.'
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
|
||||
# Set the default coding model.
|
||||
function set_coding_model() {
|
||||
selected_model=${coding_model}
|
||||
}
|
||||
|
||||
# Set the default reasoning model.
|
||||
function set_reasoning_model() {
|
||||
selected_model='deepseek-r1:8b'
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
|
||||
# Print out help menu.
|
||||
function print_help() {
|
||||
echo 'Interact with the AquaAI via the command line.'
|
||||
echo ''
|
||||
echo '--delete - delete a chat from history'
|
||||
echo '-l --list - list available models'
|
||||
echo '--load - load a chat from history'
|
||||
echo '--restore - load last auto saved chat'
|
||||
echo ''
|
||||
echo '--bash - help with bash'
|
||||
echo '--cli - help with command line'
|
||||
echo '--code-review - code review of a git project'
|
||||
echo '-r --reason - help with a reasoning model'
|
||||
echo '--regex - help with regex'
|
||||
echo '--git - help with git'
|
||||
}
|
||||
|
||||
# Print out error message.
|
||||
function print_error() {
|
||||
local msg=${1}
|
||||
printf "${RED}ERROR: ${msg}\n${CLEAR}"
|
||||
}
|
||||
|
||||
# Check if a given program is installed on the system.
|
||||
function check_program() {
|
||||
if ! command -v ${1} 2>&1 >/dev/null; then
|
||||
print_error "${1} not found. Please install ${1}."
|
||||
exit ${ERROR_DEPENDENCY}
|
||||
fi
|
||||
}
|
||||
|
||||
# Check system for required programs.
|
||||
function check_requirements() {
|
||||
check_program curl
|
||||
check_program jq
|
||||
check_program fzf
|
||||
if [ "${rich_format_mode}" == true ]; then
|
||||
check_program ${rich_format_path}
|
||||
fi
|
||||
}
|
||||
|
||||
# Get list of available models.
|
||||
function get_models() {
|
||||
curl "${OLLAMA_URL}/api/tags" ${CURL_FLAGS}
|
||||
}
|
||||
|
||||
# Print list of models.
|
||||
function print_models() {
|
||||
get_models | jq -r '.models[].model' | column -t -s $'\t'
|
||||
}
|
||||
|
||||
# Print message variable.
|
||||
function print_debug_message_history() {
|
||||
echo ${message_history}
|
||||
}
|
||||
|
||||
# Check if the model exists.
|
||||
function check_if_model_exists() {
|
||||
local model=${1}
|
||||
local model_list=($(get_models | jq -r '.models[].model'))
|
||||
|
||||
for m in "${model_list[@]}"; do
|
||||
if [[ "$m" == "$model" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
print_error "model ${model} does not exists."
|
||||
exit ${ERROR_UNKNOWN_MODEL}
|
||||
}
|
||||
|
||||
# Convert string to a safe format for later use.
|
||||
function convert_to_safe_text() {
|
||||
echo "${1}" | jq -sR @json
|
||||
}
|
||||
|
||||
# Set the text output color for user input.
|
||||
function set_user_color() {
|
||||
printf "${LIGHT_GRAY}"
|
||||
}
|
||||
|
||||
# Set the text output color for ai response.
|
||||
function set_ai_color() {
|
||||
printf "${CLEAR}"
|
||||
}
|
||||
|
||||
# Set text color to defaults.
|
||||
function set_clear_color() {
|
||||
printf "${CLEAR}"
|
||||
}
|
||||
|
||||
# Print the header for the ai message
|
||||
function print_ai_start_message() {
|
||||
echo -e "\U1F916 AquaAI"
|
||||
}
|
||||
|
||||
# Print the header for the ai message
|
||||
function print_user_start_message() {
|
||||
echo -e "\U1F464 ${USER}"
|
||||
}
|
||||
|
||||
# Opens the user's preferred text editor to allow them to input text.
|
||||
function editor_input() {
|
||||
local editor=${EDITOR:=nano}
|
||||
local temp_file=$(mktemp)
|
||||
|
||||
${editor} ${temp_file}
|
||||
local user_input=$(<"$temp_file")
|
||||
rm "$temp_file"
|
||||
|
||||
msg=${user_input}
|
||||
}
|
||||
|
||||
# Check if current directory is managed by git.
|
||||
function check_git_directory() {
|
||||
if ! git rev-parse --is-inside-work-tree &> /dev/null; then
|
||||
print_error 'The current directory is not inside a git repository.'
|
||||
exit ${ERROR_NO_GIT_REPO}
|
||||
fi
|
||||
}
|
||||
|
||||
# Asks the user if they want to include staged git change data.
|
||||
function gather_staged_changes() {
|
||||
echo -n 'Do you want to include staged changes? (y/n)? '
|
||||
read response
|
||||
|
||||
if [[ "$response" == 'y' || "$response" == 'yes' ]]; then
|
||||
msg+=$(git diff --cached --patch)
|
||||
fi
|
||||
}
|
||||
|
||||
# Ask the user if they want to include changes that have not been committed.
|
||||
function gather_uncommitted_changes() {
|
||||
echo -n 'Do you want to include the changes'
|
||||
echo -n ' you have yet to commit or stash (y/n)? '
|
||||
read response
|
||||
|
||||
if [[ "$response" == 'y' || "$response" == 'yes' ]]; then
|
||||
changes=$(git diff)
|
||||
msg+=${changes}
|
||||
fi
|
||||
}
|
||||
|
||||
# Ask the user for number of commit changes to include in code review.
|
||||
# Returns a list of changes for the given number of commits.
|
||||
function gather_commit_changes() {
|
||||
echo -n 'How many previous commits do you want to include? '
|
||||
local count
|
||||
read count
|
||||
|
||||
# Allow hitting enter as a no response.
|
||||
if [ -z "$count" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Validate that the input is a positive integer.
|
||||
if ! [[ "$count" =~ ^[0-9]+$ ]] || [ "$count" -lt 0 ]; then
|
||||
print_error 'Please enter a positive integer for the number of commits.'
|
||||
exit ${ERROR_INVALID_INPUT}
|
||||
fi
|
||||
|
||||
hashes=$(git log --format=%H -n ${count})
|
||||
for h in ${hashes}; do
|
||||
commit_message=$(git show ${h})
|
||||
msg+="${commit_message}"$'\n'
|
||||
done
|
||||
}
|
||||
|
||||
# Create fifo for chat responses.
|
||||
function create_response_fifo() {
|
||||
create_data_dir
|
||||
if [ ! -p ${RESPONSE_FIFO} ]; then
|
||||
mkfifo ${RESPONSE_FIFO}
|
||||
fi
|
||||
}
|
||||
|
||||
# Delete fifo for chat responses.
|
||||
function remove_response_fifo() {
|
||||
if [ -p ${RESPONSE_FIFO} ]; then
|
||||
rm ${RESPONSE_FIFO}
|
||||
fi
|
||||
}
|
||||
|
||||
# Create response trap to allow user to stop AquaAI.
|
||||
function create_response_trap() {
|
||||
trap 'echo "AquaAI has been interrupted...";' SIGINT
|
||||
}
|
||||
|
||||
# Remove response trap to allow user to exit program.
|
||||
function remove_response_trap() {
|
||||
trap - SIGINT
|
||||
}
|
||||
|
||||
# Get the first message from a saved chat.
|
||||
function get_first_chat() {
|
||||
local file_path=${1}
|
||||
source <(cat ${file_path} | grep message_history)
|
||||
message_history=$(echo $message_history | \
|
||||
jq -r '[.[] | select(.role == "user")][0].content' \
|
||||
2>/dev/null | sed 's/^"//')
|
||||
echo -e $message_history | sed 's/"$//' | tr -d '\n' | cut -c 1-80 \
|
||||
| sed ':a;N;$!ba;s/\n//g'
|
||||
}
|
||||
|
||||
# Get an array of all saved chat files.
|
||||
function get_save_files() {
|
||||
save_files=()
|
||||
create_data_dir
|
||||
|
||||
for f in $(find "$DATA_DIR" -type f -name "*.chat"); do
|
||||
save_files+=("${f}")
|
||||
done
|
||||
}
|
||||
|
||||
# Create the data directory if it does not exist.
|
||||
function create_data_dir() {
|
||||
if [ ! -d "$DATA_DIR" ]; then
|
||||
mkdir -p "$DATA_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
# Save the current chat to a file.
|
||||
function save_chat() {
|
||||
create_data_dir
|
||||
local filename=${1}
|
||||
|
||||
if [ -z "$filename" ]; then
|
||||
print_error 'No filename provided.'
|
||||
exit ${ERROR_NO_SAVEFILE}
|
||||
fi
|
||||
|
||||
declare -p selected_model system_prompt \
|
||||
message_history cli_mode > "${DATA_DIR}/${filename}"
|
||||
}
|
||||
|
||||
# Save the current chat to autosave.
|
||||
function autosave() {
|
||||
save_chat 'autosave.chat'
|
||||
echo 'Chat has been auto saved'
|
||||
}
|
||||
|
||||
# Find all .chat files in DATA_DIR and use fzf to select one.
|
||||
function select_chat_file() {
|
||||
selected_file=$(select_chat_with_fzf)
|
||||
|
||||
if [ -z "$selected_file" ]; then
|
||||
echo 'No file selected.'
|
||||
exit ${ERROR_NO_SAVEFILE}
|
||||
fi
|
||||
}
|
||||
|
||||
# Delete .chat files in DATA_DIR.
|
||||
function delete_chat_file() {
|
||||
selected_file=$(select_chat_with_fzf)
|
||||
|
||||
if [ -z "$selected_file" ]; then
|
||||
echo 'No file selected.'
|
||||
exit ${ERROR_NO_SAVEFILE}
|
||||
else
|
||||
local pretty_name=$(get_first_chat ${selected_file})
|
||||
echo -n "do you want to delete '${pretty_name}' (y/n)? "
|
||||
read response
|
||||
if [[ "$response" == 'y' || "$response" == 'yes' ]]; then
|
||||
rm -- "${selected_file}"
|
||||
echo "Deleted '${pretty_name}'"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Select saved chat with fzf program.
|
||||
function select_chat_with_fzf() {
|
||||
get_friendly_save_names
|
||||
|
||||
local selected_index=$(printf "%s\n" "${friendly_save_files[@]}" \
|
||||
| cat -n | fzf --with-nth 2.. \
|
||||
| awk '{print $1}')
|
||||
selected_index=$((${selected_index}-1))
|
||||
|
||||
if [[ -n $selected_index ]]; then
|
||||
echo "${save_files[selected_index]}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get an array of the first message in saved chats.
|
||||
function get_friendly_save_names() {
|
||||
get_save_files
|
||||
friendly_save_files=()
|
||||
for f in "${save_files[@]}"; do
|
||||
friendly_save_files+=("$(get_first_chat ${f})")
|
||||
done
|
||||
}
|
||||
|
||||
# Validate site certificate.
|
||||
function check_cert() {
|
||||
curl ${OLLAMA_URL} ${CURL_FLAGS} 2>&1 >/dev/null
|
||||
local ec=$?
|
||||
if [ "${ec}" == '60' ]; then
|
||||
print_error 'unable to get local issuer certificate.'
|
||||
echo 'Install the certificate on the system.'
|
||||
exit ${ERROR_INVALID_SSL}
|
||||
elif [ "${ec}" != '0' ]; then
|
||||
print_error 'unknown ssl error.'
|
||||
exit ${ERROR_UNKNOWN_SSL}
|
||||
fi
|
||||
}
|
||||
|
||||
# Update chat history
|
||||
function update_history() {
|
||||
local role="$1"
|
||||
local content="$2"
|
||||
message_history=$(echo "$message_history" \
|
||||
| jq --arg role "$role" --arg content \
|
||||
"$content" '. + [{"role": $role, "content": $content}]')
|
||||
}
|
||||
|
||||
# Read input from the user.
|
||||
function read_user_input() {
|
||||
if [ "${multiline_mode}" == true ]; then
|
||||
msg=$(awk '{if ($0 == "END") exit; else print}')
|
||||
elif [ "${code_review_start}" == true ]; then
|
||||
check_git_directory
|
||||
msg=''
|
||||
gather_uncommitted_changes
|
||||
gather_staged_changes
|
||||
gather_commit_changes
|
||||
code_review_start=false
|
||||
else
|
||||
read msg
|
||||
fi
|
||||
}
|
||||
|
||||
# Handle input related to CLI mode.
|
||||
function handle_cli_mode() {
|
||||
# Check for cli mode
|
||||
if [ ${cli_mode} == true ]; then
|
||||
if [[ -z $msg || $msg == 'run' || $msg == 'r' ]]; then
|
||||
set_clear_color
|
||||
autosave
|
||||
echo
|
||||
local commands=()
|
||||
# Get a list of commands
|
||||
while IFS= read -r line; do
|
||||
commands+=("${line}")
|
||||
done <<< "$last_cmd"
|
||||
for c in "${commands[@]}"; do
|
||||
# Using eval to handle commands that include pipes.
|
||||
if [[ "${c}" == *'|'* ]]; then
|
||||
eval "${c}"
|
||||
else
|
||||
${c}
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check for editor request.
|
||||
function handle_edit() {
|
||||
if [[ $msg == 'edit' || $msg == 'e' ]]; then
|
||||
editor_input
|
||||
set_user_color
|
||||
echo "${msg}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check for debug command.
|
||||
function handle_debug() {
|
||||
if [[ $msg == 'debug' ]]; then
|
||||
echo "model=${selected_model}"
|
||||
print_debug_message_history | jq
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Check for save command.
|
||||
function handle_save() {
|
||||
if [[ $msg == 'save' || $msg == 's' ]]; then
|
||||
echo "Saving chat history"
|
||||
save_chat "$(date +%Y%m%d%H%M%S).chat"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Chat converstation loop.
|
||||
function chat_loop() {
|
||||
check_if_model_exists ${selected_model}
|
||||
update_history 'system' "$system_prompt"
|
||||
while true; do
|
||||
chat
|
||||
done
|
||||
}
|
||||
|
||||
# Main chat loop.
|
||||
function chat() {
|
||||
# Get user input.
|
||||
set_user_color
|
||||
print_user_start_message
|
||||
read_user_input
|
||||
echo
|
||||
|
||||
# Handle user input.
|
||||
local rc=0
|
||||
handle_edit
|
||||
handle_cli_mode
|
||||
handle_debug
|
||||
handle_save
|
||||
rc=$((rc + $?))
|
||||
if [ "$rc" -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
update_history 'user' "${msg}"
|
||||
|
||||
# Prepare JSON payload.
|
||||
JSON_PAYLOAD=$(jq -n \
|
||||
--arg model "$selected_model" \
|
||||
--argjson messages "$message_history" \
|
||||
'{model: $model, messages: $messages, stream: true}')
|
||||
|
||||
set_ai_color
|
||||
print_ai_start_message
|
||||
|
||||
create_response_fifo
|
||||
create_response_trap
|
||||
# Render to console.
|
||||
if [ "${rich_format_mode}" == true ]; then
|
||||
cat ${RESPONSE_FIFO} | ${rich_format_path} &
|
||||
else
|
||||
cat ${RESPONSE_FIFO} &
|
||||
fi
|
||||
local response=$(curl -sN "$OLLAMA_URL/api/chat" \
|
||||
-d "$JSON_PAYLOAD" \
|
||||
| stdbuf -o0 jq -j '.message.content // empty' \
|
||||
| tee ${RESPONSE_FIFO})
|
||||
wait
|
||||
# Newline for AI response.
|
||||
if [ "${rich_format_mode}" != true ]; then
|
||||
echo
|
||||
fi
|
||||
# One line reponses do not print out when formatted with Streamdown.
|
||||
if [[ "$rich_format_path" == *"streamdown"* && \
|
||||
"${rich_format_mode}" == true ]]; then
|
||||
local wc=$(echo "${response}" | wc -l)
|
||||
if [ ${wc} -eq 1 ]; then
|
||||
echo "${response}"
|
||||
fi
|
||||
fi
|
||||
remove_response_trap
|
||||
remove_response_fifo
|
||||
echo
|
||||
update_history "assistant" "${response}"
|
||||
last_cmd="${response}"
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
|
||||
check_requirements
|
||||
if [ "${insecure_mode}" == true ]; then
|
||||
CURL_FLAGS+=' -k'
|
||||
else
|
||||
check_cert
|
||||
fi
|
||||
cmd=chat_loop
|
||||
set_default_agent
|
||||
|
||||
# Check arguments
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
-h|--help)
|
||||
cmd=print_help
|
||||
;;
|
||||
-l|--list)
|
||||
cmd=print_models
|
||||
;;
|
||||
--delete)
|
||||
delete_chat_file
|
||||
exit 0
|
||||
;;
|
||||
--load)
|
||||
select_chat_file
|
||||
source ${selected_file}
|
||||
cmd=chat_loop
|
||||
;;
|
||||
--restore)
|
||||
if [ ! -e "${DATA_DIR}/autosave.chat" ]; then
|
||||
print_error 'auto save does not exit'
|
||||
exit ${ERROR_NO_AUTOSAVE}
|
||||
fi
|
||||
source "${DATA_DIR}/autosave.chat"
|
||||
cmd=chat_loop
|
||||
;;
|
||||
# Modes
|
||||
--bash)
|
||||
set_coding_model
|
||||
set_bash_agent
|
||||
cmd=chat_loop
|
||||
;;
|
||||
--cli)
|
||||
set_coding_model
|
||||
set_cli_agent
|
||||
cmd=chat_loop
|
||||
cli_mode=true
|
||||
rich_format_mode=false
|
||||
;;
|
||||
--code-review)
|
||||
set_coding_model
|
||||
set_code_review_agent
|
||||
code_review_start=true
|
||||
cmd=chat_loop
|
||||
;;
|
||||
--git)
|
||||
set_coding_model
|
||||
set_git_agent
|
||||
cmd=chat_loop
|
||||
cli_mode=true
|
||||
rich_format_mode=false
|
||||
;;
|
||||
-r|--reason)
|
||||
set_reasoning_model
|
||||
cmd=chat_loop
|
||||
;;
|
||||
--regex)
|
||||
set_coding_model
|
||||
set_regex_agent
|
||||
cmd=chat_loop
|
||||
rich_format_mode=false
|
||||
;;
|
||||
# Other
|
||||
-*|--*)
|
||||
echo "Unknown option ${i}"
|
||||
print_help
|
||||
exit ERROR_UNKNOWN_OPTION
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
${cmd}
|
||||
|
@ -26,8 +26,8 @@ function fixPulse() {
|
||||
function launchi3() {
|
||||
if [ -z "$skipi3" ]; then
|
||||
echo Opening i3wm sound workspaces
|
||||
sleep .1 && i3-msg 'workspace 5; exec firefox'
|
||||
sleep 5.1 && python ~/bin/start-firefox.py
|
||||
sleep .1 && i3-msg 'workspace 5; exec brave-browser'
|
||||
#sleep 5.1 && python ~/bin/start-firefox.py
|
||||
fi
|
||||
}
|
||||
|
||||
@ -59,6 +59,13 @@ function renameInterface() {
|
||||
done
|
||||
}
|
||||
|
||||
# Restart the Wireplumber service.
|
||||
function restartWireplumber() {
|
||||
systemctl --user stop wireplumber
|
||||
sleep 5
|
||||
systemctl --user restart wireplumber
|
||||
}
|
||||
|
||||
# arg parser
|
||||
for arg in "$@"
|
||||
do
|
||||
@ -70,20 +77,12 @@ done
|
||||
|
||||
# Wire sinks
|
||||
setupSinks
|
||||
connectSinks
|
||||
status=$?
|
||||
while [[ $status -eq 0 ]]; do
|
||||
echo "Connecting Sinks"
|
||||
connectSinks
|
||||
status=$?
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Rename Audio Devices
|
||||
#renameInterface
|
||||
|
||||
# Eurorack audio interface
|
||||
sh ~/bin/audio/es9start.sh
|
||||
|
||||
launchi3
|
||||
systemctl --user restart polybar
|
||||
sleep 5
|
||||
restartWireplumber
|
||||
|
||||
|
@ -33,9 +33,9 @@ def getURLId(url):
|
||||
# getURLVersion() returns the url version number.
|
||||
def getURLVersion(url):
|
||||
if 'Beta' in url['downloadTitle']:
|
||||
beta = re.search('Beta \d+', url['downloadTitle'])
|
||||
beta = re.search('Beta \\d+', url['downloadTitle'])
|
||||
if beta:
|
||||
beta = re.search('\d+', beta.group()).group()
|
||||
beta = re.search('\\d+', beta.group()).group()
|
||||
else:
|
||||
beta = '99'
|
||||
return '{}.{}.{}.{}'.format(url['major'], url['minor'], url['releaseNum'], beta)
|
||||
|
@ -15,8 +15,9 @@ function postInstallFix() {
|
||||
dragonframe=$(searchProgramInstalled dragonframe20* | \
|
||||
awk 'END {print $(NF-2), $(NF-1), $NF}')
|
||||
dragonframeVersion=$(echo $dragonframe | awk '{print $2;}' | filterVersion)
|
||||
agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0'
|
||||
url=$(curl -s https://www.dragonframe.com/downloads/ \
|
||||
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0" | \
|
||||
-A $agent | \
|
||||
grep .rpm | grep downloadButton | grep downloadButton | \
|
||||
grep -io 'https://[a-z0-9+-._/]*.rpm' | head -n 1)
|
||||
urlVersion=$(echo $url | awk -F "-" '{ print $2 }')
|
||||
@ -28,8 +29,13 @@ echo Installing Dragonframe $urlVersion
|
||||
# Setting up and downloading package
|
||||
mkdir -p ~/Downloads/installers/dragonframe
|
||||
cd ~/Downloads/installers/dragonframe
|
||||
wget $url
|
||||
|
||||
|
||||
installer=$(basename "$url")
|
||||
curl -s $url \
|
||||
-A $agent \
|
||||
-o $installer
|
||||
|
||||
# Install package
|
||||
sudo dnf install $(basename "$url") -y
|
||||
sudo dnf install $installer -y
|
||||
|
||||
|
@ -7,10 +7,10 @@ source $(dirname ${BASH_SOURCE[0]})/install-lib.sh
|
||||
|
||||
# Get download url
|
||||
reaperVersion=$(head /opt/REAPER/whatsnew.txt | filterVersion)
|
||||
reaperSite='https://www.reaper.fm/'
|
||||
downloadPage=$(curl -s ${reaperSite}download.php)
|
||||
reaperSite='https://www.reaper.fm'
|
||||
downloadPage=$(curl -s "${reaperSite}/download.php")
|
||||
urlVersion=$(echo "$downloadPage" | grep -A 2 'Linux x86_64' | filterVersion)
|
||||
url=$reaperSite$(echo "$downloadPage" | grep linux_x86_64 | grep -Po '(?<=href=")[^"]*')
|
||||
url="${reaperSite}/$(echo "$downloadPage" | grep linux_x86_64 | grep -Po '(?<=href=")[^"]*'| head -n 1)"
|
||||
|
||||
checkUptoDate Reaper $reaperVersion $urlVersion
|
||||
|
||||
|
@ -5,6 +5,20 @@
|
||||
# Import library
|
||||
source $(dirname ${BASH_SOURCE[0]})/install-lib.sh
|
||||
|
||||
# Graphics card fix
|
||||
function graphicsCardFix() {
|
||||
sudo rm /etc/OpenCL/vendors/mesa.icd
|
||||
sudo rm /etc/OpenCL/vendors/pocl.icd
|
||||
}
|
||||
|
||||
# gLib fix
|
||||
function glibFix() {
|
||||
sudo mkdir /opt/resolve/libs/_disabled
|
||||
sudo mv /opt/resolve/libs/libglib-2.0.so* /opt/resolve/libs/_disabled
|
||||
sudo mv /opt/resolve/libs/libgio-2.0.so* /opt/resolve/libs/_disabled
|
||||
sudo mv /opt/resolve/libs/libgmodule-2.0.so* /opt/resolve/libs/_disabled
|
||||
}
|
||||
|
||||
versionFile=/opt/resolve/version.txt
|
||||
|
||||
resolveVersion=$(cat /opt/resolve/docs/ReadMe.html | grep 'DaVinci Resolve Studio' | filterVersion)
|
||||
@ -77,18 +91,12 @@ if [ ! -f ./*${installerName}_Linux.run ]; then
|
||||
fi
|
||||
echo "Installing ./*${installerName}_Linux.run"
|
||||
chmod +x ./*${installerName}_Linux.run
|
||||
sudo ./*${installerName}_Linux.run -i -y
|
||||
sudo SKIP_PACKAGE_CHECK=1 ./*${installerName}_Linux.run -i -y
|
||||
|
||||
# Version number backup
|
||||
sudo echo $urlVersion > $versionFile
|
||||
|
||||
# Graphics card fix
|
||||
sudo rm /etc/OpenCL/vendors/mesa.icd
|
||||
sudo rm /etc/OpenCL/vendors/pocl.icd
|
||||
|
||||
# gLib fix
|
||||
sudo mkdir /opt/resolve/libs/_disabled
|
||||
sudo mv /opt/resolve/libs/libglib-2.0.so* /opt/resolve/libs/_disabled
|
||||
glibFix
|
||||
|
||||
# Keyboard mapping fix
|
||||
setxkbmap -option 'caps:super'
|
||||
|
@ -26,5 +26,5 @@ def closed():
|
||||
return False
|
||||
if (openToday() and not closed()):
|
||||
print("Open")
|
||||
os.system("i3-msg 'workspace 10; exec firefox --new-window robinhood.com \
|
||||
os.system("i3-msg 'workspace 10; exec librewolf --new-window robinhood.com \
|
||||
&& sleep 1 && firefox -new-tab app.webull.com/watch'")
|
||||
|
@ -54,32 +54,32 @@ def isProgramRunning(name, windows, workspace):
|
||||
return False
|
||||
|
||||
|
||||
def isPagesLoaded(firefoxWindows):
|
||||
for w in firefoxWindows:
|
||||
def isPagesLoaded(windows):
|
||||
for w in windows:
|
||||
if 'http' not in w.name:
|
||||
return True
|
||||
return True
|
||||
i3 = Connection()
|
||||
firefoxWindows = filterWindowsByClass('firefox', getWindows(i3))
|
||||
windows = filterWindowsByClass('librewolf-default', getWindows(i3))
|
||||
|
||||
while(not isPagesLoaded(firefoxWindows)):
|
||||
while(not isPagesLoaded(windows)):
|
||||
time.sleep(0.1)
|
||||
|
||||
switchWorkspace('10')
|
||||
switchWorkspace('1')
|
||||
|
||||
# Music
|
||||
if not isProgramRunning(['music.youtube.com'], firefoxWindows, '10'):
|
||||
launchProgram('firefox --new-window music.youtube.com', '10')
|
||||
if not isProgramRunning(['music.youtube.com'], windows, '10'):
|
||||
launchProgram('librewolf --new-window music.youtube.com', '10')
|
||||
|
||||
# Stocks
|
||||
if not isProgramRunning(['Robinhood', 'Webull'], firefoxWindows, '10'):
|
||||
if not isProgramRunning(['Robinhood', 'Webull'], windows, '10'):
|
||||
os.system('python ~/bin/launch-stocks-tracker.py')
|
||||
|
||||
# Videos
|
||||
if not isProgramRunning(['odysee.com', 'lbry.tv', 'www.youtube.com',
|
||||
' - YouTube', 'hulu.com', 'netflix.com',
|
||||
'disneyplus.com', 'tv.youtube.com'],
|
||||
firefoxWindows, '10'):
|
||||
launchProgram('firefox --new-window youtube.com/feed/subscriptions', '10')
|
||||
launchProgram('sleep 1 && firefox -new-tab odysee.com/$/following', '10')
|
||||
windows, '10'):
|
||||
launchProgram('librewolf --new-window youtube.com/feed/subscriptions', '10')
|
||||
launchProgram('sleep 1 && librewolf -new-tab odysee.com/$/following', '10')
|
||||
|
52
scripts/bin/system/backlight-ctl.sh
Executable file
52
scripts/bin/system/backlight-ctl.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Print help info.
|
||||
function print_help() {
|
||||
echo 'Control the backlight brightness with animation.'
|
||||
echo
|
||||
echo '-i -- increase brightness'
|
||||
echo '-d -- decrease brightness'
|
||||
}
|
||||
|
||||
# Increase backlight brightness.
|
||||
function increase() {
|
||||
run_animation 'light -A 0.1'
|
||||
}
|
||||
|
||||
# Decrease backlight brightness.
|
||||
function decrease() {
|
||||
run_animation 'light -U 0.1'
|
||||
}
|
||||
|
||||
# Run animation task.
|
||||
function run_animation() {
|
||||
local cmd="${1}"
|
||||
i=0
|
||||
while [ $i -lt 50 ]; do
|
||||
${cmd}
|
||||
sleep 0.01
|
||||
((i = i + 1));
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Check arguments
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
-i)
|
||||
increase
|
||||
;;
|
||||
-d)
|
||||
decrease
|
||||
;;
|
||||
*)
|
||||
print_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
@ -28,6 +28,11 @@ function flatpakUpdate {
|
||||
fi
|
||||
}
|
||||
|
||||
# Appimage Updater
|
||||
function appimageUpdate {
|
||||
am update
|
||||
}
|
||||
|
||||
# Checks if a program is installed and if it is runs an updater script
|
||||
function updateProgram {
|
||||
if command -v $1 &> /dev/null; then
|
||||
@ -55,4 +60,7 @@ aptUpdate
|
||||
echo ''
|
||||
flatpakUpdate
|
||||
echo ''
|
||||
appimageUpdate
|
||||
echo ''
|
||||
manualUpdate
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
"output": ["DVI-D-0", "LVDS-1", "eDP-1"],
|
||||
"position": "top",
|
||||
"height": 35, // Waybar height (to be removed for auto height)
|
||||
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
|
||||
"modules-center": ["sway/window"],
|
||||
"modules-left": ["hyprland/workspaces", "hyprland/mode", "sway/workspaces", "sway/mode", "custom/media"],
|
||||
"modules-center": ["hyprland/window", "sway/window"],
|
||||
"modules-right": ["pulseaudio", "network", "backlight", "battery", "tray", "clock"],
|
||||
// Modules configuration
|
||||
"sway/workspaces": {
|
||||
@ -23,6 +23,22 @@
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
"hyprland/workspaces": {
|
||||
"disable-scroll": true,
|
||||
"all-outputs": true,
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"1": "1",
|
||||
"2": "",
|
||||
"3": "3",
|
||||
"4": "4",
|
||||
"5": "5",
|
||||
"13": "♫",
|
||||
"urgent": "",
|
||||
"focused": "",
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
"keyboard-state": {
|
||||
"numlock": true,
|
||||
"capslock": true,
|
||||
@ -35,6 +51,9 @@
|
||||
"sway/mode": {
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"hyprland/mode": {
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"tray": {
|
||||
// "icon-size": 21,
|
||||
"spacing": 10
|
||||
|
@ -1 +0,0 @@
|
||||
load_script("/home/aqua/.config/wireplumber/scripts/auto-connect-ports.lua")
|
@ -0,0 +1,13 @@
|
||||
wireplumber.components = [
|
||||
{
|
||||
name = auto-connect-ports.lua, type = script/lua
|
||||
provides = custom.auto-connect-ports
|
||||
}
|
||||
]
|
||||
|
||||
wireplumber.profiles = {
|
||||
main = {
|
||||
custom.auto-connect-ports = required
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
-- Link two ports together
|
||||
function link_port(output_port, input_port)
|
||||
if not input_port or not output_port then
|
||||
return false
|
||||
return nil
|
||||
end
|
||||
|
||||
local link_args = {
|
||||
@ -29,7 +29,7 @@ function link_port(output_port, input_port)
|
||||
local link = Link("link-factory", link_args)
|
||||
link:activate(1)
|
||||
|
||||
return true
|
||||
return link
|
||||
end
|
||||
|
||||
-- Automatically link ports together by their specific audio channels.
|
||||
@ -72,6 +72,8 @@ function auto_connect_ports(args)
|
||||
}
|
||||
}
|
||||
|
||||
local links = {}
|
||||
|
||||
local input_om = ObjectManager {
|
||||
Interest {
|
||||
type = "port",
|
||||
@ -96,22 +98,40 @@ function auto_connect_ports(args)
|
||||
Constraint { "port.direction", "equals", "in" }
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
function _connect()
|
||||
local delete_links = unless and unless:get_n_objects() > 0
|
||||
|
||||
print("Delete links", delete_links)
|
||||
if delete_links then
|
||||
for _i, link in pairs(links) do
|
||||
link:request_destroy()
|
||||
end
|
||||
|
||||
for output_name, input_name in pairs(args.connect) do
|
||||
local output = output_om:lookup { Constraint { "audio.channel", "equals", output_name } }
|
||||
local input = input_om:lookup { Constraint { "audio.channel", "equals", input_name } }
|
||||
links = {}
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
for output_name, input_names in pairs(args.connect) do
|
||||
local input_names = input_names[1] == nil and { input_names } or input_names
|
||||
|
||||
if delete_links then
|
||||
delete_link(all_links, output, input)
|
||||
else
|
||||
link_port(output, input)
|
||||
-- Iterate through all the output ports with the correct channel name
|
||||
for output in output_om:iterate { Constraint { "audio.channel", "equals", output_name } } do
|
||||
for _i, input_name in pairs(input_names) do
|
||||
-- Iterate through all the input ports with the correct channel name
|
||||
for input in input_om:iterate { Constraint { "audio.channel", "equals", input_name } } do
|
||||
-- Link all the nodes
|
||||
local link = link_port(output, input)
|
||||
|
||||
if link then
|
||||
table.insert(links, link)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -131,25 +151,15 @@ function auto_connect_ports(args)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- pw-cli list-objects | grep object.path
|
||||
|
||||
-- Connect to speakers
|
||||
auto_connect_ports {
|
||||
output = Constraint { "object.path", "matches", "speakers:*" },
|
||||
input = Constraint { "object.path", "matches", "alsa:pcm:2:hw:2,0:playback:*" },
|
||||
input = Constraint { "object.path", "matches", "alsa:acp:C8Pre:0:playback:*" },
|
||||
connect = {
|
||||
["FL"] = "AUX0",
|
||||
["FR"] = "AUX1"
|
||||
}
|
||||
}
|
||||
|
||||
-- Connect to mic
|
||||
auto_connect_ports {
|
||||
output = Constraint { "object.path", "matches", "alsa:pcm:2:hw:2,0:capture:*" },
|
||||
input = Constraint { "object.path", "matches", "sm7b-processed:" },
|
||||
connect = {
|
||||
["AUX0"] = "FL",
|
||||
["AUX1"] = "FR"
|
||||
}
|
||||
}
|
26
wireplumber/.local/share/wireplumber/scripts/dump-ports.lua
Normal file
26
wireplumber/.local/share/wireplumber/scripts/dump-ports.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- Dump all Wireplumber ports
|
||||
|
||||
function dump(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k,v in pairs(o) do
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
s = s .. '['..k..'] = ' .. dump(v) .. ',\n'
|
||||
end
|
||||
return s .. '} '
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
local port_om = ObjectManager {
|
||||
Interest {
|
||||
type = "port",
|
||||
}
|
||||
}
|
||||
|
||||
port_om:connect("object-added", function (om, port)
|
||||
print(dump(port.properties) .. '\n\n')
|
||||
end)
|
||||
|
||||
port_om:activate()
|
31
zsh/.zshrc
31
zsh/.zshrc
@ -1,7 +1,3 @@
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTSIZE=99999999
|
||||
SAVEHIST=99999999
|
||||
|
||||
autoload -Uz vcs_info
|
||||
precmd() { vcs_info }
|
||||
zstyle ':vcs_info:git:*' formats '%b '
|
||||
@ -16,6 +12,11 @@ zstyle :compinstall filename '~/.zshrc'
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTSIZE=99999999
|
||||
SAVEHIST=99999999
|
||||
|
||||
|
||||
# Text Editor
|
||||
alias emacs='emacs -nw'
|
||||
alias e='emacs -nw'
|
||||
@ -36,10 +37,28 @@ alias g='git'
|
||||
alias p='git pull'
|
||||
alias gp='git push'
|
||||
alias gd='git diff $(git rev-parse --abbrev-ref HEAD)'
|
||||
alias stash='git stash create; git stash push'
|
||||
alias pop='git stash pop'
|
||||
|
||||
# AquaAI
|
||||
export AQUAAI_PATH='~/bin/aquaai.sh'
|
||||
alias q=${AQUAAI_PATH}
|
||||
alias qc="${AQUAAI_PATH} --cli"
|
||||
alias qg="${AQUAAI_PATH} --git"
|
||||
alias cr="${AQUAAI_PATH} --code-review"
|
||||
export AQUAAI_DEFAULT_MODEL='qwen2.5:1.5b'
|
||||
export AQUAAI_CODING_MODEL='qwen2.5:3b'
|
||||
export AQUAAI_RICH_FORMAT_MODE=true
|
||||
|
||||
export TERM=xterm
|
||||
export EDITOR=emacs
|
||||
export EDITOR='emacs -nw'
|
||||
|
||||
# Daisy build toolkit
|
||||
GCC_PATH=~/dev/gcc-arm-none-eabi-9-2020-q2-update/bin
|
||||
GCC_PATH=~/dev/gcc-arm-none-eabi-10-2020-q4-major/bin
|
||||
export PATH=$GCC_PATH:$PATH
|
||||
|
||||
# AM auto complete
|
||||
autoload bashcompinit
|
||||
bashcompinit
|
||||
source "/home/aqua/.local/share/bash-completion/completions/am"
|
||||
|
||||
|
Reference in New Issue
Block a user