Declared hyprland scripts
This commit is contained in:
@@ -2,5 +2,8 @@
|
||||
imports = [
|
||||
../programs/fuzzel.nix
|
||||
../programs/kitty.nix
|
||||
../scripts/powermenu.nix
|
||||
../scripts/screenshot.nix
|
||||
../scripts/themeswitch.nix
|
||||
];
|
||||
}
|
||||
|
||||
35
hyprland/scripts/powermenu.nix
Normal file
35
hyprland/scripts/powermenu.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
{
|
||||
home.file.".config/hypr/hyprland/scripts/powermenu.sh".text = ''
|
||||
#!/bin/bash
|
||||
|
||||
INPUT="echo -e Lock\nLogout\nReboot\nShutdown\nSuspend"
|
||||
|
||||
# Execute the input command and get the selected choice
|
||||
SELECTED=$($INPUT | fuzzel -d)
|
||||
|
||||
case "$SELECTED" in
|
||||
"Lock")
|
||||
hyprlock
|
||||
;;
|
||||
"Logout")
|
||||
hyprctl dispatch exit
|
||||
;;
|
||||
"Reboot")
|
||||
reboot
|
||||
;;
|
||||
"Shutdown")
|
||||
shutdown now
|
||||
;;
|
||||
"Suspend")
|
||||
systemctl suspend
|
||||
;;
|
||||
*)
|
||||
echo "Invalid selection"
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
|
||||
home.file.".config/hypr/hyprland/scripts/powermenu.sh".force = true;
|
||||
}
|
||||
28
hyprland/scripts/screenshot.nix
Normal file
28
hyprland/scripts/screenshot.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
{
|
||||
home.file.".config/hypr/hyprland/scripts/screenshot.sh".text = ''
|
||||
#!/bin/bash
|
||||
|
||||
INPUT="echo -e Screen\nWindow\nRegion"
|
||||
|
||||
SELECTED=$($INPUT | fuzzel -d)
|
||||
|
||||
case "$SELECTED" in
|
||||
"Screen")
|
||||
hyprshot -m output
|
||||
;;
|
||||
"Window")
|
||||
hyprshot -m window
|
||||
;;
|
||||
"Region")
|
||||
hyprshot -m region
|
||||
;;
|
||||
*)
|
||||
echo "Invalid selection"
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
|
||||
home.file.".config/hypr/hyprland/scripts/screenshot.sh".force = true;
|
||||
}
|
||||
130
hyprland/scripts/themeswitch.nix
Normal file
130
hyprland/scripts/themeswitch.nix
Normal file
@@ -0,0 +1,130 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
{
|
||||
home.file.".config/hypr/hyprland/scripts/themeswitch.sh".text = ''
|
||||
#!/bin/bash
|
||||
|
||||
OPTION_DARK="Gruvbox Dark"
|
||||
OPTION_LIGHT="Gruvbox Light"
|
||||
|
||||
EMACS_LIGHT_THEME="doom-gruvbox-light"
|
||||
EMACS_DARK_THEME="doom-gruvbox"
|
||||
|
||||
INPUT="echo -e $OPTION_DARK\n$OPTION_LIGHT"
|
||||
|
||||
# Execute the input command and get the selected choice
|
||||
SELECTED=$($INPUT | fuzzel -d)
|
||||
|
||||
declare -A TARGETS=(
|
||||
["kitty"]="$XDG_CONFIG_HOME/kitty/kitty.conf"
|
||||
["waybar"]="$XDG_CONFIG_HOME/waybar/style.css"
|
||||
["fuzzel"]="$XDG_CONFIG_HOME/fuzzel/fuzzel.ini"
|
||||
["swaync"]="$XDG_CONFIG_HOME/swaync/style.css"
|
||||
["swayosd"]="$XDG_CONFIG_HOME/swayosd/style.css"
|
||||
)
|
||||
|
||||
make_link() {
|
||||
ln -sf $1 $2
|
||||
}
|
||||
|
||||
switch_emacs() {
|
||||
if [[ "$1" == "$OPTION_LIGHT" ]]; then
|
||||
emacsclient -e "(load-theme '$EMACS_LIGHT_THEME)"
|
||||
elif [[ "$1" == "$OPTION_DARK" ]]; then
|
||||
emacsclient -e "(load-theme '$EMACS_DARK_THEME)"
|
||||
else
|
||||
echo "Invalid parameter $1"
|
||||
fi
|
||||
}
|
||||
|
||||
switch_fuzzel() {
|
||||
if [[ "$1" == "$OPTION_LIGHT" ]]; then
|
||||
make_link $HOME/.config/fuzzel/fuzzel_light.ini $HOME/.config/fuzzel/fuzzel.ini
|
||||
elif [[ "$1" == "$OPTION_DARK" ]]; then
|
||||
make_link $HOME/.config/fuzzel/fuzzel_dark.ini $HOME/.config/fuzzel/fuzzel.ini
|
||||
else
|
||||
echo "Invalid parameter $1"
|
||||
fi
|
||||
}
|
||||
|
||||
switch_swayosd() {
|
||||
if [[ "$1" == "$OPTION_LIGHT" ]]; then
|
||||
make_link $HOME/.config/swayosd/style_light.css $HOME/.config/swayosd/style.css
|
||||
elif [[ "$1" == "$OPTION_DARK" ]]; then
|
||||
make_link $HOME/.config/swayosd/style_dark.css $HOME/.config/swayosd/style.css
|
||||
else
|
||||
echo "Invalid parameter $1"
|
||||
fi
|
||||
}
|
||||
|
||||
switch_swaync() {
|
||||
if [[ "$1" == "$OPTION_LIGHT" ]]; then
|
||||
make_link $HOME/.config/swaync/style_light.css $HOME/.config/swaync/style.css
|
||||
elif [[ "$1" == "$OPTION_DARK" ]]; then
|
||||
make_link $HOME/.config/swaync/style_dark.css $HOME/.config/swaync/style.css
|
||||
else
|
||||
echo "Invalid parameter $1"
|
||||
fi
|
||||
}
|
||||
|
||||
switch_kitty() {
|
||||
if [[ "$1" == "$OPTION_LIGHT" ]]; then
|
||||
make_link $HOME/.config/kitty/kitty_light.conf $HOME/.config/kitty/kitty.conf
|
||||
elif [[ "$1" == "$OPTION_DARK" ]]; then
|
||||
make_link $HOME/.config/kitty/kitty_dark.conf $HOME/.config/kitty/kitty.conf
|
||||
else
|
||||
echo "Invalid parameter $1"
|
||||
fi
|
||||
}
|
||||
|
||||
switch_waybar() {
|
||||
if [[ "$1" == "$OPTION_LIGHT" ]]; then
|
||||
make_link $HOME/.config/waybar/style_light.css $HOME/.config/waybar/style.css
|
||||
elif [[ "$1" == "$OPTION_DARK" ]]; then
|
||||
make_link $HOME/.config/waybar/style_dark.css $HOME/.config/waybar/style.css
|
||||
else
|
||||
echo "Invalid parameter $1"
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
#kitty
|
||||
pgrep -x kitty >/dev/null && kill -SIGUSR1 $(pgrep -x kitty)
|
||||
|
||||
#waybar
|
||||
pgrep -x waybar >/dev/null && kill -SIGUSR2 $(pgrep -x waybar)
|
||||
|
||||
#swaync
|
||||
pgrep -x swaync >/dev/null && swaync-client --reload-css
|
||||
|
||||
#swayosd
|
||||
killall swayosd-server
|
||||
swayosd-server &
|
||||
}
|
||||
|
||||
case "$SELECTED" in
|
||||
$OPTION_DARK)
|
||||
dconf write /org/gnome/desktop/interface/color-scheme \'prefer-dark\'
|
||||
awww img /home/typo/.config/backgrounds/gruvbox/wp11058332.png -t grow --transition-duration 1 --transition-fps 60 --transition-pos 0.$((1 + $RANDOM % 9)),0.$((1 + $RANDOM % 9))
|
||||
;;
|
||||
$OPTION_LIGHT)
|
||||
dconf write /org/gnome/desktop/interface/color-scheme \'prefer-light\'
|
||||
awww img /home/typo/.config/backgrounds/gruvbox/chinese-hills.jpg -t grow --transition-duration 1 --transition-fps 60 --transition-pos 0.$((1 + $RANDOM % 9)),0.$((1 + $RANDOM % 9))
|
||||
|
||||
;;
|
||||
*)
|
||||
echo "Invalid selection"
|
||||
;;
|
||||
esac
|
||||
|
||||
switch_kitty "$SELECTED"
|
||||
switch_waybar "$SELECTED"
|
||||
switch_swaync "$SELECTED"
|
||||
switch_swayosd "$SELECTED"
|
||||
switch_fuzzel "$SELECTED"
|
||||
switch_emacs "$SELECTED"
|
||||
update
|
||||
'';
|
||||
|
||||
home.file.".config/hypr/hyprland/scripts/themeswitch.sh".force = true;
|
||||
}
|
||||
Reference in New Issue
Block a user