Skip to content

Commit d48c5a9

Browse files
committed
alot of stuff
1 parent 87db462 commit d48c5a9

35 files changed

Lines changed: 1674 additions & 1095 deletions

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
update:
2+
sudo echo Update
3+
nix flake update
4+
nh os switch ~/dotnix/ -- --show-trace -vL && nh home switch ~/dotnix/ -- --show-trace -vL
5+
6+
7+
home:
8+
nh home switch ~/dotnix -- --show-trace -vL
9+
10+
os:
11+
sudo echo OS
12+
nh os switch ~/dotnix -- --show-trace -vL

bin/_tool_search

Lines changed: 75 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,102 @@
11
#!/usr/bin/env bash
22
# List of options
33
options=(
4-
"chatgpt"
5-
"claude"
6-
"deepseek"
7-
"github"
8-
"google search"
9-
"grok"
10-
"home-manager options"
11-
"nh search"
12-
"nixpkgs search"
13-
"perplexity"
14-
"pypi"
15-
"youtube"
4+
"nixpkgs search"
5+
"bg"
6+
"audio"
7+
"lock"
8+
"color"
9+
"home-manager options"
10+
"bluetooth"
11+
"github"
12+
"wifi"
13+
"youtube"
14+
"kill"
15+
# "chatgpt"
16+
# "claude"
17+
# "deepseek"
18+
# "google search"
19+
# "grok"
20+
# "nh search"
21+
# "perplexity"
22+
# "pypi"
1623
)
1724
# Prompt the user to pick an option using rofi
1825
choice=$(printf "%s\n" "${options[@]}" | rofi -dmenu -p "Choose an action")
1926
# Exit if no choice was made
2027
[ -z "$choice" ] && exit 1
2128
# Function to open a URL in the default browser
2229
open_browser() {
23-
xdg-open "$1" &>/dev/null &
24-
hyprctl dispatch workspace 2
30+
xdg-open "$1" &>/dev/null &
31+
hyprctl dispatch workspace 2
2532
}
2633
# Handle each choice
2734
case "$choice" in
35+
"audio") rofi-pulse.sh ;;
36+
"kill") rofi-kill.sh ;;
37+
"bg") rofi-bg.sh ;;
38+
39+
"lock")
40+
lock.sh
41+
;;
42+
"color")
43+
sleep 1
44+
color=$(hyprpicker)
45+
echo "$color" | cs
46+
notify-send Color "$color"
47+
;;
48+
49+
"bluetooth")
50+
rofi-bluetooth
51+
;;
52+
"wifi")
53+
rofi-wifi-menu
54+
;;
2855
"chatgpt")
29-
open_browser "https://chat.openai.com/"
30-
;;
56+
open_browser "https://chat.openai.com/"
57+
;;
3158
"google search")
32-
query=$(rofi -dmenu -p "Enter Google query")
33-
[ -z "$query" ] || open_browser "https://www.google.com/search?q=$(printf "%s" "$query" | jq -sRr @uri)"
34-
;;
59+
query=$(rofi -dmenu -p "Enter Google query")
60+
[ -z "$query" ] || open_browser "https://www.google.com/search?q=$(printf "%s" "$query" | jq -sRr @uri)"
61+
;;
3562
"nixpkgs search")
36-
query=$(rofi -dmenu -p "Enter nixpkgs query")
37-
[ -z "$query" ] || open_browser "https://search.nixos.org/packages?channel=24.11&from=0&size=50&sort=relevance&type=packages&query=$(printf "%s" "$query" | jq -sRr @uri)"
38-
;;
63+
query=$(rofi -dmenu -p "Enter nixpkgs query")
64+
[ -z "$query" ] || open_browser "https://search.nixos.org/packages?channel=24.11&from=0&size=50&sort=relevance&type=packages&query=$(printf "%s" "$query" | jq -sRr @uri)"
65+
;;
3966
"pypi")
40-
query=$(rofi -dmenu -p "Enter PyPI query")
41-
[ -z "$query" ] || open_browser "https://pypi.org/search/?q=$(printf "%s" "$query" | jq -sRr @uri)"
42-
;;
67+
query=$(rofi -dmenu -p "Enter PyPI query")
68+
[ -z "$query" ] || open_browser "https://pypi.org/search/?q=$(printf "%s" "$query" | jq -sRr @uri)"
69+
;;
4370
"github")
44-
query=$(rofi -dmenu -p "Enter GitHub query")
45-
[ -z "$query" ] || open_browser "https://github.com/search?q=$(printf "%s" "$query" | jq -sRr @uri)&type=repositories"
46-
;;
71+
query=$(rofi -dmenu -p "Enter GitHub query")
72+
[ -z "$query" ] || open_browser "https://github.com/search?q=$(printf "%s" "$query" | jq -sRr @uri)&type=repositories"
73+
;;
4774
"home-manager options")
48-
query=$(rofi -dmenu -p "Enter home-manager query")
49-
[ -z "$query" ] || open_browser "https://home-manager-options.extranix.com/?release=master&query=$(printf "%s" "$query" | jq -sRr @uri)"
50-
;;
75+
query=$(rofi -dmenu -p "Enter home-manager query")
76+
[ -z "$query" ] || open_browser "https://home-manager-options.extranix.com/?release=master&query=$(printf "%s" "$query" | jq -sRr @uri)"
77+
;;
5178
"nh search")
52-
query=$(rofi -dmenu -p "Enter nh query")
53-
[ -z "$query" ] || wezterm start --always-new-process bash -c "nh '$query' | bat --paging=always"
54-
;;
79+
query=$(rofi -dmenu -p "Enter nh query")
80+
[ -z "$query" ] || wezterm start --always-new-process bash -c "nh '$query' | bat --paging=always"
81+
;;
5582
"grok")
56-
open_browser "https://x.com/i/grok"
57-
;;
83+
open_browser "https://x.com/i/grok"
84+
;;
5885
"claude")
59-
open_browser "https://claude.ai/new"
60-
;;
86+
open_browser "https://claude.ai/new"
87+
;;
6188
"deepseek")
62-
open_browser "https://chat.deepseek.com/"
63-
;;
89+
open_browser "https://chat.deepseek.com/"
90+
;;
6491
"perplexity")
65-
open_browser "https://www.perplexity.ai/"
66-
;;
92+
open_browser "https://www.perplexity.ai/"
93+
;;
6794
"youtube")
68-
query=$(rofi -dmenu -p "Enter YouTube search")
69-
[ -z "$query" ] || open_browser "https://www.youtube.com/results?search_query=$(printf "%s" "$query" | jq -sRr @uri)"
70-
;;
95+
query=$(rofi -dmenu -p "Enter YouTube search")
96+
[ -z "$query" ] || open_browser "https://www.youtube.com/results?search_query=$(printf "%s" "$query" | jq -sRr @uri)"
97+
;;
7198
*)
72-
notify-send "Unknown choice: $choice"
73-
exit 1
74-
;;
99+
notify-send "Unknown choice: $choice"
100+
exit 1
101+
;;
75102
esac

