mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
update laptop configuration
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
# - ## 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
|
||||
{pkgs, ...}: let
|
||||
increments = "5";
|
||||
|
||||
brightness-change = pkgs.writeShellScriptBin "brightness-change" ''
|
||||
@@ -28,7 +25,6 @@ let
|
||||
brightness-down = pkgs.writeShellScriptBin "brightness-down" ''
|
||||
brightness-change down ${increments}
|
||||
'';
|
||||
|
||||
in {
|
||||
home.packages = [
|
||||
pkgs.brightnessctl
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
#- - `caffeine-status` - Check if hypridle is running. (0/1)
|
||||
#- - `caffeine-status-icon` - Check if hypridle is running. (icon)
|
||||
#- - `caffeine` - Toggle hypridle.
|
||||
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
{pkgs, ...}: let
|
||||
caffeine-status = pkgs.writeShellScriptBin "caffeine-status" ''
|
||||
[[ $(pidof "hypridle") ]] && echo "0" || echo "1"
|
||||
'';
|
||||
@@ -29,5 +27,4 @@ let
|
||||
|
||||
notif "caffeine" "$title" "$description"
|
||||
'';
|
||||
|
||||
in { home.packages = [ caffeine-status caffeine caffeine-status-icon ]; }
|
||||
in {home.packages = [caffeine-status caffeine caffeine-status-icon];}
|
||||
|
||||
@@ -11,6 +11,5 @@
|
||||
./nerdfont-fzf
|
||||
./notification
|
||||
./system
|
||||
./openvpn
|
||||
];
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#- - `hyprfocus-on` - Enable hyprfocus.
|
||||
#- - `hyprfocus-off` - Disable hyprfocus.
|
||||
#- - `hyprfocus-toggle` - Toggle hyprfocus.
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
hyprfocus-on = pkgs.writeShellScriptBin "hyprfocus-on"
|
||||
{pkgs, ...}: let
|
||||
hyprfocus-on =
|
||||
pkgs.writeShellScriptBin "hyprfocus-on"
|
||||
# bash
|
||||
''
|
||||
hyprpanel-hide
|
||||
@@ -27,7 +27,8 @@ let
|
||||
echo "1" > /tmp/hyprfocus
|
||||
'';
|
||||
|
||||
hyprfocus-off = pkgs.writeShellScriptBin "hyprfocus-off"
|
||||
hyprfocus-off =
|
||||
pkgs.writeShellScriptBin "hyprfocus-off"
|
||||
# bash
|
||||
''
|
||||
hyprctl reload
|
||||
@@ -35,8 +36,9 @@ let
|
||||
rm /tmp/hyprfocus
|
||||
'';
|
||||
|
||||
hyprfocus-toggle = pkgs.writeShellScriptBin "hyprfocus-toggle"
|
||||
# bash
|
||||
hyprfocus-toggle =
|
||||
pkgs.writeShellScriptBin "hyprfocus-toggle"
|
||||
# bash
|
||||
''
|
||||
if [ -f /tmp/hyprfocus ]; then
|
||||
hyprfocus-off
|
||||
@@ -44,4 +46,4 @@ let
|
||||
hyprfocus-on
|
||||
fi
|
||||
'';
|
||||
in { home.packages = [ hyprfocus-on hyprfocus-off hyprfocus-toggle ]; }
|
||||
in {home.packages = [hyprfocus-on hyprfocus-off hyprfocus-toggle];}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# - ## 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
|
||||
{pkgs, ...}: let
|
||||
hyprpanel-toggle = pkgs.writeShellScriptBin "hyprpanel-toggle" ''
|
||||
hyprpanel toggleWindow bar-0
|
||||
hyprpanel toggleWindow bar-1
|
||||
@@ -42,6 +41,5 @@ let
|
||||
hyprctl dispatch exec hyprpanel
|
||||
'';
|
||||
in {
|
||||
home.packages =
|
||||
[ hyprpanel-toggle hyprpanel-reload hyprpanel-hide hyprpanel-show ];
|
||||
home.packages = [hyprpanel-toggle hyprpanel-reload hyprpanel-hide hyprpanel-show];
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
#- 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
|
||||
{
|
||||
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}')
|
||||
@@ -17,12 +20,11 @@ let
|
||||
${pkgs.wl-clipboard}/bin/wl-copy "$fzf_result"
|
||||
'';
|
||||
in {
|
||||
home.packages = [ nerdfont-fzf ];
|
||||
home.packages = [nerdfont-fzf];
|
||||
|
||||
xdg.configFile."nerdfont_glyphnames.json" = {
|
||||
source = pkgs.fetchurl {
|
||||
url =
|
||||
"https://raw.githubusercontent.com/ryanoasis/nerd-fonts/384b1825ea0037b0314f7f9c660a80c1ecdb219a/glyphnames.json";
|
||||
url = "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/384b1825ea0037b0314f7f9c660a80c1ecdb219a/glyphnames.json";
|
||||
hash = "sha256-Ps0dyFcMs51RMTthBOVSOf/lafPV/53JxuNSKlmZ7cc=";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#- - `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
|
||||
{pkgs, ...}: let
|
||||
value = "4500"; # Default value for night-shift temperature
|
||||
|
||||
night-shift-on = pkgs.writeShellScriptBin "night-shift-on"
|
||||
# bash
|
||||
night-shift-on =
|
||||
pkgs.writeShellScriptBin "night-shift-on"
|
||||
# bash
|
||||
''
|
||||
${pkgs.hyprsunset}/bin/hyprsunset -t ${value} &
|
||||
title=" Night-Shift Activated"
|
||||
@@ -22,8 +22,9 @@ let
|
||||
notif "night-shift" "$title" "$description"
|
||||
'';
|
||||
|
||||
night-shift-off = pkgs.writeShellScriptBin "night-shift-off"
|
||||
# bash
|
||||
night-shift-off =
|
||||
pkgs.writeShellScriptBin "night-shift-off"
|
||||
# bash
|
||||
''
|
||||
pkill hyprsunset
|
||||
title=" Night-Shift Deactivated"
|
||||
@@ -32,7 +33,8 @@ let
|
||||
notif "night-shift" "$title" "$description"
|
||||
'';
|
||||
|
||||
night-shift = pkgs.writeShellScriptBin "night-shift"
|
||||
night-shift =
|
||||
pkgs.writeShellScriptBin "night-shift"
|
||||
# bash
|
||||
''
|
||||
if pidof "hyprsunset"; then
|
||||
@@ -42,7 +44,8 @@ let
|
||||
fi
|
||||
'';
|
||||
|
||||
night-shift-status = pkgs.writeShellScriptBin "night-shift-status"
|
||||
night-shift-status =
|
||||
pkgs.writeShellScriptBin "night-shift-status"
|
||||
# bash
|
||||
''
|
||||
if pidof "hyprsunset"; then
|
||||
@@ -52,7 +55,8 @@ let
|
||||
fi
|
||||
'';
|
||||
|
||||
night-shift-status-icon = pkgs.writeShellScriptBin "night-shift-status-icon"
|
||||
night-shift-status-icon =
|
||||
pkgs.writeShellScriptBin "night-shift-status-icon"
|
||||
# bash
|
||||
''
|
||||
if pidof "hyprsunset"; then
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
# - ## 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, upgrade, update, collect garbage, clean boot menu, etc.
|
||||
#-
|
||||
#- Nixy is a simple script that I use to manage my NixOS system. It's a simple script that provides a menu to rebuild, upgrade, 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, inputs, ... }:
|
||||
let
|
||||
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
configDirectory = config.var.configDirectory;
|
||||
hostname = config.var.hostname;
|
||||
|
||||
nixy = pkgs.writeShellScriptBin "nixy"
|
||||
nixy =
|
||||
pkgs.writeShellScriptBin "nixy"
|
||||
# bash
|
||||
''
|
||||
function exec() {
|
||||
@@ -68,5 +71,4 @@ let
|
||||
echo "Unknown argument"
|
||||
fi
|
||||
'';
|
||||
|
||||
in { home.packages = [ nixy ]; }
|
||||
in {home.packages = [nixy];}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
notif = pkgs.writeShellScriptBin "notif" # bash
|
||||
# - ## 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"]
|
||||
@@ -22,5 +28,4 @@ let
|
||||
"$description" \
|
||||
> "$NOTIF_FOLDER/$sender_id"
|
||||
'';
|
||||
|
||||
in { home.packages = [ pkgs.libnotify notif ]; }
|
||||
in {home.packages = [pkgs.libnotify notif];}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# - ## OpenVPN
|
||||
#-
|
||||
#- OpenVPN allows you to connect/disconnect quickly to a openVPN server
|
||||
#-
|
||||
#- - `openvpn-up` turn on the vpn
|
||||
#- - `openvpn-down` turn down the vpn
|
||||
#- - `openvpn-toggle` toggle the vpn
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
id = "home"; # ID of the connection
|
||||
password-file = "/home/hadi/.config/vpn-password";
|
||||
|
||||
openvpn-up = pkgs.writeShellScriptBin "openvpn-up"
|
||||
# bash
|
||||
''
|
||||
nmcli con up id ${id} passwd-file ${password-file}
|
||||
notif "VPN" "VPN activated" "The OpenVPN connection to ${id} has been activated"
|
||||
'';
|
||||
|
||||
openvpn-down = pkgs.writeShellScriptBin "openvpn-down"
|
||||
# bash
|
||||
''
|
||||
nmcli con down id ${id}
|
||||
notif "VPN" "VPN deactivated" "The OpenVPN connection to ${id} has been deactivated"
|
||||
'';
|
||||
|
||||
openvpn-toggle = pkgs.writeShellScriptBin "openvpn-toggle"
|
||||
# bash
|
||||
''
|
||||
if nmcli connection show --active | grep -q "${id}"; then
|
||||
openvpn-down
|
||||
else
|
||||
openvpn-up
|
||||
fi
|
||||
'';
|
||||
|
||||
in { home.packages = [ openvpn-up openvpn-down openvpn-toggle ]; }
|
||||
@@ -3,8 +3,7 @@
|
||||
#- 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
|
||||
{pkgs, ...}: let
|
||||
screenshot = pkgs.writeShellScriptBin "screenshot" ''
|
||||
if [[ $2 == "swappy" ]];then
|
||||
folder="/tmp"
|
||||
@@ -29,6 +28,5 @@ let
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
home.packages =
|
||||
[ pkgs.hyprshot screenshot pkgs.slurp pkgs.grim pkgs.grimblast ];
|
||||
home.packages = [pkgs.hyprshot screenshot pkgs.slurp pkgs.grim pkgs.grimblast];
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
#- - `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
|
||||
{pkgs, ...}: let
|
||||
increments = "5";
|
||||
|
||||
sound-change = pkgs.writeShellScriptBin "sound-change" ''
|
||||
@@ -34,5 +32,5 @@ let
|
||||
sound-change mute
|
||||
'';
|
||||
in {
|
||||
home.packages = [ sound-change sound-up sound-down sound-toggle sound-set ];
|
||||
home.packages = [sound-change sound-up sound-down sound-toggle sound-set];
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
# - ## System
|
||||
#-
|
||||
#-
|
||||
#- Usefull quick scripts
|
||||
#-
|
||||
#- - `menu` - Open wofi with drun mode. (wofi)
|
||||
#- - `powermenu` - Open power dropdown menu. (wofi)
|
||||
#- - `quickmenu` - Open a dropdown menu with shortcuts and scripts. (wofi)
|
||||
#- - `lock` - Lock the screen. (hyprlock)
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
menu = pkgs.writeShellScriptBin "menu"
|
||||
{pkgs, ...}: let
|
||||
menu =
|
||||
pkgs.writeShellScriptBin "menu"
|
||||
# bash
|
||||
''
|
||||
if pgrep wofi; then
|
||||
@@ -29,7 +28,8 @@ let
|
||||
fi
|
||||
'';
|
||||
|
||||
powermenu = pkgs.writeShellScriptBin "powermenu"
|
||||
powermenu =
|
||||
pkgs.writeShellScriptBin "powermenu"
|
||||
# bash
|
||||
''
|
||||
if pgrep wofi; then
|
||||
@@ -69,7 +69,8 @@ let
|
||||
fi
|
||||
'';
|
||||
|
||||
quickmenu = pkgs.writeShellScriptBin "quickmenu"
|
||||
quickmenu =
|
||||
pkgs.writeShellScriptBin "quickmenu"
|
||||
# bash
|
||||
''
|
||||
if pgrep wofi; then
|
||||
@@ -109,10 +110,10 @@ let
|
||||
fi
|
||||
'';
|
||||
|
||||
lock = pkgs.writeShellScriptBin "lock"
|
||||
lock =
|
||||
pkgs.writeShellScriptBin "lock"
|
||||
# bash
|
||||
''
|
||||
${pkgs.hyprlock}/bin/hyprlock
|
||||
'';
|
||||
|
||||
in { home.packages = [ menu powermenu lock quickmenu ]; }
|
||||
in {home.packages = [menu powermenu lock quickmenu];}
|
||||
|
||||
Reference in New Issue
Block a user