tidying
This commit is contained in:
parent
de571443d9
commit
6f898b505e
37 changed files with 7 additions and 1074 deletions
|
|
@ -19,7 +19,7 @@
|
||||||
./neofetch.nix
|
./neofetch.nix
|
||||||
|
|
||||||
#../sway
|
#../sway
|
||||||
../hyprland
|
../hypr
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
|
|
||||||
../common/themes
|
../common/themes
|
||||||
./scripts
|
../common/scripts
|
||||||
|
|
||||||
./hyprland.nix
|
./hyprland.nix
|
||||||
./hyprpaper.nix
|
./hyprpaper.nix
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
nerdfont-fzf = pkgs.writeShellScriptBin "nerdfont-fzf" ''
|
|
||||||
# Dependencies: jq, fzf, wl-copy, wget
|
|
||||||
icons=$(jq -r 'to_entries[] | "\(.key):\(.value.char)"' "${homedir}/.config/nerdfont_glyphnames.json" | awk -F: '{print "\033[95m "$2" \033[0m "$1}')
|
|
||||||
fzf_result=$(echo "$icons" | 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"
|
|
||||||
echo "Paste it to close the window"
|
|
||||||
${pkgs.wl-clipboard}/bin/wl-copy -o "$fzf_result" # wait for paste before exiting.. not cool
|
|
||||||
'';
|
|
||||||
|
|
||||||
nerdfont-fzf-fetch = pkgs.writeShellScriptBin "nerdfont-fzf-fetch" ''
|
|
||||||
wget "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/glyphnames.json" -O "glyphnames.json" || exit 1
|
|
||||||
jq 'del(.METADATA)' "glyphnames.json"
|
|
||||||
'';
|
|
||||||
|
|
||||||
nerdfont-popup = pkgs.writeShellScriptBin "nerdfont-popup" ''
|
|
||||||
${pkgs.kitty}/bin/kitty --class floating -o font_size=18 zsh -c nerdfont-fzf 2>/dev/null
|
|
||||||
'';
|
|
||||||
|
|
||||||
in {
|
|
||||||
home.packages = with pkgs; [ nerdfont-fzf nerdfont-fzf-fetch nerdfont-popup ];
|
|
||||||
|
|
||||||
xdg.configFile."nerdfont_glyphnames.json" = {
|
|
||||||
source = ../misc/nerdfont_glyphnames.json;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -11,13 +11,10 @@
|
||||||
imports = [
|
imports = [
|
||||||
|
|
||||||
../common/themes
|
../common/themes
|
||||||
./scripts
|
../common/scripts
|
||||||
|
|
||||||
./hyprland.nix
|
|
||||||
./hyprpaper.nix
|
|
||||||
./hyprcursor.nix
|
./hyprcursor.nix
|
||||||
./wlogout.nix
|
./wlogout.nix
|
||||||
./hypridle.nix
|
|
||||||
./hyprlock.nix
|
./hyprlock.nix
|
||||||
./waybar.nix
|
./waybar.nix
|
||||||
./dunst.nix
|
./dunst.nix
|
||||||
|
|
@ -33,10 +30,8 @@
|
||||||
wlsunset
|
wlsunset
|
||||||
wlr-randr
|
wlr-randr
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
hypridle
|
|
||||||
hyprlock
|
hyprlock
|
||||||
hyprshot
|
hyprshot
|
||||||
hyprpaper
|
|
||||||
hyprpicker
|
hyprpicker
|
||||||
hyprcursor
|
hyprcursor
|
||||||
brightnessctl
|
brightnessctl
|
||||||
|
|
@ -48,17 +43,17 @@
|
||||||
gnome.gnome-control-center
|
gnome.gnome-control-center
|
||||||
|
|
||||||
## lib and compat
|
## lib and compat
|
||||||
xwayland
|
|
||||||
wayland-utils
|
|
||||||
wayland-protocols
|
|
||||||
meson
|
meson
|
||||||
qt5ct
|
qt5ct
|
||||||
libva
|
libva
|
||||||
libnotify
|
libnotify
|
||||||
dconf
|
dconf
|
||||||
|
xwayland
|
||||||
|
wayland-utils
|
||||||
|
wayland-protocols
|
||||||
xdg-desktop-portal-gtk
|
xdg-desktop-portal-gtk
|
||||||
xdg-desktop-portal-gnome
|
xdg-desktop-portal-gnome
|
||||||
# xdg-desktop-portal-hyprland
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
{ config, pkgs, ... }: {
|
|
||||||
|
|
||||||
xdg.configFile."hypr/hypridle.conf".text = ''
|
|
||||||
general {
|
|
||||||
ignore_dbus_inhibit = false
|
|
||||||
}
|
|
||||||
|
|
||||||
# Screenlock
|
|
||||||
listener {
|
|
||||||
timeout = 10000
|
|
||||||
on-timeout = ${pkgs.hyprlock}/bin/hyprlock
|
|
||||||
on-resume = ${pkgs.libnotify}/bin/notify-send "Welcome back ${config.home.username}!"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Suspend
|
|
||||||
listener {
|
|
||||||
timeout = 10000
|
|
||||||
on-timeout = systemctl suspend
|
|
||||||
# on-resume = ${pkgs.libnotify}/bin/notify-send "Welcome back to your desktop!"
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
@ -1,240 +0,0 @@
|
||||||
{
|
|
||||||
self,
|
|
||||||
inputs,
|
|
||||||
outputs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
|
||||||
enable = true;
|
|
||||||
xwayland.enable = true;
|
|
||||||
|
|
||||||
plugins = [
|
|
||||||
# inputs.hyprland-plugins.packages."${pkgs.system}".borders-plus-plus
|
|
||||||
# inputs.hyprland-plugins.packages."${pkgs.system}".hyprbars
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
"$mod" = "SUPER";
|
|
||||||
"$shiftMod" = "SUPER_SHIFT";
|
|
||||||
|
|
||||||
exec-once = [
|
|
||||||
"startup"
|
|
||||||
"${pkgs.hypridle}/bin/hypridle"
|
|
||||||
"${pkgs.hyprpaper}/bin/hyprpaper"
|
|
||||||
"${pkgs.kitty}/bin/kitty"
|
|
||||||
"${pkgs.wofi}/bin/wofi"
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bind = [
|
|
||||||
"$shiftMod, RETURN, exec, ${pkgs.wofi}/bin/wofi"
|
|
||||||
"$mod, RETURN, exec, ${pkgs.kitty}/bin/kitty"
|
|
||||||
"$mod, E, exec, ${pkgs.xfce.thunar}/bin/nautilus"
|
|
||||||
"$mod, B, exec, ${pkgs.firefox}/bin/firefox"
|
|
||||||
"$mod, C, exec, ${pkgs.kitty}/bin/kitty --class peaclock peaclock"
|
|
||||||
"$mod, L, exec, ${pkgs.hyprlock}/bin/hyprlock"
|
|
||||||
"$mod, X, exec, powermenu"
|
|
||||||
"$mod, SPACE, exec, menu"
|
|
||||||
# Windows control
|
|
||||||
#"$mod, TAB, layoutmsg, togglesplit"
|
|
||||||
"$mod, A, layoutmsg, swapwithmaster master"
|
|
||||||
"$mod, Z, layoutmsg, cyclenext"
|
|
||||||
"$shiftMod, Z, layoutmsg, rollnext"
|
|
||||||
"$mod, Q, killactive,"
|
|
||||||
"$mod, T, togglefloating,"
|
|
||||||
"$mod, F, fullscreen"
|
|
||||||
"$mod, left, movefocus, l"
|
|
||||||
"$mod, right, movefocus, r"
|
|
||||||
"$mod, up, movefocus, u"
|
|
||||||
"$mod, down, movefocus, d"
|
|
||||||
# Screenshots
|
|
||||||
"$mod, PRINT, exec, screenshot window"
|
|
||||||
", PRINT, exec, screenshot monitor"
|
|
||||||
"$shiftMod, PRINT, exec, screenshot region"
|
|
||||||
"ALT, PRINT, exec, screenshot region swappy"
|
|
||||||
# Night Shift
|
|
||||||
"$mod, F2, exec, night-shift-off"
|
|
||||||
"$mod, F3, exec, night-shift-on"
|
|
||||||
# Sound output
|
|
||||||
"$mod, F5, exec, ${pkgs.kitty}/bin/kitty --class floating fish -c sound-output"
|
|
||||||
"$mod, F6, exec, ${pkgs.kitty}/bin/kitty --class floating fish -c sound-output"
|
|
||||||
"$mod, F7, exec, ${pkgs.kitty}/bin/kitty --class floating fish -c sound-output"
|
|
||||||
] ++ (builtins.concatLists (builtins.genList (i:
|
|
||||||
let ws = i + 1;
|
|
||||||
in [
|
|
||||||
"$mod, code:1${toString i}, workspace, ${toString ws}"
|
|
||||||
"$mod SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}"
|
|
||||||
]) 9));
|
|
||||||
|
|
||||||
bindm = [ "$mod, R, movewindow" "$shiftMod, R, resizewindow" ];
|
|
||||||
|
|
||||||
bindl = [
|
|
||||||
",XF86AudioMute, exec, sound-toggle"
|
|
||||||
",switch:Lid Switch, exec, ${pkgs.hyprlock}/bin/hyprlock"
|
|
||||||
];
|
|
||||||
|
|
||||||
bindle = [
|
|
||||||
", XF86AudioRaiseVolume, exec, sound-up"
|
|
||||||
", XF86AudioLowerVolume, exec, sound-down"
|
|
||||||
", XF86MonBrightnessUp, exec, brightness-up"
|
|
||||||
", XF86MonBrightnessDown, exec, brightness-down"
|
|
||||||
];
|
|
||||||
|
|
||||||
env = [
|
|
||||||
"XDG_SESSION_TYPE,wayland"
|
|
||||||
"XDG_CURRENT_DESKTOP,Hyprland"
|
|
||||||
"XDG_SESSION_TYPE,wayland"
|
|
||||||
"XDG_SESSION_DESKTOP,Hyprland"
|
|
||||||
"QT_AUTO_SCREEN_SCALE_FACTOR,1"
|
|
||||||
"QT_QPA_PLATFORM=wayland,xcb"
|
|
||||||
"QT_QPA_PLATFORMTHEME=qt6ct"
|
|
||||||
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
|
|
||||||
"GTK_THEME,adwaita-dark"
|
|
||||||
# "HYPRCURSOR_THEME,rose-pine"
|
|
||||||
# "HYPRCURSOR_SIZE,16"
|
|
||||||
];
|
|
||||||
|
|
||||||
general = {
|
|
||||||
resize_on_border = true;
|
|
||||||
gaps_in = config.theme.gaps-in;
|
|
||||||
gaps_out = config.theme.gaps-out;
|
|
||||||
border_size = config.theme.border-size;
|
|
||||||
"col.active_border" = "rgba(${config.theme.colors.primary-bg}ff)";
|
|
||||||
"col.inactive_border" = "rgba(00000055)";
|
|
||||||
border_part_of_window = true;
|
|
||||||
layout = "master";
|
|
||||||
};
|
|
||||||
|
|
||||||
#monitor = [
|
|
||||||
#"preferred,auto,2"
|
|
||||||
#];
|
|
||||||
|
|
||||||
decoration = {
|
|
||||||
rounding = config.theme.rounding;
|
|
||||||
drop_shadow = true;
|
|
||||||
shadow_range = 25;
|
|
||||||
shadow_render_power = 3;
|
|
||||||
"col.shadow" = "rgba(00000055)";
|
|
||||||
blur = { enabled = true; };
|
|
||||||
};
|
|
||||||
|
|
||||||
master = {
|
|
||||||
mfact = 0.4;
|
|
||||||
orientation = "center";
|
|
||||||
always_center_master = true;
|
|
||||||
new_is_master = true;
|
|
||||||
new_on_top = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
#dwindle = {
|
|
||||||
#pseudotile = true;
|
|
||||||
#preserve_split = true;
|
|
||||||
#force_split = 2;
|
|
||||||
#};
|
|
||||||
|
|
||||||
gestures = { workspace_swipe = true; };
|
|
||||||
|
|
||||||
misc = {
|
|
||||||
disable_hyprland_logo = false;
|
|
||||||
disable_splash_rendering = true;
|
|
||||||
focus_on_activate = true;
|
|
||||||
new_window_takes_over_fullscreen = 2;
|
|
||||||
};
|
|
||||||
|
|
||||||
input = {
|
|
||||||
kb_layout = "us";
|
|
||||||
|
|
||||||
kb_options = "caps:escape";
|
|
||||||
follow_mouse = 1;
|
|
||||||
sensitivity = 0.1;
|
|
||||||
repeat_delay = 350;
|
|
||||||
repeat_rate = 40;
|
|
||||||
numlock_by_default = true;
|
|
||||||
|
|
||||||
touchpad = {
|
|
||||||
natural_scroll = true;
|
|
||||||
clickfinger_behavior = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
windowrulev2 = [
|
|
||||||
"float, class:peaclock"
|
|
||||||
"move 2% 78%, class:peaclock"
|
|
||||||
"size 30% 20%, class:peaclock"
|
|
||||||
|
|
||||||
"float, class:floating"
|
|
||||||
"size 40% 40%, class:floating"
|
|
||||||
"move 30% 30%, class:floating"
|
|
||||||
|
|
||||||
"float, title:Bluetooth Devices"
|
|
||||||
"move 20% 20%, title:Bluetooth Devices"
|
|
||||||
"size 60% 60%, title:Bluetooth Devices"
|
|
||||||
];
|
|
||||||
|
|
||||||
animations = {
|
|
||||||
enabled = true;
|
|
||||||
bezier = [
|
|
||||||
"linear, 0, 0, 1, 1"
|
|
||||||
"md3_standard, 0.2, 0, 0, 1"
|
|
||||||
"md3_decel, 0.05, 0.7, 0.1, 1"
|
|
||||||
"md3_accel, 0.3, 0, 0.8, 0.15"
|
|
||||||
"overshot, 0.05, 0.9, 0.1, 1.1"
|
|
||||||
"crazyshot, 0.1, 1.5, 0.76, 0.92 "
|
|
||||||
"hyprnostretch, 0.05, 0.9, 0.1, 1.0"
|
|
||||||
"fluent_decel, 0.1, 1, 0, 1"
|
|
||||||
"easeInOutCirc, 0.85, 0, 0.15, 1"
|
|
||||||
"easeOutCirc, 0, 0.55, 0.45, 1"
|
|
||||||
"easeOutExpo, 0.16, 1, 0.3, 1"
|
|
||||||
];
|
|
||||||
|
|
||||||
animation = [
|
|
||||||
"windows, 1, 3, md3_decel, popin 60%"
|
|
||||||
"border, 1, 10, default"
|
|
||||||
"fade, 1, 2.5, md3_decel"
|
|
||||||
"workspaces, 1, 3.5, easeOutExpo, slide"
|
|
||||||
"specialWorkspace, 1, 3, md3_decel, slidevert"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
qt = {
|
|
||||||
enable = true;
|
|
||||||
platformTheme = "gnome";
|
|
||||||
style.name = "adwaita-dark";
|
|
||||||
};
|
|
||||||
|
|
||||||
gtk = {
|
|
||||||
enable = true;
|
|
||||||
# theme = {
|
|
||||||
# package = pkgs.adwaita-dark;
|
|
||||||
# name = "adwaita-dark";
|
|
||||||
# };
|
|
||||||
|
|
||||||
iconTheme = {
|
|
||||||
package = pkgs.flat-remix-icon-theme;
|
|
||||||
name = "Flat-Remix-Grey-Darkest";
|
|
||||||
};
|
|
||||||
|
|
||||||
font = {
|
|
||||||
name = config.theme.font;
|
|
||||||
size = 10;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
home.pointerCursor = {
|
|
||||||
gtk.enable = true;
|
|
||||||
package = pkgs.bibata-cursors;
|
|
||||||
name = "Bibata-Modern-Classic";
|
|
||||||
size = 12;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{ pkgs, config, ... }: {
|
|
||||||
|
|
||||||
xdg.configFile."hypr/hyprpaper.conf".text = ''
|
|
||||||
preload = ~/.config/wallpapers/${config.theme.wallpaper}
|
|
||||||
wallpaper = ~/.config/wallpapers/${config.theme.wallpaper}
|
|
||||||
ipc=true
|
|
||||||
splash=false
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
increments = "5";
|
|
||||||
|
|
||||||
brightness-change = pkgs.writeShellScriptBin "brightness-change" ''
|
|
||||||
sleep 0.05
|
|
||||||
|
|
||||||
[[ $1 == "up" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ${increments}%+
|
|
||||||
[[ $1 == "down" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ${increments}%-
|
|
||||||
|
|
||||||
brightness_level=$(${pkgs.brightnessctl}/bin/brightnessctl get)
|
|
||||||
|
|
||||||
message=" Brightness: $brightness_level%"
|
|
||||||
|
|
||||||
${pkgs.libnotify}/bin/notify-send "$message" \
|
|
||||||
-h int:value:"$brightness_level" \
|
|
||||||
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
|
|
||||||
'';
|
|
||||||
|
|
||||||
brightness-up = pkgs.writeShellScriptBin "brightness-up" ''
|
|
||||||
brightness-change up ${increments}
|
|
||||||
'';
|
|
||||||
|
|
||||||
brightness-down = pkgs.writeShellScriptBin "brightness-down" ''
|
|
||||||
brightness-change down ${increments}
|
|
||||||
'';
|
|
||||||
|
|
||||||
in {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
brightness-change
|
|
||||||
brightness-up
|
|
||||||
brightness-down
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
caffeine-status = pkgs.writeShellScriptBin "caffeine-status" ''
|
|
||||||
[[ -f /tmp/caffeine ]] && echo "active" || echo "inactive"
|
|
||||||
'';
|
|
||||||
|
|
||||||
caffeine = pkgs.writeShellScriptBin "caffeine" ''
|
|
||||||
if [[ -f /tmp/caffeine ]]; then
|
|
||||||
rm /tmp/caffeine
|
|
||||||
${pkgs.hyprland}/bin/hyprctl dispatch exec ${pkgs.hypridle}/bin/hypridle
|
|
||||||
message=" Caffeine Deactivated"
|
|
||||||
else
|
|
||||||
touch /tmp/caffeine
|
|
||||||
pkill hypridle
|
|
||||||
message=" Caffeine Activated"
|
|
||||||
fi
|
|
||||||
${pkgs.libnotify}/bin/notify-send "$message" \
|
|
||||||
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
|
|
||||||
'';
|
|
||||||
|
|
||||||
in { home.packages = with pkgs; [ caffeine-status caffeine ]; }
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./misc.nix
|
|
||||||
./nerdfetch.nix
|
|
||||||
./nixy.nix
|
|
||||||
./sounds.nix
|
|
||||||
./brightness.nix
|
|
||||||
./caffeine.nix
|
|
||||||
./night-shift.nix
|
|
||||||
./screenshot.nix
|
|
||||||
./startup.nix
|
|
||||||
# ./nerdfont_fzf.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
menu = pkgs.writeShellScriptBin "menu" ''
|
|
||||||
if pgrep wofi; then
|
|
||||||
pkill wofi
|
|
||||||
else
|
|
||||||
wofi --show drun
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
|
|
||||||
powermenu = pkgs.writeShellScriptBin "powermenu" ''
|
|
||||||
if pgrep wlogout; then
|
|
||||||
pkill wlogout
|
|
||||||
else
|
|
||||||
${pkgs.wlogout}/bin/wlogout
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
|
|
||||||
wireguard-import = pkgs.writeShellScriptBin "wireguard-import" ''
|
|
||||||
nmcli connection import type wireguard file "$1"
|
|
||||||
'';
|
|
||||||
|
|
||||||
vault = pkgs.writeShellScriptBin "vault" ''
|
|
||||||
nvim $HOME/Nextcloud/obsidian
|
|
||||||
'';
|
|
||||||
|
|
||||||
in { home.packages = with pkgs; [ menu wireguard-import powermenu vault ]; }
|
|
||||||
|
|
@ -1,372 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
nerdfetch = pkgs.writeShellScriptBin "nerdfetch" ''
|
|
||||||
ostype="$(uname)"
|
|
||||||
|
|
||||||
version=8.1.1
|
|
||||||
font=nerd
|
|
||||||
distrotype=none
|
|
||||||
osi=""
|
|
||||||
ki=""
|
|
||||||
ri=""
|
|
||||||
pi=""
|
|
||||||
ui=""
|
|
||||||
ci=""
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
"-p")
|
|
||||||
font=phosphor
|
|
||||||
osi=""
|
|
||||||
ki=""
|
|
||||||
ri=""
|
|
||||||
pi=""
|
|
||||||
ui=""
|
|
||||||
ci=""
|
|
||||||
;;
|
|
||||||
"-c")
|
|
||||||
font=cozette
|
|
||||||
ki="♥"
|
|
||||||
ri=""
|
|
||||||
pi=""
|
|
||||||
ui=""
|
|
||||||
ci=""
|
|
||||||
;;
|
|
||||||
"-e")
|
|
||||||
font=emoji
|
|
||||||
osi="🐧"
|
|
||||||
ki="💓"
|
|
||||||
ri="🐐"
|
|
||||||
pi="📦"
|
|
||||||
ui="☕"
|
|
||||||
ci="🎨"
|
|
||||||
;;
|
|
||||||
"-v")
|
|
||||||
echo "NerdFetch $version"
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
"-h")
|
|
||||||
echo "Flags:
|
|
||||||
-c: Cozette font
|
|
||||||
-p: Phosphor font
|
|
||||||
-e: Emoji font
|
|
||||||
-v: Version"
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if command -v getprop 1>/dev/null; then
|
|
||||||
distrotype=android
|
|
||||||
fi
|
|
||||||
kernel="$(echo $(uname -r) | cut -d'-' -f1-1)"
|
|
||||||
case $ostype in
|
|
||||||
*"Linux"*)
|
|
||||||
if [ $distrotype = android ]; then
|
|
||||||
host="$(hostname)"
|
|
||||||
USER="$(whoami)"
|
|
||||||
os="Android $(getprop ro.build.version.release)"
|
|
||||||
case $font in
|
|
||||||
phosphor) osi="" ;;
|
|
||||||
emoji) osi="🤖" ;;
|
|
||||||
*) osi="" ;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
host="$(cat /proc/sys/kernel/hostname)"
|
|
||||||
. /etc/os-release
|
|
||||||
if [ -f /bedrock/etc/bedrock-release ]; then
|
|
||||||
os="$(brl version)"
|
|
||||||
else
|
|
||||||
os="''${PRETTY_NAME}"
|
|
||||||
if [ $font = nerd ]; then
|
|
||||||
case $(echo $ID | sed 's/ .*//') in
|
|
||||||
debian) osi="" ;;
|
|
||||||
arch) osi="" ;;
|
|
||||||
endeavouros) osi="" ;;
|
|
||||||
fedora) osi="" ;;
|
|
||||||
gentoo) osi="" ;;
|
|
||||||
rhel) osi="" ;;
|
|
||||||
slackware) osi="" ;;
|
|
||||||
void) osi="" ;;
|
|
||||||
alpine) osi="" ;;
|
|
||||||
nixos) osi="" ;;
|
|
||||||
artix) osi="" ;;
|
|
||||||
exherbo) osi="" ;;
|
|
||||||
mageia) osi="" ;;
|
|
||||||
manjaro) osi="" ;;
|
|
||||||
opensuse) osi="" ;;
|
|
||||||
solus) osi="" ;;
|
|
||||||
ubuntu) osi="" ;;
|
|
||||||
mint) osi="" ;;
|
|
||||||
trisquel) osi="" ;;
|
|
||||||
puppy) osi="" ;;
|
|
||||||
coreos) osi="" ;;
|
|
||||||
mx) osi="" ;;
|
|
||||||
vanilla) osi="" ;;
|
|
||||||
pop_os) osi="" ;;
|
|
||||||
raspbian) osi="" ;;
|
|
||||||
deepin) osi="" ;;
|
|
||||||
almalinux) osi="" ;;
|
|
||||||
garuda) osi="" ;;
|
|
||||||
centos) osi="" ;;
|
|
||||||
rocky) osi="" ;;
|
|
||||||
esac
|
|
||||||
elif [ $font = cozette ]; then
|
|
||||||
case $(echo $ID | sed 's/ .*//') in
|
|
||||||
debian) osi="" ;;
|
|
||||||
arch) osi="" ;;
|
|
||||||
fedora) osi="" ;;
|
|
||||||
gentoo) osi="" ;;
|
|
||||||
slackware) osi="" ;;
|
|
||||||
void) osi="" ;;
|
|
||||||
alpine) osi="" ;;
|
|
||||||
nixos) osi="" ;;
|
|
||||||
mageia) osi="" ;;
|
|
||||||
manjaro) osi="" ;;
|
|
||||||
opensuse) osi="" ;;
|
|
||||||
ubuntu) osi="" ;;
|
|
||||||
mint) osi="" ;;
|
|
||||||
coreos) osi="" ;;
|
|
||||||
centos) osi="" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
shell=$(basename "$SHELL")
|
|
||||||
;;
|
|
||||||
*"Darwin"*)
|
|
||||||
host="$(hostname -f | sed -e 's/^[^.]*\.//')"
|
|
||||||
mac_product="$(/usr/libexec/PlistBuddy -c "Print:ProductName" /System/Library/CoreServices/SystemVersion.plist)"
|
|
||||||
mac_version="$(/usr/libexec/PlistBuddy -c "Print:ProductVersion" /System/Library/CoreServices/SystemVersion.plist)"
|
|
||||||
os="''${mac_product} ''${mac_version}"
|
|
||||||
case $font in
|
|
||||||
nerd) osi="" ;;
|
|
||||||
phosphor) osi="" ;;
|
|
||||||
cozette) osi="" ;;
|
|
||||||
emoji) osi="🍎" ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*"FreeBSD"*)
|
|
||||||
host="$(hostname)"
|
|
||||||
distrotype=bsd
|
|
||||||
os="FreeBSD $(freebsd-version | sed 's/-.*//')"
|
|
||||||
case $font in
|
|
||||||
nerd) osi="" ;;
|
|
||||||
phosphor) osi="" ;;
|
|
||||||
cozette) osi="" ;;
|
|
||||||
emoji) osi="😈" ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*"OpenBSD"*)
|
|
||||||
host="$(hostname)"
|
|
||||||
distrotype=bsd
|
|
||||||
os="OpenBSD $(uname -r)"
|
|
||||||
case $font in
|
|
||||||
nerd) osi="" ;;
|
|
||||||
phosphor) osi="" ;;
|
|
||||||
cozette) osi="⌘" ;;
|
|
||||||
emoji) osi="🐡" ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*"NetBSD"*)
|
|
||||||
host="$(hostname)"
|
|
||||||
distrotype=netbsd
|
|
||||||
os="NetBSD $(uname -r)"
|
|
||||||
case $font in
|
|
||||||
nerd) osi="" ;;
|
|
||||||
phosphor) osi="" ;;
|
|
||||||
cozette) osi="" ;;
|
|
||||||
emoji) osi="🚩" ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
os="Unix-like"
|
|
||||||
host="host"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
## PACKAGE MANAGER AND PACKAGES DETECTION
|
|
||||||
|
|
||||||
MANAGER=$(which nix-env pkg flatpak yum zypper dnf rpm dpkg-query brew port pacman xbps-query emerge cave apk kiss pmm /usr/sbin/slackpkg bulge birb yay paru pacstall cpm pmm eopkg getprop 2>/dev/null)
|
|
||||||
manager=$(basename "$MANAGER")
|
|
||||||
if [ $distrotype = netbsd ]; then
|
|
||||||
manager="pkg_info-netbsd"
|
|
||||||
fi
|
|
||||||
case $manager in
|
|
||||||
cpm) packages="$(cpm C)" ;;
|
|
||||||
flatpak) packages="$(flatpak list --app | wc -l)" ;;
|
|
||||||
brew) packages="$(printf '%s\n' "$(brew --cellar)/"* | wc -l)" ;;
|
|
||||||
port) packages="$(port installed | wc -l)" ;;
|
|
||||||
dpkg-query) packages="$(dpkg-query -f '${
|
|
||||||
"binary:Package"
|
|
||||||
}\n' -W | wc -l)" ;;
|
|
||||||
rpm) packages="$(rpm -qa --last | wc -l)" ;;
|
|
||||||
yum) packages="$(yum list installed | wc -l)" ;;
|
|
||||||
dnf) packages="$(dnf list installed | wc -l)" ;;
|
|
||||||
zypper) packages="$(zypper se | wc -l)" ;;
|
|
||||||
pacman) packages="$(pacman -Q | wc -l)" ;;
|
|
||||||
yay) packages="$(yay -Q | wc -l)" ;;
|
|
||||||
paru) packages="$(paru -Q | wc -l)" ;;
|
|
||||||
pacstall) packages="$(pacstall -L | wc -l)" ;;
|
|
||||||
kiss) packages="$(kiss list | wc -l)" ;;
|
|
||||||
emerge) packages="$(qlist -I | wc -l)" ;;
|
|
||||||
pkg) packages="$(pkg info | wc -l | tr -d ' ')" ;;
|
|
||||||
cave) packages="$(cave show installed-slots | wc -l)" ;;
|
|
||||||
xbps-query) packages="$(xbps-query -l | wc -l)" ;;
|
|
||||||
nix-env) packages="$(nix-store -q --requisites /run/current-system/sw | wc -l)" ;;
|
|
||||||
apk) packages="$(apk list --installed | wc -l)" ;;
|
|
||||||
pmm) packages="$(/bedrock/libexec/pmm pacman pmm -Q 2>/dev/null | wc -l)" ;;
|
|
||||||
eopkg) packages="$(eopkg li | wc -l)" ;;
|
|
||||||
/usr/sbin/slackpkg) packages="$(ls /var/log/packages | wc -l)" ;;
|
|
||||||
bulge) packages="$(bulge list | wc -l)" ;;
|
|
||||||
birb) packages="$(birb --list-installed | wc -l)" ;;
|
|
||||||
pkg_info)
|
|
||||||
packages="$(pkg_info -A | wc -l)"
|
|
||||||
manager="pkg"
|
|
||||||
;;
|
|
||||||
pkg_info-netbsd)
|
|
||||||
packages="$(pkg_info -a | wc -l)"
|
|
||||||
manager="pkg"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ $distrotype = android ]; then
|
|
||||||
packages="$(dpkg-query -f '${"binary:Package"}\n' -W | wc -l)"
|
|
||||||
manager="dpkg"
|
|
||||||
else
|
|
||||||
packages="$(ls /usr/bin | wc -l)"
|
|
||||||
manager="bin"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
packages="''${packages#"''${packages%%[![:space:]]*}"}"
|
|
||||||
manager=$(echo $manager | sed "s/-query//; s/\/usr\/.*\///")
|
|
||||||
|
|
||||||
## UPTIME DETECTION
|
|
||||||
|
|
||||||
if [ $distrotype = android ]; then
|
|
||||||
uptime="$(echo $(uptime -p) | cut -c 4-)"
|
|
||||||
elif [ $distrotype = bsd ] || [ $distrotype = netbsd ]; then
|
|
||||||
uptime="$(uptime | sed -e 's/.* up //; s/, [0-9]* user.*//')"
|
|
||||||
else
|
|
||||||
case $ostype in
|
|
||||||
*"Linux"*)
|
|
||||||
IFS=. read -r s _ </proc/uptime
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
s=$(sysctl -n kern.boottime)
|
|
||||||
s=''${s#*=}
|
|
||||||
s=''${s%,*}
|
|
||||||
s=$(($(date +%s) - s))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
d="$((s / 60 / 60 / 24))"
|
|
||||||
h="$((s / 60 / 60 % 24))"
|
|
||||||
m="$((s / 60 % 60))"
|
|
||||||
# Plurals
|
|
||||||
[ "$d" -gt 1 ] && dp=s
|
|
||||||
[ "$h" -gt 1 ] && hp=s
|
|
||||||
[ "$m" -gt 1 ] && mp=s
|
|
||||||
[ "$s" -gt 1 ] && sp=s
|
|
||||||
# Hide empty fields.
|
|
||||||
[ "$d" = 0 ] && d=
|
|
||||||
[ "$h" = 0 ] && h=
|
|
||||||
[ "$m" = 0 ] && m=
|
|
||||||
[ "$m" != "" ] && s=
|
|
||||||
# Make the output of uptime smaller.
|
|
||||||
[ "$d" ] && uptime="$d day$dp, "
|
|
||||||
[ "$h" ] && uptime="$uptime$h hour$hp, "
|
|
||||||
[ "$m" ] && uptime="$uptime$m min$mp"
|
|
||||||
[ "$s" ] && uptime="$uptime$s sec$sp"
|
|
||||||
uptime=''${uptime%, }
|
|
||||||
fi
|
|
||||||
|
|
||||||
## RAM DETECTION
|
|
||||||
|
|
||||||
case $ostype in
|
|
||||||
*"Linux"*)
|
|
||||||
while IFS=':k ' read -r key val _; do
|
|
||||||
case $key in
|
|
||||||
MemTotal)
|
|
||||||
mem_used=$((mem_used + val))
|
|
||||||
mem_full=$val
|
|
||||||
;;
|
|
||||||
Shmem) mem_used=$((mem_used + val)) ;;
|
|
||||||
MemFree | Buffers | Cached | SReclaimable) mem_used=$((mem_used - val)) ;;
|
|
||||||
esac
|
|
||||||
done </proc/meminfo
|
|
||||||
mem_used=$((mem_used / 1024))
|
|
||||||
mem_full=$((mem_full / 1024))
|
|
||||||
;;
|
|
||||||
*"Darwin"*)
|
|
||||||
mem_full=$(($(sysctl -n hw.memsize) / 1024 / 1024))
|
|
||||||
while IFS=:. read -r key val; do
|
|
||||||
case $key in
|
|
||||||
*' wired'* | *' active'* | *' occupied'*)
|
|
||||||
mem_used=$((mem_used + ${"val:-0"}))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <-EOF
|
|
||||||
$(vm_stat)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mem_used=$((mem_used * 4 / 1024))
|
|
||||||
;;
|
|
||||||
*"BSD"*)
|
|
||||||
mem_full=$(($(sysctl -n hw.physmem) / 1024 / 1024))
|
|
||||||
if [ $distrotype = netbsd ]; then
|
|
||||||
mem_free=$(($(vmstat | awk 'NR==3 {print $4}') / 1024))
|
|
||||||
else
|
|
||||||
mem_free=$(($(sysctl -n vm.stats.vm.v_free_count) * $(sysctl -n vm.stats.vm.v_page_size) / 1024 / 1024))
|
|
||||||
fi
|
|
||||||
mem_used=$((mem_full - mem_free))
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
mem_full=1
|
|
||||||
mem_used=0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
memstat="''${mem_used}/''${mem_full} MiB"
|
|
||||||
if which expr >/dev/null 2>&1; then
|
|
||||||
mempercent="($(expr $(expr ''${mem_used} \* 100 / ''${mem_full}))%)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## DEFINE COLORS
|
|
||||||
|
|
||||||
bold='[1m'
|
|
||||||
black='[30m'
|
|
||||||
red='[31m'
|
|
||||||
green='[32m'
|
|
||||||
yellow='[33m'
|
|
||||||
blue='[34m'
|
|
||||||
magenta='[35m'
|
|
||||||
cyan='[36m'
|
|
||||||
white='[37m'
|
|
||||||
grey='[90m'
|
|
||||||
reset='[0m'
|
|
||||||
|
|
||||||
## USER VARIABLES -- YOU CAN CHANGE THESE
|
|
||||||
|
|
||||||
lc="$reset$bold$magenta" # labels
|
|
||||||
nc="$reset$bold$magenta" # user
|
|
||||||
hn="$reset$bold$magenta" # hostname
|
|
||||||
ic="$reset$white" # info
|
|
||||||
c0="$reset$grey" # first color
|
|
||||||
c1="$reset$white" # second color
|
|
||||||
c2="$reset$yellow" # third color
|
|
||||||
|
|
||||||
## OUTPUT
|
|
||||||
|
|
||||||
echo """
|
|
||||||
''${c0} ___ ''${nc}''${USER}''${grey}@''${reset}''${hn}''${host}''${reset}
|
|
||||||
''${c0} (''${c1}.. ''${c0}\ ''${lc}''${osi} ''${ic}''${os}''${reset}
|
|
||||||
''${c0} (''${c2}<> ''${c0}| ''${lc}''${ki} ''${ic}''${kernel}''${reset}
|
|
||||||
''${c0} /''${c1}/ \\ ''${c0}\\ ''${lc}''${ri} ''${ic}''${RAM}''${memstat} ''${mempercent}
|
|
||||||
''${c0} ( ''${c1}| | ''${c0}/| ''${lc}''${pi} ''${ic}''${packages} (''${manager})''${reset}
|
|
||||||
''${c2} _''${c0}/\\ ''${c1}__)''${c0}/''${c2}_''${c0}) ''${lc}''${ui} ''${ic}''${uptime}''${reset}
|
|
||||||
''${c2} \/''${c0}-____''${c2}\/''${reset} ''${lc}''${ci} ''${red}███''${green}███''${yellow}███''${blue}███''${magenta}███''${cyan}███''${reset}
|
|
||||||
"""
|
|
||||||
'';
|
|
||||||
|
|
||||||
in { home.packages = with pkgs; [ nerdfetch ]; }
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
nerdfont-fzf = pkgs.writeShellScriptBin "nerdfont-fzf" ''
|
|
||||||
# Dependencies: jq, fzf, wl-copy, wget
|
|
||||||
icons=$(jq -r 'to_entries[] | "\(.key):\(.value.char)"' "${homedir}/.config/nerdfont_glyphnames.json" | awk -F: '{print "\033[95m "$2" \033[0m "$1}')
|
|
||||||
fzf_result=$(echo "$icons" | 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"
|
|
||||||
echo "Paste it to close the window"
|
|
||||||
${pkgs.wl-clipboard}/bin/wl-copy -o "$fzf_result" # wait for paste before exiting.. not cool
|
|
||||||
'';
|
|
||||||
|
|
||||||
nerdfont-fzf-fetch = pkgs.writeShellScriptBin "nerdfont-fzf-fetch" ''
|
|
||||||
wget "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/glyphnames.json" -O "glyphnames.json" || exit 1
|
|
||||||
jq 'del(.METADATA)' "glyphnames.json"
|
|
||||||
'';
|
|
||||||
|
|
||||||
nerdfont-popup = pkgs.writeShellScriptBin "nerdfont-popup" ''
|
|
||||||
${pkgs.kitty}/bin/kitty --class floating -o font_size=18 zsh -c nerdfont-fzf 2>/dev/null
|
|
||||||
'';
|
|
||||||
|
|
||||||
in {
|
|
||||||
home.packages = with pkgs; [ nerdfont-fzf nerdfont-fzf-fetch nerdfont-popup ];
|
|
||||||
|
|
||||||
xdg.configFile."nerdfont_glyphnames.json" = {
|
|
||||||
source = ../misc/nerdfont_glyphnames.json;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
default = "4000";
|
|
||||||
|
|
||||||
night-shift-on = pkgs.writeShellScriptBin "night-shift-on" ''
|
|
||||||
${pkgs.hyprland}/bin/hyprctl dispatch exec "${pkgs.wlsunset}/bin/wlsunset -t ${default}"
|
|
||||||
message=" Night-Shift Activated"
|
|
||||||
${pkgs.libnotify}/bin/notify-send "$message" \
|
|
||||||
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
|
|
||||||
'';
|
|
||||||
night-shift-off = pkgs.writeShellScriptBin "night-shift-off" ''
|
|
||||||
pkill wlsunset
|
|
||||||
message=" Night-Shift Deactivated"
|
|
||||||
${pkgs.libnotify}/bin/notify-send "$message" \
|
|
||||||
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
|
|
||||||
'';
|
|
||||||
|
|
||||||
in { home.packages = with pkgs; [ night-shift-on night-shift-off ]; }
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
nixy-rebuild = pkgs.writeShellScriptBin "nixy-rebuild" ''
|
|
||||||
sudo nixos-rebuild switch --flake ${homedir}/.config/nixos#nixy
|
|
||||||
'';
|
|
||||||
|
|
||||||
nixy-edit = pkgs.writeShellScriptBin "nixy-edit" ''
|
|
||||||
$EDITOR ${homedir}/.config/nixos/
|
|
||||||
'';
|
|
||||||
|
|
||||||
nixy-upgrade = pkgs.writeShellScriptBin "nixy-upgrade" ''
|
|
||||||
sudo nixos-rebuild switch --upgrade --flake ${homedir}/.config/nixos#nixy
|
|
||||||
'';
|
|
||||||
|
|
||||||
nixy-update = pkgs.writeShellScriptBin "nixy-update" ''
|
|
||||||
cd ${homedir}/.config/nixos && sudo nix flake update
|
|
||||||
'';
|
|
||||||
|
|
||||||
nixy-gc = pkgs.writeShellScriptBin "nixy-gc" ''
|
|
||||||
cd ${homedir}/.config/nixos && sudo nix-collect-garbage -d
|
|
||||||
'';
|
|
||||||
|
|
||||||
nixy-cb = pkgs.writeShellScriptBin "nixy-cb" ''
|
|
||||||
sudo /run/current-system/bin/switch-to-configuration boot
|
|
||||||
'';
|
|
||||||
|
|
||||||
in {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
nixy-rebuild
|
|
||||||
nixy-edit
|
|
||||||
nixy-upgrade
|
|
||||||
nixy-update
|
|
||||||
nixy-gc
|
|
||||||
nixy-cb
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
screenshot = pkgs.writeShellScriptBin "screenshot" ''
|
|
||||||
if [[ $2 == "swappy" ]];then
|
|
||||||
folder="/tmp"
|
|
||||||
else
|
|
||||||
folder="$HOME/Pictures/screenshots"
|
|
||||||
fi
|
|
||||||
filename="$(date +%Y-%m-%d_%H:%M:%S).png"
|
|
||||||
mode="region" # Default to region
|
|
||||||
|
|
||||||
if [[ $1 == "window" ]];then
|
|
||||||
mode="window"
|
|
||||||
elif [[ $1 == "monitor" ]];then
|
|
||||||
mode="output"
|
|
||||||
fi
|
|
||||||
|
|
||||||
${pkgs.hyprshot}/bin/hyprshot -m $mode -o $folder -f $filename -s || exit 1
|
|
||||||
|
|
||||||
if [[ $2 == "swappy" ]];then
|
|
||||||
${pkgs.swappy}/bin/swappy -f "$folder/$filename" -o "$HOME/Pictures/screenshots/$filename"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
message=" Screenshot saved"
|
|
||||||
|
|
||||||
${pkgs.libnotify}/bin/notify-send "$message" \
|
|
||||||
--icon="$folder/$filename" \
|
|
||||||
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
|
|
||||||
'';
|
|
||||||
in { home.packages = with pkgs; [ hyprshot screenshot ]; }
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
increments = "5";
|
|
||||||
|
|
||||||
sound-change = pkgs.writeShellScriptBin "sound-change" ''
|
|
||||||
sleep 0.05
|
|
||||||
|
|
||||||
[[ $1 == "mute" ]] && wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
|
||||||
[[ $1 == "up" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ "$2%+"
|
|
||||||
[[ $1 == "down" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ "$2%-"
|
|
||||||
|
|
||||||
sink_info=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
|
|
||||||
|
|
||||||
volume=$(echo "$(echo "$sink_info" | awk '{print $2}' | sed 's/%//')*100" | bc -l | xargs printf "%.0f")
|
|
||||||
muted=false
|
|
||||||
if [[ $sink_info == *"MUTED"* ]]; then
|
|
||||||
muted=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
message=""
|
|
||||||
if [ $muted = true ]; then
|
|
||||||
message=" Muted"
|
|
||||||
else
|
|
||||||
message=" Volume: $volume%"
|
|
||||||
fi
|
|
||||||
|
|
||||||
${pkgs.libnotify}/bin/notify-send "$message" \
|
|
||||||
-h int:value:"$volume" \
|
|
||||||
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
|
|
||||||
'';
|
|
||||||
|
|
||||||
sound-up = pkgs.writeShellScriptBin "sound-up" ''
|
|
||||||
sound-change up ${increments}
|
|
||||||
'';
|
|
||||||
|
|
||||||
sound-down = pkgs.writeShellScriptBin "sound-down" ''
|
|
||||||
sound-change down ${increments}
|
|
||||||
'';
|
|
||||||
|
|
||||||
sound-toggle = pkgs.writeShellScriptBin "sound-toggle" ''
|
|
||||||
sound-change mute
|
|
||||||
'';
|
|
||||||
|
|
||||||
sound-output = pkgs.writeShellScriptBin "sound-output" ''
|
|
||||||
function parse_sinks(){
|
|
||||||
output=$(wpctl status)
|
|
||||||
sinks=($(echo "$output" | sed 's/ │ //' | awk '/Sinks:/ {flag=1; next} /^$/ {flag=0} flag' | sed 's/ /-/g'))
|
|
||||||
|
|
||||||
for sink in "''${sinks[@]}"; do
|
|
||||||
|
|
||||||
id=""
|
|
||||||
default=false
|
|
||||||
sink=$(echo "$sink" | sed 's/-/ /g')
|
|
||||||
sink_name=$(echo "$sink" | sed 's/\[vol:.*$//')
|
|
||||||
|
|
||||||
if [[ $sink_name == "*"* ]]; then
|
|
||||||
sink_name=$(echo "$sink_name" | sed 's/*//')
|
|
||||||
default=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
id=$(echo "$sink_name" | cut -d'.' -f1)
|
|
||||||
sink_name=$(echo "$sink_name" | sed 's/^[ ]*//;s/[ ]*$//' )
|
|
||||||
sink_name=$(echo "$sink_name" | cut -d'.' -f2 )
|
|
||||||
|
|
||||||
if [[ $default == true ]];then
|
|
||||||
printf "*%s (%d)" "$sink_name" "$id"
|
|
||||||
else
|
|
||||||
printf " %s (%d)" "$sink_name" "$id"
|
|
||||||
fi
|
|
||||||
printf "\n"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
choosed_sink=$(echo "$(parse_sinks)" | ${pkgs.fzf}/bin/fzf \
|
|
||||||
--border-label "Choose sound output" ) || exit 1
|
|
||||||
|
|
||||||
choosed_sink_id=$(echo "$choosed_sink" | sed 's/.*(\(.*\))/\1/')
|
|
||||||
|
|
||||||
wpctl set-default $choosed_sink_id
|
|
||||||
'';
|
|
||||||
|
|
||||||
in {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
sound-output
|
|
||||||
sound-change
|
|
||||||
sound-up
|
|
||||||
sound-down
|
|
||||||
sound-toggle
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
# File runned at startup by Hyprland
|
|
||||||
{ pkgs, config, ... }:
|
|
||||||
let
|
|
||||||
homedir = config.home.homeDirectory;
|
|
||||||
|
|
||||||
battery-notif = pkgs.writeShellScriptBin "battery-notif" ''
|
|
||||||
# Send notifications when low on battery and not in charge
|
|
||||||
while true; do
|
|
||||||
battery_level=$(cat /sys/class/power_supply/BAT*/capacity)
|
|
||||||
battery_status=$(cat /sys/class/power_supply/BAT*/status)
|
|
||||||
if [[ $battery_level -le 20 ]] && [[ $battery_status == "Discharging" ]]; then
|
|
||||||
${pkgs.libnotify}/bin/notify-send " Low battery" "Battery level is $battery_level%"
|
|
||||||
elif [[ $battery_level -le 10 ]] && [[ $battery_status == "Discharging" ]]; then
|
|
||||||
${pkgs.libnotify}/bin/notify-send --urgency=critical " Very low battery" "Battery level is $battery_level%"
|
|
||||||
fi
|
|
||||||
sleep 60
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
|
|
||||||
nextcloud-watch = pkgs.writeShellScriptBin "nextcloud-watch" ''
|
|
||||||
# Start nextcloud if I'm on my networks
|
|
||||||
while true;do
|
|
||||||
ssid=$(nmcli -t -f name connection show --active | head -n1)
|
|
||||||
status=$(pgrep -n nextcloud)
|
|
||||||
if [[ -z $status ]]; then
|
|
||||||
service_status="inactive"
|
|
||||||
else
|
|
||||||
service_status="active"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $ssid == "inthecloud" || $ssid == "Wired connection 2" ]]; then
|
|
||||||
if [[ $service_status == "inactive" ]]; then
|
|
||||||
${pkgs.nextcloud-client}/bin/nextcloud --background
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [[ $service_status == "active" ]]; then
|
|
||||||
pkill nextcloud
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
sleep 120
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
|
|
||||||
startup = pkgs.writeShellScriptBin "startup" ''
|
|
||||||
# Because HM enabling services suck.
|
|
||||||
|
|
||||||
systemctl --user start sops-nix
|
|
||||||
|
|
||||||
nextcloud-watch &
|
|
||||||
battery-notif &
|
|
||||||
'';
|
|
||||||
|
|
||||||
in {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
startup
|
|
||||||
battery-notif
|
|
||||||
nextcloud-watch
|
|
||||||
nextcloud-client
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue