pełna konfiguracja noctalia i czystka waybar, swaync, wlogout i skryptów

This commit is contained in:
2026-02-02 21:23:05 +01:00
parent 80d7fc08cc
commit e5b5d68808
117 changed files with 1041 additions and 6119 deletions

View File

@@ -1,35 +1,7 @@
{
pkgs,
username,
...
}: {
home.packages = with pkgs; [
# hyprland
swww
grim
slurp
wl-clipboard
swappy
ydotool
hyprpolkitagent
hyprland-qtutils # needed for banners and ANR messages
# pyprland
pyprland
(import ./emopicker9000.nix {inherit pkgs;})
(import ./hm-find.nix {inherit pkgs;})
(import ./keybinds.nix {inherit pkgs username;})
(import ./note.nix {inherit pkgs;})
(import ./note-from-clipboard.nix {inherit pkgs;})
{pkgs, ...}: {
home.packages = [
(import ./nvidia-offload.nix {inherit pkgs;})
(import ./rofi-launcher.nix {inherit pkgs;})
(import ./screenshootin.nix {inherit pkgs;})
(import ./task-waybar.nix {inherit pkgs;})
(import ./wallsetter.nix {
inherit pkgs;
inherit username;
})
(import ./web-search.nix {inherit pkgs;})
(import ./restart.noctalia.nix {inherit pkgs;})
(import ./screenshootin.nix {inherit pkgs;})
];
}

View File

@@ -1,22 +0,0 @@
{pkgs}:
pkgs.writeShellScriptBin "emopicker9000" ''
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
# Get user selection via wofi from emoji file.
chosen=$(cat $HOME/.config/.emoji | ${pkgs.rofi}/bin/rofi -i -dmenu -config ~/.config/rofi/config-long.rasi | awk '{print $1}')
# Exit if none chosen.
[ -z "$chosen" ] && exit
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
${pkgs.ydotool}/bin/ydotool type "$chosen"
else
printf "$chosen" | ${pkgs.wl-clipboard}/bin/wl-copy
${pkgs.libnotify}/bin/notify-send "'$chosen' copied to clipboard." &
fi
''

View File

@@ -1,60 +0,0 @@
{pkgs}:
pkgs.writeShellScriptBin "hm-find" ''
#!/usr/bin/env bash
# Script Metadata
#===============================================
# This script searches recent journalctl entries for Home Manager errors
# It identifies backup files that prevent rebuilds and allows removal.
# Author: Don Williams
# Creation Date: May 6th, 2025
# Revision History:
#-----------------------------------------------
# 0.1 - 5/6/25 - Initial version
# 0.2 - 5/7/25 - Improved messaging, added log directory check
# Display WARNING message
echo "==============================================="
echo " WARNING "
echo "==============================================="
echo "*** This script is experimental! ***"
echo "It will attempt to find old backup files that are preventing Home Manager from rebuilding."
echo "If conflicting files are found, you will be prompted to remove them."
echo "A log of any deletions will be stored in \$HOME/hm-logs."
echo "==============================================="
# Define the time range (default: last 30 minutes)
TIME_RANGE="30m"
LOG_DIR="$HOME/hm-logs"
LOG_FILE="$LOG_DIR/hm-cleanup-$(date +'%Y-%m-%d_%H-%M-%S').log"
# Ensure the log directory exists
if [ ! -d "$LOG_DIR" ]; then
echo "Creating log directory: $LOG_DIR"
mkdir -p "$LOG_DIR"
fi
# Search journal logs for backup conflicts and extract file paths
FILES=$(journalctl --since "-$TIME_RANGE" -xe | grep hm-activate | awk -F "'|'" '/would be clobbered by backing up/ {print $2}')
# Check if any files were found
if [ -z "$FILES" ]; then
echo "No conflicting backup files found in the last $TIME_RANGE."
exit 0
fi
# Display found backup files
echo "🚨 The following backup files are preventing Home Manager from rebuilding:"
echo "$FILES" | tr ' ' '\n'
# Ask for user confirmation before deletion
read -p " Do you want to remove these files? (y/N): " confirm
if [[ "$confirm" == "y" || "$confirm" == "Y" ]]; then
echo "🗑 Deleting files..." | tee -a "$LOG_FILE"
echo "$FILES" | xargs rm -v | tee -a "$LOG_FILE"
echo " Cleanup completed at $(date)" | tee -a "$LOG_FILE"
else
echo " No files were removed." | tee -a "$LOG_FILE"
fi
''

View File

@@ -1,32 +0,0 @@
{
pkgs,
username,
...
}: let
desktopEntriesPath = "/home/${username}/.local/state/home-manager/gcroots/current-home/home-path/share/applications/";
in
pkgs.writeShellScriptBin "list-keybinds" ''
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
msg=' = Windows/Super/CAPS LOCK (Enter nie wykonuje skrótu)'
keybinds=$(cat ~/.config/hypr/hyprland.conf | grep -E '^bind')
# replace SUPER with SUPER and clean up paths
display_keybinds=$(echo "$keybinds" | sed 's/\SUPER//g' | sed 's|${desktopEntriesPath}/||g')
# remove "bind=" and "bindm=" prefixes
display_keybinds=$(echo "$display_keybinds" | sed 's/^bind=//' | sed 's/^bindm=/🖱/')
# add + before CONTROL, SHIFT, ALT when they appear after removed SUPER
display_keybinds=$(echo "$display_keybinds" | sed 's/ CONTROL/ + CONTROL/g' | sed 's/ SHIFT/ + SHIFT/g' | sed 's/ ALT/ + ALT/g')
# replace commas: first comma -> " +", second comma -> " =", remaining commas -> " ->"
display_keybinds=$(echo "$display_keybinds" | sed 's/,/ +/1' | sed 's/,/ =/1' | sed 's/,/ ->/g')
# use rofi to display the keybinds with the modified content
echo "$display_keybinds" | rofi -dmenu -i -config ~/.config/rofi/config-long.rasi -mesg "$msg"
''

View File

@@ -1,20 +0,0 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "note-from-clipboard" ''
#!/usr/bin/env bash
# Check clipboard content type
clipboard_type=$(${pkgs.wl-clipboard}/bin/wl-paste --list-types | head -n 1)
if [[ "$clipboard_type" == "text/plain"* ]]; then
# It's text, let's create a note
${pkgs.wl-clipboard}/bin/wl-paste | note
if [ $? -eq 0 ]; then
${pkgs.libnotify}/bin/notify-send -t 3000 "📝 Note Created" "Clipboard content added as a new note."
else
${pkgs.libnotify}/bin/notify-send -t 5000 -u critical " Note Creation Failed" "There was an error creating the note."
fi
else
# It's not text, so we do nothing and notify the user
${pkgs.libnotify}/bin/notify-send -t 4000 -u low "📋 Note Skipped" "Clipboard does not contain text."
fi
''

View File

@@ -1,244 +0,0 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "note" ''
# Colors for nice output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
GRAY='\033[0;37m'
BOLD='\033[1m'
NC='\033[0m' # No Color
# XDG-compliant notes directory and file
NOTES_DIR="$HOME/.local/share/notes"
NOTES_FILE="$NOTES_DIR/notes.txt"
# Create notes directory if it doesn't exist
mkdir -p "$NOTES_DIR"
# Function to display usage
show_usage() {
echo -e "''${BOLD}''${BLUE}📝 Note Manager''${NC}"
echo -e "''${GRAY}Usage:''${NC}"
echo -e " ''${CYAN}note''${NC} ''${YELLOW}<text>''${NC} - Add a new note"
echo -e " ''${CYAN}note''${NC} - Display all notes"
echo -e " ''${CYAN}note del''${NC} ''${YELLOW}<number>''${NC} - Delete note by number"
echo -e " ''${CYAN}note clear''${NC} - Clear all notes"
echo -e " ''${CYAN}echo 'text' | note''${NC} - Add note from stdin"
echo -e " ''${CYAN}cat file | note''${NC} - Add file contents as note"
echo ""
echo -e "''${GRAY}Examples:''${NC}"
echo -e " ''${GREEN}note call plumber tomorrow''${NC}"
echo -e " ''${GREEN}cat todo.txt | note''${NC}"
echo -e " ''${GREEN}note del 3''${NC}"
}
# Function to add a note
add_note() {
local note_text="$1"
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
local date_only=$(date '+%Y-%m-%d')
# Create notes file if it doesn't exist
touch "$NOTES_FILE"
# Get next note number
local note_num=1
if [ -f "$NOTES_FILE" ] && [ -s "$NOTES_FILE" ]; then
note_num=$(grep -E "^#[0-9]+" "$NOTES_FILE" | sed 's/^#\([0-9]*\).*/\1/' | sort -n | tail -1)
note_num=$((note_num + 1))
fi
# Add the note with proper formatting
{
echo "#$note_num [$timestamp]"
echo "$note_text"
echo ""
} >> "$NOTES_FILE"
echo -e "''${GREEN}''${NC} Note #$note_num added ''${GRAY}($date_only)''${NC}"
}
# Function to display all notes
display_notes() {
if [ ! -f "$NOTES_FILE" ] || [ ! -s "$NOTES_FILE" ]; then
echo -e "''${YELLOW}📝 No notes found''${NC}"
echo -e "''${GRAY}Use ''${CYAN}note <text>''${GRAY} to add your first note''${NC}"
return
fi
echo -e "''${BOLD}''${BLUE}📝 Your Notes''${NC}"
echo -e "''${GRAY}📁 $NOTES_FILE''${NC}"
echo -e "''${GRAY}$(printf '%.0s' {1..50})''${NC}"
local in_note=false
local note_content=""
while IFS= read -r line; do
# Check if line starts with # followed by numbers and space and [
if echo "$line" | grep -q "^#[0-9][0-9]* \["; then
# Print previous note content if exists
if [ "$in_note" = true ] && [ -n "$note_content" ]; then
echo -e "$note_content"
echo ""
fi
# Extract note number and timestamp
local num=$(echo "$line" | sed 's/^#\([0-9]*\) \[.*/\1/')
local timestamp=$(echo "$line" | sed 's/^#[0-9]* \[\(.*\)\]/\1/')
local date_part=$(echo "$timestamp" | cut -d' ' -f1)
local time_part=$(echo "$timestamp" | cut -d' ' -f2)
echo -e "''${BOLD}''${CYAN}#$num''${NC} ''${GRAY}[$date_part ''${YELLOW}$time_part''${GRAY}]''${NC}"
in_note=true
note_content=""
elif [ -n "$line" ] && [ "$in_note" = true ]; then
# Accumulate note content
if [ -z "$note_content" ]; then
note_content="''${WHITE}$line''${NC}"
else
note_content="$note_content\n''${WHITE}$line''${NC}"
fi
elif [ -z "$line" ] && [ "$in_note" = true ]; then
# End of current note
if [ -n "$note_content" ]; then
echo -e "$note_content"
echo ""
fi
in_note=false
note_content=""
fi
done < "$NOTES_FILE"
# Print last note if file doesn't end with empty line
if [ "$in_note" = true ] && [ -n "$note_content" ]; then
echo -e "$note_content"
echo ""
fi
local total_notes=$(grep -c "^#[0-9]" "$NOTES_FILE")
echo -e "''${GRAY}$(printf '%.0s' {1..50})''${NC}"
echo -e "''${GRAY}Total: ''${BOLD}$total_notes''${NC} ''${GRAY}notes''${NC}"
}
# Function to delete a note
delete_note() {
local note_num="$1"
if [ ! -f "$NOTES_FILE" ] || [ ! -s "$NOTES_FILE" ]; then
echo -e "''${RED}''${NC} No notes found"
return 1
fi
if ! echo "$note_num" | grep -q "^[0-9][0-9]*$"; then
echo -e "''${RED}''${NC} Invalid note number: $note_num"
return 1
fi
# Check if note exists
if ! grep -q "^#$note_num " "$NOTES_FILE"; then
echo -e "''${RED}''${NC} Note #$note_num not found"
return 1
fi
# Create temporary file without the specified note
local temp_file=$(mktemp)
local skip_lines=false
while IFS= read -r line; do
if echo "$line" | grep -q "^#[0-9][0-9]* "; then
local current_num=$(echo "$line" | sed 's/^#\([0-9]*\) .*/\1/')
if [ "$current_num" = "$note_num" ]; then
skip_lines=true
continue
else
skip_lines=false
fi
fi
if [ "$skip_lines" = false ]; then
echo "$line" >> "$temp_file"
elif [ -z "$line" ]; then
# Stop skipping when we hit an empty line (end of note)
skip_lines=false
fi
done < "$NOTES_FILE"
mv "$temp_file" "$NOTES_FILE"
echo -e "''${GREEN}''${NC} Note #$note_num deleted"
}
# Function to clear all notes
clear_notes() {
if [ ! -f "$NOTES_FILE" ] || [ ! -s "$NOTES_FILE" ]; then
echo -e "''${YELLOW}📝 No notes to clear''${NC}"
return
fi
local total_notes=$(grep -c "^#[0-9]" "$NOTES_FILE")
echo -e "''${YELLOW}''${NC} This will delete all $total_notes notes. Are you sure? ''${GRAY}[y/N]''${NC}"
read -r confirmation
if echo "$confirmation" | grep -qi "^y"; then
> "$NOTES_FILE"
echo -e "''${GREEN}''${NC} All notes cleared"
else
echo -e "''${BLUE}''${NC} Operation cancelled"
fi
}
# Main script logic
main() {
# Check if input is being piped
if [ ! -t 0 ]; then
# Read from stdin (pipe)
local piped_content=""
while IFS= read -r line; do
if [ -z "$piped_content" ]; then
piped_content="$line"
else
piped_content="$piped_content"$'\n'"$line"
fi
done
if [ -n "$piped_content" ]; then
add_note "$piped_content"
else
echo -e "''${RED}''${NC} No input received from pipe"
exit 1
fi
return
fi
# Handle command line arguments
case "$1" in
"")
display_notes
;;
"del")
if [ -z "$2" ]; then
echo -e "''${RED}''${NC} Please specify note number to delete"
echo -e "''${GRAY}Usage: ''${CYAN}note del <number>''${NC}"
exit 1
fi
delete_note "$2"
;;
"clear")
clear_notes
;;
"help"|"--help"|"-h")
show_usage
;;
*)
# Everything else is treated as note content
add_note "$*"
;;
esac
}
main "$@"
''

