Restructure repo
This commit is contained in:
36
modules/home-manager/scripts/brightness.nix
Normal file
36
modules/home-manager/scripts/brightness.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
# - ## Brightness
|
||||
#-
|
||||
#- This module provides a set of scripts to control the brightness of the screen.
|
||||
#-
|
||||
#- - `brightness-up` increases the brightness by 5%.
|
||||
#- - `brightness-down` decreases the brightness by 5%.
|
||||
#- - `brightness-set [value]` sets the brightness to the given value.
|
||||
#- - `brightness-change [up|down] [value]` increases or decreases the brightness by the given value.
|
||||
{pkgs, ...}: let
|
||||
increments = "5";
|
||||
|
||||
brightness-change = pkgs.writeShellScriptBin "brightness-change" ''
|
||||
[[ $1 == "up" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ''${2-${increments}}%+
|
||||
[[ $1 == "down" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ''${2-${increments}}%-
|
||||
'';
|
||||
|
||||
brightness-set = pkgs.writeShellScriptBin "brightness-set" ''
|
||||
${pkgs.brightnessctl}/bin/brightnessctl set ''${1-100}%
|
||||
'';
|
||||
|
||||
brightness-up = pkgs.writeShellScriptBin "brightness-up" ''
|
||||
brightness-change up ${increments}
|
||||
'';
|
||||
|
||||
brightness-down = pkgs.writeShellScriptBin "brightness-down" ''
|
||||
brightness-change down ${increments}
|
||||
'';
|
||||
in {
|
||||
home.packages = [
|
||||
pkgs.brightnessctl
|
||||
brightness-change
|
||||
brightness-up
|
||||
brightness-down
|
||||
brightness-set
|
||||
];
|
||||
}
|
||||
26
modules/home-manager/scripts/caffeine.nix
Normal file
26
modules/home-manager/scripts/caffeine.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
# - ## Caffeine
|
||||
#-
|
||||
#- Caffeine is a simple script that toggles hypridle (disable suspend & screenlock).
|
||||
#-
|
||||
#- - `caffeine-status` - Check if hypridle is running. (0/1)
|
||||
#- - `caffeine-status-icon` - Check if hypridle is running. (icon)
|
||||
#- - `caffeine` - Toggle hypridle.
|
||||
{pkgs, ...}: let
|
||||
caffeine-status = pkgs.writeShellScriptBin "caffeine-status" ''
|
||||
[[ $(pidof "hypridle") ]] && echo "0" || echo "1"
|
||||
'';
|
||||
|
||||
caffeine-status-icon = pkgs.writeShellScriptBin "caffeine-status-icon" ''
|
||||
[[ $(pidof "hypridle") ]] && echo "" || echo ""
|
||||
'';
|
||||
|
||||
caffeine = pkgs.writeShellScriptBin "caffeine" ''
|
||||
if [[ $(pidof "hypridle") ]]; then
|
||||
systemctl --user stop hypridle.service
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Caffeine On" --custom-icon="emblem-default"
|
||||
else
|
||||
systemctl --user start hypridle.service
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Caffeine Off" --custom-icon="emblem-default"
|
||||
fi
|
||||
'';
|
||||
in {home.packages = [caffeine-status caffeine caffeine-status-icon];}
|
||||
15
modules/home-manager/scripts/default.nix
Normal file
15
modules/home-manager/scripts/default.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
imports = [
|
||||
./nixy.nix
|
||||
./sounds.nix
|
||||
./brightness.nix
|
||||
./caffeine.nix
|
||||
./hyprpanel.nix
|
||||
./hyprfocus.nix
|
||||
./night-shift.nix
|
||||
./screenshot.nix
|
||||
./nerdfont-fzf.nix
|
||||
./notification.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
52
modules/home-manager/scripts/hyprfocus.nix
Normal file
52
modules/home-manager/scripts/hyprfocus.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
# - ## Hyprfocus
|
||||
#-
|
||||
#- A simple script to toggle focus on few windows in Hyprland.
|
||||
#- (disable gaps, border, shadow, opacity, etc.)
|
||||
#-
|
||||
#- - `hyprfocus-on` - Enable hyprfocus.
|
||||
#- - `hyprfocus-off` - Disable hyprfocus.
|
||||
#- - `hyprfocus-toggle` - Toggle hyprfocus.
|
||||
{pkgs, ...}: let
|
||||
hyprfocus-on =
|
||||
pkgs.writeShellScriptBin "hyprfocus-on"
|
||||
# bash
|
||||
''
|
||||
hyprpanel-hide
|
||||
|
||||
hyprctl --batch "\
|
||||
keyword animations:enabled 0;\
|
||||
keyword decoration:shadow:enabled 0;\
|
||||
keyword decoration:blur:enabled 0;\
|
||||
keyword general:gaps_in 0;\
|
||||
keyword general:gaps_out 0;\
|
||||
keyword general:border_size 1;\
|
||||
keyword decoration:rounding 0;\
|
||||
keyword decoration:inactive_opacity 1;\
|
||||
keyword decoration:active_opacity 1"
|
||||
|
||||
echo "1" > /tmp/hyprfocus
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Hyprfocus On" --custom-icon="emblem-default"
|
||||
'';
|
||||
|
||||
hyprfocus-off =
|
||||
pkgs.writeShellScriptBin "hyprfocus-off"
|
||||
# bash
|
||||
''
|
||||
hyprctl reload
|
||||
hyprpanel-show
|
||||
rm /tmp/hyprfocus
|
||||
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Hyprfocus Off" --custom-icon="emblem-default"
|
||||
'';
|
||||
|
||||
hyprfocus-toggle =
|
||||
pkgs.writeShellScriptBin "hyprfocus-toggle"
|
||||
# bash
|
||||
''
|
||||
if [ -f /tmp/hyprfocus ]; then
|
||||
hyprfocus-off
|
||||
else
|
||||
hyprfocus-on
|
||||
fi
|
||||
'';
|
||||
in {home.packages = [hyprfocus-on hyprfocus-off hyprfocus-toggle];}
|
||||
45
modules/home-manager/scripts/hyprpanel.nix
Normal file
45
modules/home-manager/scripts/hyprpanel.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
# - ## Hyprpanel
|
||||
#-
|
||||
#- Quick scripts to toggle, reload, hide & show hyprpanel.
|
||||
#-
|
||||
#- - `hyprpanel-toggle` - Toggle hyprpanel (hide/show).
|
||||
#- - `hyprpanel-show` - Show hyprpanel.
|
||||
#- - `hyprpanel-hide` - Hide hyprpanel.
|
||||
#- - `hyprpanel-reload` - Reload hyprpanel.
|
||||
{pkgs, ...}: let
|
||||
hyprpanel-toggle = pkgs.writeShellScriptBin "hyprpanel-toggle" ''
|
||||
hyprpanel toggleWindow bar-0
|
||||
hyprpanel toggleWindow bar-1
|
||||
hyprpanel toggleWindow bar-2
|
||||
hyprpanel toggleWindow bar-3
|
||||
'';
|
||||
|
||||
hyprpanel-hide = pkgs.writeShellScriptBin "hyprpanel-hide" ''
|
||||
status=$(hyprpanel isWindowVisible bar-0)
|
||||
if [[ $status == "true" ]]; then
|
||||
hyprpanel toggleWindow bar-0
|
||||
fi
|
||||
status=$(hyprpanel isWindowVisible bar-1)
|
||||
if [[ $status == "true" ]]; then
|
||||
hyprpanel toggleWindow bar-1
|
||||
fi
|
||||
'';
|
||||
|
||||
hyprpanel-show = pkgs.writeShellScriptBin "hyprpanel-show" ''
|
||||
status=$(hyprpanel isWindowVisible bar-0)
|
||||
if [[ $status == "false" ]]; then
|
||||
hyprpanel toggleWindow bar-0
|
||||
fi
|
||||
status=$(hyprpanel isWindowVisible bar-1)
|
||||
if [[ $status == "false" ]]; then
|
||||
hyprpanel toggleWindow bar-1
|
||||
fi
|
||||
'';
|
||||
|
||||
hyprpanel-reload = pkgs.writeShellScriptBin "hyprpanel-reload" ''
|
||||
[ $(pgrep "hyprpanel") ] && pkill hyprpanel
|
||||
hyprctl dispatch exec hyprpanel
|
||||
'';
|
||||
in {
|
||||
home.packages = [hyprpanel-toggle hyprpanel-reload hyprpanel-hide hyprpanel-show];
|
||||
}
|
||||
31
modules/home-manager/scripts/nerdfont-fzf.nix
Normal file
31
modules/home-manager/scripts/nerdfont-fzf.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
# - ## Nerdfont FZF
|
||||
#-
|
||||
#- This module provides a script to search for Nerd Fonts icons using fzf.
|
||||
#-
|
||||
#- - `nerdfont-fzf` - Search for Nerd Fonts icons using fzf.
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
nerdfont-fzf = pkgs.writeShellScriptBin "nerdfont-fzf" ''
|
||||
icons=$(${pkgs.jq}/bin/jq -r 'to_entries[] | "\(.key):\(.value.char)"' "/home/${config.var.username}/.config/nerdfont_glyphnames.json" | awk -F: '{print "\033[95m "$2" \033[0m "$1}')
|
||||
fzf_result=$(echo "$icons" | ${pkgs.fzf}/bin/fzf --ansi --border none | awk '{print $1}')
|
||||
if [ -z "$fzf_result" ]; then
|
||||
echo "No icon selected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Copied to clipboard: $fzf_result"
|
||||
${pkgs.wl-clipboard}/bin/wl-copy "$fzf_result"
|
||||
'';
|
||||
in {
|
||||
home.packages = [nerdfont-fzf];
|
||||
|
||||
xdg.configFile."nerdfont_glyphnames.json" = {
|
||||
source = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/384b1825ea0037b0314f7f9c660a80c1ecdb219a/glyphnames.json";
|
||||
hash = "sha256-Ps0dyFcMs51RMTthBOVSOf/lafPV/53JxuNSKlmZ7cc=";
|
||||
};
|
||||
};
|
||||
}
|
||||
71
modules/home-manager/scripts/night-shift.nix
Normal file
71
modules/home-manager/scripts/night-shift.nix
Normal file
@@ -0,0 +1,71 @@
|
||||
# - ## Night-Shift
|
||||
#-
|
||||
#- Night-Shift is a feature that reduces the amount of blue light emitted by your screen, which can help reduce eye strain and improve sleep quality. This module provides a set of scripts to control Night-Shift on your system.
|
||||
#- It use hyprsunset to control the screen temperature.
|
||||
#-
|
||||
#- - `night-shift-on` activates Night-Shift.
|
||||
#- - `night-shift-off` deactivates Night-Shift.
|
||||
#- - `night-shift` toggles Night-Shift.
|
||||
#- - `night-shift-status` checks if Night-Shift is active. (0/1)
|
||||
#- - `night-shift-status-icon` checks if Night-Shift is active. (icon)
|
||||
{pkgs, ...}: let
|
||||
value = "4500"; # Default value for night-shift temperature
|
||||
|
||||
night-shift-on =
|
||||
pkgs.writeShellScriptBin "night-shift-on"
|
||||
# bash
|
||||
''
|
||||
${pkgs.hyprsunset}/bin/hyprsunset -t ${value} &
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Night-Shift On" --custom-icon="emblem-default"
|
||||
'';
|
||||
|
||||
night-shift-off =
|
||||
pkgs.writeShellScriptBin "night-shift-off"
|
||||
# bash
|
||||
''
|
||||
pkill hyprsunset
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Night-Shift Off" --custom-icon="emblem-default"
|
||||
'';
|
||||
|
||||
night-shift =
|
||||
pkgs.writeShellScriptBin "night-shift"
|
||||
# bash
|
||||
''
|
||||
if pidof "hyprsunset"; then
|
||||
night-shift-off
|
||||
else
|
||||
night-shift-on
|
||||
fi
|
||||
'';
|
||||
|
||||
night-shift-status =
|
||||
pkgs.writeShellScriptBin "night-shift-status"
|
||||
# bash
|
||||
''
|
||||
if pidof "hyprsunset"; then
|
||||
echo "1"
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
'';
|
||||
|
||||
night-shift-status-icon =
|
||||
pkgs.writeShellScriptBin "night-shift-status-icon"
|
||||
# bash
|
||||
''
|
||||
if pidof "hyprsunset"; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
home.packages = [
|
||||
pkgs.hyprsunset
|
||||
night-shift-on
|
||||
night-shift-off
|
||||
night-shift
|
||||
night-shift-status
|
||||
night-shift-status-icon
|
||||
];
|
||||
}
|
||||
77
modules/home-manager/scripts/nixy.nix
Normal file
77
modules/home-manager/scripts/nixy.nix
Normal file
@@ -0,0 +1,77 @@
|
||||
# - ## Nixy
|
||||
#-
|
||||
#- Nixy is a simple script that I use to manage my NixOS system. It's a simple script that provides a menu to rebuild, test, update, collect garbage, clean boot menu, etc.
|
||||
#-
|
||||
#- - `nixy` - UI wizard to manage the system.
|
||||
#- - `nixy rebuild` - Rebuild the system.
|
||||
#- - `nixy ...` - ... see the script for more commands.
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
configDirectory = config.var.configDirectory;
|
||||
|
||||
nixy = pkgs.writeShellScriptBin "nixy"
|
||||
# bash
|
||||
''
|
||||
function exec() {
|
||||
$@
|
||||
}
|
||||
|
||||
function ui(){
|
||||
DEFAULT_ICON=""
|
||||
|
||||
# "icon;name;command"[]
|
||||
apps=(
|
||||
";Rebuild;nixy rebuild"
|
||||
";Test;nixy test"
|
||||
";Update;nixy update"
|
||||
";Collect Garbage;nixy gc"
|
||||
";Clean Boot Menu;nixy cb"
|
||||
";List generation;nixy listgen"
|
||||
";Hyprland Keybindings;nvim ${configDirectory}/docs/KEYBINDINGS-HYPRLAND.md"
|
||||
";Wallpapers;zen https://github.com/anotherhadi/nixy-wallpapers"
|
||||
)
|
||||
|
||||
# Apply default icons if empty:
|
||||
for i in "''${!apps[@]}"; do
|
||||
apps[i]=$(echo "''${apps[i]}" | sed 's/^;/'$DEFAULT_ICON';/')
|
||||
done
|
||||
|
||||
fzf_result=$(printf "%s\n" "''${apps[@]}" | awk -F ';' '{print $1" "$2}' | fzf)
|
||||
[[ -z $fzf_result ]] && exit 0
|
||||
fzf_result=''${fzf_result/ /;}
|
||||
line=$(printf "%s\n" "''${apps[@]}" | grep "$fzf_result")
|
||||
command=$(echo "$line" | sed 's/^[^;]*;//;s/^[^;]*;//')
|
||||
|
||||
exec "$command"
|
||||
exit $?
|
||||
}
|
||||
|
||||
[[ $1 == "" ]] && ui
|
||||
|
||||
if [[ $1 == "rebuild" ]];then
|
||||
cd ${configDirectory} && git add . && sudo nixos-rebuild switch --flake
|
||||
elif [[ $1 == "test" ]];then
|
||||
cd ${configDirectory} && git add . && sudo nixos-rebuild test --flake
|
||||
elif [[ $1 == "update" ]];then
|
||||
cd ${configDirectory} && nix flake update
|
||||
elif [[ $1 == "gc" ]];then
|
||||
echo "Starting Nix garbage collection..."
|
||||
cd ${configDirectory} && \
|
||||
echo "Cleaning up system garbage..." && \
|
||||
sudo nix-collect-garbage -d && \
|
||||
echo "Cleaning up user garbage..." && \
|
||||
nix-collect-garbage -d && \
|
||||
echo "Collecting garbage from Nix store..." && \
|
||||
nix-store --gc && \
|
||||
echo "Optimizing Nix store..." && \
|
||||
nix-store --optimise
|
||||
echo "Nix garbage collection complete."
|
||||
elif [[ $1 == "cb" ]];then
|
||||
sudo /run/current-system/bin/switch-to-configuration boot
|
||||
elif [[ $1 == "listgen" ]];then
|
||||
sudo nix-env -p /nix/var/nix/profiles/system --list-generations
|
||||
else
|
||||
echo "Unknown argument"
|
||||
fi
|
||||
'';
|
||||
in { home.packages = [ nixy ]; }
|
||||
31
modules/home-manager/scripts/notification.nix
Normal file
31
modules/home-manager/scripts/notification.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
# - ## Notif
|
||||
#-
|
||||
# This file provides a script to send custom notifications using `notify-send`.
|
||||
#-
|
||||
#- - `notif {id} {title} {description}` - Sends a notification
|
||||
{pkgs, ...}: let
|
||||
notif =
|
||||
pkgs.writeShellScriptBin "notif" # bash
|
||||
|
||||
''
|
||||
# Shell script to send custom notifications
|
||||
# Usage: notif "sender_id" "message" ["description"]
|
||||
NOTIF_FOLDER="/tmp/notif"
|
||||
sender_id=$1 # To overwrite existing notifications
|
||||
title=$2
|
||||
description=$3
|
||||
|
||||
[[ -d "$NOTIF_FOLDER" ]] || mkdir $NOTIF_FOLDER
|
||||
[[ -f "$NOTIF_FOLDER/$sender_id" ]] || (echo "0" > "$NOTIF_FOLDER/$sender_id")
|
||||
|
||||
old_notification_id=$(cat "$NOTIF_FOLDER/$sender_id")
|
||||
[[ -z "$old_notification_id" ]] && old_notification_id=0
|
||||
|
||||
${pkgs.libnotify}/bin/notify-send \
|
||||
--replace-id="$old_notification_id" --print-id \
|
||||
--app-name="$sender_id" \
|
||||
"$title" \
|
||||
"$description" \
|
||||
> "$NOTIF_FOLDER/$sender_id"
|
||||
'';
|
||||
in {home.packages = [pkgs.libnotify notif];}
|
||||
32
modules/home-manager/scripts/screenshot.nix
Normal file
32
modules/home-manager/scripts/screenshot.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
# - ## Screenshot
|
||||
#-
|
||||
#- This module provides a script to take screenshots using `grimblast` and `swappy`.
|
||||
#-
|
||||
#- - `screenshot [region|window|monitor] [swappy]` - Take a screenshot of the region, window, or monitor. Optionally, use `swappy` to copy the screenshot to the clipboard.
|
||||
{pkgs, ...}: let
|
||||
screenshot = pkgs.writeShellScriptBin "screenshot" ''
|
||||
if [[ $2 == "swappy" ]];then
|
||||
folder="/tmp"
|
||||
else
|
||||
folder="$HOME/Pictures"
|
||||
fi
|
||||
filename="$(date +%Y-%m-%d_%H:%M:%S).png"
|
||||
|
||||
if [[ $1 == "window" ]];then
|
||||
mode="active"
|
||||
elif [[ $1 == "region" ]];then
|
||||
mode="area"
|
||||
elif [[ $1 == "monitor" ]];then
|
||||
mode="output"
|
||||
fi
|
||||
|
||||
${pkgs.grimblast}/bin/grimblast --notify --freeze copysave $mode "$folder/$filename" || exit 1
|
||||
|
||||
if [[ $2 == "swappy" ]];then
|
||||
${pkgs.swappy}/bin/swappy -f "$folder/$filename" -o "$HOME/Pictures/$filename"
|
||||
exit 0
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
home.packages = [ screenshot pkgs.grim pkgs.grimblast ];
|
||||
}
|
||||
36
modules/home-manager/scripts/sounds.nix
Normal file
36
modules/home-manager/scripts/sounds.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
# - ## Sound
|
||||
#-
|
||||
#- This module provides a set of scripts to control the volume of the default audio sink using `wpctl`.
|
||||
#-
|
||||
#- - `sound-up` increases the volume by 5%.
|
||||
#- - `sound-down` decreases the volume by 5%.
|
||||
#- - `sound-set [value]` sets the volume to the given value.
|
||||
#- - `sound-toggle` toggles the mute state of the default audio sink.
|
||||
{pkgs, ...}: let
|
||||
increments = "5";
|
||||
|
||||
sound-change = pkgs.writeShellScriptBin "sound-change" ''
|
||||
[[ $1 == "mute" ]] && wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||
[[ $1 == "up" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ ''${2-${increments}}%+
|
||||
[[ $1 == "down" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ ''${2-${increments}}%-
|
||||
[[ $1 == "set" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ ''${2-100}%
|
||||
'';
|
||||
|
||||
sound-up = pkgs.writeShellScriptBin "sound-up" ''
|
||||
sound-change up ${increments}
|
||||
'';
|
||||
|
||||
sound-set = pkgs.writeShellScriptBin "sound-set" ''
|
||||
sound-change set ''${1-100}
|
||||
'';
|
||||
|
||||
sound-down = pkgs.writeShellScriptBin "sound-down" ''
|
||||
sound-change down ${increments}
|
||||
'';
|
||||
|
||||
sound-toggle = pkgs.writeShellScriptBin "sound-toggle" ''
|
||||
sound-change mute
|
||||
'';
|
||||
in {
|
||||
home.packages = [sound-change sound-up sound-down sound-toggle sound-set];
|
||||
}
|
||||
69
modules/home-manager/scripts/system.nix
Normal file
69
modules/home-manager/scripts/system.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
# - ## System
|
||||
#-
|
||||
#- Usefull quick scripts
|
||||
#-
|
||||
#- - `lock` - Lock the screen. (hyprlock)
|
||||
#- - `powermode-toggle` - Toggle between performance and balanced power mode. (powerprofilesctl)
|
||||
{pkgs, ...}: let
|
||||
menu =
|
||||
pkgs.writeShellScriptBin "menu"
|
||||
# bash
|
||||
''
|
||||
if pgrep wofi; then
|
||||
pkill wofi
|
||||
else
|
||||
wofi -p "Apps" --show drun
|
||||
fi
|
||||
'';
|
||||
powermenu =
|
||||
pkgs.writeShellScriptBin "powermenu"
|
||||
# bash
|
||||
''
|
||||
if pgrep wofi >/dev/null; then
|
||||
pkill wofi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
declare -A actions=(
|
||||
[" Lock"]="hyprlock"
|
||||
[" Logout"]="hyprctl dispatch exit"
|
||||
[" Suspend"]="systemctl suspend"
|
||||
[" Reboot"]="systemctl reboot"
|
||||
[" Shutdown"]="systemctl poweroff"
|
||||
)
|
||||
|
||||
selected_option=$(
|
||||
printf '%s\n' "''${!actions[@]}" | wofi -p "Powermenu" --dmenu
|
||||
)
|
||||
|
||||
if [[ -n "$selected_option" ]]; then
|
||||
|
||||
action_command=''${actions["''$selected_option"]}
|
||||
|
||||
if [[ -n "$action_command" ]]; then
|
||||
eval "$action_command"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
lock =
|
||||
pkgs.writeShellScriptBin "lock"
|
||||
# bash
|
||||
''
|
||||
${pkgs.hyprlock}/bin/hyprlock
|
||||
'';
|
||||
|
||||
powermode-toggle =
|
||||
pkgs.writeShellScriptBin "powermode-toggle"
|
||||
# bash
|
||||
''
|
||||
current_profile=$(powerprofilesctl get)
|
||||
if [ "$current_profile" = "performance" ]; then
|
||||
powerprofilesctl set balanced
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Powermode set to balanced" --custom-icon="emblem-default"
|
||||
else
|
||||
powerprofilesctl set performance
|
||||
${pkgs.swayosd}/bin/swayosd-client --custom-message="Powermode set to performance" --custom-icon="emblem-default"
|
||||
fi
|
||||
'';
|
||||
in {home.packages = [lock powermode-toggle menu powermenu];}
|
||||
Reference in New Issue
Block a user