mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-22 16:58:31 +02:00
feat: add hyprshot for screenshot
This commit is contained in:
@@ -94,7 +94,6 @@ $term = kitty
|
|||||||
$app_launcher = ~/.config/hypr/scripts/menu
|
$app_launcher = ~/.config/hypr/scripts/menu
|
||||||
$volume = ~/.config/hypr/scripts/volume
|
$volume = ~/.config/hypr/scripts/volume
|
||||||
$backlight = ~/.config/hypr/scripts/brightness
|
$backlight = ~/.config/hypr/scripts/brightness
|
||||||
$screenshot = ~/.config/hypr/scripts/screenshot
|
|
||||||
$lockscreen = ~/.config/hypr/scripts/lockscreen
|
$lockscreen = ~/.config/hypr/scripts/lockscreen
|
||||||
$wlogout = ~/.config/hypr/scripts/wlogout
|
$wlogout = ~/.config/hypr/scripts/wlogout
|
||||||
$colorpicker = ~/.config/hypr/scripts/colorpicker
|
$colorpicker = ~/.config/hypr/scripts/colorpicker
|
||||||
@@ -137,9 +136,9 @@ bind=,XF86AudioPlay,exec,mpc toggle
|
|||||||
bind=,XF86AudioStop,exec,mpc stop
|
bind=,XF86AudioStop,exec,mpc stop
|
||||||
|
|
||||||
# -- Screenshots --
|
# -- Screenshots --
|
||||||
bind=,Print,exec,$screenshot --now
|
bind=,Print,exec,hyprshot -m output -o ~/Pictures/Screenshots -- imv
|
||||||
bind=SUPER,Print,exec,$screenshot --win
|
bind=SUPER,Print,exec,hyprshot -m window -o ~/Pictures/Screenshots -- imv
|
||||||
bind=CTRL,Print,exec,$screenshot --area
|
bind=CTRL,Print,exec,hyprshot -m region -o ~/Pictures/Screenshots -- imv
|
||||||
|
|
||||||
# Focus
|
# Focus
|
||||||
bind=SUPER,left,movefocus,l
|
bind=SUPER,left,movefocus,l
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## Script to take screenshots with grim, slurp (in Wayland)
|
|
||||||
|
|
||||||
iDIR="$HOME/.config/hypr/mako/icons"
|
|
||||||
|
|
||||||
time=$(date +%Y-%m-%d-%H-%M-%S)
|
|
||||||
dir="$(xdg-user-dir PICTURES)/Screenshots" # need
|
|
||||||
file="Screenshot_${time}_${RANDOM}.png"
|
|
||||||
|
|
||||||
# notify and view screenshot
|
|
||||||
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png"
|
|
||||||
notify_view () {
|
|
||||||
${notify_cmd_shot} "Copied to clipboard."
|
|
||||||
imv ${dir}/"$file"
|
|
||||||
if [[ -e "$dir/$file" ]]; then
|
|
||||||
${notify_cmd_shot} "Screenshot Saved."
|
|
||||||
else
|
|
||||||
${notify_cmd_shot} "Screenshot Deleted."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# take shots
|
|
||||||
shotnow () {
|
|
||||||
cd ${dir} && grim - | tee "$file" | wl-copy
|
|
||||||
notify_view
|
|
||||||
}
|
|
||||||
|
|
||||||
shotwin () {
|
|
||||||
w_pos=$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1)
|
|
||||||
w_size=$(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)
|
|
||||||
cd ${dir} && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
|
|
||||||
notify_view
|
|
||||||
}
|
|
||||||
|
|
||||||
shotarea () {
|
|
||||||
cd ${dir} && grim -g "$(slurp -b 1B1F28CC -c E06B74ff -s C778DD0D -w 2)" - | tee "$file" | wl-copy
|
|
||||||
notify_view
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ ! -d "$dir" ]]; then
|
|
||||||
mkdir -p "$dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$1" == "--now" ]]; then
|
|
||||||
shotnow
|
|
||||||
elif [[ "$1" == "--area" ]]; then
|
|
||||||
shotarea
|
|
||||||
elif [[ "$1" == "--win" ]]; then
|
|
||||||
shotwin
|
|
||||||
else
|
|
||||||
echo -e "Available Options : --now --win --area"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
{pkgs, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
pkgs-unstable,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
waybar # the status bar
|
waybar # the status bar
|
||||||
swaybg # the wallpaper
|
swaybg # the wallpaper
|
||||||
@@ -8,10 +12,10 @@
|
|||||||
wl-clipboard # copying and pasting
|
wl-clipboard # copying and pasting
|
||||||
hyprpicker # color picker
|
hyprpicker # color picker
|
||||||
|
|
||||||
wf-recorder # creen recording
|
pkgs-unstable.hyprshot # screen shot
|
||||||
grim # taking screenshots
|
grim # taking screenshots
|
||||||
slurp # selecting a region to screenshot
|
slurp # selecting a region to screenshot
|
||||||
# TODO replace by `flameshot gui --raw | wl-copy`
|
wf-recorder # creen recording
|
||||||
|
|
||||||
mako # the notification daemon, the same as dunst
|
mako # the notification daemon, the same as dunst
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user