First Commit

This commit is contained in:
ant 2024-02-27 16:03:12 +01:00
commit cae9d57360
22 changed files with 1957 additions and 0 deletions

35
bin/dark.fish Executable file
View file

@ -0,0 +1,35 @@
if test -e $XDG_STATE_HOME/darkmode
rm $XDG_STATE_HOME/darkmode
set LIGHT 1
else
echo > $XDG_STATE_HOME/darkmode
set LIGHT 0
end
if test $LIGHT = 1;
notify-send "Light mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/
hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi
else
notify-send "Dark mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/
hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi
end

42
bin/dark.nix Executable file
View file

@ -0,0 +1,42 @@
{ pkgs, ... } :
pkgs.writers.writeFish "dark" ''
if test -e $XDG_STATE_HOME/darkmode
rm $XDG_STATE_HOME/darkmode
set LIGHT 1
else
echo > $XDG_STATE_HOME/darkmode
set LIGHT 0
end
if test $LIGHT = 1;
${pkgs.libnotify}/bin/notify-send "Light mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
else
${pkgs.libnotify}/bin/notify-send "Dark mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
end
''

3
bin/ocrzone Executable file
View file

@ -0,0 +1,3 @@
f=$(mktemp --suffix .png)
${pkgs.sway-contrib.grimshot}/bin/grimshot save area $f
${pkgs.tesseract}/bin/tesseract -l fra "$f" - | wl-copy

1
bin/runmenu Executable file
View file

@ -0,0 +1 @@
${pkgs.rofi-wayland}/bin/rofi -matching normal -sort -show run

39
bin/screenshot.nix Executable file
View file

@ -0,0 +1,39 @@
{ pkgs, ... }:
pkgs.writers.writePython3 "screenshot" { flakeIgnore = [ "E501" ];} ''
import subprocess
import re
options = """\
a selected area (copy)
current window (copy)
full screen (copy)
a selected area
current window
full screen
"""
cmd = '${pkgs.rofi-wayland}/bin/rofi -dmenu -location 2 -l 6 -i -p "Screenshot which area?"'
result = subprocess.run(cmd,
input=options,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
text=True)
if result.returncode != 0:
exit(1)
choice = result.stdout.strip()
cmd = "${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot "
cmd += "copy " if re.match(".*(copy)", choice) else "save "
for k, v in {"a selected area.*": "area ",
"current window.*": "active ",
"current screen.*": "output ",
"all screens.*": "screen "}.items():
if re.match(k, choice):
cmd += v
subprocess.call(cmd,
shell=True)
''

6
bin/window_dir Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
PID=$(hyprctl activewindow | grep pid | cut -d' ' -f 2)
PID=$(echo $(ps --ppid $PID -o pid | tail -n1))
cwd=$(readlink /proc/"$PID"/cwd)
echo "$cwd"

29
bin/wl Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
cd ~
# Log WLR errors and logs to the hyprland log. Recommended
export HYPRLAND_LOG_WLR=1
# Tell XWayland to use a cursor theme
export XCURSOR_THEME=Bibata-Modern-Classic
# Set a cursor size
export XCURSOR_SIZE=24
# Example IME Support: fcitx
# export GTK_IM_MODULE=fcitx
# export QT_IM_MODULE=fcitx
# export XMODIFIERS=@im=fcitx
# export SDL_IM_MODULE=fcitx
# export GLFW_IM_MODULE=ibus
export WLR_NO_HARDWARE_CURSORS=1
if lsmod | grep nvidia; then
export LIBVA_DRIVER_NAME=nvidia
export XDG_SESSION_TYPE=wayland
# export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
fi
exec Hyprland