From 2a8931b112fd5026c0c60c03ea76a2b9fa40d77a Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sat, 8 Oct 2022 21:10:17 -0700 Subject: [PATCH] Partially add screenshots and media controls --- README.md | 5 +++++ i3.nix | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d978c3..2d009ba 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,8 @@ - Install and setup service for yubioath-desktop - Install Anthy IME for Japanese input - Fix issue where wireless connection dies after suspend, even after restarting NetworkManager +- Fix screenshots + - Fix adding screenshots to clipboard with `xclip` + - Could be a system/user level issue? Try installing required packages without home manager + - Get area selection screenshots working in i3 (currently only when manually run) +- Fix/map media keys (already declared within [`i3.nix`](i3.nix) but are non-functional diff --git a/i3.nix b/i3.nix index 2b728ee..0cc1f60 100644 --- a/i3.nix +++ b/i3.nix @@ -3,6 +3,13 @@ let mod = "Mod4"; in { + # Dependencies + home.packages = with pkgs; [ + playerctl # pactl comes with PulseAudio + scrot # Screnshot keybindings + xclip # Copying screenshots to clipboard + ]; + xsession.windowManager.i3 = { enable = true; config = { @@ -20,11 +27,24 @@ in { "${mod}+Return" = "exec kitty"; "${mod}+Shift+e" = "exec i3-msg exit"; # bypass default session exit confirmation menu "Mod1+Q" = "exec /etc/profiles/per-user/elnu/bin/rofi-power"; + + # Audio controls "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10%"; "XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10%"; "XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle"; "XF86AudioMicMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - }; + + # Media player controls + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrev" = "exec playerctl previous"; + + # Multi-screen screenshots with scrot + "Print" = "exec scrot 'screenshot_%Y%m%d_%H%M%S.png' -e 'mkdir -p ~/Pictures/screenshots && mv $f ~/Pictures/screenshots && xclip -selection clipboard -t image/png -i ~/Pictures/screenshots/`ls -1 -t ~/Pictures/screenshots | head -1`"; # All screens + + # OSX-like area selection screenshots + "Shift+Print" = "exec scrot -s 'screenshot_%Y%m%d_%H%M%S.png' -e 'mkdir -p ~/Pictures/screenshots && mv $f ~/Pictures/screenshots && xclip -selection clipboard -t image/png -i ~/Pictures/screenshots/`ls -1 -t ~/Pictures/screenshots | head -1`'"; # Area selection + }; keycodebindings = { "133" = "--release exec rofi -show run -theme"; };