View File

@@ -1,8 +0,0 @@
{pkgs}:
pkgs.writeShellScriptBin "rofi-launcher" ''
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
rofi -show drun
''

View File

@@ -1,5 +0,0 @@
{pkgs}:
pkgs.writeShellScriptBin "task-waybar" ''
sleep 0.1
${pkgs.swaynotificationcenter}/bin/swaync-client -t &
''

View File

@@ -1,23 +0,0 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "wallsetter" ''
TIMEOUT=720
for pid in $(pidof -o %PPID -x wallsetter); do
kill $pid
done
if ! [ -d ~/Pictures/Wallpapers ]; then notify-send -t 5000 "~/Pictures/Wallpapers does not exist" && exit 1; fi
if [ $(ls -1 ~/Pictures/Wallpapers | wc -l) -lt 1 ]; then notify-send -t 9000 "The wallpaper folder is expected to have more than 1 image. Exiting Wallsetter." && exit 1; fi
while true; do
while [ "$WALLPAPER" == "$PREVIOUS" ]; do
WALLPAPER=$(find ~/Pictures/Wallpapers -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1)
done
PREVIOUS=$WALLPAPER
${pkgs.swww}/bin/swww img "$WALLPAPER" --transition-type random --transition-step 1 --transition-fps 60
sleep $TIMEOUT
done
''

