Use satty to edit screenshots

This commit is contained in:
Paul-Henri Froidmont 2025-10-28 18:18:36 +01:00
parent 99180536b1
commit 22daf9d874
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
2 changed files with 384 additions and 476 deletions

View file

@ -1,39 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.modules.desktop.flameshot;
in
{
options.modules.desktop.flameshot = {
enable = lib.my.mkBoolOpt false;
};
config = lib.mkIf cfg.enable {
home-manager.users.${config.user.name} =
{ config, ... }:
{
services.flameshot = {
enable = true;
package = pkgs.flameshot;
settings = {
General = {
showStartupLaunchMessage = false;
disabledTrayIcon = true;
showHelp = false;
showDesktopNotification = false;
filenamePattern = "%F_%T";
savePath = "${config.home.homeDirectory}/Pictures/Screenshots";
savePathFixed = true;
saveAfterCopy = true;
uiColor = "#83A598";
};
};
};
home.packages = [ pkgs.grim ];
};
};
}

View file

@ -8,6 +8,7 @@
let
cfg = config.modules.desktop.wm;
term = "${config.home-manager.users.${config.user.name}.programs.kitty.package}/bin/kitty";
wallpaper = config.modules.desktop.wallpaper;
in
{
options.modules.desktop.wm = {
@ -27,7 +28,6 @@ in
zsh.enable = true;
dunst.enable = true;
htop.enable = true;
flameshot.enable = true;
};
hardware = {
audio.enable = true;
@ -35,85 +35,9 @@ in
apps.rofi.enable = true;
};
home-manager.users.${config.user.name} = {
wayland.windowManager.sway = {
enable = true;
systemd.enable = true;
xwayland = true;
config = {
modifier = "Mod4";
input = {
"type:keyboard" = {
"xkb_layout" = "fr";
"xkb_variant" = "nodeadkeys";
"xkb_options" = "caps:escape";
"xkb_numlock" = "enabled";
};
};
keybindings = {
"mod4+Return" = "exec ${term}";
"mod4+c" = "kill";
"mod4+Shift+r" = "reload";
"mod4+Shift+c" = "exit";
"mod4+Shift+a" = "exec ${term} -e pulsemixer";
"mod4+w" = "exec firefox";
"mod4+r" = "exec ${term} -e yazi";
"mod4+e" = "exec emacsclient -c";
"mod4+n" = "exec emacsclient -c --eval '(elfeed)'";
"mod4+i" = "exec ${term} -e htop";
"mod4+m" = "exec ${term} -e ncmpcpp";
"mod4+v" = "exec ${term} -e ncmpcpp -s visualizer";
"mod4+t" = "floating toggle";
"mod4+d" = "exec rofi -show drun -show-icons";
"mod4+Shift+p" = "exec rofi -show p -modi p:rofi-power-menu";
"mod4+h" = "focus left";
"mod4+j" = "focus down";
"mod4+k" = "focus up";
"mod4+l" = "focus right";
"mod4+Shift+h" = "move left";
"mod4+Shift+j" = "move down";
"mod4+Shift+k" = "move up";
"mod4+Shift+l" = "move right";
"mod4+f" = "fullscreen";
"XF86AudioRaiseVolume" = "exec pulsemixer --change-volume +1";
"XF86AudioLowerVolume" = "exec pulsemixer --change-volume -1";
"XF86AudioMute" = "exec pulsemixer --toggle-mute";
"XF86AudioPlay" = "exec mpc toggle";
"XF86AudioPause" = "exec mpc toggle";
"XF86AudioNext" = "exec mpc next";
"XF86AudioPrev" = "exec mpc prev";
"mod4+p" = "exec mpc toggle";
};
keycodebindings = {
"mod4+10" = "workspace number 1";
"mod4+11" = "workspace number 2";
"mod4+12" = "workspace number 3";
"mod4+13" = "workspace number 4";
"mod4+14" = "workspace number 5";
"mod4+15" = "workspace number 6";
"mod4+16" = "workspace number 7";
"mod4+17" = "workspace number 8";
"mod4+18" = "workspace number 9";
"mod4+19" = "workspace number 0";
"mod4+Shift+10" = "move container to workspace number 1";
"mod4+Shift+11" = "move container to workspace number 2";
"mod4+Shift+12" = "move container to workspace number 3";
"mod4+Shift+13" = "move container to workspace number 4";
"mod4+Shift+14" = "move container to workspace number 5";
"mod4+Shift+15" = "move container to workspace number 6";
"mod4+Shift+16" = "move container to workspace number 7";
"mod4+Shift+17" = "move container to workspace number 8";
"mod4+Shift+18" = "move container to workspace number 9";
"mod4+Shift+19" = "move container to workspace number 0";
};
};
};
home-manager.users.${config.user.name} =
{ config, ... }:
{
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = true;
@ -304,8 +228,8 @@ in
", XF86MonBrightnessDown, exec, light -U 5"
", XF86MonBrightnessUp, exec, light -A 5"
# ", Print, exec, flameshot full"
", Print, exec, env QT_SCREEN_SCALE_FACTORS=0.66666666 flameshot gui"
", Print, exec, grim -g \"$(slurp)\" - | satty -f -"
"SHIFT, Print, exec, grim - | satty -f -"
];
bindm = [
@ -315,7 +239,7 @@ in
];
exec-once = [
"${pkgs.swaybg}/bin/swaybg --image ${config.modules.desktop.wallpaper} --mode fill"
"${pkgs.swaybg}/bin/swaybg --image ${wallpaper} --mode fill"
"keepassxc"
];
@ -444,11 +368,34 @@ in
package = pkgs.waybar.override { wireplumberSupport = false; };
};
programs.satty = {
enable = true;
settings = {
general = {
output-filename = "${config.home.homeDirectory}/Pictures/Screenshots/satty_%Y-%m-%d_%H-%M-%S.png";
copy-command = "wl-copy";
actions-on-enter = [
"save-to-clipboard"
"save-to-file"
"exit"
];
early-exit = true;
save-after-copy = true;
};
};
};
home.activation.ensureScreenshotsDir = ''
${pkgs.coreutils}/bin/mkdir -p "$HOME/Pictures/Screenshots"
'';
home = {
packages = with pkgs; [
wlr-randr
wl-clipboard
wdisplays
grim
slurp
];
};