format using nixpkgs-fmt

This commit is contained in:
Leonardo Eugênio 2023-01-22 18:12:04 -03:00
parent 219fe2c565
commit 273cd93ea3
26 changed files with 936 additions and 878 deletions

View File

@ -97,9 +97,10 @@
home-manager.extraSpecialArgs = { inherit inputs; };
}
] ++ lib.optional (desktop == "sway") ./system/sway.nix
++ lib.optional (desktop == "gnome") ./system/gnome.nix
++ lib.optional (desktop == "kde") ./system/kde.nix;
in {
++ lib.optional (desktop == "gnome") ./system/gnome.nix
++ lib.optional (desktop == "kde") ./system/kde.nix;
in
{
nixosConfigurations = {
i15 = lib.nixosSystem {
inherit system specialArgs;

View File

@ -4,7 +4,8 @@
{ config, lib, pkgs, modulesPath, ... }:
let
btrfs_options = [ "compress=zstd:3" "noatime" ];
in {
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =

View File

@ -5,7 +5,8 @@
let
btrfs_options = [ "compress=zstd:3" "noatime" ];
btrfs_ssd = [ "ssd" "discard=async" ];
in {
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];

View File

@ -5,7 +5,8 @@
let
btrfs_options = [ "compress=zstd:3" "noatime" ];
btrfs_ssd = [ "ssd" "discard=async" ];
in {
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =

View File

@ -1,54 +1,55 @@
(inputs@{ system, packages, ... }:
{ pkgs, ... }: {
nixpkgs.overlays = [
inputs.nur.overlay
(import ../scripts)
(import ./sway.nix)
(final: prev: {
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
})
(import ./sixel-patches.nix (inputs // { inherit pkgs; }))
(final: prev: {
inherit (packages) dzgui;
plymouth-theme-red = (import ./plymouth-theme-red.nix (inputs // { inherit pkgs; }));
uservars = import ../user/variables.nix;
dhist = inputs.dhist.packages.${system}.dhist;
demoji = inputs.demoji.packages.${system}.demoji;
devenv = inputs.devenv.packages.${system}.devenv;
mpvpaper = inputs.wegank.packages.${prev.system}.mpvpaper;
{ pkgs, ... }: {
nixpkgs.overlays = [
inputs.nur.overlay
(import ../scripts)
(import ./sway.nix)
(final: prev: {
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
})
(import ./sixel-patches.nix (inputs // { inherit pkgs; }))
(final: prev: {
inherit (packages) dzgui;
plymouth-theme-red = (import ./plymouth-theme-red.nix (inputs // { inherit pkgs; }));
uservars = import ../user/variables.nix;
dhist = inputs.dhist.packages.${system}.dhist;
demoji = inputs.demoji.packages.${system}.demoji;
devenv = inputs.devenv.packages.${system}.devenv;
mpvpaper = inputs.wegank.packages.${prev.system}.mpvpaper;
bemenu = prev.bemenu.overrideAttrs (o: {
preBuild = ''
sed -i 's/ZWLR_LAYER_SHELL_V1_LAYER_TOP/ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY/g' lib/renderers/wayland/window.c
'';
});
bemenu = prev.bemenu.overrideAttrs (o: {
preBuild = ''
sed -i 's/ZWLR_LAYER_SHELL_V1_LAYER_TOP/ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY/g' lib/renderers/wayland/window.c
'';
});
sea-orm-cli =
inputs.sea-orm-cli.legacyPackages.${prev.system}.sea-orm-cli;
webcord = inputs.webcord.legacyPackages.${prev.system}.webcord;
nil-lsp = inputs.nil-lsp.packages.${prev.system}.nil;
sway-unwrapped = prev.sway-unwrapped.overrideAttrs (old: {
patches = old.patches
++ [ ../patches/sway/fix-hide_cursor-clearing-focus.patch ];
});
material-wifi-icons = final.stdenv.mkDerivation rec {
name = "material-wifi-icons";
src = inputs.material-wifi-icons;
installPhase = let dest = "$out/share/fonts/${name}";
sea-orm-cli =
inputs.sea-orm-cli.legacyPackages.${prev.system}.sea-orm-cli;
webcord = inputs.webcord.legacyPackages.${prev.system}.webcord;
nil-lsp = inputs.nil-lsp.packages.${prev.system}.nil;
sway-unwrapped = prev.sway-unwrapped.overrideAttrs (old: {
patches = old.patches
++ [ ../patches/sway/fix-hide_cursor-clearing-focus.patch ];
});
material-wifi-icons = final.stdenv.mkDerivation rec {
name = "material-wifi-icons";
src = inputs.material-wifi-icons;
installPhase =
let dest = "$out/share/fonts/${name}";
in ''
mkdir -p ${dest}
cp material-wifi.ttf ${dest}
'';
};
papirus_red =
(final.unstable.papirus-icon-theme.override { color = "red"; });
orchis_theme_compact =
(final.orchis-theme.override { tweaks = [ "compact" "solid" ]; });
nerdfonts_fira_hack =
(final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; });
steam = prev.steam.override {
extraPkgs = pkgs: with pkgs; [ capitaine-cursors bibata-cursors ];
};
})
];
})
};
papirus_red =
(final.unstable.papirus-icon-theme.override { color = "red"; });
orchis_theme_compact =
(final.orchis-theme.override { tweaks = [ "compact" "solid" ]; });
nerdfonts_fira_hack =
(final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; });
steam = prev.steam.override {
extraPkgs = pkgs: with pkgs; [ capitaine-cursors bibata-cursors ];
};
})
];
})

View File

@ -1,24 +1,27 @@
(final: prev:
with prev;
let
import_script = (_: path: import (path) { inherit pkgs lib; });
create_script = (name: text: runtimeInputs:
let
script_body = pkgs.writeTextFile {
inherit name;
executable = true;
text = ''
${builtins.readFile text}
'';
};
in (pkgs.writeShellApplication {
inherit name runtimeInputs;
text = ''exec ${script_body} "$@"'';
checkPhase = "";
}));
create_scripts =
lib.mapAttrs (name: deps: create_script name ./${name} deps);
in create_scripts {
with prev;
let
import_script = (_: path: import (path) { inherit pkgs lib; });
create_script = (name: text: runtimeInputs:
let
script_body = pkgs.writeTextFile {
inherit name;
executable = true;
text = ''
${builtins.readFile text}
'';
};
in
(pkgs.writeShellApplication {
inherit name runtimeInputs;
text = ''exec ${script_body} "$@"'';
checkPhase = "";
}));
create_scripts =
lib.mapAttrs (name: deps: create_script name ./${name} deps);
in
create_scripts
{
br = [ ];
bmenu = [ final.bemenu final.dhist fish j4-dmenu-desktop jq sway ];
_diffr = [ diffr ];
@ -34,7 +37,7 @@
volumesh = [ pulseaudio libnotify ];
pulse_sink = [ pulseaudio pamixer final.wdmenu ];
} // lib.mapAttrs import_script {
wdmenu = ./wdmenu.nix;
wlauncher = ./wlauncher.nix;
_gpg-unlock = ./_gpg-unlock.nix;
})
wdmenu = ./wdmenu.nix;
wlauncher = ./wlauncher.nix;
_gpg-unlock = ./_gpg-unlock.nix;
})

View File

@ -6,6 +6,7 @@ let
rofi = "rofi -dmenu -sort";
};
menu_cmd = available_menus.${dmenu};
in pkgs.writeShellScriptBin "wdmenu" ''
in
pkgs.writeShellScriptBin "wdmenu" ''
exec ${menu_cmd} "$@"
''

View File

@ -6,6 +6,7 @@ let
rofi = "rofi -show drun -sort";
};
menu_cmd = available_menus.${dmenu};
in pkgs.writeShellScriptBin "wlauncher" ''
in
pkgs.writeShellScriptBin "wlauncher" ''
exec ${menu_cmd} "$@"
''

View File

@ -6,6 +6,7 @@ let
rofi = "rofi -show drun -sort";
};
menu_cmd = available_menus.${dmenu};
in pkgs.writeShellScriptBin "wlauncher" ''
in
pkgs.writeShellScriptBin "wlauncher" ''
exec ${menu_cmd} "$@"
''

View File

@ -1,6 +1,7 @@
let
main_ssh_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxR/w+38b2lX90yNBqhq3mUmkn1WGu6GAPhN1tVp2ZjYRJNV/+5gWCnTtOWYtDx35HmK/spQ2Qy8X9ttkzORa24fysNx1Iqn/TiXhD7eIJjbGPnrOpIKTkW5/uB3SD/P5NBSa06//BaqJU4sBlG79hoXRpod052hQtdpTVDiMCIV+iboWPKqopmJJfWdBtVnHXs9rep0htPRExxGslImFk7Z6xjcaHyCpIQZPlOGf+sGsmUU7jRqzvZFV8ucIdbnAlMHrU4pepNFhuraESyZVTa/bi9sw0iozXp5Q5+5thMebEslmT1Z771kI4sieDy+O4r8c0Sx2/VY1UAzcpq1faggc3YB01MTh+tiEC6xdMvZLrQGL1NBWjHleMyL53GU5ERluC0vXJF3Hv3BGGBDfXWbrEm5n06DHr2apRVJGC0LwiQ7Woud1X4V4X1pKSusxCVMjT2lmcOwV6YhKhB2sowJc1OdMx4+tL0UWE+YKSZgBHfolwk6ml0F4EO9nnUHc= lelgenio@i15";
in {
in
{
"rainbow-gitlab-runner-thoreb-itinerario-registrationConfigFile.age".publicKeys = [ main_ssh_public_key ];
"monolith-gitlab-runner-thoreb-itinerario-registrationConfigFile.age".publicKeys = [ main_ssh_public_key ];
"lelgenio-cachix.age".publicKeys = [ main_ssh_public_key ];

View File

@ -1,7 +1,7 @@
{ config, pkgs, inputs, ... }: {
console = {
font = "ter-120n";
packages = [pkgs.terminus_font];
packages = [ pkgs.terminus_font ];
earlySetup = false;
};

View File

@ -16,41 +16,43 @@
# gtk portal needed to make gtk apps happy
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
services.greetd = let
greetd_main_script = pkgs.writeShellScriptBin "main" ''
${pkgs.dbus-sway-environment}/bin/dbus-sway-environment
export XDG_CURRENT_DESKTOP=sway GTK_THEME="${pkgs.uservars.gtk_theme}" XCURSOR_THEME="${pkgs.uservars.cursor_theme}"
${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway
swaymsg exit
'';
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "${greetd_main_script}/bin/main"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
input "*" {
repeat_delay 200
repeat_rate 30
xkb_layout us(colemak)
xkb_numlock enabled
xkb_options lv3:lsgt_switch,grp:shifts_toggle
}
'';
in {
enable = true;
settings = {
initial_session = {
command = "${pkgs.sway}/bin/sway";
user = "lelgenio";
};
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
services.greetd =
let
greetd_main_script = pkgs.writeShellScriptBin "main" ''
${pkgs.dbus-sway-environment}/bin/dbus-sway-environment
export XDG_CURRENT_DESKTOP=sway GTK_THEME="${pkgs.uservars.gtk_theme}" XCURSOR_THEME="${pkgs.uservars.cursor_theme}"
${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway
swaymsg exit
'';
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "${greetd_main_script}/bin/main"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
input "*" {
repeat_delay 200
repeat_rate 30
xkb_layout us(colemak)
xkb_numlock enabled
xkb_options lv3:lsgt_switch,grp:shifts_toggle
}
'';
in
{
enable = true;
settings = {
initial_session = {
command = "${pkgs.sway}/bin/sway";
user = "lelgenio";
};
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
};
};
};
};
environment.systemPackages = with pkgs; [
sway
swaylock

View File

@ -38,12 +38,14 @@ in {
hints = {
alphabet = key.hints;
enabled = [{
regex = let
mimes =
"(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)";
# I fucking hate regex, look at this bullshit
delimiters = ''^\\u0000-\\u001F\\u007F-\\u009F<>"\\s{-}\\^`'';
in "${mimes}[${delimiters}]+";
regex =
let
mimes =
"(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)";
# I fucking hate regex, look at this bullshit
delimiters = ''^\\u0000-\\u001F\\u007F-\\u009F<>"\\s{-}\\^`'';
in
"${mimes}[${delimiters}]+";
command = "xdg-open";
post_processing = true;
mouse = {

View File

@ -1,32 +1,34 @@
{ pkgs, ... }: {
accounts.email.accounts = let
mkAccount = username: host: passName: {
realName = "Leonardo Eugênio";
address = "${username}@${host}";
userName = username;
astroid.enable = true;
imap.host = host;
smtp.host = host;
imapnotify = {
enable = true;
onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost =
"${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/ notify-send 'New mail arrived'";
accounts.email.accounts =
let
mkAccount = username: host: passName: {
realName = "Leonardo Eugênio";
address = "${username}@${host}";
userName = username;
astroid.enable = true;
imap.host = host;
smtp.host = host;
imapnotify = {
enable = true;
onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost =
"${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/ notify-send 'New mail arrived'";
};
mbsync = {
enable = true;
create = "both";
};
msmtp.enable = true;
notmuch.enable = true;
passwordCommand = toString (pkgs.writeShellScript "get_pass" ''
pass ${passName} | head -n1
'');
};
mbsync = {
enable = true;
create = "both";
};
msmtp.enable = true;
notmuch.enable = true;
passwordCommand = toString (pkgs.writeShellScript "get_pass" ''
pass ${passName} | head -n1
'');
in
{
"personal" = (mkAccount "lelgenio" "disroot.org" "disroot.org") // { primary = true; };
"work" = mkAccount "leonardo" "wopus.com.br" "Trabalho/wopus_email/leonardo@wopus.com.br";
};
in {
"personal" = (mkAccount "lelgenio" "disroot.org" "disroot.org") // { primary = true; } ;
"work" = mkAccount "leonardo" "wopus.com.br" "Trabalho/wopus_email/leonardo@wopus.com.br";
};
services.imapnotify.enable = true;

View File

@ -17,7 +17,8 @@ in {
};
make_extension = name: src:
((pkgs.fetchFirefoxAddon { inherit name src; }));
in lib.mapAttrsToList make_extension extensions_name_src;
in
lib.mapAttrsToList make_extension extensions_name_src;
};
profiles = {
main = {

View File

@ -17,7 +17,8 @@ let
preview_opts =
"--preview '${pkgs.bat}/bin/bat --style=numbers --color=always {}'";
in {
in
{
programs.fzf = {
enable = true;

View File

@ -147,29 +147,31 @@ in {
programs.bash = { enable = true; };
services.nextcloud-client = {
enable = true;
startInBackground = true;
enable = true;
startInBackground = true;
};
xdg.configFile = {
"thunar/".source = ./thunar;
};
xdg.userDirs = let
HOME = config.home.homeDirectory;
in {
enable = true;
createDirectories = true;
xdg.userDirs =
let
HOME = config.home.homeDirectory;
in
{
enable = true;
createDirectories = true;
desktop = "${HOME}/Área de trabalho";
documents = "${HOME}/Documentos";
download = "${HOME}/Downloads";
music = "${HOME}/Música";
pictures = "${HOME}/Imagens";
publicShare = "${HOME}/Público";
templates = "${HOME}/Modelos";
videos = "${HOME}/Vídeos";
};
desktop = "${HOME}/Área de trabalho";
documents = "${HOME}/Documentos";
download = "${HOME}/Downloads";
music = "${HOME}/Música";
pictures = "${HOME}/Imagens";
publicShare = "${HOME}/Público";
templates = "${HOME}/Modelos";
videos = "${HOME}/Vídeos";
};
systemd.user.services = {
steam = {

View File

@ -4,122 +4,127 @@ in {
config = {
programs.kakoune = {
enable = true;
extraConfig = let
colors = lib.mapAttrs (_: lib.replaceStrings [ "#" ] [ "rgb:" ]) {
accent_fg = accent.fg;
accent_color = accent.color;
bg_light = color.bg_light;
bg_dark = color.bg_dark;
nontxt = color.nontxt;
orange = color.normal.orange;
brown = color.normal.brown;
};
in with colors;
lib.concatStringsSep "\n" (map (lib.readFile) ([
./kak/filetypes.kak
./kak/hooks.kak
./kak/indent.kak
./kak/keys.kak
./kak/plug.kak
./kak/usermode.kak
./kak/git-mode.kak
] ++ lib.optional (dmenu == "rofi") ./kak/rofi-commands.kak)) + ''
extraConfig =
let
colors = lib.mapAttrs (_: lib.replaceStrings [ "#" ] [ "rgb:" ]) {
accent_fg = accent.fg;
accent_color = accent.color;
bg_light = color.bg_light;
bg_dark = color.bg_dark;
nontxt = color.nontxt;
orange = color.normal.orange;
brown = color.normal.brown;
};
in
with colors;
lib.concatStringsSep "\n"
(map (lib.readFile) ([
./kak/filetypes.kak
./kak/hooks.kak
./kak/indent.kak
./kak/keys.kak
./kak/plug.kak
./kak/usermode.kak
./kak/git-mode.kak
] ++ lib.optional (dmenu == "rofi") ./kak/rofi-commands.kak)) + ''
set global scrolloff 10,20
set global autoreload yes
set global startup_info_version 20200901
'' + ''
face global crosshairs_line default,${bg_dark}
face global crosshairs_column default+b
face global crosshairs_line default,${bg_dark}
face global crosshairs_column default+b
# For Code
face global value magenta
face global type yellow
face global variable blue
face global module ${brown}
face global function ${orange}
face global string green
face global keyword ${accent_color}
face global operator yellow
face global attribute cyan
face global comment ${bg_light}
face global documentation comment
face global meta +i@function
face global builtin blue
# For Code
face global value magenta
face global type yellow
face global variable blue
face global module ${brown}
face global function ${orange}
face global string green
face global keyword ${accent_color}
face global operator yellow
face global attribute cyan
face global comment ${bg_light}
face global documentation comment
face global meta +i@function
face global builtin blue
# For markup
face global title blue
face global header cyan
face global mono green
face global block magenta
face global link cyan
face global bullet cyan
face global list yellow
# For markup
face global title blue
face global header cyan
face global mono green
face global block magenta
face global link cyan
face global bullet cyan
face global list yellow
# builtin faces
face global Default default,default
# builtin faces
face global Default default,default
face global PrimaryCursor ${accent_fg},${accent_color}+fg
face global PrimaryCursorEol PrimaryCursor
face global PrimarySelection default,${bg_light}+f
face global PrimaryCursor ${accent_fg},${accent_color}+fg
face global PrimaryCursorEol PrimaryCursor
face global PrimarySelection default,${bg_light}+f
face global SecondaryCursor default,default+rfg
face global SecondaryCursorEol SecondaryCursor
face global SecondarySelection PrimarySelection
face global SecondaryCursor default,default+rfg
face global SecondaryCursorEol SecondaryCursor
face global SecondarySelection PrimarySelection
face global InactiveCursor ${accent_fg},${bg_light}+fg
face global InactiveCursor ${accent_fg},${bg_light}+fg
face global MenuForeground ${accent_fg},${accent_color}
face global MenuBackground default,${bg_dark}
face global MenuInfo cyan
face global MenuForeground ${accent_fg},${accent_color}
face global MenuBackground default,${bg_dark}
face global MenuInfo cyan
face global Information default,${bg_dark}
face global Error default,red+g
face global Information default,${bg_dark}
face global Error default,red+g
face global StatusLine %sh{
printf "rgb:"
head /dev/urandom |
base64 |
rg --text -o "${color.random_range}" |
head -n 6 |
sd '\n' ""
}
face global StatusLineMode StatusLine
face global StatusLineInfo StatusLine
face global StatusLineValue StatusLine
face global StatusCursor ${accent_fg},${accent_color}
face global StatusLine %sh{
printf "rgb:"
head /dev/urandom |
base64 |
rg --text -o "${color.random_range}" |
head -n 6 |
sd '\n' ""
}
face global StatusLineMode StatusLine
face global StatusLineInfo StatusLine
face global StatusLineValue StatusLine
face global StatusCursor ${accent_fg},${accent_color}
face global Prompt yellow,default
try %{add-highlighter global/ show-matching}
face global MatchingChar ${accent_color},default+b
face global Prompt yellow,default
try %{add-highlighter global/ show-matching}
face global MatchingChar ${accent_color},default+b
# Goodies
try %{add-highlighter global/number-lines number-lines -relative -hlcursor}
face global LineNumbers ${bg_light},default
face global LineNumberCursor default,${bg_dark}
face global LineNumbersWrapped red,default
# Goodies
try %{add-highlighter global/number-lines number-lines -relative -hlcursor}
face global LineNumbers ${bg_light},default
face global LineNumberCursor default,${bg_dark}
face global LineNumbersWrapped red,default
try %{add-highlighter global/ show-whitespaces}
face global Whitespace ${nontxt},default+f
face global BufferPadding ${nontxt},default
## highlight trailing whitespace
# add-highlighter global/ regex '\h*$' 0:red,red+u
try %{add-highlighter global/ show-whitespaces}
face global Whitespace ${nontxt},default+f
face global BufferPadding ${nontxt},default
## highlight trailing whitespace
# add-highlighter global/ regex '\h*$' 0:red,red+u
face global Reference default+bu
face global InlayHint ${bg_light}+buif
face global Reference default+bu
face global InlayHint ${bg_light}+buif
# Lsp
'' + (lib.concatStringsSep "\n" (lib.mapAttrsToList (name: color: ''
face global HighlightDiagnostic${name} ${color},default+bu
face global Diagnostic${name} ${color},default+bu
face global TextDiagnostic${name} ${color},default+b
face global InlayDiagnostic${name} ${color},default+br
'') {
Error = "red";
Warning = "yellow";
Hint = "blue";
}));
# Lsp
'' + (lib.concatStringsSep "\n" (lib.mapAttrsToList
(name: color: ''
face global HighlightDiagnostic${name} ${color},default+bu
face global Diagnostic${name} ${color},default+bu
face global TextDiagnostic${name} ${color},default+b
face global InlayDiagnostic${name} ${color},default+br
'')
{
Error = "red";
Warning = "yellow";
Hint = "blue";
}));
};
home.file = { ".config/kak-lsp/kak-lsp.toml".source = ./kak/kak-lsp.toml; };
home.packages = with pkgs; [

View File

@ -52,270 +52,272 @@ in {
# workaround to allow overriding mimeapps file
# btw, whatever it was that decided that damn file should always be written is an asshole
xdg.configFile."mimeapps.list".force = true;
xdg.mimeApps = let
xdg.mimeApps =
let
createMimeAssociation = (mime_prefix: application: mime_suffix: {
"${mime_prefix}/${mime_suffix}" = application;
});
createMimeAssociation = (mime_prefix: application: mime_suffix: {
"${mime_prefix}/${mime_suffix}" = application;
});
createMimeAssociations = (mime_prefix: application: mime_suffixes:
lib.foldAttrs (n: _: n) { }
(map (createMimeAssociation mime_prefix application) mime_suffixes));
createMimeAssociations = (mime_prefix: application: mime_suffixes:
lib.foldAttrs (n: _: n) { }
(map (createMimeAssociation mime_prefix application) mime_suffixes));
mimes = simple
// (createMimeAssociations "image" "pqiv.desktop" image_suffixes)
// (createMimeAssociations "video" "mpv.desktop" video_suffixes);
mimes = simple
// (createMimeAssociations "image" "pqiv.desktop" image_suffixes)
// (createMimeAssociations "video" "mpv.desktop" video_suffixes);
browser_desktop = {
firefox = "firefox.desktop";
qutebrowser = "org.qutebrowser.qutebrowser.desktop";
}.${browser};
browser_desktop = {
firefox = "firefox.desktop";
qutebrowser = "org.qutebrowser.qutebrowser.desktop";
}.${browser};
simple = {
"text/plain" = "kak.desktop";
"inode/directory" = "thunar.desktop";
simple = {
"text/plain" = "kak.desktop";
"inode/directory" = "thunar.desktop";
"application/pdf" = "org.pwmt.zathura.desktop";
"application/epub+zip" = "org.pwmt.zathura.desktop";
"application/pdf" = "org.pwmt.zathura.desktop";
"application/epub+zip" = "org.pwmt.zathura.desktop";
"text/html" = browser_desktop;
"x-scheme-handler/http" = browser_desktop;
"x-scheme-handler/https" = browser_desktop;
"text/html" = browser_desktop;
"x-scheme-handler/http" = browser_desktop;
"x-scheme-handler/https" = browser_desktop;
"x-scheme-handler/magnet" = "torrent.desktop";
"application/x-bittorrent" = "torrent.desktop";
"x-scheme-handler/magnet" = "torrent.desktop";
"application/x-bittorrent" = "torrent.desktop";
"x-scheme-handler/mailto" = "thunderbird.desktop";
"x-scheme-handler/mailto" = "thunderbird.desktop";
};
image_suffixes = [
"bmp"
"cgm"
"dicom-rle"
"emf"
"example"
"fits"
"g3fax"
"gif"
"heic"
"heif"
"ief"
"jls"
"jp2"
"jpeg"
"jpeg"
"jpg"
"jpm"
"jpx"
"ktx"
"naplps"
"pjpeg"
"png"
"prs.btif"
"prs.pti"
"pwg-raster"
"svg+xml-compressed"
"svg+xml"
"t38"
"tiff-fx"
"tiff"
"vnd.adobe.photoshop"
"vnd.airzip.accelerator.azv"
"vnd.cns.inf2"
"vnd.dece.graphic"
"vnd.djvu"
"vnd.dvb.subtitle"
"vnd.dwg"
"vnd.dxf"
"vnd.fastbidsheet"
"vnd.fpx"
"vnd.fst"
"vnd.fujixerox.edmics-mmr"
"vnd.fujixerox.edmics-rlc"
"vnd.globalgraphics.pgb"
"vnd.microsoft.icon"
"vnd.mix"
"vnd.mozilla.apng"
"vnd.ms-modi"
"vnd.net-fpx"
"vnd.radiance"
"vnd.rn-realpix"
"vnd.sealed.png"
"vnd.sealedmedia.softseal.gif"
"vnd.sealedmedia.softseal.jpg"
"vnd.svf"
"vnd.tencent.tap"
"vnd.valve.source.texture"
"vnd.wap.wbmp"
"vnd.xiff"
"vnd.zbrush.pcx"
"webp"
"wmf"
"x-bmp"
"x-cmu-raster"
"x-compressed-xcf"
"x-emf"
"x-eps"
"x-exr"
"x-fits"
"x-freehand"
"x-gimp-gbr"
"x-gimp-gih"
"x-gimp-pat"
"x-icon"
"x-pcx"
"x-png"
"x-portable-anymap"
"x-portable-bitmap"
"x-portable-graymap"
"x-portable-pixmap"
"x-psd"
"x-psp"
"x-rgb"
"x-sgi"
"x-targa"
"x-tga"
"x-vsd"
"x-webp"
"x-wmf"
"x-xbitmap"
"x-xcdr"
"x-xcf"
"x-xcursor"
"x-xpixmap"
"x-xwindowdump"
];
video_suffixes = [
"1d-interleaved-parityfec"
"3gp"
"3gpp"
"3gpp-tt"
"3gpp2"
"BMPEG"
"BT656"
"CelB"
"DV"
"H261"
"H263"
"H263-1998"
"H263-2000"
"H264"
"H264-RCDO"
"H264-SVC"
"H265"
"JPEG"
"MP1S"
"MP2P"
"MP2T"
"MP4V-ES"
"MPV"
"SMPTE292M"
"VP8"
"avi"
"divx"
"dv"
"encaprtp"
"example"
"fli"
"flv"
"iso.segment"
"jpeg2000"
"mj2"
"mkv"
"mp2t"
"mp4"
"mp4v-es"
"mpeg"
"mpeg-system"
"mpeg4-generic"
"msvideo"
"nv"
"ogg"
"parityfec"
"pointer"
"quicktime"
"raptorfec"
"raw"
"rtp-enc-aescm128"
"rtploopback"
"rtx"
"ulpfec"
"vc1"
"vnd.CCTV"
"vnd.dece.hd"
"vnd.dece.mobile"
"vnd.dece.mp4"
"vnd.dece.pd"
"vnd.dece.sd"
"vnd.dece.video"
"vnd.directv.mpeg"
"vnd.directv.mpeg-tts"
"vnd.divx"
"vnd.dlna.mpeg-tts"
"vnd.dvb.file"
"vnd.fvt"
"vnd.hns.video"
"vnd.iptvforum.1dparityfec-1010"
"vnd.iptvforum.1dparityfec-2005"
"vnd.iptvforum.2dparityfec-1010"
"vnd.iptvforum.2dparityfec-2005"
"vnd.iptvforum.ttsavc"
"vnd.iptvforum.ttsmpeg2"
"vnd.motorola.video"
"vnd.motorola.videop"
"vnd.mpegurl"
"vnd.ms-playready.media.pyv"
"vnd.nokia.interleaved-multimedia"
"vnd.nokia.mp4vr"
"vnd.nokia.videovoip"
"vnd.objectvideo"
"vnd.radgamettools.bink"
"vnd.radgamettools.smacker"
"vnd.rn-realvideo"
"vnd.sealed.mpeg1"
"vnd.sealed.mpeg4"
"vnd.sealed.swf"
"vnd.sealedmedia.softseal.mov"
"vnd.uvvu.mp4"
"vnd.vivo"
"webm"
"x-anim"
"x-annodex"
"x-avi"
"x-flc"
"x-fli"
"x-flic"
"x-flv"
"x-javafx"
"x-m4v"
"x-matroska"
"x-matroska-3d"
"x-mpeg"
"x-mpeg-system"
"x-mpeg2"
"x-mpeg3"
"x-ms-afs"
"x-ms-asf"
"x-ms-asf-plugin"
"x-ms-asx"
"x-ms-wm"
"x-ms-wmv"
"x-ms-wmx"
"x-ms-wvx"
"x-ms-wvxvideo"
"x-msvideo"
"x-nsv"
"x-ogm"
"x-ogm+ogg"
"x-sgi-movie"
"x-theora"
"x-theora+ogg"
];
in
{
enable = true;
defaultApplications = mimes;
};
image_suffixes = [
"bmp"
"cgm"
"dicom-rle"
"emf"
"example"
"fits"
"g3fax"
"gif"
"heic"
"heif"
"ief"
"jls"
"jp2"
"jpeg"
"jpeg"
"jpg"
"jpm"
"jpx"
"ktx"
"naplps"
"pjpeg"
"png"
"prs.btif"
"prs.pti"
"pwg-raster"
"svg+xml-compressed"
"svg+xml"
"t38"
"tiff-fx"
"tiff"
"vnd.adobe.photoshop"
"vnd.airzip.accelerator.azv"
"vnd.cns.inf2"
"vnd.dece.graphic"
"vnd.djvu"
"vnd.dvb.subtitle"
"vnd.dwg"
"vnd.dxf"
"vnd.fastbidsheet"
"vnd.fpx"
"vnd.fst"
"vnd.fujixerox.edmics-mmr"
"vnd.fujixerox.edmics-rlc"
"vnd.globalgraphics.pgb"
"vnd.microsoft.icon"
"vnd.mix"
"vnd.mozilla.apng"
"vnd.ms-modi"
"vnd.net-fpx"
"vnd.radiance"
"vnd.rn-realpix"
"vnd.sealed.png"
"vnd.sealedmedia.softseal.gif"
"vnd.sealedmedia.softseal.jpg"
"vnd.svf"
"vnd.tencent.tap"
"vnd.valve.source.texture"
"vnd.wap.wbmp"
"vnd.xiff"
"vnd.zbrush.pcx"
"webp"
"wmf"
"x-bmp"
"x-cmu-raster"
"x-compressed-xcf"
"x-emf"
"x-eps"
"x-exr"
"x-fits"
"x-freehand"
"x-gimp-gbr"
"x-gimp-gih"
"x-gimp-pat"
"x-icon"
"x-pcx"
"x-png"
"x-portable-anymap"
"x-portable-bitmap"
"x-portable-graymap"
"x-portable-pixmap"
"x-psd"
"x-psp"
"x-rgb"
"x-sgi"
"x-targa"
"x-tga"
"x-vsd"
"x-webp"
"x-wmf"
"x-xbitmap"
"x-xcdr"
"x-xcf"
"x-xcursor"
"x-xpixmap"
"x-xwindowdump"
];
video_suffixes = [
"1d-interleaved-parityfec"
"3gp"
"3gpp"
"3gpp-tt"
"3gpp2"
"BMPEG"
"BT656"
"CelB"
"DV"
"H261"
"H263"
"H263-1998"
"H263-2000"
"H264"
"H264-RCDO"
"H264-SVC"
"H265"
"JPEG"
"MP1S"
"MP2P"
"MP2T"
"MP4V-ES"
"MPV"
"SMPTE292M"
"VP8"
"avi"
"divx"
"dv"
"encaprtp"
"example"
"fli"
"flv"
"iso.segment"
"jpeg2000"
"mj2"
"mkv"
"mp2t"
"mp4"
"mp4v-es"
"mpeg"
"mpeg-system"
"mpeg4-generic"
"msvideo"
"nv"
"ogg"
"parityfec"
"pointer"
"quicktime"
"raptorfec"
"raw"
"rtp-enc-aescm128"
"rtploopback"
"rtx"
"ulpfec"
"vc1"
"vnd.CCTV"
"vnd.dece.hd"
"vnd.dece.mobile"
"vnd.dece.mp4"
"vnd.dece.pd"
"vnd.dece.sd"
"vnd.dece.video"
"vnd.directv.mpeg"
"vnd.directv.mpeg-tts"
"vnd.divx"
"vnd.dlna.mpeg-tts"
"vnd.dvb.file"
"vnd.fvt"
"vnd.hns.video"
"vnd.iptvforum.1dparityfec-1010"
"vnd.iptvforum.1dparityfec-2005"
"vnd.iptvforum.2dparityfec-1010"
"vnd.iptvforum.2dparityfec-2005"
"vnd.iptvforum.ttsavc"
"vnd.iptvforum.ttsmpeg2"
"vnd.motorola.video"
"vnd.motorola.videop"
"vnd.mpegurl"
"vnd.ms-playready.media.pyv"
"vnd.nokia.interleaved-multimedia"
"vnd.nokia.mp4vr"
"vnd.nokia.videovoip"
"vnd.objectvideo"
"vnd.radgamettools.bink"
"vnd.radgamettools.smacker"
"vnd.rn-realvideo"
"vnd.sealed.mpeg1"
"vnd.sealed.mpeg4"
"vnd.sealed.swf"
"vnd.sealedmedia.softseal.mov"
"vnd.uvvu.mp4"
"vnd.vivo"
"webm"
"x-anim"
"x-annodex"
"x-avi"
"x-flc"
"x-fli"
"x-flic"
"x-flv"
"x-javafx"
"x-m4v"
"x-matroska"
"x-matroska-3d"
"x-mpeg"
"x-mpeg-system"
"x-mpeg2"
"x-mpeg3"
"x-ms-afs"
"x-ms-asf"
"x-ms-asf-plugin"
"x-ms-asx"
"x-ms-wm"
"x-ms-wmv"
"x-ms-wmx"
"x-ms-wvx"
"x-ms-wvxvideo"
"x-msvideo"
"x-nsv"
"x-ogm"
"x-ogm+ogg"
"x-sgi-movie"
"x-theora"
"x-theora+ogg"
];
in {
enable = true;
defaultApplications = mimes;
};
};
}

View File

@ -1,4 +1,4 @@
{pkgs, config, ...}: {
{ pkgs, config, ... }: {
services.mpd = {
enable = true;
musicDirectory = config.home.homeDirectory + "/Música";

View File

@ -6,7 +6,8 @@ let
let
sign = if (idx < 2) then 1 else -1;
axis = if ((lib.mod idx 2) != 0) then "y" else "x";
in ''
in
''
${key.${direction}} { shift_${axis}(${toString (sign * 10)}) }
${lib.toUpper key.${direction}} { shift_${axis}(${toString (sign * 50)}) }
@MONTAGE{
@ -16,7 +17,8 @@ let
}
'');
in {
in
{
# My bemenu wrapper
xdg.configFile = {
"pqivrc".text = ''

View File

@ -64,31 +64,33 @@ in {
# Tabs
########################################################
tabs = let
tabs_defaults = {
odd = {
fg = color.txt;
bg = color.bg;
};
even = {
fg = color.txt;
bg = color.bg_dark;
};
selected = {
tabs =
let
tabs_defaults = {
odd = {
fg = accent.fg;
bg = accent.color;
fg = color.txt;
bg = color.bg;
};
even = {
fg = accent.fg;
bg = accent.color;
fg = color.txt;
bg = color.bg_dark;
};
selected = {
odd = {
fg = accent.fg;
bg = accent.color;
};
even = {
fg = accent.fg;
bg = accent.color;
};
};
};
};
in {
bar = { bg = color.bg; };
pinned = tabs_defaults;
} // tabs_defaults;
in
{
bar = { bg = color.bg; };
pinned = tabs_defaults;
} // tabs_defaults;
########################################################
# Completion for urls and commands

View File

@ -4,10 +4,12 @@ in {
config = {
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland.override { plugins = with pkgs; [
rofi-emoji
rofi-file-browser
];};
package = pkgs.rofi-wayland.override {
plugins = with pkgs; [
rofi-emoji
rofi-file-browser
];
};
extraConfig = {
show-icons = true;
modi = "drun,emoji";
@ -17,62 +19,64 @@ in {
kb-primary-paste = "Control+V,Shift+Insert";
kb-secondary-paste = "Control+v,Insert";
};
theme = let
# Use `mkLiteral` for string-like values that should show without
# quotes, e.g.:
# {
# foo = "abc"; => foo: "abc";
# bar = mkLiteral "abc"; => bar: abc;
# };
inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = {
# foreground-color = mkLiteral color.txt;
text-color = mkLiteral color.txt;
# background-color = mkLiteral color.bg;
background-color = mkLiteral "transparent";
# width = 512;
};
theme =
let
# Use `mkLiteral` for string-like values that should show without
# quotes, e.g.:
# {
# foo = "abc"; => foo: "abc";
# bar = mkLiteral "abc"; => bar: abc;
# };
inherit (config.lib.formats.rasi) mkLiteral;
in
{
"*" = {
# foreground-color = mkLiteral color.txt;
text-color = mkLiteral color.txt;
# background-color = mkLiteral color.bg;
background-color = mkLiteral "transparent";
# width = 512;
};
"#window" = {
background-color = mkLiteral
"${color.bg}${lib.toHexString (theme.opacity * 255 / 100)}";
# children = map mkLiteral [ "prompt" "entry" ];
border = mkLiteral "2px solid";
border-color = mkLiteral accent.color;
padding = 0;
};
"#inputbar" = { margin = mkLiteral "10px"; };
"#listview" = {
# fixed-height=0;
border = mkLiteral "2px solid 0px 0px";
# border-color = mkLiteral "@separatorcolor";
# spacing= 0 ;
};
"#window" = {
background-color = mkLiteral
"${color.bg}${lib.toHexString (theme.opacity * 255 / 100)}";
# children = map mkLiteral [ "prompt" "entry" ];
border = mkLiteral "2px solid";
border-color = mkLiteral accent.color;
padding = 0;
};
"#inputbar" = { margin = mkLiteral "10px"; };
"#listview" = {
# fixed-height=0;
border = mkLiteral "2px solid 0px 0px";
# border-color = mkLiteral "@separatorcolor";
# spacing= 0 ;
};
# "#textbox-prompt-colon" = {
# expand = false;
# str = ":";
# margin = mkLiteral "0px 0.3em 0em 0em";
# text-color = mkLiteral "@foreground-color";
# };
"#element" = {
# text-color = mkLiteral "#252525";
background-color = mkLiteral "transparent";
padding = mkLiteral "3px 10px";
};
"#element selected" = {
# text-color = mkLiteral "#252525";
background-color = mkLiteral accent.color;
};
element-icon = {
# background-color= inherit;
# text-color= inherit;
margin-right = mkLiteral "20px";
size = 24;
};
# "#textbox-prompt-colon" = {
# expand = false;
# str = ":";
# margin = mkLiteral "0px 0.3em 0em 0em";
# text-color = mkLiteral "@foreground-color";
# };
"#element" = {
# text-color = mkLiteral "#252525";
background-color = mkLiteral "transparent";
padding = mkLiteral "3px 10px";
};
"#element selected" = {
# text-color = mkLiteral "#252525";
background-color = mkLiteral accent.color;
};
element-icon = {
# background-color= inherit;
# text-color= inherit;
margin-right = mkLiteral "20px";
size = 24;
};
};
};
};
};

View File

@ -24,291 +24,309 @@ let
systemctl --user start swayidle.service
fi
'';
in {
in
{
imports = [ ./theme.nix ];
config = {
wayland.windowManager.sway = let
mod = "Mod4";
menu = "wlauncher";
terminal = "alacritty";
wayland.windowManager.sway =
let
mod = "Mod4";
menu = "wlauncher";
terminal = "alacritty";
# Utility funcion
# Input: [{v1=1;} {v2=2;}]
# Output: {v1=1;v2=2;}
mergeAttrsSet = lib.foldAttrs (n: _: n) { };
# Utility funcion
# Input: [{v1=1;} {v2=2;}]
# Output: {v1=1;v2=2;}
mergeAttrsSet = lib.foldAttrs (n: _: n) { };
forEachMerge = list: func: mergeAttrsSet (lib.forEach list func);
in {
enable = true;
config = {
bars = [ ];
window.titlebar = false;
gaps = {
smartGaps = true;
smartBorders = "on";
inner = 5;
};
colors = let
acc = accent.color;
fg_acc = accent.fg;
fg_color = color.txt;
bg_color = color.bg_dark;
alert = "#000000";
client = border: background: text: indicator: childBorder: {
inherit border background text indicator childBorder;
forEachMerge = list: func: mergeAttrsSet (lib.forEach list func);
in
{
enable = true;
config = {
bars = [ ];
window.titlebar = false;
gaps = {
smartGaps = true;
smartBorders = "on";
inner = 5;
};
in {
focused = client acc acc fg_acc acc acc;
focusedInactive = client bg_color bg_color fg_color bg_color bg_color;
unfocused = client bg_color bg_color fg_color bg_color bg_color;
urgent = client alert alert fg_color alert alert;
};
output = {
"*" = {
adaptive_sync = "on";
bg = "${theme.background} fill";
colors =
let
acc = accent.color;
fg_acc = accent.fg;
fg_color = color.txt;
bg_color = color.bg_dark;
alert = "#000000";
client = border: background: text: indicator: childBorder: {
inherit border background text indicator childBorder;
};
in
{
focused = client acc acc fg_acc acc acc;
focusedInactive = client bg_color bg_color fg_color bg_color bg_color;
unfocused = client bg_color bg_color fg_color bg_color bg_color;
urgent = client alert alert fg_color alert alert;
};
output = {
"*" = {
adaptive_sync = "on";
bg = "${theme.background} fill";
};
"DP-1" = {
mode = "1920x1080@144.000Hz";
};
};
"DP-1" = {
mode = "1920x1080@144.000Hz";
fonts = {
names = [ font.interface ];
size = font.size.medium * 1.0;
};
};
fonts = {
names = [ font.interface ];
size = font.size.medium * 1.0;
};
input."type:touchpad" = {
# Disable While Typing
dwt = "enabled";
natural_scroll = "enabled";
tap = "enabled";
};
input."*" = {
xkb_layout = "us(colemak),br";
xkb_options = "lv3:lsgt_switch,grp:shifts_toggle";
xkb_numlock = "enabled";
repeat_rate = "30";
repeat_delay = "200";
};
# setup cursor based on home.pointerCursor
seat."*" = {
xcursor_theme = "${config.home.pointerCursor.name} ${
input."type:touchpad" = {
# Disable While Typing
dwt = "enabled";
natural_scroll = "enabled";
tap = "enabled";
};
input."*" = {
xkb_layout = "us(colemak),br";
xkb_options = "lv3:lsgt_switch,grp:shifts_toggle";
xkb_numlock = "enabled";
repeat_rate = "30";
repeat_delay = "200";
};
# setup cursor based on home.pointerCursor
seat."*" = {
xcursor_theme = "${config.home.pointerCursor.name} ${
toString config.home.pointerCursor.size
}";
};
assigns = {
"2" = [
{ class = "qutebrowser"; }
{ app_id = "qutebrowser"; }
{ class = "firefox"; }
{ app_id = "firefox"; }
{ class = "Chromium"; }
{ app_id = "chromium"; }
];
"7" = [
{ app_id = "thunderbird"; }
];
"9" = [
{ class = ".*[Ss]team.*"; }
{ app_id = ".*[Ss]team.*"; }
{ app_id = "[Ll]utris"; }
];
"10" = [
{ app_id = ".*[Tt]elegram.*"; }
{ class = ".*[Tt]elegram.*"; }
{ class = "Jitsi Meet"; }
{ class = "discord"; }
{ title = "Discord"; }
{ class = "WebCord"; }
{ app_id = "WebCord"; }
];
};
modes = let
locked_binds =
lib.mapAttrs' (k: v: lib.nameValuePair "--locked ${k}" v);
code_binds =
lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v);
return_mode = lib.mapAttrs (k: v: "${v}; mode default");
in {
audio = code_binds (locked_binds {
${key.tabR} = "exec volumesh -i 10";
${key.tabL} = "exec volumesh -d 10";
${key.right} = "exec mpc next";
${key.left} = "exec mpc prev";
${key.up} = "exec volumesh --mpd -i 10";
${key.down} = "exec volumesh --mpd -d 10";
}) // return_mode {
"space" = "exec mpc toggle";
"escape" = "";
"q" = "";
"m" = "exec volumesh -t";
"s" = "exec ${pkgs.pulse_sink}/bin/pulse_sink";
};
passthrough = {
"${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
};
};
floating = {
modifier = "Mod4";
criteria = [ { class = "file_picker"; } { app_id = "file_picker"; } ];
};
keybindings = let
# mod+1 to swich to workspace 1
# mod+shift+1 to move to workspace 1
workspace_binds = let
workspaceBinds = map makeWorkspaceBinds (lib.range 1 10);
makeWorkspaceBinds = (i:
let
key = toString (lib.mod i 10);
workspaceNumber = toString i;
in {
"${mod}+${key}" = "workspace number ${workspaceNumber}";
"${mod}+Shift+${key}" =
"move container to workspace number ${workspaceNumber}";
});
in mergeAttrsSet workspaceBinds;
prev_next_binds = let
maybe_window = key:
if (lib.strings.hasInfix "button" key) then
"--whole-window"
else
"";
makePrevNextBindFunction = (prev_or_next:
map (key: {
"${maybe_window key} ${mod}+${key}" =
"workspace ${prev_or_next}_on_output";
}));
prev_binds = makePrevNextBindFunction "prev" [
key.tabL
"bracketleft"
"Prior"
"button9"
"button4"
"Shift+Tab"
assigns = {
"2" = [
{ class = "qutebrowser"; }
{ app_id = "qutebrowser"; }
{ class = "firefox"; }
{ app_id = "firefox"; }
{ class = "Chromium"; }
{ app_id = "chromium"; }
];
next_binds = makePrevNextBindFunction "next" [
key.tabR
"bracketright"
"Next"
"button8"
"button5"
"Tab"
"7" = [
{ app_id = "thunderbird"; }
];
in mergeAttrsSet (prev_binds ++ next_binds);
"9" = [
{ class = ".*[Ss]team.*"; }
{ app_id = ".*[Ss]team.*"; }
{ app_id = "[Ll]utris"; }
];
"10" = [
{ app_id = ".*[Tt]elegram.*"; }
{ class = ".*[Tt]elegram.*"; }
{ class = "Jitsi Meet"; }
{ class = "discord"; }
{ title = "Discord"; }
{ class = "WebCord"; }
{ app_id = "WebCord"; }
];
};
modes =
let
locked_binds =
lib.mapAttrs' (k: v: lib.nameValuePair "--locked ${k}" v);
code_binds =
lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v);
return_mode = lib.mapAttrs (k: v: "${v}; mode default");
in
{
audio = code_binds
(locked_binds {
${key.tabR} = "exec volumesh -i 10";
${key.tabL} = "exec volumesh -d 10";
${key.right} = "exec mpc next";
${key.left} = "exec mpc prev";
${key.up} = "exec volumesh --mpd -i 10";
${key.down} = "exec volumesh --mpd -d 10";
}) // return_mode {
"space" = "exec mpc toggle";
"escape" = "";
"q" = "";
"m" = "exec volumesh -t";
"s" = "exec ${pkgs.pulse_sink}/bin/pulse_sink";
};
passthrough = {
"${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
};
};
floating = {
modifier = "Mod4";
criteria = [{ class = "file_picker"; } { app_id = "file_picker"; }];
};
keybindings =
let
# mod+1 to swich to workspace 1
# mod+shift+1 to move to workspace 1
workspace_binds =
let
workspaceBinds = map makeWorkspaceBinds (lib.range 1 10);
makeWorkspaceBinds = (i:
let
key = toString (lib.mod i 10);
workspaceNumber = toString i;
in
{
"${mod}+${key}" = "workspace number ${workspaceNumber}";
"${mod}+Shift+${key}" =
"move container to workspace number ${workspaceNumber}";
});
in
mergeAttrsSet workspaceBinds;
# focus, move, resize, (focus and move output)
# for every direction with both arrow keys and vim keys
movement_binds = let
directions = [ "Left" "Up" "Right" "Down" ];
makeVimKeys = (k: key.${lib.toLower k});
makeArrowKeys = (k: k);
makeResizeCommand = direction:
{
Left = "shrink width 20px";
Up = "shrink height 20px";
Right = "grow width 20px";
Down = "grow height 20px";
}.${direction};
in forEachMerge [ makeVimKeys makeArrowKeys ] (prefixFun:
forEachMerge directions (direction:
let
resize_cmd = makeResizeCommand direction;
keyBind = prefixFun direction;
in {
# Move focus
"${mod}+${keyBind}" = "focus ${direction}";
# Move window
"${mod}+Shift+${keyBind}" = "move ${direction}";
# Resize window
"${mod}+Control+${keyBind}" = "resize ${resize_cmd}";
# focus output
"${mod}+mod1+${keyBind}" = "focus output ${direction}";
# Move workspace to output
"${mod}+mod1+Shift+${keyBind}" =
"move workspace output ${direction}";
}));
prev_next_binds =
let
maybe_window = key:
if (lib.strings.hasInfix "button" key) then
"--whole-window"
else
"";
makePrevNextBindFunction = (prev_or_next:
map (key: {
"${maybe_window key} ${mod}+${key}" =
"workspace ${prev_or_next}_on_output";
}));
prev_binds = makePrevNextBindFunction "prev" [
key.tabL
"bracketleft"
"Prior"
"button9"
"button4"
"Shift+Tab"
];
next_binds = makePrevNextBindFunction "next" [
key.tabR
"bracketright"
"Next"
"button8"
"button5"
"Tab"
];
in
mergeAttrsSet (prev_binds ++ next_binds);
parenting_binds = {
"${mod}+equal" = "focus parent";
"${mod}+minus" = "focus child";
"${mod}+r" = "layout toggle split";
"${mod}+t" = "layout toggle split tabbed stacking";
"${mod}+b" = "splith";
"${mod}+v" = "splitv";
"${mod}+a" = "focus parent";
# focus, move, resize, (focus and move output)
# for every direction with both arrow keys and vim keys
movement_binds =
let
directions = [ "Left" "Up" "Right" "Down" ];
makeVimKeys = (k: key.${lib.toLower k});
makeArrowKeys = (k: k);
makeResizeCommand = direction:
{
Left = "shrink width 20px";
Up = "shrink height 20px";
Right = "grow width 20px";
Down = "grow height 20px";
}.${direction};
in
forEachMerge [ makeVimKeys makeArrowKeys ] (prefixFun:
forEachMerge directions (direction:
let
resize_cmd = makeResizeCommand direction;
keyBind = prefixFun direction;
in
{
# Move focus
"${mod}+${keyBind}" = "focus ${direction}";
# Move window
"${mod}+Shift+${keyBind}" = "move ${direction}";
# Resize window
"${mod}+Control+${keyBind}" = "resize ${resize_cmd}";
# focus output
"${mod}+mod1+${keyBind}" = "focus output ${direction}";
# Move workspace to output
"${mod}+mod1+Shift+${keyBind}" =
"move workspace output ${direction}";
}));
## TODO:
# "${mod}+Shift+minus" = "move scratchpad";
# "${mod}+minus" = "scratchpad show";
};
parenting_binds = {
"${mod}+equal" = "focus parent";
"${mod}+minus" = "focus child";
"${mod}+r" = "layout toggle split";
"${mod}+t" = "layout toggle split tabbed stacking";
"${mod}+b" = "splith";
"${mod}+v" = "splitv";
"${mod}+a" = "focus parent";
audio_binds = {
XF86AudioRaiseVolume = "exec volumesh -i 10";
XF86AudioLowerVolume = "exec volumesh -d 10";
XF86AudioMute = "exec volumesh -t";
XF86AudioMicMute =
"exec pactl set-source-mute @DEFAULT_SOURCE@ toggle";
# Control media
XF86AudioPlay = "exec playerctl play-pause";
XF86AudioPause = "exec playerctl play-pause";
XF86AudioNext = "exec playerctl next";
XF86AudioPrev = "exec playerctl previous";
};
system_binds = {
"--locked Ctrl+${mod}+z" = "exec ${_suspend}/bin/_suspend";
"${mod}+Alt+c" = "exec ${_sway_idle_toggle}/bin/_sway_idle_toggle";
};
screenshot_binds = {
# Screens to file
"Print" = "exec ${pkgs.screenshotsh}/bin/screenshotsh def";
# Screen area to file
"Shift+Print" = "exec ${pkgs.screenshotsh}/bin/screenshotsh area";
# Screen area to clipboard
"Control+Shift+Print" =
"exec ${pkgs.screenshotsh}/bin/screenshotsh area-clip";
# Focused monitor to clipboard
"Control+Print" = "exec ${pkgs.screenshotsh}/bin/screenshotsh clip";
};
other_binds = {
"${mod}+p" = "exec ${pkgs.wpass}/bin/wpass";
"${mod}+s" = "exec ${menu}";
"${mod}+g" = "exec ${pkgs.demoji}/bin/demoji --lang pt --fallback --copy -- ${pkgs.wdmenu}/bin/wdmenu";
"${mod}+c" = "exec ${color_picker}";
"${mod}+Return" = "exec ${terminal}";
"${mod}+Ctrl+Return" = "exec thunar";
"${mod}+Shift+s" = "exec grim - | swappy -f -";
"${mod}+Ctrl+v" = "exec wl-paste | tesseract -l por - - | wl-copy";
"${mod}+k" = "exec showkeys";
"${mod}+x" = "kill";
"${mod}+m" = "mode audio";
"${mod}+escape" =
"mode passthrough;exec notify-send 'Passthrough on'";
"${mod}+f" = "fullscreen toggle";
"${mod}+Shift+space" = "floating toggle";
"${mod}+space" = "focus mode_toggle";
"${mod}+ctrl+space" = "sticky toggle";
"${mod}+Shift+c" = "reload";
# "${mod}+Shift+e" =
# "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
};
in mergeAttrsSet [
other_binds
workspace_binds
prev_next_binds
movement_binds
audio_binds
system_binds
parenting_binds
screenshot_binds
];
terminal = pkgs.alacritty.executable;
## TODO:
# "${mod}+Shift+minus" = "move scratchpad";
# "${mod}+minus" = "scratchpad show";
};
audio_binds = {
XF86AudioRaiseVolume = "exec volumesh -i 10";
XF86AudioLowerVolume = "exec volumesh -d 10";
XF86AudioMute = "exec volumesh -t";
XF86AudioMicMute =
"exec pactl set-source-mute @DEFAULT_SOURCE@ toggle";
# Control media
XF86AudioPlay = "exec playerctl play-pause";
XF86AudioPause = "exec playerctl play-pause";
XF86AudioNext = "exec playerctl next";
XF86AudioPrev = "exec playerctl previous";
};
system_binds = {
"--locked Ctrl+${mod}+z" = "exec ${_suspend}/bin/_suspend";
"${mod}+Alt+c" = "exec ${_sway_idle_toggle}/bin/_sway_idle_toggle";
};
screenshot_binds = {
# Screens to file
"Print" = "exec ${pkgs.screenshotsh}/bin/screenshotsh def";
# Screen area to file
"Shift+Print" = "exec ${pkgs.screenshotsh}/bin/screenshotsh area";
# Screen area to clipboard
"Control+Shift+Print" =
"exec ${pkgs.screenshotsh}/bin/screenshotsh area-clip";
# Focused monitor to clipboard
"Control+Print" = "exec ${pkgs.screenshotsh}/bin/screenshotsh clip";
};
other_binds = {
"${mod}+p" = "exec ${pkgs.wpass}/bin/wpass";
"${mod}+s" = "exec ${menu}";
"${mod}+g" = "exec ${pkgs.demoji}/bin/demoji --lang pt --fallback --copy -- ${pkgs.wdmenu}/bin/wdmenu";
"${mod}+c" = "exec ${color_picker}";
"${mod}+Return" = "exec ${terminal}";
"${mod}+Ctrl+Return" = "exec thunar";
"${mod}+Shift+s" = "exec grim - | swappy -f -";
"${mod}+Ctrl+v" = "exec wl-paste | tesseract -l por - - | wl-copy";
"${mod}+k" = "exec showkeys";
"${mod}+x" = "kill";
"${mod}+m" = "mode audio";
"${mod}+escape" =
"mode passthrough;exec notify-send 'Passthrough on'";
"${mod}+f" = "fullscreen toggle";
"${mod}+Shift+space" = "floating toggle";
"${mod}+space" = "focus mode_toggle";
"${mod}+ctrl+space" = "sticky toggle";
"${mod}+Shift+c" = "reload";
# "${mod}+Shift+e" =
# "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
};
in
mergeAttrsSet [
other_binds
workspace_binds
prev_next_binds
movement_binds
audio_binds
system_binds
parenting_binds
screenshot_binds
];
terminal = pkgs.alacritty.executable;
};
extraConfig = ''
for_window [title=.*] inhibit_idle fullscreen
exec ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment
exec swaymsg workspace 2
'';
};
extraConfig = ''
for_window [title=.*] inhibit_idle fullscreen
exec ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment
exec swaymsg workspace 2
'';
};
services.swayidle = {
enable = true;
timeouts = [

View File

@ -77,7 +77,8 @@ let
};
};
};
in rec {
in
rec {
key = keys.colemak;
theme = themes.dark;

View File

@ -72,21 +72,23 @@ in {
format = "<b>{:%H:%M %a %d/%m}</b>";
tooltip = false;
};
mpd = let
mpc = "${pkgs.mpc-cli}/bin/mpc";
in {
format = "{stateIcon} {title} - {artist}";
format-paused = "{stateIcon}";
format-stopped = "";
state-icons = {
paused = "";
playing = "";
mpd =
let
mpc = "${pkgs.mpc-cli}/bin/mpc";
in
{
format = "{stateIcon} {title} - {artist}";
format-paused = "{stateIcon}";
format-stopped = "";
state-icons = {
paused = "";
playing = "";
};
tooltip = false;
on-click = "${mpc} toggle";
on-scroll-up = "${mpc} vol +10";
on-scroll-down = "${mpc} vol -10";
};
tooltip = false;
on-click = "${mpc} toggle";
on-scroll-up = "${mpc} vol +10";
on-scroll-down = "${mpc} vol -10";
};
"sway/language" = { format = "{short} {variant}"; };
"custom/caffeine" = {
format = "{}";