added menu-qalc

This commit is contained in:
Schrottkatze 2022-09-02 20:28:50 +02:00
parent e4b15a3b1a
commit bce7db5f8d
11 changed files with 180 additions and 76 deletions

View file

@ -2,71 +2,14 @@
let
cfg = config.jade.desktop;
# Screenshot scripts {{{
window-screenshot = pkgs.writeShellScriptBin "window-screenshot.sh" ''
unset x y w h
eval $(xwininfo -id $(xdotool getactivewindow) |
sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
-e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
-e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
-e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
echo -n "''$x ''$y ''$w ''$h"
flameshot gui --region "''${w}x''${h}+''${x}+''${y}" -c -p ~/Pictures/screenshots/
'';
# }}}
# Desktop ctl {{{
desktop-ctl = pkgs.writeShellScriptBin "desktop-ctl.sh" ''
items="lock screen;log out;toggle picom;shut down;reboot;update all"
selection=$(echo $items | rofi -sep ";" -dmenu)
case $selection in
"lock screen")
i3lock-fancy
;;
"log out")
pkill i3
;;
"toggle picom")
pkill picom || picom --experimental-backend -b
;;
"shut down")
shutdown now
;;
"reboot")
systemctl reboot
;;
esac
'';
# }}}
# Macro scripts {{{
em-record = pkgs.writeShellScriptBin "em-record.sh" ''
register=$(ls $HOME/xmacros | rofi -dmenu)
count=$(echo "2;5;10;20;50;100" | rofi -dmenu -sep ";" -l 5)
for i in $(seq $count); do
echo $i
xmacroplay "$DISPLAY" < $HOME/xmacros/$register
done
register=$(ls $HOME/xmacros | rofi -dmenu)
xmacrorec2 > $HOME/xmacros/$register
'';
em-play = pkgs.writeShellScriptBin "em-play.sh" ''
register=$(ls $HOME/xmacros | rofi -dmenu)
xmacroplay "$DISPLAY" < $HOME/xmacros/$register
'';
em-play-loop = pkgs.writeShellScriptBin "em-play-loop.sh" ''
register=$(ls $HOME/xmacros | rofi -dmenu)
count=$(echo "2;5;10;20;50;100" | rofi -dmenu -sep ";" -l 5)
for i in $(seq $count); do
echo $i
xmacroplay "$DISPLAY" < $HOME/xmacros/$register
done
'';
# }}}
window-screenshot = pkgs.writeShellScriptBin "window-screenshot.sh" (builtins.readFile ../scripts/desktop/window-screenshot.sh);
desktop-ctl = pkgs.writeShellScriptBin "desktop-ctl.sh" (builtins.readFile ../scripts/desktop/desktop-ctl.sh);
em-record = pkgs.writeShellScriptBin "em-record.sh" (builtins.readFile ../scripts/desktop/macros/record.sh);
em-play = pkgs.writeShellScriptBin "em-play.sh" (builtins.readFile ../scripts/desktop/macros/play.sh);
em-play-loop = pkgs.writeShellScriptBin "em-play-loop.sh" (builtins.readFile ../scripts/desktop/macros/play-loop.sh);
ocr-screenshot = pkgs.writeShellScriptBin "ocr-screenshot.sh" (builtins.readFile ../scripts/desktop/ocr-screenshot.sh);
# rofi calculator copied from https://github.com/barbuk/menu-qalc
menu-qalc = pkgs.writeShellScriptBin "menu-qalc" (builtins.readFile ../scripts/desktop/menu-qalc.sh);
in with lib; {
options.jade.desktop = {
enable = mkEnableOption "Enable the i3 setup";
@ -79,12 +22,13 @@ in with lib; {
i3lock-fancy rofi rofimoji volumeicon feh xorg.xinput dunst
arandr lxappearance gruvbox-dark-gtk gruvbox-dark-icons-gtk
gruvterial-theme flameshot tesseract5 imagemagick xclip polybar kitty
xkeysnail gtk-engine-murrine playerctl xmacro
xkeysnail gtk-engine-murrine playerctl xmacro pa_applet brightnessctl
libqalculate # needed by menu-qalc
# custom scripts
window-screenshot desktop-ctl em-record em-play em-play-loop
pa_applet
brightnessctl gruvbox-dark-icons-gtk
gruvbox-dark-gtk
window-screenshot desktop-ctl em-record em-play em-play-loop ocr-screenshot menu-qalc
# themes
gruvbox-dark-gtk gruvbox-dark-icons-gtk
];
# i3 {{{
xsession = {
@ -162,13 +106,13 @@ in with lib; {
"${mod}+w" = "exec window-screenshot.sh";
"${mod}+s" = "exec flameshot gui -c -p $HOME/Pictures/screenshots";
"${mod}+a" = "exec flameshot screen -c -p $HOME/Pictures/screenshots";
"${mod}+t" = "exec ocr-screenshot.sh";
# rofi fuckery
"${mod}+d" = "exec --no-startup-id rofi -show drun";
"${mod}+space" = "exec --no-startup-id -show window";
"${mod}+i" = "exec --no-startup-id rofimoji -f alchemical_symbols emojis braille_patterns box_drawing chess_symbols emoticons geometric_shapes gothic greek_extended math mathematical_alphanumeric_symbols mathematical_operators miscellaneous_symbols miscellaneous_mathematical_symbols-a miscellaneous_mathematical_symbols-b miscellaneous_symbols_and_arrows miscellaneous_symbols_and_pictographs miscellaneous_technical modi modifier_tone_letters musical_symbols nerd_font number_forms shorthand_format_controls specials variation_selectors vertical_forms -a copy";
"${mod}+Shift+e" = "exec --no-startup-id desktop-ctl.sh";
# rofi calculator, https://github.com/barbuk/menu-qalc
# "${mod}+m" = "exec --no-startup-id ="
"${mod}+m" = "exec --no-startup-id menu-qalc";
# audio
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status";