initial commit
This commit is contained in:
commit
90cff4f16a
59 changed files with 6855 additions and 0 deletions
86
Rofi/Scripts/favorites.sh
Normal file
86
Rofi/Scripts/favorites.sh
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin/env bash
|
||||
# Rofi Favorites - Reads Zen/Firefox bookmarks directly from SQLite
|
||||
# Supports folder navigation with ROFI_DATA state tracking
|
||||
# Works with both Hyprland and dwm (no WM-specific code)
|
||||
|
||||
PLACES_DB="$HOME/.zen/default/places.sqlite"
|
||||
TEMP_DB="/tmp/rofi-bookmarks.sqlite"
|
||||
STATE="${ROFI_DATA:-3}" # 3 = Bookmarks Toolbar folder ID
|
||||
SELECTION="$1"
|
||||
|
||||
# Copy database to avoid lock issues (browser keeps it locked)
|
||||
cp "$PLACES_DB" "$TEMP_DB" 2>/dev/null
|
||||
|
||||
show_folder() {
|
||||
local folder_id="$1"
|
||||
echo -en "\0data\x1f${folder_id}\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
|
||||
# Show back option if not at root
|
||||
[[ "$folder_id" != "3" ]] && echo " .."
|
||||
|
||||
# Query bookmarks in this folder
|
||||
# type 1 = bookmark, type 2 = folder
|
||||
sqlite3 -separator '|' "$TEMP_DB" "
|
||||
SELECT
|
||||
b.id,
|
||||
b.type,
|
||||
COALESCE(b.title, ''),
|
||||
COALESCE(p.url, '')
|
||||
FROM moz_bookmarks b
|
||||
LEFT JOIN moz_places p ON b.fk = p.id
|
||||
WHERE b.parent = $folder_id
|
||||
AND b.title IS NOT NULL
|
||||
AND b.title != ''
|
||||
ORDER BY b.position;
|
||||
" | while IFS='|' read -r id type title url; do
|
||||
if [[ "$type" == "2" ]]; then
|
||||
# Folder
|
||||
echo -en " ${title}\0info\x1ffolder:${id}\n"
|
||||
elif [[ "$type" == "1" && -n "$url" ]]; then
|
||||
# Bookmark
|
||||
echo -en " ${title}\0info\x1f${url}\n"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
handle_selection() {
|
||||
local info="$ROFI_INFO"
|
||||
|
||||
# Back/parent
|
||||
if [[ "$SELECTION" == " .." ]]; then
|
||||
parent=$(sqlite3 "$TEMP_DB" "SELECT parent FROM moz_bookmarks WHERE id = $STATE;")
|
||||
[[ -z "$parent" || "$parent" == "0" || "$parent" == "1" ]] && parent=3
|
||||
show_folder "$parent"
|
||||
return
|
||||
fi
|
||||
|
||||
# Folder - navigate into it
|
||||
if [[ "$info" == folder:* ]]; then
|
||||
local folder_id="${info#folder:}"
|
||||
show_folder "$folder_id"
|
||||
return
|
||||
fi
|
||||
|
||||
# URL - open it
|
||||
if [[ -n "$info" && "$info" != folder:* ]]; then
|
||||
coproc (xdg-open "$info" &)
|
||||
exit 0
|
||||
fi
|
||||
|
||||
show_folder "$STATE"
|
||||
}
|
||||
|
||||
# Check if database exists
|
||||
if [[ ! -f "$PLACES_DB" ]]; then
|
||||
echo " No Zen browser profile found"
|
||||
echo " Expected: ~/.zen/default/places.sqlite"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Main entry
|
||||
if [[ -z "$SELECTION" ]]; then
|
||||
show_folder "$STATE"
|
||||
else
|
||||
handle_selection
|
||||
fi
|
||||
46
Rofi/Scripts/max30.sh
Normal file
46
Rofi/Scripts/max30.sh
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env bash
|
||||
# Rofi Max30 mode - list and open video files with custom names
|
||||
# Supports both Hyprland (Wayland) and dwm (X11)
|
||||
|
||||
# ==============================================================================
|
||||
# Environment Detection
|
||||
# ==============================================================================
|
||||
if [[ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; then
|
||||
WM="hyprland"
|
||||
else
|
||||
WM="dwm"
|
||||
fi
|
||||
|
||||
VIDEOS=(
|
||||
"Max Out Cardio|/data-bis/Insanity MAX 30/Max Out Cardio.mkv"
|
||||
"Max Out Power|/data-bis/Insanity MAX 30/Max Out Power.mkv"
|
||||
"Max Out Sweat|/data-bis/Insanity MAX 30/Max Out Sweat.mkv"
|
||||
"Max Out Strength|/data-bis/Insanity MAX 30/Max Out Strength.mkv"
|
||||
"Friday Fight #2|/data-bis/Insanity MAX 30/Friday Fight Round 2.mkv"
|
||||
)
|
||||
|
||||
# If no argument, list video names
|
||||
if [ -z "$1" ]; then
|
||||
for entry in "${VIDEOS[@]}"; do
|
||||
echo "${entry%%|*}"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If argument provided, find and open the matching video
|
||||
SELECTED="$1"
|
||||
for entry in "${VIDEOS[@]}"; do
|
||||
name="${entry%%|*}"
|
||||
path="${entry#*|}"
|
||||
if [ "$name" = "$SELECTED" ]; then
|
||||
setsid xdg-open "$path" >/dev/null 2>&1 &
|
||||
if [[ "$WM" == "hyprland" ]]; then
|
||||
hyprctl dispatch workspace 90 >/dev/null 2>&1
|
||||
else
|
||||
# Focus primary monitor first if not on mobile (single monitor) profile
|
||||
[[ $(autorandr --detected) != "mobile" ]] && echo "mon-prim" > /tmp/dwm.fifo
|
||||
echo "video" > /tmp/dwm.fifo
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
317
Rofi/Scripts/system.sh
Normal file
317
Rofi/Scripts/system.sh
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
#!/usr/bin/env bash
|
||||
# Rofi System Menu - as rofi mode with inline submenus
|
||||
# Uses ROFI_DATA for state tracking between calls
|
||||
# Supports both Hyprland (Wayland) and dwm (X11)
|
||||
|
||||
STATE="${ROFI_DATA:-main}"
|
||||
SELECTION="$1"
|
||||
|
||||
# ==============================================================================
|
||||
# Environment Detection
|
||||
# ==============================================================================
|
||||
if [[ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; then
|
||||
WM="hyprland"
|
||||
else
|
||||
WM="dwm"
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# Helper Functions
|
||||
# ==============================================================================
|
||||
|
||||
get_volume() { wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | awk '{print int($2*100)}'; }
|
||||
get_mic_volume() { wpctl get-volume @DEFAULT_AUDIO_SOURCE@ 2>/dev/null | awk '{print int($2*100)}'; }
|
||||
is_muted() { wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | grep -q MUTED && echo "yes" || echo "no"; }
|
||||
is_mic_muted() { wpctl get-volume @DEFAULT_AUDIO_SOURCE@ 2>/dev/null | grep -q MUTED && echo "yes" || echo "no"; }
|
||||
get_brightness_internal() { brightnessctl -m 2>/dev/null | cut -d',' -f4 | tr -d '%'; }
|
||||
get_brightness_external() {
|
||||
if [[ "$WM" == "hyprland" ]]; then
|
||||
local val=$(busctl --user get-property rs.wl-gammarelay /outputs/DP_3 rs.wl.gammarelay Brightness 2>/dev/null | awk '{print $2}')
|
||||
echo "${val:-1}" | awk '{print int($1*100)}'
|
||||
else
|
||||
# X11: Use xrandr gamma (approximate)
|
||||
local gamma=$(xrandr --verbose | grep -A5 "DP-3" | grep "Brightness" | awk '{print $2}' 2>/dev/null)
|
||||
echo "${gamma:-1}" | awk '{print int($1*100)}'
|
||||
fi
|
||||
}
|
||||
get_power_profile() { powerprofilesctl get 2>/dev/null || echo "balanced"; }
|
||||
|
||||
get_default_sink_id() {
|
||||
wpctl inspect @DEFAULT_AUDIO_SINK@ 2>/dev/null | head -1 | awk '{print $2}' | tr -d ','
|
||||
}
|
||||
|
||||
get_default_source_id() {
|
||||
wpctl inspect @DEFAULT_AUDIO_SOURCE@ 2>/dev/null | head -1 | awk '{print $2}' | tr -d ','
|
||||
}
|
||||
|
||||
get_sinks() {
|
||||
local default_id=$(get_default_sink_id)
|
||||
pw-cli list-objects Node 2>/dev/null | awk '
|
||||
/^[[:space:]]*id [0-9]+/ { id = $2; gsub(",", "", id) }
|
||||
/node.description = / { gsub(/.*node.description = "|"$/, ""); desc = $0 }
|
||||
/media.class = "Audio\/Sink"/ { print id "|" desc }
|
||||
' | while IFS='|' read -r id desc; do
|
||||
if [[ "$id" == "$default_id" ]]; then
|
||||
echo "✓ ${desc}|${id}"
|
||||
else
|
||||
echo "${desc}|${id}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
get_sources() {
|
||||
local default_id=$(get_default_source_id)
|
||||
pw-cli list-objects Node 2>/dev/null | awk '
|
||||
/^[[:space:]]*id [0-9]+/ { id = $2; gsub(",", "", id) }
|
||||
/node.description = / { gsub(/.*node.description = "|"$/, ""); desc = $0 }
|
||||
/media.class = "Audio\/Source"/ { print id "|" desc }
|
||||
' | while IFS='|' read -r id desc; do
|
||||
if [[ "$id" == "$default_id" ]]; then
|
||||
echo "✓ ${desc}|${id}"
|
||||
else
|
||||
echo "${desc}|${id}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# Menu Display Functions
|
||||
# ==============================================================================
|
||||
|
||||
show_main() {
|
||||
echo -en "\0data\x1fmain\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
echo " Sound"
|
||||
echo " Brightness"
|
||||
echo " WiFi"
|
||||
echo " Bluetooth"
|
||||
echo " Power Profile"
|
||||
echo " Power"
|
||||
}
|
||||
|
||||
show_sound() {
|
||||
echo -en "\0data\x1fsound\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
local vol=$(get_volume)
|
||||
local mic=$(get_mic_volume)
|
||||
local muted=$(is_muted)
|
||||
local mic_muted=$(is_mic_muted)
|
||||
local vol_icon=""; [[ "$muted" == "yes" ]] && vol_icon=""
|
||||
local mic_icon=""; [[ "$mic_muted" == "yes" ]] && mic_icon=""
|
||||
|
||||
echo "$vol_icon Volume: ${vol}%"
|
||||
echo " Volume +5%"
|
||||
echo " Volume -5%"
|
||||
echo " Output Device"
|
||||
echo "$mic_icon Mic: ${mic}%"
|
||||
echo " Mic +5%"
|
||||
echo " Mic -5%"
|
||||
echo " Input Device"
|
||||
echo " Back"
|
||||
}
|
||||
|
||||
show_output() {
|
||||
echo -en "\0data\x1foutput\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
get_sinks | while IFS='|' read -r name id; do
|
||||
echo -en " ${name}\0info\x1f${id}\n"
|
||||
done
|
||||
echo " Back"
|
||||
}
|
||||
|
||||
show_input() {
|
||||
echo -en "\0data\x1finput\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
get_sources | while IFS='|' read -r name id; do
|
||||
echo -en " ${name}\0info\x1f${id}\n"
|
||||
done
|
||||
echo " Back"
|
||||
}
|
||||
|
||||
show_brightness() {
|
||||
echo -en "\0data\x1fbrightness\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
local internal=$(get_brightness_internal)
|
||||
local external=$(get_brightness_external)
|
||||
|
||||
echo " Internal: ${internal}%"
|
||||
echo " Internal +5%"
|
||||
echo " Internal -5%"
|
||||
echo " External: ${external}%"
|
||||
echo " External +5%"
|
||||
echo " External -5%"
|
||||
echo " Back"
|
||||
}
|
||||
|
||||
show_power_profile() {
|
||||
echo -en "\0data\x1fprofile\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
local current=$(get_power_profile)
|
||||
local perf="" bal="" saver=""
|
||||
[[ "$current" == "performance" ]] && perf="✓ "
|
||||
[[ "$current" == "balanced" ]] && bal="✓ "
|
||||
[[ "$current" == "power-saver" ]] && saver="✓ "
|
||||
|
||||
echo "${perf} Performance"
|
||||
echo "${bal} Balanced"
|
||||
echo "${saver} Power Saver"
|
||||
echo " Edit Tuning"
|
||||
echo " Back"
|
||||
}
|
||||
|
||||
show_power() {
|
||||
echo -en "\0data\x1fpower\n"
|
||||
echo -en "\0keep-selection\x1ftrue\n"
|
||||
echo " Shutdown"
|
||||
echo " Reboot"
|
||||
echo " Logout"
|
||||
echo " Lock"
|
||||
echo " Back"
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# Action Handlers
|
||||
# ==============================================================================
|
||||
|
||||
handle_main() {
|
||||
case "$SELECTION" in
|
||||
*"Sound"*) show_sound ;;
|
||||
*"Brightness"*) show_brightness ;;
|
||||
*"WiFi"*) coproc (rofi-network-manager &); exit 0 ;;
|
||||
*"Bluetooth"*) coproc (rofi-bluetooth &); exit 0 ;;
|
||||
*"Power Profile"*) show_power_profile ;;
|
||||
*"Power"*) show_power ;;
|
||||
*) show_main ;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_sound() {
|
||||
case "$SELECTION" in
|
||||
*"Volume:"*) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; show_sound ;;
|
||||
*"Volume +5%"*) wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ -l 1.0; show_sound ;;
|
||||
*"Volume -5%"*) wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; show_sound ;;
|
||||
*"Output Device"*) show_output ;;
|
||||
*"Mic:"*) wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle; show_sound ;;
|
||||
*"Mic +5%"*) wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%+ -l 1.0; show_sound ;;
|
||||
*"Mic -5%"*) wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%-; show_sound ;;
|
||||
*"Input Device"*) show_input ;;
|
||||
*"Back"*) show_main ;;
|
||||
*) show_sound ;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_output() {
|
||||
case "$SELECTION" in
|
||||
*"Back"*) show_sound ;;
|
||||
*)
|
||||
[[ -n "$ROFI_INFO" ]] && wpctl set-default "$ROFI_INFO"
|
||||
show_output
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_input() {
|
||||
case "$SELECTION" in
|
||||
*"Back"*) show_sound ;;
|
||||
*)
|
||||
[[ -n "$ROFI_INFO" ]] && wpctl set-default "$ROFI_INFO"
|
||||
show_input
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_brightness() {
|
||||
case "$SELECTION" in
|
||||
*"Internal +5%"*) brightnessctl -q set +5%; show_brightness ;;
|
||||
*"Internal -5%"*) brightnessctl -q set 5%-; show_brightness ;;
|
||||
*"External +5%"*)
|
||||
if [[ "$WM" == "hyprland" ]]; then
|
||||
current=$(get_brightness_external)
|
||||
new=$((current + 5)); [[ $new -gt 100 ]] && new=100
|
||||
val=$(echo "scale=2; $new/100" | bc)
|
||||
busctl --user set-property rs.wl-gammarelay /outputs/DP_3 rs.wl.gammarelay Brightness d "$val" 2>/dev/null
|
||||
else
|
||||
current=$(get_brightness_external)
|
||||
new=$((current + 5)); [[ $new -gt 100 ]] && new=100
|
||||
val=$(echo "scale=2; $new/100" | bc)
|
||||
xrandr --output DP-3 --brightness "$val" 2>/dev/null
|
||||
fi
|
||||
show_brightness ;;
|
||||
*"External -5%"*)
|
||||
if [[ "$WM" == "hyprland" ]]; then
|
||||
current=$(get_brightness_external)
|
||||
new=$((current - 5)); [[ $new -lt 5 ]] && new=5
|
||||
val=$(echo "scale=2; $new/100" | bc)
|
||||
busctl --user set-property rs.wl-gammarelay /outputs/DP_3 rs.wl.gammarelay Brightness d "$val" 2>/dev/null
|
||||
else
|
||||
current=$(get_brightness_external)
|
||||
new=$((current - 5)); [[ $new -lt 5 ]] && new=5
|
||||
val=$(echo "scale=2; $new/100" | bc)
|
||||
xrandr --output DP-3 --brightness "$val" 2>/dev/null
|
||||
fi
|
||||
show_brightness ;;
|
||||
*"Back"*) show_main ;;
|
||||
*) show_brightness ;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_power_profile() {
|
||||
case "$SELECTION" in
|
||||
# systemd path watcher auto-applies power-tuning on profile change
|
||||
*"Performance"*) powerprofilesctl set performance; show_power_profile ;;
|
||||
*"Balanced"*) powerprofilesctl set balanced; show_power_profile ;;
|
||||
*"Power Saver"*) powerprofilesctl set power-saver; show_power_profile ;;
|
||||
*"Edit Tuning"*) coproc (zeditor "$HOME/NixOS/ryzenadj.nix" &); exit 0 ;;
|
||||
*"Back"*) show_main ;;
|
||||
*) show_power_profile ;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_power() {
|
||||
case "$SELECTION" in
|
||||
*"Shutdown"*) systemctl poweroff ;;
|
||||
*"Reboot"*) systemctl reboot ;;
|
||||
*"Logout"*)
|
||||
if [[ "$WM" == "hyprland" ]]; then
|
||||
hyprctl dispatch exit
|
||||
else
|
||||
pkill -x dwm
|
||||
fi
|
||||
;;
|
||||
*"Lock"*)
|
||||
if [[ "$WM" == "hyprland" ]]; then
|
||||
hyprlock & exit 0
|
||||
else
|
||||
slock & exit 0
|
||||
fi
|
||||
;;
|
||||
*"Back"*) show_main ;;
|
||||
*) show_power ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# Main Entry Point
|
||||
# ==============================================================================
|
||||
|
||||
if [[ -z "$SELECTION" ]]; then
|
||||
case "$STATE" in
|
||||
sound) show_sound ;;
|
||||
output) show_output ;;
|
||||
input) show_input ;;
|
||||
brightness) show_brightness ;;
|
||||
profile) show_power_profile ;;
|
||||
power) show_power ;;
|
||||
*) show_main ;;
|
||||
esac
|
||||
else
|
||||
case "$STATE" in
|
||||
sound) handle_sound ;;
|
||||
output) handle_output ;;
|
||||
input) handle_input ;;
|
||||
brightness) handle_brightness ;;
|
||||
profile) handle_power_profile ;;
|
||||
power) handle_power ;;
|
||||
*) handle_main ;;
|
||||
esac
|
||||
fi
|
||||
86
Rofi/Scripts/websearch.sh
Normal file
86
Rofi/Scripts/websearch.sh
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin/env bash
|
||||
# Rofi web search - with DuckDuckGo result preview
|
||||
# Supports both Hyprland (Wayland) and dwm (X11)
|
||||
|
||||
# ==============================================================================
|
||||
# Environment Detection
|
||||
# ==============================================================================
|
||||
if [[ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; then
|
||||
WM="hyprland"
|
||||
else
|
||||
WM="dwm"
|
||||
fi
|
||||
|
||||
switch_to_browser() {
|
||||
if [[ "$WM" == "hyprland" ]]; then
|
||||
hyprctl dispatch workspace 70
|
||||
else
|
||||
# Focus primary monitor first if not on mobile (single monitor) profile
|
||||
[[ $(autorandr --detected) != "mobile" ]] && echo "mon-prim" > /tmp/dwm.fifo
|
||||
echo "browser" > /tmp/dwm.fifo
|
||||
fi
|
||||
}
|
||||
|
||||
# Step 1: Query input (no list)
|
||||
QUERY=$(echo "" | rofi -dmenu -p "Search : " -l 0)
|
||||
[ -z "$QUERY" ] && exit 0
|
||||
|
||||
# Check if input looks like a URL - open directly
|
||||
if echo "$QUERY" | grep -qE '\.(com|org|net|io|dev|co|me|gov|edu|app|xyz|info)(/|$)'; then
|
||||
# Add https:// if no protocol specified
|
||||
[[ "$QUERY" =~ ^https?:// ]] || QUERY="https://$QUERY"
|
||||
switch_to_browser
|
||||
xdg-open "$QUERY"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Step 2: Engine selection (DuckDuckGo first)
|
||||
ENGINE=$(printf " DuckDuckGo\n Google\n MyNixOS\n Nixpkgs\n NerdFonts" | rofi -dmenu -p "Engine : " -no-custom -l 5)
|
||||
[ -z "$ENGINE" ] && exit 0
|
||||
|
||||
# Remove icon prefix
|
||||
ENGINE="${ENGINE#* }"
|
||||
|
||||
ENCODED=$(echo "$QUERY" | sed 's/ /%20/g; s/&/%26/g; s/?/%3F/g; s/=/%3D/g')
|
||||
|
||||
case "$ENGINE" in
|
||||
"DuckDuckGo")
|
||||
# Fetch top 5 results using ddgr
|
||||
RESULTS=$(ddgr --json -n 5 "$QUERY" 2>/dev/null | jq -r '.[] | "\(.title)\t\(.url)"')
|
||||
|
||||
if [ -z "$RESULTS" ]; then
|
||||
# Fallback to direct search if no results
|
||||
switch_to_browser
|
||||
xdg-open "https://duckduckgo.com/?q=$ENCODED"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Show results in rofi (title only)
|
||||
TITLES=$(echo "$RESULTS" | cut -f1)
|
||||
SELECTED=$(echo "$TITLES" | rofi -dmenu -p "Results : " -l 5)
|
||||
[ -z "$SELECTED" ] && exit 0
|
||||
|
||||
# Get URL for selected title
|
||||
URL=$(echo "$RESULTS" | grep "^$SELECTED " | cut -f2)
|
||||
if [ -n "$URL" ]; then
|
||||
switch_to_browser
|
||||
xdg-open "$URL"
|
||||
fi
|
||||
;;
|
||||
"Google")
|
||||
switch_to_browser
|
||||
xdg-open "https://www.google.com/search?q=$ENCODED"
|
||||
;;
|
||||
"MyNixOS")
|
||||
switch_to_browser
|
||||
xdg-open "https://mynixos.com/search?q=$ENCODED"
|
||||
;;
|
||||
"Nixpkgs")
|
||||
switch_to_browser
|
||||
xdg-open "https://search.nixos.org/packages?query=$ENCODED"
|
||||
;;
|
||||
"NerdFonts")
|
||||
switch_to_browser
|
||||
xdg-open "https://www.nerdfonts.com/cheat-sheet?q=$ENCODED"
|
||||
;;
|
||||
esac
|
||||
162
Rofi/rofi.nix
Normal file
162
Rofi/rofi.nix
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
# Rofi configuration and scripts
|
||||
# Works with both Hyprland (Wayland) and dwm (X11)
|
||||
{
|
||||
pkgs-stable,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
scriptsDir = ./Scripts;
|
||||
|
||||
# Detect if we're in Wayland or X11 based on session type
|
||||
# This is evaluated at build time, so we need runtime detection in scripts
|
||||
isWayland = config.wayland.windowManager.hyprland.enable or false;
|
||||
|
||||
# Terminal varies by environment
|
||||
terminal = if isWayland then "foot" else "st";
|
||||
in
|
||||
{
|
||||
# Wayland-specific packages (only when using Hyprland)
|
||||
home.packages =
|
||||
with pkgs-stable;
|
||||
[
|
||||
rofi-bluetooth
|
||||
rofi-network-manager
|
||||
ddgr
|
||||
brightnessctl
|
||||
bc
|
||||
sqlite
|
||||
|
||||
# Custom scripts (environment-aware)
|
||||
(writeShellScriptBin "rofi-websearch" (builtins.readFile "${scriptsDir}/websearch.sh"))
|
||||
(writeShellScriptBin "rofi-max30" (builtins.readFile "${scriptsDir}/max30.sh"))
|
||||
(writeShellScriptBin "rofi-system" (builtins.readFile "${scriptsDir}/system.sh"))
|
||||
(writeShellScriptBin "rofi-favorites" (builtins.readFile "${scriptsDir}/favorites.sh"))
|
||||
]
|
||||
++ (
|
||||
if isWayland then
|
||||
[
|
||||
wl-gammarelay-rs
|
||||
]
|
||||
else
|
||||
[
|
||||
]
|
||||
);
|
||||
|
||||
# Start wl-gammarelay-rs on Hyprland
|
||||
wayland.windowManager.hyprland.settings = lib.mkIf isWayland {
|
||||
exec-once = [ "wl-gammarelay-rs" ];
|
||||
};
|
||||
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
package = pkgs-stable.rofi;
|
||||
terminal = terminal;
|
||||
|
||||
plugins = with pkgs-stable; [
|
||||
rofi-calc
|
||||
rofi-emoji
|
||||
];
|
||||
|
||||
modes = [
|
||||
"system:rofi-system"
|
||||
"favorites:rofi-favorites"
|
||||
"drun"
|
||||
"calc"
|
||||
"emoji"
|
||||
"max30:rofi-max30"
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
show-icons = true;
|
||||
display-system = "";
|
||||
display-favorites = "";
|
||||
display-drun = "";
|
||||
display-calc = "";
|
||||
display-emoji = "";
|
||||
display-max30 = "";
|
||||
drun-display-format = "{name}";
|
||||
scroll-method = 0;
|
||||
disable-history = false;
|
||||
sidebar-mode = false;
|
||||
sort = true;
|
||||
sorting-method = "fzf";
|
||||
matching = "fuzzy";
|
||||
|
||||
kb-primary-paste = "Control+V,Shift+Insert";
|
||||
kb-secondary-paste = "Control+v,Insert";
|
||||
kb-secondary-copy = "Control+c";
|
||||
kb-clear-line = "Control+w";
|
||||
kb-move-front = "Control+a";
|
||||
kb-move-end = "Control+e";
|
||||
kb-move-word-back = "Alt+b,Control+Left";
|
||||
kb-move-word-forward = "Alt+f,Control+Right";
|
||||
kb-move-char-back = "Control+b";
|
||||
kb-move-char-forward = "Control+f";
|
||||
kb-remove-word-back = "Control+Alt+h,Control+BackSpace";
|
||||
kb-remove-word-forward = "Control+Alt+d";
|
||||
kb-remove-char-forward = "Delete,Control+d";
|
||||
kb-remove-char-back = "BackSpace,Shift+BackSpace,Control+h";
|
||||
kb-remove-to-eol = "";
|
||||
kb-remove-to-sol = "Control+u";
|
||||
kb-accept-entry = "Return,KP_Enter";
|
||||
kb-accept-custom = "Control+Return";
|
||||
kb-accept-custom-alt = "Control+Shift+Return";
|
||||
kb-accept-alt = "Shift+Return";
|
||||
kb-delete-entry = "Shift+Delete";
|
||||
kb-mode-next = "Right";
|
||||
kb-mode-previous = "Left";
|
||||
kb-mode-complete = "Control+l";
|
||||
kb-row-left = "Control+Page_Up";
|
||||
kb-row-right = "Control+Page_Down";
|
||||
kb-row-up = "Up";
|
||||
kb-row-down = "Down";
|
||||
kb-row-tab = "";
|
||||
kb-element-next = "Tab";
|
||||
kb-element-prev = "ISO_Left_Tab";
|
||||
kb-page-prev = "Page_Up";
|
||||
kb-page-next = "Page_Down";
|
||||
kb-row-first = "Home,KP_Home";
|
||||
kb-row-last = "End,KP_End";
|
||||
kb-row-select = "Control+space";
|
||||
kb-screenshot = "Alt+S";
|
||||
kb-ellipsize = "Alt+period";
|
||||
kb-toggle-case-sensitivity = "grave,dead_grave";
|
||||
kb-toggle-sort = "Alt+grave";
|
||||
kb-cancel = "Escape";
|
||||
};
|
||||
|
||||
theme =
|
||||
let
|
||||
mkLiteral = value: {
|
||||
_type = "literal";
|
||||
value = value;
|
||||
};
|
||||
in
|
||||
{
|
||||
window = {
|
||||
width = mkLiteral "300px";
|
||||
location = mkLiteral "center";
|
||||
# border-radius = mkLiteral "12px";
|
||||
border = mkLiteral "2px solid";
|
||||
border-color = mkLiteral "@border-color";
|
||||
};
|
||||
listview = {
|
||||
lines = 8;
|
||||
fixed-height = false;
|
||||
};
|
||||
element = {
|
||||
padding = mkLiteral "8px";
|
||||
# border-radius = mkLiteral "6px";
|
||||
};
|
||||
# "element selected" = {
|
||||
# border-radius = mkLiteral "6px";
|
||||
# };
|
||||
inputbar = {
|
||||
padding = mkLiteral "8px";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue