feat(hyprland): add hyprland and wayland config

This commit is contained in:
2025-05-04 14:27:15 +02:00
parent 92c59eb915
commit 39d57a4313
21 changed files with 768 additions and 345 deletions

View File

@@ -7,12 +7,13 @@
in [
askpass
(import ./backup.nix {inherit pkgs;})
(import ./hyprland-autostart.nix {inherit pkgs;})
(import ./keygen.nix {inherit pkgs;})
(import ./launch-with-emacsclient.nix {
inherit pkgs;
emacsPackage = config.emacsPkg;
})
(import ./mp42webm.nix {inherit pkgs;})
(import ./plock.nix {inherit pkgs;})
(import ./screenshot.nix {inherit pkgs;})
(import ./sshbind.nix {inherit pkgs;})
]

View File

@@ -1,4 +0,0 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "hyprland-autostart" ''
${pkgs.waybar}/bin/waybar &
${pkgs.wlsunset}/bin/wlsunset -l 48.5 -L 2.2 -d 1500''

16
users/scripts/plock.nix Normal file
View File

@@ -0,0 +1,16 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "plock" ''
TMPBG="/tmp/screen.png"
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
SCREENER=${pkgs.grim}/bin/grim
LOCKER="${pkgs.swaylock}/bin/swaylock -feF"
else
SCREENER=${pkgs.scrot}/bin/scrot
LOCKER="${pkgs.i3lock}/bin/i3lock -ef"
fi
$SCREENER "$TMPBG"
${pkgs.corrupter}/bin/corrupter -add 0 "$TMPBG" "$TMPBG"
$LOCKER -ti "$TMPBG"
rm "$TMPBG"
''

View File

@@ -0,0 +1,18 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "rofi-emoji" ''
SELECTED_EMOJI=$(grep -v "#" ~/.config/emoji | ${pkgs.wofi}/bin/wofi --dmenu -p "Select emoji" -i | awk '{print $1}' | tr -d '\n')
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
printf "%s" "$SELECTED_EMOJI" | ${pkgs.wl-clipboard-rs}/bin/wl-copy
else
printf "%s" "$SELECTED_EMOJI" | ${pkgs.xclip}/bin/xclip -sel clip
fi
if [ "$XDG_SESSION_TYPE" = "wayland" ]
then EMOJI=$(${pkgs.wl-clipboard-rs}/bin/wl-paste)
else EMOJI=$(${pkgs.xclip}/bin/xclip -o)
fi
test -z "$EMOJI" && notify-send "No emoji copied" -u low && exit
EMOJI="$EMOJI copied to clipboard"
${pkgs.libnotify}/bin/notify-send -u low "$EMOJI"
''

View File

@@ -0,0 +1,56 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "screenshot" ''
OUTFILE_BASE="$HOME/Pictures/Screenshots/Screenshot_$(date +%Y-%m-%d_%H.%M.%S)"
OUTFILE="$OUTFILE_BASE.png"
SUFFIX=0
while getopts ':cd:egs' OPTION; do
case "$OPTION" in
c )
COPY="yes"
;;
d )
DELAY="$OPTARG"
;;
e )
EDIT="yes"
;;
g )
GIMP="yes"
;;
s )
SELECT="yes"
;;
? )
echo "Usage: $(basename "$0") [-c] [-d DELAY] [-e] [-g] [-s]"
exit 1
;;
esac
done
if [ "$SELECT" = "yes" ]; then
AREA="$(${pkgs.slurp}/bin/slurp)"
fi
if [ -n "$DELAY" ]; then
sleep "$DELAY"
fi
if [ "$SELECT" = "yes" ]; then
${pkgs.grim}/bin/grim -g "$AREA" "$OUTFILE"
else
${pkgs.grim}/bin/grim "$OUTFILE"
fi
if [ "$EDIT" = "yes" ];then
${pkgs.swappy}/bin/swappy -f "$OUTFILE" -o "$OUTFILE"
fi
if [ "$GIMP" = "yes" ]; then
${pkgs.gimp}/bin/gimp "$OUTFILE"
fi
if [ "$COPY" = "yes" ]; then
${pkgs.wl-clipboard-rs}/bin/wl-copy < "$OUTFILE"
fi
''

View File

@@ -1,18 +1,16 @@
{pkgs, ...}: let
rofi = pkgs.rofi-wayland;
in
pkgs.writeShellScriptBin "ytplay" ''
URL=$(${rofi}/bin/rofi -dmenu -i -p "Video URL")
if [ -z "$URL" ]; then
echo "You need to provide a URL"
exit 1
fi
RESOLUTION_CHOICE=$(${pkgs.yt-dlp}/bin/yt-dlp --list-formats "$URL" | \
grep -E "webm.*[0-9]+x[0-9]" | \
awk '{print $3 " " $1}' | \
sort -gu | \
${rofi}/bin/rofi -dmenu -i -p "Resolution")
mapfile -t RESOLUTION <<< "$RESOLUTION_CHOICE"
RESOLUTION_CODE=''${RESOLUTION[0]}
${pkgs.mpv}/bin/mpv --ytdl-format="''${RESOLUTION_CODE}+bestaudio/best" "$URL"
''
{pkgs, ...}:
pkgs.writeShellScriptBin "ytplay" ''
URL=$(${pkgs.wofi}/bin/wofi --dmenu -i -p "Video URL")
if [ -z "$URL" ]; then
echo "You need to provide a URL"
exit 1
fi
RESOLUTION_CHOICE=$(${pkgs.yt-dlp}/bin/yt-dlp --list-formats "$URL" | \
grep -E "webm.*[0-9]+x[0-9]" | \
awk '{print $3 " " $1}' | \
sort -gu | \
${pkgs.wofi}/bin/wofi --dmenu -i -p "Resolution")
mapfile -t RESOLUTION <<< "$RESOLUTION_CHOICE"
RESOLUTION_CODE=''${RESOLUTION[0]}
${pkgs.mpv}/bin/mpv --ytdl-format="''${RESOLUTION_CODE}+bestaudio/best" "$URL"
''