bin/bat.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
battery=$(</sys/class/power_supply/BAT1/capacity)
4+
5+
if ((battery >= 100)); then
6+
color="#50fa7b" # green
7+
elif ((battery >= 40)); then
8+
color="#8F93A2" # normal gray
9+
elif ((battery >= 20)); then
10+
color="#f1fa8c" # warning yellow
11+
else
12+
color="#ff5555" # critical red
13+
fi
14+
15+
echo "$color ${battery}"

bin/dea

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nohup "$@" > /dev/null 2>&1 & disown

bin/findcmake.sh

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/usr/bin/env bash
2+
3+
# CMake Package Finder
4+
# This script searches for a package in various forms and generates boilerplate CMake code
5+
6+
# Check if package name is provided
7+
if [ "$#" -lt 1 ]; then
8+
echo "Usage: $0 <package_name>"
9+
exit 1
10+
fi
11+
12+
PACKAGE_NAME=$1
13+
ORIGINAL_PACKAGE=$PACKAGE_NAME
14+
OUTPUT_FILE="cmake_package_results.txt"
15+
16+
# Clear previous results
17+
> "$OUTPUT_FILE"
18+
19+
echo "==============================================" | tee -a "$OUTPUT_FILE"
20+
echo "CMake Package Finder - Searching for: $PACKAGE_NAME" | tee -a "$OUTPUT_FILE"
21+
echo "==============================================" | tee -a "$OUTPUT_FILE"
22+
echo "" | tee -a "$OUTPUT_FILE"
23+
24+
# Create temporary CMake project
25+
TEMP_DIR=$(mktemp -d)
26+
cd "$TEMP_DIR" || exit 1
27+
28+
# Function to test a package and record results
29+
test_package() {
30+
local package_name=$1
31+
local variation_desc=$2
32+
33+
echo "Trying: $package_name ($variation_desc)" | tee -a "$OUTPUT_FILE"
34+
35+
# Create test CMake file
36+
cat > CMakeLists.txt << EOF
37+
cmake_minimum_required(VERSION 3.10)
38+
project(PackageTest)
39+
40+
find_package($package_name QUIET)
41+
42+
message(STATUS "Package found: \${${package_name}_FOUND}")
43+
if(${package_name}_FOUND)
44+
message(STATUS "Version: \${${package_name}_VERSION}")
45+
message(STATUS "Include dirs: \${${package_name}_INCLUDE_DIRS}")
46+
if(DEFINED ${package_name}_LIBRARIES)
47+
message(STATUS "Libraries: \${${package_name}_LIBRARIES}")
48+
endif()
49+
if(DEFINED ${package_name}_LIBRARY)
50+
message(STATUS "Library: \${${package_name}_LIBRARY}")
51+
endif()
52+
# Try common variable names
53+
if(DEFINED ${package_name}_INCLUDE_DIR)
54+
message(STATUS "Include dir: \${${package_name}_INCLUDE_DIR}")
55+
endif()
56+
get_directory_property(vars VARIABLES)
57+
foreach(var \${vars})
58+
string(FIND "\${var}" "${package_name}" pos)
59+
if(NOT \${pos} EQUAL -1)
60+
message(STATUS "Variable: \${var}=\${\${var}}")
61+
endif()
62+
endforeach()
63+
endif()
64+
EOF
65+
66+
# Run CMake to test package
67+
OUTPUT=$(cmake . 2>&1)
68+
69+
# Check if package was found
70+
if echo "$OUTPUT" | grep -q "Package found: 1"; then
71+
echo "✅ FOUND! $package_name ($variation_desc)" | tee -a "$OUTPUT_FILE"
72+
echo "$OUTPUT" | grep "STATUS" | tee -a "$OUTPUT_FILE"
73+
echo "" | tee -a "$OUTPUT_FILE"
74+
75+
# Generate boilerplate code section
76+
echo "==== CMake Boilerplate for $package_name ====" >> "$OUTPUT_FILE"
77+
cat >> "$OUTPUT_FILE" << EOF
78+
# Find and link $package_name
79+
find_package($package_name REQUIRED)
80+
81+
# Add include directories
82+
include_directories(\${${package_name}_INCLUDE_DIRS})
83+
84+
# Link libraries (in target_link_libraries)
85+
# target_link_libraries(your_target \${${package_name}_LIBRARIES})
86+
87+
EOF
88+
echo "============================================" >> "$OUTPUT_FILE"
89+
echo "" >> "$OUTPUT_FILE"
90+
91+
return 0
92+
else
93+
echo "❌ Not found" | tee -a "$OUTPUT_FILE"
94+
echo "" | tee -a "$OUTPUT_FILE"
95+
return 1
96+
fi
97+
}
98+
99+
# Try different variations of the package name
100+
variations=(
101+
"$PACKAGE_NAME:Original name"
102+
"$(echo "$PACKAGE_NAME" | tr '[:lower:]' '[:upper:]'):All uppercase"
103+
"$(echo "$PACKAGE_NAME" | tr '[:upper:]' '[:lower:]'):All lowercase"
104+
"$(echo "$PACKAGE_NAME" | sed 's/_//g'):Without underscores"
105+
"$(echo "$PACKAGE_NAME" | sed 's/-/_/g'):Replace hyphens with underscores"
106+
"$(echo "$PACKAGE_NAME" | sed 's/_/-/g'):Replace underscores with hyphens"
107+
"lib$PACKAGE_NAME:With lib prefix"
108+
"${PACKAGE_NAME}lib:With lib suffix"
109+
"$(echo "$PACKAGE_NAME" | sed 's/lib//'):Without lib prefix"
110+
"$(echo "$PACKAGE_NAME" | sed -r 's/([a-z])([A-Z])/\1_\2/g' | tr '[:upper:]' '[:lower:]'):Snake case"
111+
"$(echo "$PACKAGE_NAME" | sed -r 's/_([a-z])/\U\1/g'):Camel case"
112+
)
113+
114+
# Add more variations with first letter capitalized
115+
for suffix in "" "Lib" "Library"; do
116+
name="$(echo "$PACKAGE_NAME" | sed 's/.*/\u&/'):Capitalized${suffix:+ with $suffix suffix}"
117+
variations+=("$(echo "$PACKAGE_NAME" | sed 's/.*/\u&/')$suffix:$name")
118+
done
119+
120+
# Try each variation
121+
success=0
122+
for variation in "${variations[@]}"; do
123+
IFS=: read -r name description <<< "$variation"
124+
if test_package "$name" "$description"; then
125+
success=1
126+
fi
127+
done
128+
129+
# Try with CONFIG mode explicitly
130+
if test_package "$ORIGINAL_PACKAGE CONFIG" "Original with CONFIG mode"; then
131+
success=1
132+
fi
133+
134+
# Try with REQUIRED flag to see possible error messages
135+
echo "Attempting with REQUIRED flag to see detailed errors..." | tee -a "$OUTPUT_FILE"
136+
cat > CMakeLists.txt << EOF
137+
cmake_minimum_required(VERSION 3.10)
138+
project(PackageTest)
139+
find_package($ORIGINAL_PACKAGE REQUIRED)
140+
EOF
141+
142+
OUTPUT=$(cmake . 2>&1 || true)
143+
echo "$OUTPUT" | grep -i "error\|could not find\|not found" | tee -a "$OUTPUT_FILE"
144+
echo "" | tee -a "$OUTPUT_FILE"
145+
146+
# Clean up
147+
cd - > /dev/null
148+
rm -rf "$TEMP_DIR"
149+
150+
if [ $success -eq 1 ]; then
151+
echo "✅ At least one variation of the package was found!" | tee -a "$OUTPUT_FILE"
152+
echo "Check $OUTPUT_FILE for detailed results and CMake boilerplate." | tee -a "$OUTPUT_FILE"
153+
else
154+
echo "❌ No variations of the package were found." | tee -a "$OUTPUT_FILE"
155+
echo "" | tee -a "$OUTPUT_FILE"
156+
echo "Suggestions:" | tee -a "$OUTPUT_FILE"
157+
echo "1. Make sure the package is installed on your system." | tee -a "$OUTPUT_FILE"
158+
echo "2. Check if it provides a CMake config file or module." | tee -a "$OUTPUT_FILE"
159+
echo "3. Try setting CMAKE_PREFIX_PATH to include the package install location." | tee -a "$OUTPUT_FILE"
160+
echo "4. Look for the correct package name in the package documentation." | tee -a "$OUTPUT_FILE"
161+
fi
162+
163+
echo "" | tee -a "$OUTPUT_FILE"
164+
echo "Results saved to $OUTPUT_FILE" | tee -a "$OUTPUT_FILE"

0 commit comments

Comments
 (0)