diff --git a/users/profiles/cli/default.nix b/users/profiles/cli/default.nix index 807f12f7..2d56c6ee 100644 --- a/users/profiles/cli/default.nix +++ b/users/profiles/cli/default.nix @@ -38,7 +38,6 @@ file lsof atool - inotify-tools strace zip unzip @@ -50,15 +49,12 @@ less gdb xxd - kitty taskwarrior yt-dlp gnupg syncthing dijo - flameshot #ssb-patchwork - libreoffice fontconfig pandoc ]; diff --git a/users/profiles/desktop/bin/screenshot b/users/profiles/desktop/bin/screenshot index a31c1bad..6e0e8bc3 100755 --- a/users/profiles/desktop/bin/screenshot +++ b/users/profiles/desktop/bin/screenshot @@ -1,3 +1,53 @@ -#!/usr/bin/env sh -scrot ~/screenshots/%b%d::%H%M%S.png; -xclip -i < ~/screenshots/%b%d::%H%M%S.png; +#!/usr/bin/env bash + +timer=5 + +# Options +select="麗" +window="类" +screen="" +delay="" +cancel="" + +# Variable passed to rofi +options="$select\n$window\n$screen\n$delay\n$cancel" + +rofi_command="rofi -theme theme/screenshotsmenu.rasi" + +setFilename() { + directory="/tmp/" + filename="IMG_$(date +%Y%m%d_%H%M%S).jpg" + filepath=$directory$filename +} + +notify() { + dunstify "Screenshot saved and copied to clipboard" -i accessories-screenshot +} + +chosen="$(echo -e "$options" | $rofi_command -dmenu)" +case $chosen in + $select) + setFilename + maim -Buosd 0.25 \ + | tee $filepath | xclip -selection c -t image/png + notify + ;; + $window) + setFilename + maim -Buod 0.25 -i $(xdotool getactivewindow) \ + | tee $filepath | xclip -selection c -t image/png + notify + ;; + $screen) + setFilename + maim -Buod 0.25 \ + | tee $filepath | xclip -selection c -t image/png + notify + ;; + $delay) + setFilename + maim -Buod $timer \ + | tee $filepath | xclip -selection c -t image/png + notify + ;; +esac diff --git a/users/profiles/desktop/default.nix b/users/profiles/desktop/default.nix index d124f153..64e812be 100644 --- a/users/profiles/desktop/default.nix +++ b/users/profiles/desktop/default.nix @@ -26,6 +26,10 @@ in qt5ct gtk-engine-murrine gtk_engines + maim + kitty + libreoffice + inotify-tools ]; xresources.properties = { diff --git a/users/profiles/desktop/rofi/iconmenu.rasi b/users/profiles/desktop/rofi/iconmenu.rasi new file mode 100644 index 00000000..e85447f5 --- /dev/null +++ b/users/profiles/desktop/rofi/iconmenu.rasi @@ -0,0 +1,43 @@ +@import "config.rasi" + +* { + icon-font : "Iosevka Nerd Font Mono 24"; + text-color : @fg; + background-color : @bg; + + margin : 0px; + padding : 0px; + spacing : 0px; +} + +window { + location : north; + children : [mainbox]; +} + +mainbox { + children : [listview]; +} + +listview { + columns : 8; + lines : 1; +} + +element { + children : [element-text]; +} + +element-text { + font : @icon-font; + cursor : pointer; + padding : 4px; + + vertical-align : 0.5; + horizontal-align : 0.5; +} + +element-text selected { + text-color : @bg; + background-color : @accent; +} diff --git a/users/profiles/desktop/rofi/screenshotmenu.rasi b/users/profiles/desktop/rofi/screenshotmenu.rasi new file mode 100644 index 00000000..5b1778dd --- /dev/null +++ b/users/profiles/desktop/rofi/screenshotmenu.rasi @@ -0,0 +1,5 @@ +@import "iconmenu.rasi" + +* { icon-font: "Iosevka Nerd Font Mono 24"; } + +window { width: 264px; }