View File

@@ -1,59 +0,0 @@
{pkgs}:
pkgs.writeShellScriptBin "web-search" ''
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
declare -A URLS
URLS=(
[" Search"]="https://search.garandplg.com/search?q="
[" Nix Unstable Packages"]="https://search.nixos.org/packages?channel=unstable&query="
[" Nix Options"]="https://search.nixos.org/options?query="
[" Nix Wiki"]="https://wiki.nixos.org/w/index.php?search="
[" Home Manager Options"]="https://home-manager-options.extranix.com/release=master?query="
[" Kalkulator walutowy EUR"]="https://www.money.pl/pieniadze/kalkulator/?currencyFrom=EUR&currencyTo=PLN&amount="
["\$ Kalkulator walutowy USD"]="https://www.money.pl/pieniadze/kalkulator/?currencyFrom=USD&currencyTo=PLN&amount="
[" YouTube"]="https://www.youtube.com/results?search_query="
[" Wikipedia PL"]="https://pl.wikipedia.org/w/index.php?search="
[" StackOverflow"]="https://stackoverflow.com/search?q="
[" Eneba"]="https://www.eneba.com/pl/store/all?text="
[" Kinguin"]="https://www.kinguin.net/listing?active=1&hideUnavailable=0&type=kinguin?phrase="
[" Instant Gaming"]="https://www.instant-gaming.com/pl/search/?q="
[" Morele"]="https://www.morele.net/wyszukiwarka/?q="
[" X-kom"]="https://www.x-kom.pl/szukaj?q="
[" Komputrnik"]="https://www.komputronik.pl/search/category/1?q="
[" Allegro"]="https://allegro.pl/listing?string="
)
# List for rofi
gen_list() {
for i in "''${!URLS[@]}"
do
echo "$i"
done
}
main() {
# Pass the list to rofi
platform=$( (gen_list) | ${pkgs.rofi}/bin/rofi -dmenu -config ~/.config/rofi/config-long.rasi )
if [[ -n "$platform" ]]; then
query=$( (echo ) | ${pkgs.rofi}/bin/rofi -dmenu -config ~/.config/rofi/config-long.rasi )
if [[ -n "$query" ]]; then
url=''${URLS[$platform]}$query
xdg-open "$url"
else
exit
fi
else
exit
fi
}
main
exit 0
''