Screenshot: Update sway config
This commit is contained in:
parent
c68ee16732
commit
b671d9d203
|
@ -118,12 +118,6 @@ def take_subcommand(args):
|
|||
case _:
|
||||
raise Exception(f"Region '{args.region}' not recognized")
|
||||
|
||||
match args.drop_shadow:
|
||||
case "light":
|
||||
add_drop_shadow(save_path, save_path, DS_BG_LIGHT, DS_SHADOW_LIGHT)
|
||||
case "dark":
|
||||
add_drop_shadow(save_path, save_path, DS_BG_DARK, DS_SHADOW_DARK)
|
||||
|
||||
if args.clipboard:
|
||||
copy_to_clipboard(save_path)
|
||||
|
||||
|
@ -135,6 +129,9 @@ def edit_subcommand(args):
|
|||
ext = args.extension if args.extension else 'avif'
|
||||
og_path, edit_path = get_edit_path(ext)
|
||||
|
||||
if args.overwrite:
|
||||
edit_path = og_path
|
||||
|
||||
# Drop shadow
|
||||
match args.drop_shadow:
|
||||
case "light":
|
||||
|
@ -215,17 +212,6 @@ subcommands = parser.add_subparsers(dest='subcommand', required=True);
|
|||
# Take ====
|
||||
take_subcmd = subcommands.add_parser(
|
||||
"take", help="Takes a screenshot. (Default is full screen)");
|
||||
take_subcmd.add_argument(
|
||||
'-c', '--clipboard',
|
||||
action='store_true',
|
||||
help='Save the screenshot to your clipboard',
|
||||
);
|
||||
take_subcmd.add_argument(
|
||||
'-d', '--drop-shadow',
|
||||
action='store',
|
||||
choices=['light', 'dark'],
|
||||
help='Apply a drop shadow to the final image with a light/dark background',
|
||||
);
|
||||
|
||||
# Different possible screenshot regions
|
||||
region = take_subcmd.add_subparsers(dest='region', required=True);
|
||||
|
@ -242,6 +228,22 @@ exact.add_argument(
|
|||
help="Exact dimensions of screenshot: 'x,y width,height'"
|
||||
);
|
||||
|
||||
full.add_argument(
|
||||
'-c', '--clipboard',
|
||||
action='store_true',
|
||||
help='Save the screenshot to your clipboard',
|
||||
);
|
||||
exact.add_argument(
|
||||
'-c', '--clipboard',
|
||||
action='store_true',
|
||||
help='Save the screenshot to your clipboard',
|
||||
);
|
||||
select.add_argument(
|
||||
'-c', '--clipboard',
|
||||
action='store_true',
|
||||
help='Save the screenshot to your clipboard',
|
||||
);
|
||||
|
||||
full.add_argument(
|
||||
"file", nargs='?', type=Path,
|
||||
help="Save the screenshot to this file name"
|
||||
|
@ -286,6 +288,11 @@ edit_subcmd.add_argument(
|
|||
metavar="<ext>",
|
||||
help='Change image extension and image type saved',
|
||||
);
|
||||
edit_subcmd.add_argument(
|
||||
'--overwrite',
|
||||
action='store_true',
|
||||
help='Overwrite original image with the edited image',
|
||||
);
|
||||
edit_subcmd.add_argument(
|
||||
"file", nargs='?', type=Path,
|
||||
help="Save the screenshot to this file name"
|
||||
|
|
35
sway/config
35
sway/config
|
@ -53,6 +53,7 @@ set $screenshot_sound ffplay -nodisp -autoexit -v error ~/.config/sway/screensho
|
|||
|
||||
# Duplicate screenshot path, for quick uploads
|
||||
set $screenshot_tmp /dev/shm/screenshot_shm.png
|
||||
set $screenshot_script ~/.configs_pointer/bin/screenshot_wayland.py
|
||||
|
||||
#╔─────────────────────────────────────────────────────────────────────────────╗
|
||||
#│ Pαηεs αηd cδηταiηεrs |
|
||||
|
@ -295,30 +296,28 @@ bindsym $mod2+Escape exec ~/.config/sway/sway_exit.sh
|
|||
|
||||
# Screenshots ====
|
||||
bindsym $mod2+6 mode "screenshots"
|
||||
bindsym $mod2+5 mode "screenshots"; exec ~/.configs_pointer/bin/screenshot_wayland.py take -c select $screenshot_tmp && $screenshot_sound
|
||||
bindsym $mod2+4 mode "screenshots"; exec ~/.configs_pointer/bin/screenshot_wayland.py \
|
||||
take -c -d "$(colo.sh -t)" exact "$(~/.config/sway/window_dimensions.py)" $screenshot_tmp && $screenshot_sound
|
||||
bindsym $mod2+5 mode "screenshots"; exec $screenshot_script take select -c $screenshot_tmp && $screenshot_sound
|
||||
bindsym $mod2+4 mode "screenshots"; exec $screenshot_script take exact "$(~/.config/sway/window_dimensions.py)" && \
|
||||
$screenshot_script edit -c --overwrite -d "$(colo.sh -t)" -e png $screenshot_tmp && $screenshot_sound
|
||||
|
||||
mode "screenshots" {
|
||||
# Screenshooting in processing "steps"
|
||||
# 1. Get screenshot
|
||||
bindsym a exec ~/.configs_pointer/bin/screenshot_wayland.py take -c select \
|
||||
$screenshot_tmp && $screenshot_sound
|
||||
bindsym f exec ~/.configs_pointer/bin/screenshot_wayland.py take -c full \
|
||||
$screenshot_tmp && $screenshot_sound
|
||||
bindsym m mode "default"; exec ~/.configs_pointer/bin/screenshot_wayland.py markup
|
||||
bindsym a exec $screenshot_script take select -c $screenshot_tmp && $screenshot_sound
|
||||
bindsym f exec $screenshot_script take full -c $screenshot_tmp && $screenshot_sound
|
||||
bindsym m mode "default"; exec $screenshot_script markup
|
||||
|
||||
# 2. Downsize the screenshot, since 4k is too big
|
||||
bindsym 1 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '10%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 2 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '20%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 3 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '30%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 4 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '40%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 5 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '50%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 6 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '60%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 7 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '70%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 8 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '80%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 9 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '90%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 0 exec ~/.configs_pointer/bin/screenshot_wayland.sh --resize '100%' --clipboard --extension png $screenshot_tmp && $screenshot_sound
|
||||
bindsym 1 exec $screenshot_script edit -c -e png r '10%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 2 exec $screenshot_script edit -c -e png r '20%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 3 exec $screenshot_script edit -c -e png r '30%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 4 exec $screenshot_script edit -c -e png r '40%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 5 exec $screenshot_script edit -c -e png r '50%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 6 exec $screenshot_script edit -c -e png r '60%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 7 exec $screenshot_script edit -c -e png r '70%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 8 exec $screenshot_script edit -c -e png r '80%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 9 exec $screenshot_script edit -c -e png r '90%' $screenshot_tmp && $screenshot_sound
|
||||
bindsym 0 exec $screenshot_script edit -c -e png r '100%' $screenshot_tmp && $screenshot_sound
|
||||
|
||||
# OR compress image
|
||||
bindsym space mode "shrink_screenshots"
|
||||
|
|
Loading…
Reference in a new issue