Improve rofi scripts and the theme

This commit is contained in:
Tyler Kelley 2025-02-17 14:23:57 -06:00
parent 30a279ebe9
commit c2e17fbf15
6 changed files with 105 additions and 68 deletions

View File

@ -1,11 +0,0 @@
{ ... }:
{
home.file.".config/rofi/config-emoji.rasi".text = ''
@import "~/.config/rofi/config-long.rasi"
entry {
width: 45%;
placeholder: "🔎 Search Emoji's 👀";
}
'';
}

View File

@ -1,12 +1,49 @@
{...}: { {...}: {
home.file.".config/rofi/config-long.rasi".text = '' home.file.".config/rofi/config-long.rasi".text = ''
@import "~/.config/rofi/config.rasi" @import "~/.config/rofi/config.rasi"
entry { window {
placeholder: "🔎 Search "; width: 600px;
border-radius: 20px;
} }
listview { mainbox {
columns: 1; orientation: vertical;
lines: 10; children: [ "inputbar", "listbox" ];
}
inputbar {
padding: 75px 40px;
background-color: transparent;
background-image: url("~/Pictures/Wallpapers/Rainnight.jpg", width);
text-color: @foreground;
children: [ "textbox-prompt-colon", "entry" ];
}
textbox-prompt-colon {
padding: 12px 20px;
border-radius: 100%;
background-color: @bg-alt;
text-color: @foreground;
}
entry {
expand: true;
padding: 12px 16px;
border-radius: 100%;
background-color: @bg-alt;
text-color: @foreground;
}
button {
padding: 12px;
border-radius: 100%;
}
element {
spacing: 10px;
padding: 12px;
border-radius: 100%;
}
textbox {
padding: 12px;
border-radius: 100%;
}
error-message {
border-radius: 0px;
} }
''; '';
} }

View File

@ -0,0 +1,10 @@
{...}: {
home.file.".config/rofi/config-wide.rasi".text = ''
@import "~/.config/rofi/config-long.rasi"
window {
width: 100%;
location: south;
anchor: south;
}
'';
}

View File

@ -1,9 +1,7 @@
{ ... }: {...}: {
{
imports = [ imports = [
./config-emoji.nix
./config-long.nix ./config-long.nix
./config-wide.nix
./rofi.nix ./rofi.nix
]; ];
} }

View File

@ -1,18 +1,22 @@
{ pkgs }: {pkgs}:
pkgs.writeShellScriptBin "emopicker9000" '' pkgs.writeShellScriptBin "emopicker9000" ''
# Get user selection via wofi from emoji file. # check if rofi is already running
chosen=$(cat $HOME/.config/.emoji | ${pkgs.rofi-wayland}/bin/rofi -i -dmenu -config ~/.config/rofi/config-emoji.rasi | awk '{print $1}') if pidof rofi > /dev/null; then
pkill rofi
fi
# Exit if none chosen. # Get user selection via wofi from emoji file.
[ -z "$chosen" ] && exit chosen=$(cat $HOME/.config/.emoji | ${pkgs.rofi-wayland}/bin/rofi -i -dmenu -config ~/.config/rofi/config-long.rasi | awk '{print $1}')
# If you run this command with an argument, it will automatically insert the # Exit if none chosen.
# character. Otherwise, show a message that the emoji has been copied. [ -z "$chosen" ] && exit
if [ -n "$1" ]; then
${pkgs.ydotool}/bin/ydotool type "$chosen" # If you run this command with an argument, it will automatically insert the
else # character. Otherwise, show a message that the emoji has been copied.
printf "$chosen" | ${pkgs.wl-clipboard}/bin/wl-copy if [ -n "$1" ]; then
${pkgs.libnotify}/bin/notify-send "'$chosen' copied to clipboard." & ${pkgs.ydotool}/bin/ydotool type "$chosen"
fi else
printf "$chosen" | ${pkgs.wl-clipboard}/bin/wl-copy
${pkgs.libnotify}/bin/notify-send "'$chosen' copied to clipboard." &
fi
'' ''

View File

@ -1,43 +1,42 @@
{ pkgs }: {pkgs}:
pkgs.writeShellScriptBin "web-search" '' pkgs.writeShellScriptBin "web-search" ''
declare -A URLS declare -A URLS
URLS=( URLS=(
["🌎 Search"]="https://search.brave.com/search?q=" ["🌎 Search"]="https://search.brave.com/search?q="
[" Unstable Packages"]="https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=" [" Unstable Packages"]="https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query="
["🎞 YouTube"]="https://www.youtube.com/results?search_query=" ["🎞 YouTube"]="https://www.youtube.com/results?search_query="
["🦥 Arch Wiki"]="https://wiki.archlinux.org/title/" ["🦥 Arch Wiki"]="https://wiki.archlinux.org/title/"
["🐃 Gentoo Wiki"]="https://wiki.gentoo.org/index.php?title=" ["🐃 Gentoo Wiki"]="https://wiki.gentoo.org/index.php?title="
) )
# List for rofi # List for rofi
gen_list() { gen_list() {
for i in "''${!URLS[@]}" for i in "''${!URLS[@]}"
do do
echo "$i" echo "$i"
done done
} }
main() { main() {
# Pass the list to rofi # Pass the list to rofi
platform=$( (gen_list) | ${pkgs.rofi-wayland}/bin/rofi -dmenu ) platform=$( (gen_list) | ${pkgs.rofi-wayland}/bin/rofi -dmenu -config ~/.config/rofi/config-long.rasi )
if [[ -n "$platform" ]]; then if [[ -n "$platform" ]]; then
query=$( (echo ) | ${pkgs.rofi-wayland}/bin/rofi -dmenu ) query=$( (echo ) | ${pkgs.rofi-wayland}/bin/rofi -dmenu -config ~/.config/rofi/config-long.rasi )
if [[ -n "$query" ]]; then if [[ -n "$query" ]]; then
url=''${URLS[$platform]}$query url=''${URLS[$platform]}$query
xdg-open "$url" xdg-open "$url"
else else
exit exit
fi fi
else else
exit exit
fi fi
} }
main main
exit 0 exit 0
'' ''