Add screenshot tool to i3

This commit is contained in:
Natsu Kagami 2021-11-16 11:05:41 -05:00
parent 48bf60da1b
commit af9c209bd3
Signed by: nki
GPG key ID: 7306B3D3C3AD6E51
2 changed files with 141 additions and 127 deletions

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... } : { pkgs, config, lib, ... }:
let let
mod = "Mod4"; mod = "Mod4";
@ -22,18 +22,21 @@ let
remainder = x: y: x - (builtins.div x y) * y; remainder = x: y: x - (builtins.div x y) * y;
range = from: to: range = from: to:
let let
f = cur: if cur == to then [] else [cur] ++ f (cur + 1); f = cur: if cur == to then [ ] else [ cur ] ++ f (cur + 1);
in f from; in
f from;
in in
{ {
imports = [ ./i3/screenshot.nix ];
## i3 window manager ## i3 window manager
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = true; enable = true;
config.assigns = { config.assigns = {
"${wsAttrs."1"}" = [ { class = "^Firefox$"; } ]; "${wsAttrs."1"}" = [{ class = "^Firefox$"; }];
"${wsAttrs."2"}" = [ { class = "^Discord$"; } ]; "${wsAttrs."2"}" = [{ class = "^Discord$"; }];
}; };
config.bars = [ { config.bars = [{
command = "${pkgs.i3-gaps}/bin/i3bar -t"; command = "${pkgs.i3-gaps}/bin/i3bar -t";
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml"; statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
position = "top"; position = "top";
@ -48,7 +51,7 @@ in
urgentWorkspace = { background = "#2f343a"; border = "#900000"; text = "#ffffff"; }; urgentWorkspace = { background = "#2f343a"; border = "#900000"; text = "#ffffff"; };
bindingMode = { background = "#2f343a"; border = "#900000"; text = "#ffffff"; }; bindingMode = { background = "#2f343a"; border = "#900000"; text = "#ffffff"; };
}; };
} ]; }];
config.fonts = { names = [ "FantasqueSansMono Nerd Font Mono" "monospace" ]; size = 11.0; }; config.fonts = { names = [ "FantasqueSansMono Nerd Font Mono" "monospace" ]; size = 11.0; };
config.gaps.outer = 5; config.gaps.outer = 5;
config.gaps.inner = 5; config.gaps.inner = 5;
@ -75,7 +78,8 @@ in
"${mod}+r" = "exec ${pkgs.dmenu}/bin/dmenu_run"; "${mod}+r" = "exec ${pkgs.dmenu}/bin/dmenu_run";
"${mod}+d" = "exec i3-dmenu-desktop --dmenu='${pkgs.dmenu}/bin/dmenu -i'"; "${mod}+d" = "exec i3-dmenu-desktop --dmenu='${pkgs.dmenu}/bin/dmenu -i'";
} // ( } // (
builtins.listToAttrs (lib.flatten (map (key: [ builtins.listToAttrs (lib.flatten (map
(key: [
{ {
name = "${mod}+${key}"; name = "${mod}+${key}";
value = "workspace ${builtins.getAttr key wsAttrs}"; value = "workspace ${builtins.getAttr key wsAttrs}";
@ -84,7 +88,8 @@ in
name = "${mod}+Shift+${key}"; name = "${mod}+Shift+${key}";
value = "move to workspace ${builtins.getAttr key wsAttrs}"; value = "move to workspace ${builtins.getAttr key wsAttrs}";
} }
]) (builtins.attrNames wsAttrs)) ])
(builtins.attrNames wsAttrs))
))); )));
# Workspace # Workspace

View file

@ -0,0 +1,9 @@
{ pkgs, config, lib, ... }:
with lib;
{
xsession.windowManager.i3.config = {
startup = [ { command = "${pkgs.flameshot}/bin/flameshot"; } ];
keybindings."Print" = "exec ${pkgs.flameshot}/bin/flameshot gui";
};
}