2022-03-10 21:52:12 +01:00
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
pkgs,
|
|
|
|
|
lib,
|
|
|
|
|
...
|
|
|
|
|
}: let
|
2020-10-30 11:05:26 +01:00
|
|
|
inherit (import <niveum/lib>) defaultApplications colours;
|
2022-09-23 23:31:14 +02:00
|
|
|
scripts = import <niveum/packages/scripts> {inherit pkgs lib;};
|
2020-06-10 16:36:52 +02:00
|
|
|
klem = import <niveum/packages/scripts/klem.nix> {
|
|
|
|
|
inherit pkgs lib;
|
|
|
|
|
config.scripts = {
|
|
|
|
|
"p.r" = pkgs.writers.writeDash "p.r" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -fSs http://p.r --data-binary @- \
|
|
|
|
|
| ${pkgs.coreutils}/bin/tail --lines=1 \
|
|
|
|
|
| ${pkgs.gnused}/bin/sed 's/\\<r\\>/krebsco.de/'
|
|
|
|
|
'';
|
2022-11-22 11:48:09 +01:00
|
|
|
# "envs.sh host" = pkgs.writers.writeDash "envs-host" ''
|
|
|
|
|
# ${pkgs.curl}/bin/curl -F "file=$(${pkgs.coreutils}/bin/cat)" https://envs.sh
|
|
|
|
|
# '';
|
|
|
|
|
"envs.sh mirror" = pkgs.writers.writeDash "envs-mirror" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -F "url=$(${pkgs.coreutils}/bin/cat)" https://envs.sh
|
|
|
|
|
'';
|
|
|
|
|
"envs.sh shorten" = pkgs.writers.writeDash "envs-shorten" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -F "shorten=$(${pkgs.coreutils}/bin/cat)" https://envs.sh
|
|
|
|
|
'';
|
2020-06-10 16:36:52 +02:00
|
|
|
"ix.io" = pkgs.writers.writeDash "ix.io" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -fSs -F 'f:1=<-' ix.io
|
|
|
|
|
'';
|
|
|
|
|
"go.r" = pkgs.writers.writeDash "go.r" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -fSs http://go.r -F "uri=$(${pkgs.coreutils}/bin/cat)"
|
|
|
|
|
'';
|
|
|
|
|
"0x0.st" = pkgs.writers.writeDash "0x0.st" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -fSs https://0x0.st -F "shorten=$(${pkgs.coreutils}/bin/cat)"
|
|
|
|
|
'';
|
|
|
|
|
"rot13" = pkgs.writers.writeDash "rot13" ''
|
|
|
|
|
${pkgs.coreutils}/bin/tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
|
|
|
|
|
'';
|
|
|
|
|
"ipa" = pkgs.writers.writeDash "ipa" ''
|
2022-09-23 23:31:14 +02:00
|
|
|
${scripts.ipa}/bin/ipa
|
2020-06-22 08:44:09 +02:00
|
|
|
'';
|
|
|
|
|
"betacode" = pkgs.writers.writeDash "betacode" ''
|
2022-09-23 23:31:14 +02:00
|
|
|
${scripts.betacode}/bin/betacode
|
2020-06-10 16:36:52 +02:00
|
|
|
'';
|
2021-07-11 17:59:50 +02:00
|
|
|
"curl" = pkgs.writers.writeDash "curl" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -fSs "$(${pkgs.coreutils}/bin/cat)"
|
|
|
|
|
'';
|
2022-01-06 20:16:54 +01:00
|
|
|
ocr = pkgs.writers.writeDash "ocr" ''
|
|
|
|
|
${pkgs.tesseract4}/bin/tesseract -l eng+deu - stdout
|
2022-01-05 21:37:36 +01:00
|
|
|
'';
|
2020-06-10 16:36:52 +02:00
|
|
|
};
|
2020-06-09 21:31:58 +02:00
|
|
|
};
|
|
|
|
|
|
2020-10-16 08:23:27 +02:00
|
|
|
new-workspace = pkgs.writers.writeDash "new-workspace" ''
|
2019-04-19 03:11:51 +02:00
|
|
|
i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))
|
|
|
|
|
'';
|
2020-10-16 08:23:27 +02:00
|
|
|
move-to-new-workspace = pkgs.writers.writeDash "new-workspace" ''
|
2019-04-19 03:11:51 +02:00
|
|
|
i3-msg move container to workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))
|
|
|
|
|
'';
|
2020-10-30 11:05:26 +01:00
|
|
|
in {
|
2019-04-19 03:11:51 +02:00
|
|
|
services.xserver = {
|
2020-04-22 17:42:45 +02:00
|
|
|
displayManager.defaultSession = "none+i3";
|
2020-04-10 14:52:28 +02:00
|
|
|
windowManager.i3 = {
|
|
|
|
|
enable = true;
|
|
|
|
|
};
|
2019-04-19 03:11:51 +02:00
|
|
|
};
|
|
|
|
|
|
2021-01-18 18:32:16 +01:00
|
|
|
services.xserver = {
|
|
|
|
|
monitorSection = ''Option "DPMS" "false"'';
|
|
|
|
|
serverFlagsSection = ''
|
|
|
|
|
Option "BlankTime" "0"
|
|
|
|
|
Option "StandbyTime" "0"
|
|
|
|
|
Option "SuspendTime" "0"
|
|
|
|
|
Option "OffTime" "0"
|
|
|
|
|
'';
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
Section "Extensions"
|
|
|
|
|
Option "DPMS" "Disable"
|
|
|
|
|
EndSection
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-19 03:11:51 +02:00
|
|
|
home-manager.users.me.xsession.windowManager.i3 = {
|
|
|
|
|
enable = true;
|
|
|
|
|
config = rec {
|
2022-03-10 21:52:12 +01:00
|
|
|
fonts = {
|
|
|
|
|
names = ["Sans"];
|
|
|
|
|
size = 10.0;
|
|
|
|
|
};
|
2019-04-19 03:11:51 +02:00
|
|
|
modifier = "Mod4";
|
|
|
|
|
window = {
|
|
|
|
|
titlebar = false;
|
|
|
|
|
border = 1;
|
|
|
|
|
hideEdgeBorders = "smart";
|
2020-04-10 14:52:28 +02:00
|
|
|
commands = [
|
2020-04-18 17:58:14 +02:00
|
|
|
{
|
2022-03-10 21:52:12 +01:00
|
|
|
criteria = {class = "floating";};
|
2020-04-18 17:58:14 +02:00
|
|
|
command = "floating enable";
|
|
|
|
|
}
|
2020-04-10 14:52:28 +02:00
|
|
|
{
|
2022-03-10 21:52:12 +01:00
|
|
|
criteria = {class = "fzfmenu";};
|
2020-04-13 11:58:56 +02:00
|
|
|
command = "floating enable";
|
|
|
|
|
}
|
2022-11-08 20:30:16 +01:00
|
|
|
{
|
|
|
|
|
criteria = {class = ".*";};
|
|
|
|
|
command = "border pixel 2";
|
|
|
|
|
}
|
2020-04-13 11:58:56 +02:00
|
|
|
{
|
2022-03-10 21:52:12 +01:00
|
|
|
criteria = {class = "mpv";};
|
2020-04-13 11:58:56 +02:00
|
|
|
command = lib.strings.concatStringsSep ", " [
|
|
|
|
|
"floating enable"
|
|
|
|
|
"sticky enable"
|
|
|
|
|
"fullscreen disable"
|
|
|
|
|
"resize set 640 480"
|
|
|
|
|
"move position mouse"
|
|
|
|
|
];
|
2020-04-10 14:52:28 +02:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
2019-04-19 03:11:51 +02:00
|
|
|
floating = {
|
|
|
|
|
titlebar = false;
|
|
|
|
|
border = 1;
|
|
|
|
|
};
|
2020-06-10 17:37:25 +02:00
|
|
|
colors = let
|
|
|
|
|
scheme = {
|
|
|
|
|
background = colours.background;
|
|
|
|
|
text = colours.foreground;
|
|
|
|
|
};
|
|
|
|
|
in rec {
|
2022-03-10 21:52:12 +01:00
|
|
|
focused =
|
|
|
|
|
scheme
|
|
|
|
|
// {
|
2022-11-08 20:31:16 +01:00
|
|
|
border = colours.blue.bright;
|
|
|
|
|
indicator = colours.blue.bright;
|
|
|
|
|
childBorder = colours.blue.bright;
|
2022-03-10 21:52:12 +01:00
|
|
|
};
|
|
|
|
|
unfocused =
|
|
|
|
|
scheme
|
|
|
|
|
// {
|
|
|
|
|
border = colours.background;
|
|
|
|
|
indicator = colours.background;
|
|
|
|
|
childBorder = colours.background;
|
|
|
|
|
};
|
2020-06-10 17:37:25 +02:00
|
|
|
focusedInactive = unfocused;
|
2022-03-10 21:52:12 +01:00
|
|
|
urgent =
|
|
|
|
|
scheme
|
|
|
|
|
// {
|
|
|
|
|
border = colours.red.bright;
|
|
|
|
|
indicator = colours.red.bright;
|
|
|
|
|
childBorder = colours.red.bright;
|
|
|
|
|
};
|
|
|
|
|
placeholder =
|
|
|
|
|
scheme
|
|
|
|
|
// {
|
|
|
|
|
border = colours.green.bright;
|
|
|
|
|
indicator = colours.green.bright;
|
|
|
|
|
childBorder = colours.green.bright;
|
|
|
|
|
};
|
2020-06-10 17:37:25 +02:00
|
|
|
};
|
2022-03-10 21:52:12 +01:00
|
|
|
bars = [
|
|
|
|
|
{
|
|
|
|
|
workspaceButtons = false;
|
|
|
|
|
fonts = {
|
2022-08-21 01:01:08 +02:00
|
|
|
names = ["Monospace" "Font Awesome 6 Free"];
|
2022-03-10 21:52:12 +01:00
|
|
|
size = 8.0;
|
2019-04-19 03:11:51 +02:00
|
|
|
};
|
2022-09-10 21:51:16 +02:00
|
|
|
mode = "dock"; # "hide";
|
2022-03-10 21:52:12 +01:00
|
|
|
position = "bottom";
|
|
|
|
|
colors = rec {
|
|
|
|
|
background = colours.background;
|
|
|
|
|
separator = background;
|
|
|
|
|
statusline = colours.foreground;
|
|
|
|
|
bindingMode = {
|
|
|
|
|
background = colours.red.bright;
|
|
|
|
|
border = colours.background;
|
|
|
|
|
text = colours.foreground;
|
|
|
|
|
};
|
|
|
|
|
};
|
2022-08-22 10:28:48 +02:00
|
|
|
statusCommand = "env I3RS_GITHUB_TOKEN=${lib.strings.fileContents <secrets/github/notification.token>} ${pkgs.i3status-rust}/bin/i3status-rs ${
|
2021-04-07 09:37:57 +02:00
|
|
|
(pkgs.formats.toml {}).generate "i3status-rust.toml" (import <niveum/lib/i3status-rust.nix> {
|
2020-10-30 11:05:26 +01:00
|
|
|
inherit (config.niveum) batteryName wirelessInterface;
|
|
|
|
|
inherit colours;
|
2020-06-10 17:37:25 +02:00
|
|
|
inherit pkgs;
|
|
|
|
|
})
|
|
|
|
|
}";
|
2022-03-10 21:52:12 +01:00
|
|
|
}
|
|
|
|
|
];
|
2020-05-17 10:21:04 +02:00
|
|
|
modes.resize = {
|
2020-06-10 17:37:25 +02:00
|
|
|
"Escape" = ''mode "default"'';
|
|
|
|
|
"Return" = ''mode "default"'';
|
2020-05-17 10:21:04 +02:00
|
|
|
"h" = "resize shrink width 10 px or 5 ppt";
|
|
|
|
|
"j" = "resize grow height 10 px or 5 ppt";
|
|
|
|
|
"k" = "resize shrink height 10 px or 5 ppt";
|
|
|
|
|
"l" = "resize grow width 10 px or 5 ppt";
|
|
|
|
|
};
|
2019-04-19 03:11:51 +02:00
|
|
|
keybindings = {
|
2020-11-23 11:58:55 +01:00
|
|
|
"${modifier}+Shift+h" = "move left 25 px";
|
|
|
|
|
"${modifier}+Shift+j" = "move down 25 px";
|
|
|
|
|
"${modifier}+Shift+k" = "move up 25 px";
|
|
|
|
|
"${modifier}+Shift+l" = "move right 25 px";
|
2020-04-15 14:56:57 +02:00
|
|
|
"${modifier}+h" = "focus left";
|
|
|
|
|
"${modifier}+j" = "focus down";
|
|
|
|
|
"${modifier}+k" = "focus up";
|
|
|
|
|
"${modifier}+l" = "focus right";
|
|
|
|
|
|
2019-04-22 22:40:41 +02:00
|
|
|
"${modifier}+Shift+b" = "move window to workspace prev";
|
2019-04-19 03:11:51 +02:00
|
|
|
"${modifier}+Shift+n" = "move window to workspace next";
|
2022-11-08 20:30:53 +01:00
|
|
|
"${modifier}+Shift+x" = "exec ${move-to-new-workspace}";
|
2020-04-15 14:56:57 +02:00
|
|
|
"${modifier}+b" = "workspace prev";
|
|
|
|
|
"${modifier}+n" = "workspace next";
|
2022-11-08 20:30:53 +01:00
|
|
|
"${modifier}+x" = "exec ${new-workspace}";
|
2020-04-15 14:56:57 +02:00
|
|
|
|
|
|
|
|
"${modifier}+Shift+c" = "reload";
|
2019-04-19 03:11:51 +02:00
|
|
|
"${modifier}+Shift+q" = "kill";
|
|
|
|
|
"${modifier}+Shift+r" = "restart";
|
2020-04-15 14:56:57 +02:00
|
|
|
|
2021-09-17 20:49:19 +02:00
|
|
|
"${modifier}+z" = "sticky toggle";
|
2020-04-15 14:56:57 +02:00
|
|
|
"${modifier}+Shift+z" = "floating toggle";
|
2021-09-17 20:49:19 +02:00
|
|
|
|
|
|
|
|
"${modifier}+s" = "scratchpad show";
|
|
|
|
|
"${modifier}+Shift+s" = "move scratchpad";
|
|
|
|
|
|
2019-04-22 22:40:41 +02:00
|
|
|
"${modifier}+c" = "split h";
|
2019-04-19 03:11:51 +02:00
|
|
|
"${modifier}+e" = "layout toggle split";
|
|
|
|
|
"${modifier}+f" = "fullscreen toggle";
|
|
|
|
|
"${modifier}+r" = "mode resize";
|
|
|
|
|
"${modifier}+v" = "split v";
|
|
|
|
|
"${modifier}+w" = "layout tabbed";
|
2022-07-25 22:25:19 +02:00
|
|
|
"${modifier}+q" = "exec ${pkgs.writers.writeDash "newsboat-sync" ''
|
|
|
|
|
notify-send --app-name="newsboat" "Updating ..."
|
|
|
|
|
newsboat -x reload
|
|
|
|
|
notify-send --app-name="newsboat" "Finished updating."
|
|
|
|
|
''}";
|
2020-04-15 14:56:57 +02:00
|
|
|
|
2020-04-22 17:42:45 +02:00
|
|
|
# "${modifier}+Shift+y" = "exec ${pkgs.qutebrowser}/bin/qutebrowser";
|
2020-10-30 11:05:26 +01:00
|
|
|
"${modifier}+Return" = "exec ${(defaultApplications pkgs).terminal}";
|
|
|
|
|
"${modifier}+t" = "exec ${(defaultApplications pkgs).fileManager}";
|
|
|
|
|
"${modifier}+y" = "exec ${(defaultApplications pkgs).browser}";
|
2022-09-23 23:31:14 +02:00
|
|
|
"${modifier}+0" = "exec ${scripts.menu-calc}/bin/=";
|
2020-04-15 14:56:57 +02:00
|
|
|
|
2022-09-23 23:31:14 +02:00
|
|
|
"${modifier}+Shift+w" = "exec ${scripts.k-lock}/bin/k-lock";
|
2022-10-05 16:50:22 +02:00
|
|
|
"${modifier}+d" = "exec ${pkgs.writers.writeDash "run" ''exec rofi -modi run,ssh,window -show run''}";
|
2020-06-10 17:37:25 +02:00
|
|
|
"${modifier}+Shift+d" = "exec ${
|
2022-03-10 21:52:12 +01:00
|
|
|
pkgs.writers.writeDash "notemenu" ''
|
|
|
|
|
set -efu
|
|
|
|
|
PATH=$PATH:${
|
|
|
|
|
lib.makeBinPath [pkgs.rofi pkgs.findutils pkgs.coreutils]
|
|
|
|
|
}
|
2020-06-10 17:37:25 +02:00
|
|
|
|
2022-03-10 21:52:12 +01:00
|
|
|
cd ~/notes
|
|
|
|
|
note_file=$({
|
|
|
|
|
echo diary/$(date -I).md
|
|
|
|
|
echo diary/$(date -I -d yesterday).md
|
2022-09-27 20:40:24 +02:00
|
|
|
find . ! -name '.*' -type f -printf "%T@ %p\n" | sort --reverse --numeric-sort | cut --delimiter=" " --fields=2-
|
2022-03-10 21:52:12 +01:00
|
|
|
} | rofi -dmenu -i -p 'notes')
|
|
|
|
|
if test "$note_file"
|
|
|
|
|
then
|
2022-12-05 10:06:40 +01:00
|
|
|
alacritty --working-directory ~/notes -e "$EDITOR" "$note_file"
|
2022-03-10 21:52:12 +01:00
|
|
|
fi
|
|
|
|
|
''
|
|
|
|
|
}";
|
2022-11-08 20:30:53 +01:00
|
|
|
"${modifier}+p" = "exec rofi-pass";
|
|
|
|
|
"${modifier}+Shift+p" = "exec rofi-pass --insert";
|
2022-09-23 23:31:14 +02:00
|
|
|
"${modifier}+u" = "exec ${scripts.unicodmenu}/bin/unicodmenu";
|
2020-04-15 14:56:57 +02:00
|
|
|
|
2022-05-10 20:52:07 +02:00
|
|
|
"${modifier}+F6" = "exec ${pkgs.xorg.xkill}/bin/xkill";
|
2022-09-23 23:31:14 +02:00
|
|
|
"${modifier}+F7" = "exec ${scripts.showkeys-toggle}/bin/showkeys-toggle";
|
2022-05-10 20:52:07 +02:00
|
|
|
"${modifier}+F8" = "exec switch-theme toggle";
|
2020-06-09 21:36:49 +02:00
|
|
|
"${modifier}+F9" = "exec ${pkgs.redshift}/bin/redshift -O 4000 -b 0.85";
|
2020-06-02 23:02:40 +02:00
|
|
|
"${modifier}+F10" = "exec ${pkgs.redshift}/bin/redshift -x";
|
2020-06-09 21:36:49 +02:00
|
|
|
"${modifier}+F11" = "exec ${pkgs.xcalib}/bin/xcalib -invert -alter";
|
2020-12-16 22:24:50 +01:00
|
|
|
"${modifier}+F12" = "exec ${klem}/bin/klem";
|
2021-12-28 14:48:09 +01:00
|
|
|
"Print" = "exec flameshot-once";
|
2022-11-08 20:30:53 +01:00
|
|
|
"XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 5";
|
|
|
|
|
"XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t";
|
|
|
|
|
"XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5";
|
2021-09-17 20:49:19 +02:00
|
|
|
"XF86Calculator" = "exec ${pkgs.st}/bin/st -c floating -e ${pkgs.bc}/bin/bc";
|
2022-11-08 20:30:53 +01:00
|
|
|
"XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl pause";
|
|
|
|
|
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
|
|
|
|
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
|
|
|
|
|
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
|
|
|
|
|
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
|
2022-09-23 23:31:14 +02:00
|
|
|
"XF86ScreenSaver" = "exec ${scripts.k-lock}/bin/k-lock";
|
2020-04-13 11:58:56 +02:00
|
|
|
|
2022-09-23 23:31:14 +02:00
|
|
|
"XF86Display" = "exec ${scripts.dmenurandr}/bin/dmenurandr";
|
2020-09-09 09:35:50 +02:00
|
|
|
|
2020-04-13 11:58:56 +02:00
|
|
|
# key names detected with xorg.xev:
|
2019-09-24 23:32:06 +02:00
|
|
|
# XF86WakeUp (fn twice)
|
|
|
|
|
# XF86Battery (fn f3)
|
|
|
|
|
# XF86Sleep (fn f4) - actually suspends
|
|
|
|
|
# XF86WLAN
|
|
|
|
|
# XF86WebCam (fn f6)
|
|
|
|
|
# XF86TouchpadToggle (fn f8)
|
|
|
|
|
# XF86Suspend (fn f12) - actually suspends to disk
|
|
|
|
|
# Num_Lock (fn Roll) - numlocks
|
|
|
|
|
# XF86Audio{Prev,Next,Mute,Play,Stop}
|
|
|
|
|
# XF86Forward
|
|
|
|
|
# XF86Back
|
|
|
|
|
# XF86Launch1 (thinkvantage)
|
2019-04-19 03:11:51 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|