feat: screenshots
This commit is contained in:
parent
31e6ab807b
commit
36d225c0ea
|
@ -13,6 +13,45 @@
|
|||
autoEnable = false;
|
||||
polarity = "dark";
|
||||
image = config.lib.stylix.pixel "base00";
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/helios.yaml";
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/vice.yaml";
|
||||
# Has to be green
|
||||
override.base0B = "#00CC99";
|
||||
#base16Scheme = {
|
||||
# base00 = "#101419";
|
||||
# base01 = "#171B20";
|
||||
# base02 = "#21262e";
|
||||
# base03 = "#242931";
|
||||
# base04 = "#485263";
|
||||
# base05 = "#b6beca";
|
||||
# base06 = "#dee1e6";
|
||||
# base07 = "#e3e6eb";
|
||||
# base08 = "#e05f65";
|
||||
# base09 = "#f9a872";
|
||||
# base0A = "#f1cf8a";
|
||||
# base0B = "#78dba9";
|
||||
# base0C = "#74bee9";
|
||||
# base0D = "#70a5eb";
|
||||
# base0E = "#c68aee";
|
||||
# base0F = "#9378de";
|
||||
#};
|
||||
## based on decaycs-dark, bright variant
|
||||
#base16Scheme = {
|
||||
# base00 = "#101419";
|
||||
# base01 = "#171B20";
|
||||
# base02 = "#21262e";
|
||||
# base03 = "#242931";
|
||||
# base04 = "#485263";
|
||||
# base05 = "#b6beca";
|
||||
# base06 = "#dee1e6";
|
||||
# base07 = "#e3e6eb";
|
||||
# base08 = "#e5646a";
|
||||
# base09 = "#f7b77c";
|
||||
# base0A = "#f6d48f";
|
||||
# base0B = "#94F7C5";
|
||||
# base0C = "#79c3ee";
|
||||
# base0D = "#75aaf0";
|
||||
# base0E = "#cb8ff3";
|
||||
# base0F = "#9d85e1";
|
||||
#};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,10 +12,71 @@
|
|||
menu = "rofi -show drun";
|
||||
keybindings = let
|
||||
cfg = config.xsession.windowManager.i3.config;
|
||||
maim = "${pkgs.maim}/bin/maim -qs -b 1 --hidecursor";
|
||||
in {
|
||||
"Menu" = "exec ${cfg.menu}";
|
||||
"${cfg.modifier}+c" = "exec ${cfg.menu}";
|
||||
"${cfg.modifier}+F12" = "exec ${pkgs.maim}/bin/maim -s | xclip -selection clipboard -t image/png";
|
||||
"${cfg.modifier}+F12" =
|
||||
"exec "
|
||||
+ toString (
|
||||
pkgs.writeShellScript "clipboard-screenshot" ''
|
||||
${maim} | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
|
||||
''
|
||||
);
|
||||
"${cfg.modifier}+F11" =
|
||||
"exec "
|
||||
+ toString (
|
||||
pkgs.writeShellScript "clipboard-screenshot" ''
|
||||
out="screenshot-$(date +"%Y-%m-%dT%H:%M:%S%:z")"
|
||||
${maim} | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
|
||||
''
|
||||
);
|
||||
"${cfg.modifier}+F10" =
|
||||
"exec "
|
||||
+ toString (
|
||||
pkgs.writeShellScript "clipboard-qr-screenshot" ''
|
||||
set -euo pipefail
|
||||
if qr=$(${maim} | ${pkgs.zbar}/bin/zbarimg -q --raw -); then
|
||||
return=$?
|
||||
else
|
||||
return=$?
|
||||
fi
|
||||
case "$return" in
|
||||
"0")
|
||||
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "Copied qr to clipboard"
|
||||
${pkgs.xclip}/bin/xclip -selection clipboard -f <<< ''${qr%"''${qr##*[![:space:]]}"}
|
||||
exit 0
|
||||
;;
|
||||
"4")
|
||||
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "No qr found"
|
||||
;;
|
||||
*)
|
||||
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "Failure scanning qr"
|
||||
;;
|
||||
esac
|
||||
''
|
||||
);
|
||||
"${cfg.modifier}+F9" =
|
||||
"exec "
|
||||
+ toString (
|
||||
pkgs.writeShellScript "clipboard-ocr-screenshot" ''
|
||||
set -euo pipefail
|
||||
qr=$(${maim} | ${pkgs.zbar}/bin/zbarimg -q --raw -) || true
|
||||
case "$?" in
|
||||
0)
|
||||
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "Copied qr to clipboard"
|
||||
${pkgs.xclip}/bin/xclip -selection clipboard -f <<< ''${qr%"''${qr##*[![:space:]]}"}
|
||||
exit 0
|
||||
;;
|
||||
4)
|
||||
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "No qr found"
|
||||
;;
|
||||
*)
|
||||
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "Failure scanning qr"
|
||||
;;
|
||||
esac
|
||||
''
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
75
users/common/graphical/deadd/deadd.nix
Normal file
75
users/common/graphical/deadd/deadd.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.services.deadd-notification-center;
|
||||
inherit
|
||||
(lib)
|
||||
mkOption
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
literalExpression
|
||||
mkIf
|
||||
types
|
||||
;
|
||||
|
||||
settingsFormat = pkgs.formats.yaml {};
|
||||
in {
|
||||
options.services.deadd-notification-center = {
|
||||
enable = mkEnableOption "deadd notification center";
|
||||
|
||||
package = mkPackageOption pkgs "deadd-notification-center" {};
|
||||
|
||||
settings = mkOption {
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
};
|
||||
description = ''
|
||||
Settings for the notification center.
|
||||
More information about the settings can be found on the project's homepage.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
notification-center = {
|
||||
marginTop = 30;
|
||||
width = 500;
|
||||
};
|
||||
notification-center-notification-popup = {
|
||||
width = 300;
|
||||
shortenBody = 3;
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
type = types.lines;
|
||||
description = "CSS styling for notifications.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
xdg.configFile."deadd/deadd.yml".source = settingsFormat.generate "deadd.yml" cfg.settings;
|
||||
|
||||
xdg.configFile."deadd/deadd.css".text = cfg.style;
|
||||
|
||||
systemd.user.services.deadd-notification-center = {
|
||||
Unit = {
|
||||
Description = "Deadd Notification Center";
|
||||
PartOf = ["graphical-session.target"];
|
||||
After = ["graphical-session.target"];
|
||||
X-Restart-Triggers = ["${config.xdg.configFile."deadd/deadd.yml".source}" "${config.xdg.configFile."deadd/deadd.css".source}"];
|
||||
};
|
||||
Service = {
|
||||
Type = "dbus";
|
||||
BusName = "org.freedesktop.Notifications";
|
||||
ExecStart = "${cfg.package}/bin/deadd-notification-center";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
}
|
9
users/common/graphical/deadd/default.nix
Normal file
9
users/common/graphical/deadd/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
imports = [
|
||||
./deadd.nix
|
||||
];
|
||||
services.deadd-notification-center = {
|
||||
enable = true;
|
||||
style = builtins.readFile ./style.css;
|
||||
};
|
||||
}
|
140
users/common/graphical/deadd/style.css
Normal file
140
users/common/graphical/deadd/style.css
Normal file
|
@ -0,0 +1,140 @@
|
|||
|
||||
/* Notification center */
|
||||
|
||||
.blurredBG, #main_window, .blurredBG.low, .blurredBG.normal {
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.noti-center.time {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
/* Notifications */
|
||||
|
||||
.notification.content {
|
||||
margin-left: 15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.appname {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.blurredBG.notification {
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
}
|
||||
|
||||
.blurredBG.notification.critical {
|
||||
background: rgba(255, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.notificationInCenter.critical {
|
||||
background: rgba(155, 0, 20, 0.5);
|
||||
}
|
||||
|
||||
/* Labels */
|
||||
|
||||
label {
|
||||
color: #322;
|
||||
}
|
||||
|
||||
label.notification {
|
||||
color: #322;
|
||||
}
|
||||
|
||||
label.critical {
|
||||
color: #000;
|
||||
}
|
||||
.notificationInCenter label.critical {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
|
||||
/* Buttons */
|
||||
|
||||
button {
|
||||
background: transparent;
|
||||
color: #322;
|
||||
border-radius: 3px;
|
||||
border-width: 0px;
|
||||
background-position: 0px 0px;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
border-radius: 3px;
|
||||
background: rgba(0, 20, 20, 0.2);
|
||||
border-width: 0px;
|
||||
border-top: transparent;
|
||||
border-color: #f00;
|
||||
color: #fee;
|
||||
}
|
||||
|
||||
|
||||
/* Custom Buttons */
|
||||
|
||||
.userbutton {
|
||||
background: rgba(20,0,0, 0.15);
|
||||
}
|
||||
|
||||
.userbuttonlabel {
|
||||
color: #222;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.userbutton:hover {
|
||||
background: rgba(20, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.userbuttonlabel:hover {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
button.buttonState1 {
|
||||
background: rgba(20,0,0,0.5);
|
||||
}
|
||||
|
||||
.userbuttonlabel.buttonState1 {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
button.buttonState1:hover {
|
||||
background: rgba(20,0,0, 0.4);
|
||||
}
|
||||
|
||||
.userbuttonlabel.buttonState1:hover {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
button.buttonState2 {
|
||||
background: rgba(255,255,255,0.3);
|
||||
}
|
||||
|
||||
.userbuttonlabel.buttonState2 {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
button.buttonState2:hover {
|
||||
background: rgba(20,0,0, 0.3);
|
||||
}
|
||||
|
||||
.userbuttonlabel.buttonState2:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
|
||||
/* Images */
|
||||
|
||||
image.deadd-noti-center.notification.image {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
{pkgs, ...}: {
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
#./deadd
|
||||
./themes.nix
|
||||
];
|
||||
home = {
|
||||
|
@ -18,5 +23,12 @@
|
|||
};
|
||||
|
||||
# notification are nice to have
|
||||
services.dunst.enable = true;
|
||||
services.dunst = {
|
||||
enable = true;
|
||||
settings.global = {
|
||||
highlight = config.lib.stylix.colors.withHashtag.base0C;
|
||||
progress_bar_frame_width = 0;
|
||||
progress_bar_corner_radius = 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue