home, scripts: use fetchers
This commit is contained in:
parent
ccb2708096
commit
4cfc603a0e
5 changed files with 17 additions and 121 deletions
|
@ -9,7 +9,7 @@ $wp = ~/.local/bin/wrapped-swww
|
||||||
$dwp = ~/.local/bin/wrapped-mpvpaper
|
$dwp = ~/.local/bin/wrapped-mpvpaper
|
||||||
$changevolume = ~/.local/bin/wrapped-pamixer # use swayosd instead
|
$changevolume = ~/.local/bin/wrapped-pamixer # use swayosd instead
|
||||||
$changebrightness = ~/.local/bin/wrapped-brightnessctl
|
$changebrightness = ~/.local/bin/wrapped-brightnessctl
|
||||||
$screenshot = ~/.local/bin/wrapped-grim
|
$screenshot = ~/.local/bin/screenshot
|
||||||
$inputfix = ~/.local/bin/minecraft-inputfix
|
$inputfix = ~/.local/bin/minecraft-inputfix
|
||||||
$video_path = ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/workshop/content/431960
|
$video_path = ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/workshop/content/431960
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ bind = SUPER SHIFT, L, exec, rofi -modi "power-men
|
||||||
# screenshot
|
# screenshot
|
||||||
bind = ,Print, exec, $screenshot fullscreen
|
bind = ,Print, exec, $screenshot fullscreen
|
||||||
bind = SUPER SHIFT, S, exec, $screenshot region
|
bind = SUPER SHIFT, S, exec, $screenshot region
|
||||||
bind = ALT SHIFT, S, exec, $screenshot region edit
|
bind = ALT SHIFT, S, exec, $screenshot swappy
|
||||||
|
|
||||||
# wallpaper switching
|
# wallpaper switching
|
||||||
bind = SHIFT ALT, 1, exec, $wp /usr/share/backgrounds/odin.jpg # pkg: elementary-wallpapers
|
bind = SHIFT ALT, 1, exec, $wp /usr/share/backgrounds/odin.jpg # pkg: elementary-wallpapers
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
inherit (config.wayland.windowManager.sway.config) modifier;
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
||||||
setBrightness = "/home/guanranwang/.local/bin/wrapped-brightnessctl";
|
setBrightness = "/home/guanranwang/.local/bin/wrapped-brightnessctl";
|
||||||
setVolume = "/home/guanranwang/.local/bin/wrapped-pamixer";
|
setVolume = "/home/guanranwang/.local/bin/wrapped-pamixer";
|
||||||
screenshot = "/home/guanranwang/.local/bin/wrapped-grim";
|
screenshot = "/home/guanranwang/.local/bin/screenshot";
|
||||||
in {
|
in {
|
||||||
### Sway itself
|
### Sway itself
|
||||||
# Window
|
# Window
|
||||||
|
@ -148,9 +148,8 @@
|
||||||
|
|
||||||
# Screenshot
|
# Screenshot
|
||||||
"${modifier}+Shift+s" = "exec ${screenshot} region";
|
"${modifier}+Shift+s" = "exec ${screenshot} region";
|
||||||
"${modifier}+Control+Shift+s" = "exec ${screenshot} region edit";
|
|
||||||
"Print" = "exec ${screenshot} fullscreen";
|
"Print" = "exec ${screenshot} fullscreen";
|
||||||
"Print+Control" = "exec ${screenshot} fullscreen edit";
|
"Print+Control" = "exec ${screenshot} swappy";
|
||||||
|
|
||||||
# Fn keys
|
# Fn keys
|
||||||
"XF86MonBrightnessUp" = "exec ${setBrightness} up";
|
"XF86MonBrightnessUp" = "exec ${setBrightness} up";
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Original script based on some early version of https://github.com/moverest/sway-interactive-screenshot
|
|
||||||
# modified for use with key bindings. For now supports sway & Hyprland.
|
|
||||||
|
|
||||||
SWAY=$(echo "$SWAYSOCK")
|
|
||||||
HYPR=$(echo "$HYPRLAND_INSTANCE_SIGNATURE")
|
|
||||||
if [[ -n "$SWAY" && -n "$HYPR" ]]; then
|
|
||||||
echo "This script only works on sway or Hyprland, terminating.";
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
list_geometry()
|
|
||||||
{
|
|
||||||
swaymsg -t get_tree | jq -r '.. | try select(.'"$1"' and .pid) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)''"'
|
|
||||||
}
|
|
||||||
|
|
||||||
list_geometry_hypr()
|
|
||||||
{
|
|
||||||
hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])''"'
|
|
||||||
}
|
|
||||||
|
|
||||||
CHOICE=$1
|
|
||||||
EDIT=$2
|
|
||||||
DIR=${SCREENSHOT_DIR:=~/Pictures/Screenshots}
|
|
||||||
|
|
||||||
mkdir -p "$DIR"
|
|
||||||
|
|
||||||
if [[ -n "$SWAY" ]]; then
|
|
||||||
FOCUSED=$(list_geometry focused)
|
|
||||||
FILENAME="${DIR/#\~/$HOME}/$(date +'%Y-%m-%d-%H%M%S_sway_screenshot.png')"
|
|
||||||
case $CHOICE in
|
|
||||||
fullscreen) grim "$FILENAME" ;;
|
|
||||||
region) grim -g "$(slurp)" "$FILENAME" ;;
|
|
||||||
focused) grim -g "$FOCUSED" "$FILENAME" ;;
|
|
||||||
display) grim -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')" "$FILENAME" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$HYPR" ]]; then
|
|
||||||
FOCUSED=$(list_geometry_hypr)
|
|
||||||
FILENAME="${DIR/#\~/$HOME}/$(date +'%Y-%m-%d-%H%M%S_hypr_screenshot.png')"
|
|
||||||
case $CHOICE in
|
|
||||||
fullscreen) grim "$FILENAME" ;;
|
|
||||||
region) grim -g "$(slurp)" "$FILENAME" ;;
|
|
||||||
focused) grim -g "$FOCUSED" "$FILENAME" ;;
|
|
||||||
display) grim -o "$(hyprctl -j monitors | jq -r '.[] | select(.focused) | .name')" "$FILENAME" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
wl-copy < "$FILENAME"
|
|
||||||
notify-send "Screenshot" "File saved as <i>'$FILENAME'</i> and copied to the clipboard." -i "$FILENAME"
|
|
||||||
|
|
||||||
if [[ "$EDIT" = "edit" ]]; then
|
|
||||||
swappy -f "$FILENAME"
|
|
||||||
fi
|
|
|
@ -1,56 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Original script based on some early version of https://github.com/moverest/sway-interactive-screenshot
|
|
||||||
# modified for use with key bindings. For now supports sway & Hyprland.
|
|
||||||
|
|
||||||
SWAY=$(echo "$SWAYSOCK")
|
|
||||||
HYPR=$(echo "$HYPRLAND_INSTANCE_SIGNATURE")
|
|
||||||
if [[ -n "$SWAY" && -n "$HYPR" ]]; then
|
|
||||||
echo "This script only works on sway or Hyprland, terminating.";
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
list_geometry()
|
|
||||||
{
|
|
||||||
swaymsg -t get_tree | jq -r '.. | try select(.'"$1"' and .pid) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)''"'
|
|
||||||
}
|
|
||||||
|
|
||||||
list_geometry_hypr()
|
|
||||||
{
|
|
||||||
hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])''"'
|
|
||||||
}
|
|
||||||
|
|
||||||
CHOICE=$1
|
|
||||||
EDIT=$2
|
|
||||||
DIR=${SCREENSHOT_DIR:=~/Pictures/Screenshots}
|
|
||||||
|
|
||||||
mkdir -p "$DIR"
|
|
||||||
|
|
||||||
if [[ -n "$SWAY" ]]; then
|
|
||||||
FOCUSED=$(list_geometry focused)
|
|
||||||
FILENAME="${DIR/#\~/$HOME}/$(date +'%Y-%m-%d-%H%M%S_sway_screenshot.png')"
|
|
||||||
case $CHOICE in
|
|
||||||
fullscreen) wayshot -f "$FILENAME" ;;
|
|
||||||
region) wayshot -s "$(slurp)" -f "$FILENAME" ;;
|
|
||||||
focused) wayshot -s "$FOCUSED" -f "$FILENAME" ;;
|
|
||||||
display) wayshot -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')" -f "$FILENAME" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$HYPR" ]]; then
|
|
||||||
FOCUSED=$(list_geometry_hypr)
|
|
||||||
FILENAME="${DIR/#\~/$HOME}/$(date +'%Y-%m-%d-%H%M%S_hypr_screenshot.png')"
|
|
||||||
case $CHOICE in
|
|
||||||
fullscreen) wayshot -f "$FILENAME" ;;
|
|
||||||
region) wayshot -s "$(slurp)" -f "$FILENAME" ;;
|
|
||||||
focused) wayshot -s "$FOCUSED" -f "$FILENAME" ;;
|
|
||||||
display) wayshot -o "$(hyprctl -j monitors | jq -r '.[] | select(.focused) | .name')" "$FILENAME" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
wl-copy < "$FILENAME"
|
|
||||||
notify-send "Screenshot" "File saved as <i>'$FILENAME'</i> and copied to the clipboard." -i "$FILENAME"
|
|
||||||
|
|
||||||
if [[ "$EDIT" = "edit" ]]; then
|
|
||||||
swappy -f "$FILENAME"
|
|
||||||
fi
|
|
|
@ -1,17 +1,26 @@
|
||||||
{pkgs, ...}: {
|
{pkgs, ...}: let
|
||||||
home.sessionPath = ["$HOME/.local/bin"];
|
binPATH = ".local/bin";
|
||||||
|
in {
|
||||||
|
home.sessionPath = ["$HOME/${binPATH}"];
|
||||||
home.file = {
|
home.file = {
|
||||||
".local/bin" = {
|
${binPATH} = {
|
||||||
source = ./bin;
|
source = ./bin;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
".local/bin/lofi" = {
|
"${binPATH}/lofi" = {
|
||||||
source = pkgs.fetchurl {
|
source = pkgs.fetchurl {
|
||||||
url = "https://raw.githubusercontent.com/lime-desu/bin/main/lofi";
|
url = "https://raw.githubusercontent.com/lime-desu/bin/main/lofi";
|
||||||
hash = "sha256-hT+S/rqOHUYnnFcSDFfQht4l1DGasz1L3wDHKUWLraA=";
|
hash = "sha256-hT+S/rqOHUYnnFcSDFfQht4l1DGasz1L3wDHKUWLraA=";
|
||||||
};
|
};
|
||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
|
"${binPATH}/screenshot" = {
|
||||||
|
source = pkgs.fetchurl {
|
||||||
|
url = "https://raw.githubusercontent.com/nwg-piotr/nwg-shell/c29e8eb4658a2613fb221ead0b101c75f457bcaf/scripts/screenshot";
|
||||||
|
hash = "sha256-Z/fWloz8pLHsvPTPOeBxnbMsGDRTY3G3l/uePQ3ZxjU=";
|
||||||
|
};
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue