mirror of
https://gitlab.com/Zaney/zaneyos.git
synced 2024-11-22 14:43:08 +01:00
Add back proper web-search script
This commit is contained in:
parent
23b54c9142
commit
d876484ffd
@ -21,5 +21,6 @@ in {
|
||||
(import ./../scripts/themechange.nix { inherit pkgs; inherit flakeDir; })
|
||||
(import ./../scripts/theme-selector.nix { inherit pkgs; })
|
||||
(import ./../scripts/nvidia-offload.nix { inherit pkgs; })
|
||||
(import ./../scripts/web-search.nix { inherit pkgs; })
|
||||
];
|
||||
}
|
||||
|
43
config/scripts/web-search.nix
Normal file
43
config/scripts/web-search.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellScriptBin "web-search" ''
|
||||
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="
|
||||
)
|
||||
|
||||
# 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 )
|
||||
|
||||
if [[ -n "$platform" ]]; then
|
||||
query=$( (echo ) | ${pkgs.rofi-wayland}/bin/rofi -dmenu )
|
||||
|
||||
if [[ -n "$query" ]]; then
|
||||
url=''${URLS[$platform]}$query
|
||||
xdg-open "$url"
|
||||
else
|
||||
exit
|
||||
fi
|
||||
else
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
exit 0
|
||||
''
|
@ -19,4 +19,21 @@
|
||||
|
||||
security.polkit.enable = true;
|
||||
|
||||
security.polkit.extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (
|
||||
subject.isInGroup("users")
|
||||
&& (
|
||||
action.id == "org.freedesktop.login1.reboot" ||
|
||||
action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
|
||||
action.id == "org.freedesktop.login1.power-off" ||
|
||||
action.id == "org.freedesktop.login1.power-off-multiple-sessions"
|
||||
)
|
||||
)
|
||||
{
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
})
|
||||
'';
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user