From 0b26225806c17b0c9b99bc495635c6391aa9231a Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Thu, 20 Jun 2024 16:34:13 +0200 Subject: [PATCH] [flameshot] feat: flameshot > grimblast hacky script --- apps/screenshot/screenshot.sh | 61 --------------------- nix/home/default.nix | 1 + nix/home/flameshot/default.nix | 1 + nix/home/flameshot/flameshot.nix | 19 +++++++ nix/home/hyprland/hyprland-bindings.nix | 3 +- nix/home/hyprland/hyprland-execution.nix | 3 + nix/home/hyprland/hyprland-window_rules.nix | 4 ++ nix/systems/packages.nix | 1 + 8 files changed, 30 insertions(+), 63 deletions(-) delete mode 100755 apps/screenshot/screenshot.sh create mode 100644 nix/home/flameshot/default.nix create mode 100644 nix/home/flameshot/flameshot.nix diff --git a/apps/screenshot/screenshot.sh b/apps/screenshot/screenshot.sh deleted file mode 100755 index b2fa61e..0000000 --- a/apps/screenshot/screenshot.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -# commands -wofi_command="wofi -l 5" -grimblast="grimblast --notify" -satty="satty --filename - --fullscreen --output-filename /home/simon/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png" - - -# buttons -area="🖥️ Capture area" -area_5="🖥️ Capture area in 5 seconds" -screen="🖥️ Capture whole screen" -screen_5="🖥️ Capture whole screen in 10 seconds" -window="🖥️ Capture active window" - - -# take shots -screenshot_area() { - $grimblast save area - | $satty -} - -screenshot_area_5() { - sleep 5 - $grimblast save area - | $satty -} - -screenshot_full() { - $grimblast save screen - | $satty -} - -screenshot_full_5() { - sleep 5 - $grimblast save screen - | $satty -} - -screenshot_window() { - $grimblast save active - | $satty -} - - -# start wofi -options="$area\n$area_5\n$screen\n$screen_5\n$window" -chosen="$(echo -e "$options" | $wofi_command -p 'Say cheese ...' -dmenu --no-action --width=400 --height=302 -selected-row 0 --style=/home/simon/.dotfiles/apps/wofi/style.css)" -sleep 1 -case $chosen in - $area) - screenshot_area - ;; - $area_5) - screenshot_area_5 - ;; - $screen) - screenshot_full - ;; - $screen_5) - screenshot_full_5 - ;; - $window) - screenshot_window - ;; -esac diff --git a/nix/home/default.nix b/nix/home/default.nix index 5729f32..7ac3bdb 100644 --- a/nix/home/default.nix +++ b/nix/home/default.nix @@ -5,6 +5,7 @@ imports = [ ./alacritty ./clipse + ./flameshot ./git ./hyprland ./mako diff --git a/nix/home/flameshot/default.nix b/nix/home/flameshot/default.nix new file mode 100644 index 0000000..bf54d27 --- /dev/null +++ b/nix/home/flameshot/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./flameshot.nix ]; } diff --git a/nix/home/flameshot/flameshot.nix b/nix/home/flameshot/flameshot.nix new file mode 100644 index 0000000..50df442 --- /dev/null +++ b/nix/home/flameshot/flameshot.nix @@ -0,0 +1,19 @@ +{ config, ... }: +{ + + # include flameshot configs + home.file.".config/flameshot/flameshot.ini".text = '' + + [General] + contrastOpacity=188 + contrastUiColor=#528bff + checkForUpdates=false + drawFontSize=8 + drawThickness=3 + uiColor=#043a8b + savePath=/home/simon/Pictures/Screenshots/ + showHelp=false + showStartupLaunchMessage=false + + ''; +} diff --git a/nix/home/hyprland/hyprland-bindings.nix b/nix/home/hyprland/hyprland-bindings.nix index 7dcd1ef..96914d0 100644 --- a/nix/home/hyprland/hyprland-bindings.nix +++ b/nix/home/hyprland/hyprland-bindings.nix @@ -27,8 +27,7 @@ "$mainMod, N, exec, alacritty --class nmtui --command ~/.dotfiles/apps/hyprland/nmtui.sh" "$mainMod, P, exec, ~/.dotfiles/apps/hyprland/hypridle.sh toggle" "$mainMod, Q, killactive" - "$mainMod, S, exec, ~/.dotfiles/apps/screenshot/screenshot.sh area" - "ALT SHIFT, S, exec, ~/.dotfiles/apps/screenshot/screenshot.sh screen" + "$mainMod, S, exec, XDG_CURRENT_DESKTOP=sway flameshot gui -c -p /home/simon/Pictures/Screenshots" "$mainMod, T, exec, alacritty --class nostt --command nostt" "$mainMod, V, togglefloating" diff --git a/nix/home/hyprland/hyprland-execution.nix b/nix/home/hyprland/hyprland-execution.nix index c3b73ad..5c77580 100644 --- a/nix/home/hyprland/hyprland-execution.nix +++ b/nix/home/hyprland/hyprland-execution.nix @@ -52,6 +52,9 @@ # nextcloud desktop "~/.dotfiles/apps/hyprland/startup/nextcloud_desktop.sh" + # flameshot + "XDG_CURRENT_DESKTOP=sway flameshot" + # start default apps "[workspace 1 silent] bitwarden" "[workspace 2 silent] firefox" diff --git a/nix/home/hyprland/hyprland-window_rules.nix b/nix/home/hyprland/hyprland-window_rules.nix index 43e56db..b10fac3 100644 --- a/nix/home/hyprland/hyprland-window_rules.nix +++ b/nix/home/hyprland/hyprland-window_rules.nix @@ -37,6 +37,10 @@ "size 1000 800, class:(clipse)" "move center, class:(clipse)" + # flameshot + "float, class:^(flameshot)$" + "noanim, class:^(flameshot)$" + # save as "float, title:(Save As)" "size 1000 800, title:(Save As)" diff --git a/nix/systems/packages.nix b/nix/systems/packages.nix index eb30d81..5f1399b 100644 --- a/nix/systems/packages.nix +++ b/nix/systems/packages.nix @@ -22,6 +22,7 @@ # hyprland adwaita-qt brightnessctl + flameshot grim grimblast hyprlock