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 = ''
@import "~/.config/rofi/config.rasi"
entry {
placeholder: "🔎 Search ";
window {
width: 600px;
border-radius: 20px;
}
listview {
columns: 1;
lines: 10;
mainbox {
orientation: vertical;
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 = [
./config-emoji.nix
./config-long.nix
./config-wide.nix
./rofi.nix
];
}

View File

@ -1,18 +1,22 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "emopicker9000" ''
# Get user selection via wofi from emoji file.
chosen=$(cat $HOME/.config/.emoji | ${pkgs.rofi-wayland}/bin/rofi -i -dmenu -config ~/.config/rofi/config-emoji.rasi | awk '{print $1}')
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
# Exit if none chosen.
[ -z "$chosen" ] && exit
# Get user selection via wofi from emoji file.
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
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
${pkgs.ydotool}/bin/ydotool type "$chosen"
else
printf "$chosen" | ${pkgs.wl-clipboard}/bin/wl-copy
${pkgs.libnotify}/bin/notify-send "'$chosen' copied to clipboard." &
fi
# Exit if none chosen.
[ -z "$chosen" ] && exit
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
${pkgs.ydotool}/bin/ydotool type "$chosen"
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" ''
declare -A URLS
declare -A URLS
URLS=(
["🌎 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="
["🎞 YouTube"]="https://www.youtube.com/results?search_query="
["🦥 Arch Wiki"]="https://wiki.archlinux.org/title/"
["🐃 Gentoo Wiki"]="https://wiki.gentoo.org/index.php?title="
)
URLS=(
["🌎 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="
["🎞 YouTube"]="https://www.youtube.com/results?search_query="
["🦥 Arch Wiki"]="https://wiki.archlinux.org/title/"
["🐃 Gentoo Wiki"]="https://wiki.gentoo.org/index.php?title="
)
# List for rofi
gen_list() {
for i in "''${!URLS[@]}"
do
echo "$i"
done
}
# List for rofi
gen_list() {
for i in "''${!URLS[@]}"
do
echo "$i"
done
}
main() {
# Pass the list to rofi
platform=$( (gen_list) | ${pkgs.rofi-wayland}/bin/rofi -dmenu )
main() {
# Pass the list to rofi
platform=$( (gen_list) | ${pkgs.rofi-wayland}/bin/rofi -dmenu -config ~/.config/rofi/config-long.rasi )
if [[ -n "$platform" ]]; then
query=$( (echo ) | ${pkgs.rofi-wayland}/bin/rofi -dmenu )
if [[ -n "$platform" ]]; then
query=$( (echo ) | ${pkgs.rofi-wayland}/bin/rofi -dmenu -config ~/.config/rofi/config-long.rasi )
if [[ -n "$query" ]]; then
url=''${URLS[$platform]}$query
xdg-open "$url"
else
exit
fi
else
exit
fi
}
if [[ -n "$query" ]]; then
url=''${URLS[$platform]}$query
xdg-open "$url"
else
exit
fi
else
exit
fi
}
main
main
exit 0
exit 0
''