Massive nixfmt reformatting
This commit is contained in:
parent
fe4492f004
commit
b29ddd5e65
109 changed files with 4323 additions and 2368 deletions
|
@ -1,4 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
|
@ -91,10 +96,13 @@ in
|
|||
|
||||
# Add an extra syntax_color config
|
||||
xdg.configFile."broot/conf.toml".source = mkOverride 1 (
|
||||
tomlFormat.generate "broot-config" (with config.programs.broot; {
|
||||
inherit (settings) verbs modal skin;
|
||||
syntax_theme = "base16-ocean.light";
|
||||
})
|
||||
tomlFormat.generate "broot-config" (
|
||||
with config.programs.broot;
|
||||
{
|
||||
inherit (settings) verbs modal skin;
|
||||
syntax_theme = "base16-ocean.light";
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
{ config, options, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
options,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.my-kakoune;
|
||||
in
|
||||
{
|
||||
imports = [ ./fish-session.nix ./tree-sitter.nix ];
|
||||
imports = [
|
||||
./fish-session.nix
|
||||
./tree-sitter.nix
|
||||
];
|
||||
|
||||
options.programs.my-kakoune = {
|
||||
enable = mkEnableOption "My version of the kakoune configuration";
|
||||
|
@ -38,7 +47,11 @@ in
|
|||
let
|
||||
kakouneFaces =
|
||||
let
|
||||
txt = strings.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (name: face: "face global ${name} \"${face}\"") cfg.extraFaces));
|
||||
txt = strings.concatStringsSep "\n" (
|
||||
builtins.attrValues (
|
||||
builtins.mapAttrs (name: face: "face global ${name} \"${face}\"") cfg.extraFaces
|
||||
)
|
||||
);
|
||||
in
|
||||
pkgs.writeText "faces.kak" txt;
|
||||
in
|
||||
|
@ -51,15 +64,13 @@ in
|
|||
# Load faces
|
||||
source ${kakouneFaces}
|
||||
'';
|
||||
} // lib.mapAttrs'
|
||||
(name: attrs: {
|
||||
name = "kak/autoload/${name}";
|
||||
value = attrs // {
|
||||
target = "kak/autoload/${name}";
|
||||
};
|
||||
})
|
||||
cfg.autoloadFile;
|
||||
}
|
||||
// lib.mapAttrs' (name: attrs: {
|
||||
name = "kak/autoload/${name}";
|
||||
value = attrs // {
|
||||
target = "kak/autoload/${name}";
|
||||
};
|
||||
}) cfg.autoloadFile;
|
||||
xdg.dataFile."kak".source = "${cfg.package}/share/kak";
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.my-kakoune.tree-sitter;
|
||||
|
@ -14,14 +19,44 @@ let
|
|||
default = "src";
|
||||
};
|
||||
grammar.compile = {
|
||||
command = mkOption { type = types.str; default = "${pkgs.gcc}/bin/gcc"; };
|
||||
args = mkOption { type = types.listOf types.str; default = [ "-c" "-fpic" "../parser.c" "../scanner.c" "-I" ".." ]; };
|
||||
flags = mkOption { type = types.listOf types.str; default = [ "-O3" ]; };
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.gcc}/bin/gcc";
|
||||
};
|
||||
args = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [
|
||||
"-c"
|
||||
"-fpic"
|
||||
"../parser.c"
|
||||
"../scanner.c"
|
||||
"-I"
|
||||
".."
|
||||
];
|
||||
};
|
||||
flags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "-O3" ];
|
||||
};
|
||||
};
|
||||
grammar.link = {
|
||||
command = mkOption { type = types.str; default = "${pkgs.gcc}/bin/gcc"; };
|
||||
args = mkOption { type = types.listOf types.str; default = [ "-shared" "-fpic" "parser.o" "scanner.o" ]; };
|
||||
flags = mkOption { type = types.listOf types.str; default = [ "-O3" ]; };
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.gcc}/bin/gcc";
|
||||
};
|
||||
args = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [
|
||||
"-shared"
|
||||
"-fpic"
|
||||
"parser.o"
|
||||
"scanner.o"
|
||||
];
|
||||
};
|
||||
flags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "-O3" ];
|
||||
};
|
||||
};
|
||||
queries.src = mkOption {
|
||||
type = types.package;
|
||||
|
@ -34,12 +69,27 @@ let
|
|||
};
|
||||
};
|
||||
mkGrammarPackage =
|
||||
{ name
|
||||
, src
|
||||
, grammarPath ? "src"
|
||||
, grammarCompileArgs ? [ "-O3" "-c" "-fpic" "../parser.c" "../scanner.c" "-I" ".." ]
|
||||
, grammarLinkArgs ? [ "-shared" "-fpic" "parser.o" "scanner.o" ]
|
||||
}: pkgs.stdenv.mkDerivation {
|
||||
{
|
||||
name,
|
||||
src,
|
||||
grammarPath ? "src",
|
||||
grammarCompileArgs ? [
|
||||
"-O3"
|
||||
"-c"
|
||||
"-fpic"
|
||||
"../parser.c"
|
||||
"../scanner.c"
|
||||
"-I"
|
||||
".."
|
||||
],
|
||||
grammarLinkArgs ? [
|
||||
"-shared"
|
||||
"-fpic"
|
||||
"parser.o"
|
||||
"scanner.o"
|
||||
],
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
inherit src;
|
||||
name = "kak-tree-sitter-grammar-${name}.so";
|
||||
version = "latest";
|
||||
|
@ -215,43 +265,54 @@ in
|
|||
toTs = name: "ts_${strings.concatStringsSep "_" (strings.splitString "." name)}";
|
||||
toScm = name: strings.concatStringsSep "." (strings.splitString "_" name);
|
||||
|
||||
definedFaces = attrsets.mapAttrs' (name: value: { inherit value; name = toTs name; }) allGroups;
|
||||
aliasFaces = attrsets.mapAttrs' (name: value: { name = toTs name; value = "@${toTs value}"; }) aliases;
|
||||
definedFaces = attrsets.mapAttrs' (name: value: {
|
||||
inherit value;
|
||||
name = toTs name;
|
||||
}) allGroups;
|
||||
aliasFaces = attrsets.mapAttrs' (name: value: {
|
||||
name = toTs name;
|
||||
value = "@${toTs value}";
|
||||
}) aliases;
|
||||
faces = attrsets.recursiveUpdate definedFaces aliasFaces;
|
||||
|
||||
toml = pkgs.formats.toml { };
|
||||
|
||||
toLanguageConf = name: lang: with lang; {
|
||||
grammar = {
|
||||
source.local.path = mkGrammarPackage {
|
||||
inherit name;
|
||||
src = grammar.src;
|
||||
grammarPath = grammar.path;
|
||||
grammarCompileArgs = grammar.compile.flags ++ grammar.compile.args;
|
||||
grammarLinkArgs = grammar.link.flags ++ grammar.link.args;
|
||||
toLanguageConf =
|
||||
name: lang: with lang; {
|
||||
grammar = {
|
||||
source.local.path = mkGrammarPackage {
|
||||
inherit name;
|
||||
src = grammar.src;
|
||||
grammarPath = grammar.path;
|
||||
grammarCompileArgs = grammar.compile.flags ++ grammar.compile.args;
|
||||
grammarLinkArgs = grammar.link.flags ++ grammar.link.args;
|
||||
};
|
||||
compile = grammar.compile.command;
|
||||
compile_args = grammar.compile.args;
|
||||
compile_flags = grammar.compile.flags;
|
||||
link = grammar.link.command;
|
||||
link_args = grammar.link.args ++ [
|
||||
"-o"
|
||||
"${name}.so"
|
||||
];
|
||||
link_flags = grammar.link.flags;
|
||||
};
|
||||
queries = rec {
|
||||
path = if queries.path == null then "runtime/queries/${name}" else queries.path;
|
||||
source.local.path = "${queries.src}/${path}";
|
||||
};
|
||||
compile = grammar.compile.command;
|
||||
compile_args = grammar.compile.args;
|
||||
compile_flags = grammar.compile.flags;
|
||||
link = grammar.link.command;
|
||||
link_args = grammar.link.args ++ [ "-o" "${name}.so" ];
|
||||
link_flags = grammar.link.flags;
|
||||
};
|
||||
queries = rec {
|
||||
path = if queries.path == null then "runtime/queries/${name}" else queries.path;
|
||||
source.local.path = "${queries.src}/${path}";
|
||||
};
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
assertions = with lib.asserts; ([ ]
|
||||
++ attrsets.mapAttrsToList
|
||||
(name: _: {
|
||||
assertion = (! (builtins.hasAttr name allGroups));
|
||||
message = "${name} was both defined and aliased";
|
||||
})
|
||||
aliases
|
||||
);
|
||||
assertions =
|
||||
with lib.asserts;
|
||||
(
|
||||
[ ]
|
||||
++ attrsets.mapAttrsToList (name: _: {
|
||||
assertion = (!(builtins.hasAttr name allGroups));
|
||||
message = "${name} was both defined and aliased";
|
||||
}) aliases
|
||||
);
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."kak-tree-sitter/config.toml" = {
|
||||
|
@ -271,4 +332,3 @@ in
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.nki.programs.kitty;
|
||||
cmd = "cmd";
|
||||
in
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
programs.kitty = mkIf (cfg.enable && pkgs.stdenv.isDarwin) {
|
||||
|
||||
# Darwin-specific setup
|
||||
|
@ -24,4 +30,3 @@ with lib; {
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,41 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nki.programs.kitty;
|
||||
|
||||
theme = { lib, options, config, ... }: {
|
||||
programs.kitty = lib.mkIf config.nki.programs.kitty.enable (
|
||||
if builtins.hasAttr "themeFile" options.programs.kitty then {
|
||||
themeFile = "ayu_light";
|
||||
} else {
|
||||
theme = "Ayu Light";
|
||||
}
|
||||
);
|
||||
};
|
||||
theme =
|
||||
{
|
||||
lib,
|
||||
options,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.kitty = lib.mkIf config.nki.programs.kitty.enable (
|
||||
if builtins.hasAttr "themeFile" options.programs.kitty then
|
||||
{
|
||||
themeFile = "ayu_light";
|
||||
}
|
||||
else
|
||||
{
|
||||
theme = "Ayu Light";
|
||||
}
|
||||
);
|
||||
};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
imports = [ theme ./darwin.nix ./linux.nix ./tabs.nix ];
|
||||
imports = [
|
||||
theme
|
||||
./darwin.nix
|
||||
./linux.nix
|
||||
./tabs.nix
|
||||
];
|
||||
|
||||
options.nki.programs.kitty = {
|
||||
enable = mkEnableOption "Enable kitty";
|
||||
|
@ -73,14 +93,17 @@ with lib;
|
|||
let
|
||||
# Background color and transparency
|
||||
background =
|
||||
if isNull cfg.background then {
|
||||
background_opacity = "0.93";
|
||||
dynamic_background_opacity = true;
|
||||
} else {
|
||||
background_image = "${cfg.background}";
|
||||
background_image_layout = "scaled";
|
||||
background_tint = "0.85";
|
||||
};
|
||||
if isNull cfg.background then
|
||||
{
|
||||
background_opacity = "0.93";
|
||||
dynamic_background_opacity = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
background_image = "${cfg.background}";
|
||||
background_image_layout = "scaled";
|
||||
background_tint = "0.85";
|
||||
};
|
||||
in
|
||||
mkMerge [
|
||||
background
|
||||
|
@ -123,4 +146,3 @@ with lib;
|
|||
'';
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.nki.programs.kitty;
|
||||
in
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nki.programs.kitty;
|
||||
|
@ -7,33 +12,33 @@ in
|
|||
with lib;
|
||||
{
|
||||
programs.kitty = mkIf cfg.enableTabs {
|
||||
keybindings = {
|
||||
"${cmd}+t" = "new_tab_with_cwd";
|
||||
"${cmd}+shift+t" = "new_tab";
|
||||
"${cmd}+shift+o" = "launch --cwd=current --location=vsplit";
|
||||
"${cmd}+o" = "launch --cwd=current --location=hsplit";
|
||||
"${cmd}+r" = "start_resizing_window";
|
||||
"${cmd}+shift+r" = "layout_action rotate";
|
||||
## Move the active window in the indicated direction
|
||||
"${cmd}+shift+h" = "move_window left";
|
||||
"${cmd}+shift+k" = "move_window up";
|
||||
"${cmd}+shift+j" = "move_window down";
|
||||
"${cmd}+shift+l" = "move_window right";
|
||||
## Switch focus to the neighboring window in the indicated direction
|
||||
"${cmd}+h" = "neighboring_window left";
|
||||
"${cmd}+k" = "neighboring_window up";
|
||||
"${cmd}+j" = "neighboring_window down ";
|
||||
"${cmd}+l" = "neighboring_window right";
|
||||
## Detach window to its own tab
|
||||
"${cmd}+shift+d" = "detach_window new-tab";
|
||||
## Change layout to fullscreen (stack) and back
|
||||
"${cmd}+f" = "toggle_layout stack";
|
||||
}
|
||||
# Tab bindings
|
||||
// builtins.listToAttrs
|
||||
(map
|
||||
(x: attrsets.nameValuePair "${cmd}+${toString x}" "goto_tab ${toString x}")
|
||||
(lists.range 1 9));
|
||||
keybindings =
|
||||
{
|
||||
"${cmd}+t" = "new_tab_with_cwd";
|
||||
"${cmd}+shift+t" = "new_tab";
|
||||
"${cmd}+shift+o" = "launch --cwd=current --location=vsplit";
|
||||
"${cmd}+o" = "launch --cwd=current --location=hsplit";
|
||||
"${cmd}+r" = "start_resizing_window";
|
||||
"${cmd}+shift+r" = "layout_action rotate";
|
||||
## Move the active window in the indicated direction
|
||||
"${cmd}+shift+h" = "move_window left";
|
||||
"${cmd}+shift+k" = "move_window up";
|
||||
"${cmd}+shift+j" = "move_window down";
|
||||
"${cmd}+shift+l" = "move_window right";
|
||||
## Switch focus to the neighboring window in the indicated direction
|
||||
"${cmd}+h" = "neighboring_window left";
|
||||
"${cmd}+k" = "neighboring_window up";
|
||||
"${cmd}+j" = "neighboring_window down ";
|
||||
"${cmd}+l" = "neighboring_window right";
|
||||
## Detach window to its own tab
|
||||
"${cmd}+shift+d" = "detach_window new-tab";
|
||||
## Change layout to fullscreen (stack) and back
|
||||
"${cmd}+f" = "toggle_layout stack";
|
||||
}
|
||||
# Tab bindings
|
||||
// builtins.listToAttrs (
|
||||
map (x: attrsets.nameValuePair "${cmd}+${toString x}" "goto_tab ${toString x}") (lists.range 1 9)
|
||||
);
|
||||
settings = {
|
||||
# Tab settings
|
||||
tab_bar_edge = "top";
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ config, osConfig, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
osConfig,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.my-niri;
|
||||
|
||||
|
@ -26,16 +32,33 @@ in
|
|||
lock-command = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = "The command to lock the screen";
|
||||
default = [ "${pkgs.swaylock}/bin/swaylock" ]
|
||||
++ (if wallpaper == "" then [ "" ] else [ "-i" "${wallpaper}" "-s" "fill" ])
|
||||
++ [ "-l" "-k" ];
|
||||
default =
|
||||
[ "${pkgs.swaylock}/bin/swaylock" ]
|
||||
++ (
|
||||
if wallpaper == "" then
|
||||
[ "" ]
|
||||
else
|
||||
[
|
||||
"-i"
|
||||
"${wallpaper}"
|
||||
"-s"
|
||||
"fill"
|
||||
]
|
||||
)
|
||||
++ [
|
||||
"-l"
|
||||
"-k"
|
||||
];
|
||||
};
|
||||
|
||||
workspaces = lib.mkOption {
|
||||
type = lib.types.attrsOf
|
||||
(lib.types.submodule {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption { type = lib.types.str; description = "workspace name"; };
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "workspace name";
|
||||
};
|
||||
fixed = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
|
@ -47,7 +70,8 @@ in
|
|||
description = "Default monitor to spawn workspace in";
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
description = "A mapping of ordering to workspace names, for fixed workspaces";
|
||||
};
|
||||
};
|
||||
|
@ -55,17 +79,39 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
programs.my-niri.workspaces = {
|
||||
# Default workspaces, always there
|
||||
"01" = { name = "🌏 web"; };
|
||||
"02" = { name = "💬 chat"; };
|
||||
"03" = { name = "⚙️ code"; };
|
||||
"04" = { name = "🎶 music"; };
|
||||
"05" = { name = "🔧 extra"; };
|
||||
"06" = { name = "🧰 6"; };
|
||||
"07" = { name = "🔩 7"; };
|
||||
"08" = { name = "🛠️ 8"; };
|
||||
"09" = { name = "🔨 9"; };
|
||||
"10" = { name = "🎲 misc"; };
|
||||
"99" = { name = "📧 Email"; };
|
||||
"01" = {
|
||||
name = "🌏 web";
|
||||
};
|
||||
"02" = {
|
||||
name = "💬 chat";
|
||||
};
|
||||
"03" = {
|
||||
name = "⚙️ code";
|
||||
};
|
||||
"04" = {
|
||||
name = "🎶 music";
|
||||
};
|
||||
"05" = {
|
||||
name = "🔧 extra";
|
||||
};
|
||||
"06" = {
|
||||
name = "🧰 6";
|
||||
};
|
||||
"07" = {
|
||||
name = "🔩 7";
|
||||
};
|
||||
"08" = {
|
||||
name = "🛠️ 8";
|
||||
};
|
||||
"09" = {
|
||||
name = "🔨 9";
|
||||
};
|
||||
"10" = {
|
||||
name = "🎲 misc";
|
||||
};
|
||||
"99" = {
|
||||
name = "📧 Email";
|
||||
};
|
||||
};
|
||||
systemd.user.services.swaync.Install.WantedBy = [ "niri.service" ];
|
||||
systemd.user.services.swaync.Unit.After = [ "niri.service" ];
|
||||
|
@ -84,7 +130,10 @@ in
|
|||
Unit = {
|
||||
Description = "XWayland Client for niri";
|
||||
PartOf = [ "xwayland.target" ];
|
||||
Before = [ "xwayland.target" "xdg-desktop-autostart.target" ];
|
||||
Before = [
|
||||
"xwayland.target"
|
||||
"xdg-desktop-autostart.target"
|
||||
];
|
||||
After = [ "niri.service" ];
|
||||
};
|
||||
Install.WantedBy = [ "niri.service" ];
|
||||
|
@ -97,16 +146,20 @@ in
|
|||
};
|
||||
|
||||
programs.niri.settings = {
|
||||
environment = {
|
||||
QT_QPA_PLATFORM = "wayland";
|
||||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
QT_IM_MODULE = "fcitx";
|
||||
# export NIXOS_OZONE_WL=1 # Until text-input is merged
|
||||
DISPLAY = xwayland-display;
|
||||
} // lib.optionalAttrs osConfig.services.desktopManager.plasma6.enable {
|
||||
XDG_MENU_PREFIX = "plasma-";
|
||||
environment =
|
||||
{
|
||||
QT_QPA_PLATFORM = "wayland";
|
||||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
QT_IM_MODULE = "fcitx";
|
||||
# export NIXOS_OZONE_WL=1 # Until text-input is merged
|
||||
DISPLAY = xwayland-display;
|
||||
}
|
||||
// lib.optionalAttrs osConfig.services.desktopManager.plasma6.enable {
|
||||
XDG_MENU_PREFIX = "plasma-";
|
||||
};
|
||||
input.keyboard.xkb = {
|
||||
layout = "jp";
|
||||
};
|
||||
input.keyboard.xkb = { layout = "jp"; };
|
||||
input.touchpad = lib.mkIf cfg.enableLaptop {
|
||||
tap = true;
|
||||
dwt = true;
|
||||
|
@ -138,9 +191,25 @@ in
|
|||
|
||||
spawn-at-startup = [
|
||||
# Wallpaper
|
||||
{ command = [ (lib.getExe pkgs.swaybg) "-i" "${wallpaper}" "-m" "fill" ]; }
|
||||
{
|
||||
command = [
|
||||
(lib.getExe pkgs.swaybg)
|
||||
"-i"
|
||||
"${wallpaper}"
|
||||
"-m"
|
||||
"fill"
|
||||
];
|
||||
}
|
||||
# Waybar
|
||||
{ command = [ "systemctl" "--user" "start" "xdg-desktop-portal-gtk.service" "xdg-desktop-portal.service" ]; }
|
||||
{
|
||||
command = [
|
||||
"systemctl"
|
||||
"--user"
|
||||
"start"
|
||||
"xdg-desktop-portal-gtk.service"
|
||||
"xdg-desktop-portal.service"
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
layout = {
|
||||
|
@ -154,11 +223,24 @@ in
|
|||
|
||||
focus-ring = {
|
||||
width = 4;
|
||||
active.gradient = { from = "#00447AFF"; to = "#71C4FFAA"; angle = 45; };
|
||||
active.gradient = {
|
||||
from = "#00447AFF";
|
||||
to = "#71C4FFAA";
|
||||
angle = 45;
|
||||
};
|
||||
inactive.color = "#505050";
|
||||
};
|
||||
border.enable = false;
|
||||
struts = let v = 8; in { left = v; right = v; bottom = v; top = v; };
|
||||
struts =
|
||||
let
|
||||
v = 8;
|
||||
in
|
||||
{
|
||||
left = v;
|
||||
right = v;
|
||||
bottom = v;
|
||||
top = v;
|
||||
};
|
||||
};
|
||||
|
||||
prefer-no-csd = true;
|
||||
|
@ -166,18 +248,31 @@ in
|
|||
workspaces =
|
||||
let
|
||||
fixedWorkspaces = lib.filterAttrs (_: w: w.fixed) cfg.workspaces;
|
||||
workspaceConfig = lib.mapAttrs
|
||||
(_: w: { inherit (w) name; } // (lib.optionalAttrs (w.monitor != null) {
|
||||
workspaceConfig = lib.mapAttrs (
|
||||
_: w:
|
||||
{
|
||||
inherit (w) name;
|
||||
}
|
||||
// (lib.optionalAttrs (w.monitor != null) {
|
||||
open-on-output = w.monitor;
|
||||
}))
|
||||
fixedWorkspaces;
|
||||
})
|
||||
) fixedWorkspaces;
|
||||
in
|
||||
workspaceConfig;
|
||||
|
||||
window-rules = [
|
||||
# Rounded Corners
|
||||
{
|
||||
geometry-corner-radius = let v = 8.0; in { bottom-left = v; bottom-right = v; top-left = v; top-right = v; };
|
||||
geometry-corner-radius =
|
||||
let
|
||||
v = 8.0;
|
||||
in
|
||||
{
|
||||
bottom-left = v;
|
||||
bottom-right = v;
|
||||
top-left = v;
|
||||
top-right = v;
|
||||
};
|
||||
clip-to-geometry = true;
|
||||
}
|
||||
# Workspace assignments
|
||||
|
@ -185,9 +280,18 @@ in
|
|||
open-on-workspace = cfg.workspaces."01".name;
|
||||
open-maximized = true;
|
||||
matches = [
|
||||
{ at-startup = true; app-id = "^firefox$"; }
|
||||
{ at-startup = true; app-id = "^librewolf$"; }
|
||||
{ at-startup = true; app-id = "^zen$"; }
|
||||
{
|
||||
at-startup = true;
|
||||
app-id = "^firefox$";
|
||||
}
|
||||
{
|
||||
at-startup = true;
|
||||
app-id = "^librewolf$";
|
||||
}
|
||||
{
|
||||
at-startup = true;
|
||||
app-id = "^zen$";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
|
@ -225,7 +329,7 @@ in
|
|||
|
||||
# xwaylandvideobridge
|
||||
{
|
||||
matches = [{ app-id = "^xwaylandvideobridge$"; }];
|
||||
matches = [ { app-id = "^xwaylandvideobridge$"; } ];
|
||||
open-floating = true;
|
||||
focus-ring.enable = false;
|
||||
opacity = 0.0;
|
||||
|
@ -242,15 +346,15 @@ in
|
|||
|
||||
# Kitty dimming
|
||||
{
|
||||
matches = [{ app-id = "kitty"; }];
|
||||
excludes = [{ is-focused = true; }];
|
||||
matches = [ { app-id = "kitty"; } ];
|
||||
excludes = [ { is-focused = true; } ];
|
||||
opacity = 0.95;
|
||||
}
|
||||
];
|
||||
|
||||
layer-rules = [
|
||||
{
|
||||
matches = [{ namespace = "^swaync-.*"; }];
|
||||
matches = [ { namespace = "^swaync-.*"; } ];
|
||||
block-out-from = "screen-capture";
|
||||
}
|
||||
];
|
||||
|
@ -268,14 +372,38 @@ in
|
|||
"Mod+Shift+P".action = spawn "rofi-rbw-script";
|
||||
|
||||
# Audio and Volume
|
||||
"XF86AudioPrev" = { action = spawn playerctl "previous"; allow-when-locked = true; };
|
||||
"XF86AudioPlay" = { action = spawn playerctl "play-pause"; allow-when-locked = true; };
|
||||
"Shift+XF86AudioPlay" = { action = spawn playerctl "stop"; allow-when-locked = true; };
|
||||
"XF86AudioNext" = { action = spawn playerctl "next"; allow-when-locked = true; };
|
||||
"XF86AudioRecord" = { action = spawn amixer "-q" "set" "Capture" "toggle"; allow-when-locked = true; };
|
||||
"XF86AudioMute" = { action = spawn amixer "-q" "set" "Master" "toggle"; allow-when-locked = true; };
|
||||
"XF86AudioLowerVolume" = { action = spawn amixer "-q" "set" "Master" "3%-"; allow-when-locked = true; };
|
||||
"XF86AudioRaiseVolume" = { action = spawn amixer "-q" "set" "Master" "3%+"; allow-when-locked = true; };
|
||||
"XF86AudioPrev" = {
|
||||
action = spawn playerctl "previous";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioPlay" = {
|
||||
action = spawn playerctl "play-pause";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"Shift+XF86AudioPlay" = {
|
||||
action = spawn playerctl "stop";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioNext" = {
|
||||
action = spawn playerctl "next";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioRecord" = {
|
||||
action = spawn amixer "-q" "set" "Capture" "toggle";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioMute" = {
|
||||
action = spawn amixer "-q" "set" "Master" "toggle";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioLowerVolume" = {
|
||||
action = spawn amixer "-q" "set" "Master" "3%-";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioRaiseVolume" = {
|
||||
action = spawn amixer "-q" "set" "Master" "3%+";
|
||||
allow-when-locked = true;
|
||||
};
|
||||
|
||||
# Backlight
|
||||
"XF86MonBrightnessDown".action = spawn brightnessctl "s" "10%-";
|
||||
|
@ -320,10 +448,22 @@ in
|
|||
"Mod+Ctrl+O".action = move-workspace-up;
|
||||
|
||||
# Mouse bindings
|
||||
"Mod+WheelScrollDown" = { action = focus-workspace-down; cooldown-ms = 150; };
|
||||
"Mod+WheelScrollUp" = { action = focus-workspace-up; cooldown-ms = 150; };
|
||||
"Mod+Ctrl+WheelScrollDown" = { action = move-column-to-workspace-down; cooldown-ms = 150; };
|
||||
"Mod+Ctrl+WheelScrollUp" = { action = move-column-to-workspace-up; cooldown-ms = 150; };
|
||||
"Mod+WheelScrollDown" = {
|
||||
action = focus-workspace-down;
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
"Mod+WheelScrollUp" = {
|
||||
action = focus-workspace-up;
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
"Mod+Ctrl+WheelScrollDown" = {
|
||||
action = move-column-to-workspace-down;
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
"Mod+Ctrl+WheelScrollUp" = {
|
||||
action = move-column-to-workspace-up;
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
|
||||
"Mod+WheelScrollRight".action = focus-column-right;
|
||||
"Mod+WheelScrollLeft".action = focus-column-left;
|
||||
|
@ -338,26 +478,66 @@ in
|
|||
#
|
||||
# For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on
|
||||
# will all refer to the 3rd workspace.
|
||||
"Mod+1" = lib.mkIf cfg.workspaces."01".fixed { action = focus-workspace (cfg.workspaces."01".name); };
|
||||
"Mod+2" = lib.mkIf cfg.workspaces."02".fixed { action = focus-workspace (cfg.workspaces."02".name); };
|
||||
"Mod+3" = lib.mkIf cfg.workspaces."03".fixed { action = focus-workspace (cfg.workspaces."03".name); };
|
||||
"Mod+4" = lib.mkIf cfg.workspaces."04".fixed { action = focus-workspace (cfg.workspaces."04".name); };
|
||||
"Mod+5" = lib.mkIf cfg.workspaces."05".fixed { action = focus-workspace (cfg.workspaces."05".name); };
|
||||
"Mod+6" = lib.mkIf cfg.workspaces."06".fixed { action = focus-workspace (cfg.workspaces."06".name); };
|
||||
"Mod+7" = lib.mkIf cfg.workspaces."07".fixed { action = focus-workspace (cfg.workspaces."07".name); };
|
||||
"Mod+8" = lib.mkIf cfg.workspaces."08".fixed { action = focus-workspace (cfg.workspaces."08".name); };
|
||||
"Mod+9" = lib.mkIf cfg.workspaces."09".fixed { action = focus-workspace (cfg.workspaces."09".name); };
|
||||
"Mod+0" = lib.mkIf cfg.workspaces."10".fixed { action = focus-workspace (cfg.workspaces."10".name); };
|
||||
"Mod+Shift+1" = lib.mkIf cfg.workspaces."01".fixed { action = move-column-to-workspace (cfg.workspaces."01".name); };
|
||||
"Mod+Shift+2" = lib.mkIf cfg.workspaces."02".fixed { action = move-column-to-workspace (cfg.workspaces."02".name); };
|
||||
"Mod+Shift+3" = lib.mkIf cfg.workspaces."03".fixed { action = move-column-to-workspace (cfg.workspaces."03".name); };
|
||||
"Mod+Shift+4" = lib.mkIf cfg.workspaces."04".fixed { action = move-column-to-workspace (cfg.workspaces."04".name); };
|
||||
"Mod+Shift+5" = lib.mkIf cfg.workspaces."05".fixed { action = move-column-to-workspace (cfg.workspaces."05".name); };
|
||||
"Mod+Shift+6" = lib.mkIf cfg.workspaces."06".fixed { action = move-column-to-workspace (cfg.workspaces."06".name); };
|
||||
"Mod+Shift+7" = lib.mkIf cfg.workspaces."07".fixed { action = move-column-to-workspace (cfg.workspaces."07".name); };
|
||||
"Mod+Shift+8" = lib.mkIf cfg.workspaces."08".fixed { action = move-column-to-workspace (cfg.workspaces."08".name); };
|
||||
"Mod+Shift+9" = lib.mkIf cfg.workspaces."09".fixed { action = move-column-to-workspace (cfg.workspaces."09".name); };
|
||||
"Mod+Shift+0" = lib.mkIf cfg.workspaces."10".fixed { action = move-column-to-workspace (cfg.workspaces."10".name); };
|
||||
"Mod+1" = lib.mkIf cfg.workspaces."01".fixed {
|
||||
action = focus-workspace (cfg.workspaces."01".name);
|
||||
};
|
||||
"Mod+2" = lib.mkIf cfg.workspaces."02".fixed {
|
||||
action = focus-workspace (cfg.workspaces."02".name);
|
||||
};
|
||||
"Mod+3" = lib.mkIf cfg.workspaces."03".fixed {
|
||||
action = focus-workspace (cfg.workspaces."03".name);
|
||||
};
|
||||
"Mod+4" = lib.mkIf cfg.workspaces."04".fixed {
|
||||
action = focus-workspace (cfg.workspaces."04".name);
|
||||
};
|
||||
"Mod+5" = lib.mkIf cfg.workspaces."05".fixed {
|
||||
action = focus-workspace (cfg.workspaces."05".name);
|
||||
};
|
||||
"Mod+6" = lib.mkIf cfg.workspaces."06".fixed {
|
||||
action = focus-workspace (cfg.workspaces."06".name);
|
||||
};
|
||||
"Mod+7" = lib.mkIf cfg.workspaces."07".fixed {
|
||||
action = focus-workspace (cfg.workspaces."07".name);
|
||||
};
|
||||
"Mod+8" = lib.mkIf cfg.workspaces."08".fixed {
|
||||
action = focus-workspace (cfg.workspaces."08".name);
|
||||
};
|
||||
"Mod+9" = lib.mkIf cfg.workspaces."09".fixed {
|
||||
action = focus-workspace (cfg.workspaces."09".name);
|
||||
};
|
||||
"Mod+0" = lib.mkIf cfg.workspaces."10".fixed {
|
||||
action = focus-workspace (cfg.workspaces."10".name);
|
||||
};
|
||||
"Mod+Shift+1" = lib.mkIf cfg.workspaces."01".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."01".name);
|
||||
};
|
||||
"Mod+Shift+2" = lib.mkIf cfg.workspaces."02".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."02".name);
|
||||
};
|
||||
"Mod+Shift+3" = lib.mkIf cfg.workspaces."03".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."03".name);
|
||||
};
|
||||
"Mod+Shift+4" = lib.mkIf cfg.workspaces."04".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."04".name);
|
||||
};
|
||||
"Mod+Shift+5" = lib.mkIf cfg.workspaces."05".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."05".name);
|
||||
};
|
||||
"Mod+Shift+6" = lib.mkIf cfg.workspaces."06".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."06".name);
|
||||
};
|
||||
"Mod+Shift+7" = lib.mkIf cfg.workspaces."07".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."07".name);
|
||||
};
|
||||
"Mod+Shift+8" = lib.mkIf cfg.workspaces."08".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."08".name);
|
||||
};
|
||||
"Mod+Shift+9" = lib.mkIf cfg.workspaces."09".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."09".name);
|
||||
};
|
||||
"Mod+Shift+0" = lib.mkIf cfg.workspaces."10".fixed {
|
||||
action = move-column-to-workspace (cfg.workspaces."10".name);
|
||||
};
|
||||
|
||||
"Mod+asciicircum".action = focus-workspace (cfg.workspaces."99".name);
|
||||
"Mod+Shift+asciicircum".action = move-column-to-workspace (cfg.workspaces."99".name);
|
||||
|
@ -392,4 +572,3 @@ in
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
{ pkgs, lib, options, config, osConfig, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
options,
|
||||
config,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.my-sway;
|
||||
|
@ -22,12 +29,14 @@ let
|
|||
mail = "📧 Email";
|
||||
};
|
||||
wsAttrs = builtins.listToAttrs (
|
||||
map
|
||||
(i: { name = toString (remainder i 10); value = builtins.elemAt workspaces (i - 1); })
|
||||
(range 1 11)
|
||||
map (i: {
|
||||
name = toString (remainder i 10);
|
||||
value = builtins.elemAt workspaces (i - 1);
|
||||
}) (range 1 11)
|
||||
);
|
||||
remainder = x: y: x - (builtins.div x y) * y;
|
||||
range = from: to:
|
||||
range =
|
||||
from: to:
|
||||
let
|
||||
f = cur: if cur == to then [ ] else [ cur ] ++ f (cur + 1);
|
||||
in
|
||||
|
@ -64,7 +73,10 @@ in
|
|||
default = true;
|
||||
};
|
||||
wallpaper = mkOption {
|
||||
type = types.oneOf [ types.path types.str ];
|
||||
type = types.oneOf [
|
||||
types.path
|
||||
types.str
|
||||
];
|
||||
description = "Path to the wallpaper to be used";
|
||||
default = config.linux.graphical.wallpaper;
|
||||
};
|
||||
|
@ -83,14 +95,20 @@ in
|
|||
lockCmd = mkOption {
|
||||
type = types.str;
|
||||
description = "The screen lock command";
|
||||
default = "${pkgs.swaylock}/bin/swaylock"
|
||||
default =
|
||||
"${pkgs.swaylock}/bin/swaylock"
|
||||
+ (if cfg.wallpaper == "" then "" else " -i ${cfg.wallpaper} -s fill")
|
||||
+ " -l -k";
|
||||
};
|
||||
};
|
||||
|
||||
config.systemd.user.targets.sway-session = mkIf cfg.enable {
|
||||
Unit.Before = [ "tray.target" "xwayland.target" "xdg-desktop-portal.service" "xdg-desktop-autostart.target" ];
|
||||
Unit.Before = [
|
||||
"tray.target"
|
||||
"xwayland.target"
|
||||
"xdg-desktop-portal.service"
|
||||
"xdg-desktop-autostart.target"
|
||||
];
|
||||
Unit.Upholds = [ "waybar.service" ];
|
||||
Unit.Wants = [ "xdg-desktop-autostart.target" ];
|
||||
};
|
||||
|
@ -107,13 +125,16 @@ in
|
|||
enable = true;
|
||||
package = cfg.package;
|
||||
systemd.enable = true;
|
||||
systemd.variables = options.wayland.windowManager.sway.systemd.variables.default ++ [
|
||||
"PATH" # for portals
|
||||
"XDG_DATA_DIRS" # For extra icons
|
||||
"XDG_DATA_HOME" # For extra icons
|
||||
] ++ lib.optionals osConfig.services.desktopManager.plasma6.enable [
|
||||
"XDG_MENU_PREFIX"
|
||||
];
|
||||
systemd.variables =
|
||||
options.wayland.windowManager.sway.systemd.variables.default
|
||||
++ [
|
||||
"PATH" # for portals
|
||||
"XDG_DATA_DIRS" # For extra icons
|
||||
"XDG_DATA_HOME" # For extra icons
|
||||
]
|
||||
++ lib.optionals osConfig.services.desktopManager.plasma6.enable [
|
||||
"XDG_MENU_PREFIX"
|
||||
];
|
||||
# systemd.extraCommands = options.wayland.windowManager.sway.systemd.extraCommands.default
|
||||
# ++ [
|
||||
# "systemctl --user restart xdg-desktop-portal.service"
|
||||
|
@ -137,7 +158,8 @@ in
|
|||
### Seats
|
||||
#
|
||||
# Cursor
|
||||
seat."*".xcursor_theme = "${config.home.pointerCursor.name} ${toString config.home.pointerCursor.size}";
|
||||
seat."*".xcursor_theme =
|
||||
"${config.home.pointerCursor.name} ${toString config.home.pointerCursor.size}";
|
||||
|
||||
### Programs
|
||||
#
|
||||
|
@ -158,110 +180,120 @@ in
|
|||
#
|
||||
# Main modifier
|
||||
modifier = mod;
|
||||
keybindings = {
|
||||
### Default Bindings
|
||||
#
|
||||
## App management
|
||||
"${mod}+Return" = "exec ${swayCfg.config.terminal}";
|
||||
"${mod}+Shift+q" = "kill";
|
||||
"${mod}+d" = "exec ${swayCfg.config.menu}";
|
||||
## Windowing
|
||||
# Focus
|
||||
"${mod}+${swayCfg.config.left}" = "focus left";
|
||||
"${mod}+${swayCfg.config.down}" = "focus down";
|
||||
"${mod}+${swayCfg.config.up}" = "focus up";
|
||||
"${mod}+${swayCfg.config.right}" = "focus right";
|
||||
"${mod}+Left" = "focus left";
|
||||
"${mod}+Down" = "focus down";
|
||||
"${mod}+Up" = "focus up";
|
||||
"${mod}+Right" = "focus right";
|
||||
# Move
|
||||
"${mod}+Shift+${swayCfg.config.left}" = "move left";
|
||||
"${mod}+Shift+${swayCfg.config.down}" = "move down";
|
||||
"${mod}+Shift+${swayCfg.config.up}" = "move up";
|
||||
"${mod}+Shift+${swayCfg.config.right}" = "move right";
|
||||
"${mod}+Shift+Left" = "move left";
|
||||
"${mod}+Shift+Down" = "move down";
|
||||
"${mod}+Shift+Up" = "move up";
|
||||
"${mod}+Shift+Right" = "move right";
|
||||
# Toggles
|
||||
"${mod}+f" = "fullscreen toggle";
|
||||
"${mod}+a" = "focus parent";
|
||||
# Layouts
|
||||
"${mod}+s" = "layout stacking";
|
||||
"${mod}+w" = "layout tabbed";
|
||||
"${mod}+e" = "layout toggle split";
|
||||
# Floating
|
||||
"${mod}+Shift+space" = "floating toggle";
|
||||
# Scratchpad
|
||||
"${mod}+Shift+minus" = "move scratchpad";
|
||||
# Resize
|
||||
"${mod}+r" = "mode resize";
|
||||
"${mod}+minus" = "scratchpad show";
|
||||
## Reload and exit
|
||||
"${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'";
|
||||
# Launcher
|
||||
"${mod}+space" = "exec rofi -show drun";
|
||||
"${mod}+tab" = "exec ${./rofi-window.py}";
|
||||
"${mod}+shift+p" = "exec rofi-rbw-script";
|
||||
} // {
|
||||
## Splits
|
||||
"${mod}+v" = "split v";
|
||||
"${mod}+Shift+v" = "split h";
|
||||
## Run
|
||||
"${mod}+r" = "exec ${config.wayland.windowManager.sway.config.menu}";
|
||||
"${mod}+Shift+r" = "mode resize";
|
||||
## Screenshot
|
||||
"Print" = "exec ${screenshotScript}/bin/screenshot";
|
||||
"Shift+Print" = "exec ${screenshotEditScript}/bin/screenshot";
|
||||
## Locking
|
||||
"${mod}+semicolon" = "exec ${cfg.lockCmd}";
|
||||
## Multimedia
|
||||
"XF86AudioPrev" = "exec ${playerctl} previous";
|
||||
"XF86AudioPlay" = "exec ${playerctl} play-pause";
|
||||
"Shift+XF86AudioPlay" = "exec ${playerctl} stop";
|
||||
"XF86AudioNext" = "exec ${playerctl} next";
|
||||
"XF86AudioRecord" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Capture toggle";
|
||||
"XF86AudioMute" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master toggle";
|
||||
"XF86AudioLowerVolume" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master 3%-";
|
||||
"XF86AudioRaiseVolume" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master 3%+";
|
||||
## Backlight
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 10%-";
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 10%+";
|
||||
"Shift+XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -d kbd_backlight s 25%-";
|
||||
"Shift+XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -d kbd_backlight s 25%+";
|
||||
} //
|
||||
# Map the workspaces
|
||||
(builtins.listToAttrs (lib.flatten (map
|
||||
(key: [
|
||||
keybindings =
|
||||
{
|
||||
### Default Bindings
|
||||
#
|
||||
## App management
|
||||
"${mod}+Return" = "exec ${swayCfg.config.terminal}";
|
||||
"${mod}+Shift+q" = "kill";
|
||||
"${mod}+d" = "exec ${swayCfg.config.menu}";
|
||||
## Windowing
|
||||
# Focus
|
||||
"${mod}+${swayCfg.config.left}" = "focus left";
|
||||
"${mod}+${swayCfg.config.down}" = "focus down";
|
||||
"${mod}+${swayCfg.config.up}" = "focus up";
|
||||
"${mod}+${swayCfg.config.right}" = "focus right";
|
||||
"${mod}+Left" = "focus left";
|
||||
"${mod}+Down" = "focus down";
|
||||
"${mod}+Up" = "focus up";
|
||||
"${mod}+Right" = "focus right";
|
||||
# Move
|
||||
"${mod}+Shift+${swayCfg.config.left}" = "move left";
|
||||
"${mod}+Shift+${swayCfg.config.down}" = "move down";
|
||||
"${mod}+Shift+${swayCfg.config.up}" = "move up";
|
||||
"${mod}+Shift+${swayCfg.config.right}" = "move right";
|
||||
"${mod}+Shift+Left" = "move left";
|
||||
"${mod}+Shift+Down" = "move down";
|
||||
"${mod}+Shift+Up" = "move up";
|
||||
"${mod}+Shift+Right" = "move right";
|
||||
# Toggles
|
||||
"${mod}+f" = "fullscreen toggle";
|
||||
"${mod}+a" = "focus parent";
|
||||
# Layouts
|
||||
"${mod}+s" = "layout stacking";
|
||||
"${mod}+w" = "layout tabbed";
|
||||
"${mod}+e" = "layout toggle split";
|
||||
# Floating
|
||||
"${mod}+Shift+space" = "floating toggle";
|
||||
# Scratchpad
|
||||
"${mod}+Shift+minus" = "move scratchpad";
|
||||
# Resize
|
||||
"${mod}+r" = "mode resize";
|
||||
"${mod}+minus" = "scratchpad show";
|
||||
## Reload and exit
|
||||
"${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'";
|
||||
# Launcher
|
||||
"${mod}+space" = "exec rofi -show drun";
|
||||
"${mod}+tab" = "exec ${./rofi-window.py}";
|
||||
"${mod}+shift+p" = "exec rofi-rbw-script";
|
||||
}
|
||||
// {
|
||||
## Splits
|
||||
"${mod}+v" = "split v";
|
||||
"${mod}+Shift+v" = "split h";
|
||||
## Run
|
||||
"${mod}+r" = "exec ${config.wayland.windowManager.sway.config.menu}";
|
||||
"${mod}+Shift+r" = "mode resize";
|
||||
## Screenshot
|
||||
"Print" = "exec ${screenshotScript}/bin/screenshot";
|
||||
"Shift+Print" = "exec ${screenshotEditScript}/bin/screenshot";
|
||||
## Locking
|
||||
"${mod}+semicolon" = "exec ${cfg.lockCmd}";
|
||||
## Multimedia
|
||||
"XF86AudioPrev" = "exec ${playerctl} previous";
|
||||
"XF86AudioPlay" = "exec ${playerctl} play-pause";
|
||||
"Shift+XF86AudioPlay" = "exec ${playerctl} stop";
|
||||
"XF86AudioNext" = "exec ${playerctl} next";
|
||||
"XF86AudioRecord" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Capture toggle";
|
||||
"XF86AudioMute" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master toggle";
|
||||
"XF86AudioLowerVolume" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master 3%-";
|
||||
"XF86AudioRaiseVolume" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master 3%+";
|
||||
## Backlight
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 10%-";
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 10%+";
|
||||
"Shift+XF86MonBrightnessDown" =
|
||||
"exec ${pkgs.brightnessctl}/bin/brightnessctl -d kbd_backlight s 25%-";
|
||||
"Shift+XF86MonBrightnessUp" =
|
||||
"exec ${pkgs.brightnessctl}/bin/brightnessctl -d kbd_backlight s 25%+";
|
||||
}
|
||||
//
|
||||
# Map the workspaces
|
||||
(builtins.listToAttrs (
|
||||
lib.flatten (
|
||||
map (key: [
|
||||
{
|
||||
name = "${mod}+${key}";
|
||||
value = "workspace ${builtins.getAttr key wsAttrs}";
|
||||
}
|
||||
{
|
||||
name = "${mod}+Shift+${key}";
|
||||
value = "move to workspace ${builtins.getAttr key wsAttrs}";
|
||||
}
|
||||
]) (builtins.attrNames wsAttrs)
|
||||
)
|
||||
))
|
||||
// {
|
||||
# Extra workspaces
|
||||
"${mod}+asciicircum" = "workspace ${extraWorkspaces.mail}";
|
||||
"${mod}+shift+asciicircum" = "move to workspace ${extraWorkspaces.mail}";
|
||||
}
|
||||
//
|
||||
# Move workspaces between outputs
|
||||
{
|
||||
name = "${mod}+${key}";
|
||||
value = "workspace ${builtins.getAttr key wsAttrs}";
|
||||
}
|
||||
{
|
||||
name = "${mod}+Shift+${key}";
|
||||
value = "move to workspace ${builtins.getAttr key wsAttrs}";
|
||||
}
|
||||
])
|
||||
(builtins.attrNames wsAttrs))
|
||||
)) //
|
||||
{
|
||||
# Extra workspaces
|
||||
"${mod}+asciicircum" = "workspace ${extraWorkspaces.mail}";
|
||||
"${mod}+shift+asciicircum" = "move to workspace ${extraWorkspaces.mail}";
|
||||
} //
|
||||
# Move workspaces between outputs
|
||||
{
|
||||
"${mod}+ctrl+h" = "move workspace to output left";
|
||||
"${mod}+ctrl+l" = "move workspace to output right";
|
||||
};
|
||||
"${mod}+ctrl+h" = "move workspace to output left";
|
||||
"${mod}+ctrl+l" = "move workspace to output right";
|
||||
};
|
||||
|
||||
### Fonts
|
||||
#
|
||||
fonts = {
|
||||
names = [ "monospace" "FontAwesome5Free" ];
|
||||
names = [
|
||||
"monospace"
|
||||
"FontAwesome5Free"
|
||||
];
|
||||
size = cfg.fontSize;
|
||||
};
|
||||
|
||||
|
@ -298,21 +330,31 @@ in
|
|||
];
|
||||
};
|
||||
# Commands
|
||||
window.commands = [
|
||||
{ criteria = { title = ".*"; }; command = "inhibit_idle fullscreen"; }
|
||||
] ++ (
|
||||
# Floating assignments
|
||||
let
|
||||
criterias = [
|
||||
{ app_id = ".*float.*"; }
|
||||
{ app_id = "org\\.freedesktop\\.impl\\.portal\\.desktop\\..*"; }
|
||||
{ class = ".*float.*"; }
|
||||
{ title = "Extension: .*Bitwarden.*"; }
|
||||
];
|
||||
toCommand = criteria: { inherit criteria; command = "floating enable"; };
|
||||
in
|
||||
map toCommand criterias
|
||||
);
|
||||
window.commands =
|
||||
[
|
||||
{
|
||||
criteria = {
|
||||
title = ".*";
|
||||
};
|
||||
command = "inhibit_idle fullscreen";
|
||||
}
|
||||
]
|
||||
++ (
|
||||
# Floating assignments
|
||||
let
|
||||
criterias = [
|
||||
{ app_id = ".*float.*"; }
|
||||
{ app_id = "org\\.freedesktop\\.impl\\.portal\\.desktop\\..*"; }
|
||||
{ class = ".*float.*"; }
|
||||
{ title = "Extension: .*Bitwarden.*"; }
|
||||
];
|
||||
toCommand = criteria: {
|
||||
inherit criteria;
|
||||
command = "floating enable";
|
||||
};
|
||||
in
|
||||
map toCommand criterias
|
||||
);
|
||||
# Focus
|
||||
focus.followMouse = true;
|
||||
focus.mouseWarping = true;
|
||||
|
@ -334,36 +376,50 @@ in
|
|||
# swaynag
|
||||
swaynag.enable = true;
|
||||
# Environment Variables
|
||||
extraSessionCommands = ''
|
||||
export QT_QPA_PLATFORM=wayland
|
||||
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
||||
export QT_IM_MODULE=fcitx
|
||||
export GTK_IM_MODULE=fcitx # Til text-input is merged
|
||||
# export NIXOS_OZONE_WL=1 # Until text-input is merged
|
||||
extraSessionCommands =
|
||||
''
|
||||
export QT_QPA_PLATFORM=wayland
|
||||
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
||||
export QT_IM_MODULE=fcitx
|
||||
export GTK_IM_MODULE=fcitx # Til text-input is merged
|
||||
# export NIXOS_OZONE_WL=1 # Until text-input is merged
|
||||
|
||||
'' + (if config.services.gnome-keyring.enable then ''
|
||||
# gnome-keyring
|
||||
if type gnome-keyring-daemon >/dev/null; then
|
||||
eval `gnome-keyring-daemon`
|
||||
export SSH_AUTH_SOCK
|
||||
fi
|
||||
'' else "") + lib.optionalString osConfig.services.desktopManager.plasma6.enable ''
|
||||
export XDG_MENU_PREFIX=plasma-
|
||||
'';
|
||||
''
|
||||
+ (
|
||||
if config.services.gnome-keyring.enable then
|
||||
''
|
||||
# gnome-keyring
|
||||
if type gnome-keyring-daemon >/dev/null; then
|
||||
eval `gnome-keyring-daemon`
|
||||
export SSH_AUTH_SOCK
|
||||
fi
|
||||
''
|
||||
else
|
||||
""
|
||||
)
|
||||
+ lib.optionalString osConfig.services.desktopManager.plasma6.enable ''
|
||||
export XDG_MENU_PREFIX=plasma-
|
||||
'';
|
||||
# Extra
|
||||
wrapperFeatures.base = true;
|
||||
wrapperFeatures.gtk = true;
|
||||
|
||||
extraConfig =
|
||||
(if cfg.enableLaptop then ''
|
||||
# Lock screen on lid close
|
||||
bindswitch lid:off exec ${cfg.lockCmd}
|
||||
(
|
||||
if cfg.enableLaptop then
|
||||
''
|
||||
# Lock screen on lid close
|
||||
bindswitch lid:off exec ${cfg.lockCmd}
|
||||
|
||||
# Gesture bindings
|
||||
bindgesture swipe:3:right workspace prev
|
||||
bindgesture swipe:3:left workspace next
|
||||
bindgesture swipe:3:up exec ${./rofi-window.py}
|
||||
'' else "") + ''
|
||||
# Gesture bindings
|
||||
bindgesture swipe:3:right workspace prev
|
||||
bindgesture swipe:3:left workspace next
|
||||
bindgesture swipe:3:up exec ${./rofi-window.py}
|
||||
''
|
||||
else
|
||||
""
|
||||
)
|
||||
+ ''
|
||||
## swayfx stuff
|
||||
# Rounded corners
|
||||
corner_radius 5
|
||||
|
@ -378,10 +434,10 @@ in
|
|||
# Blur
|
||||
for_window [app_id=".*kitty.*"] blur enable
|
||||
blur_xray disable
|
||||
'' + ''
|
||||
''
|
||||
+ ''
|
||||
# Enable portal stuff
|
||||
exec ${pkgs.writeShellScript "start-portals.sh" ''
|
||||
''}
|
||||
exec ${pkgs.writeShellScript "start-portals.sh" ''''}
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -393,20 +449,28 @@ in
|
|||
# { timeout = 15 * 60; command = cfg.lockCmd; }
|
||||
];
|
||||
events = [
|
||||
{ event = "lock"; command = cfg.lockCmd; }
|
||||
{ event = "before-sleep"; command = cfg.lockCmd; }
|
||||
{
|
||||
event = "lock";
|
||||
command = cfg.lockCmd;
|
||||
}
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = cfg.lockCmd;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
config.home.packages = mkIf cfg.enable (with pkgs; [
|
||||
# Needed for QT_QPA_PLATFORM
|
||||
kdePackages.qtwayland
|
||||
# For waybar
|
||||
font-awesome
|
||||
]);
|
||||
config.home.packages = mkIf cfg.enable (
|
||||
with pkgs;
|
||||
[
|
||||
# Needed for QT_QPA_PLATFORM
|
||||
kdePackages.qtwayland
|
||||
# For waybar
|
||||
font-awesome
|
||||
]
|
||||
);
|
||||
|
||||
config.programs.rofi = mkIf cfg.enable {
|
||||
font = lib.mkForce "monospace ${toString cfg.fontSize}";
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.my-sway;
|
||||
|
@ -6,15 +11,22 @@ let
|
|||
# Set up an ibus script
|
||||
ibusNext = (
|
||||
let
|
||||
input-methods = [ "xkb:us::eng" "mozc-jp" "Bamboo" ];
|
||||
next = m:
|
||||
input-methods = [
|
||||
"xkb:us::eng"
|
||||
"mozc-jp"
|
||||
"Bamboo"
|
||||
];
|
||||
next =
|
||||
m:
|
||||
let
|
||||
nextRec = l:
|
||||
if (length l == 1)
|
||||
then head input-methods
|
||||
else if (m == head l)
|
||||
then (head (tail l))
|
||||
else nextRec (tail l);
|
||||
nextRec =
|
||||
l:
|
||||
if (length l == 1) then
|
||||
head input-methods
|
||||
else if (m == head l) then
|
||||
(head (tail l))
|
||||
else
|
||||
nextRec (tail l);
|
||||
in
|
||||
nextRec input-methods;
|
||||
changeTo = m: ''
|
||||
|
@ -52,4 +64,3 @@ in
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.my-waybar;
|
||||
in
|
||||
|
@ -47,382 +52,418 @@ in
|
|||
};
|
||||
config.programs.waybar =
|
||||
let
|
||||
barWith = { showMedia ? true, showConnectivity ? true, extraSettings ? { }, ... }: lib.mkMerge ([{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
modules-left = [
|
||||
"sway/workspaces"
|
||||
"sway/mode"
|
||||
"sway/window"
|
||||
"niri/workspaces"
|
||||
"niri/window"
|
||||
];
|
||||
modules-center = [
|
||||
];
|
||||
modules-right =
|
||||
lib.optional showMedia (if cfg.enableMpd then "mpd" else "custom/media")
|
||||
++ [
|
||||
"tray"
|
||||
"pulseaudio"
|
||||
] ++ lib.optionals showConnectivity [
|
||||
"bluetooth"
|
||||
"network"
|
||||
] ++ [
|
||||
"cpu"
|
||||
"memory"
|
||||
"temperature"
|
||||
] ++ lib.optionals cfg.enableLaptopBars [ "battery" "battery#bat2" ]
|
||||
++ [
|
||||
"clock"
|
||||
];
|
||||
barWith =
|
||||
{
|
||||
showMedia ? true,
|
||||
showConnectivity ? true,
|
||||
extraSettings ? { },
|
||||
...
|
||||
}:
|
||||
lib.mkMerge (
|
||||
[
|
||||
{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
modules-left = [
|
||||
"sway/workspaces"
|
||||
"sway/mode"
|
||||
"sway/window"
|
||||
"niri/workspaces"
|
||||
"niri/window"
|
||||
];
|
||||
modules-center = [
|
||||
];
|
||||
modules-right =
|
||||
lib.optional showMedia (if cfg.enableMpd then "mpd" else "custom/media")
|
||||
++ [
|
||||
"tray"
|
||||
"pulseaudio"
|
||||
]
|
||||
++ lib.optionals showConnectivity [
|
||||
"bluetooth"
|
||||
"network"
|
||||
]
|
||||
++ [
|
||||
"cpu"
|
||||
"memory"
|
||||
"temperature"
|
||||
]
|
||||
++ lib.optionals cfg.enableLaptopBars [
|
||||
"battery"
|
||||
"battery#bat2"
|
||||
]
|
||||
++ [
|
||||
"clock"
|
||||
];
|
||||
|
||||
modules = {
|
||||
"sway/workspaces" = {
|
||||
format = "{name}";
|
||||
};
|
||||
"sway/mode" = {
|
||||
format = "<span style=\"italic\">{}</span>";
|
||||
};
|
||||
"sway/window" = {
|
||||
max-length = 70;
|
||||
format = "{title}";
|
||||
"rewrite" = {
|
||||
"(.*) — Mozilla Firefox" = "[🌎] $1";
|
||||
"(.*) - Mozilla Thunderbird" = "[📧] $1";
|
||||
"(.*) - Kakoune" = "[⌨️] $1";
|
||||
"(.*) - fish" = "[>_] $1";
|
||||
"(.*) - Discord" = "[🗨️] $1";
|
||||
# ArmCord thing
|
||||
"• Discord \\| (.*)" = "[🗨️] $1";
|
||||
"\\((\\d+)\\) Discord \\| (.*)" = "[🗨️] {$1} $2";
|
||||
};
|
||||
};
|
||||
"niri/window" = {
|
||||
format = "{title}";
|
||||
"rewrite" = {
|
||||
"(.*) — Mozilla Firefox" = "[🌎] $1";
|
||||
"(.*) - Mozilla Thunderbird" = "[📧] $1";
|
||||
"(.*) - Kakoune" = "[⌨️] $1";
|
||||
"(.*) - fish" = "[>_] $1";
|
||||
"(.*) - Discord" = "[🗨️] $1";
|
||||
# ArmCord thing
|
||||
"• Discord \\| (.*)" = "[🗨️] $1";
|
||||
"\\((\\d+)\\) Discord \\| (.*)" = "[🗨️] {$1} $2";
|
||||
};
|
||||
};
|
||||
"tray" = {
|
||||
icon-size = 21;
|
||||
spacing = 10;
|
||||
};
|
||||
"clock" = {
|
||||
# format = "{:📅 %Y-%m-%d | 🕰️ %H:%M [%Z]}";
|
||||
format = "📅 {0:%Y-%m-%d} |️ 🕰️ {0:%H:%M [%Z]}";
|
||||
tooltip-format = "\n<span size='9pt' font_family='Noto Sans Mono CJK JP'>{calendar}</span>";
|
||||
timezones = [
|
||||
"Europe/Zurich"
|
||||
"America/Toronto"
|
||||
"Asia/Tokyo"
|
||||
"Asia/Ho_Chi_Minh"
|
||||
];
|
||||
calendar = {
|
||||
mode = "year";
|
||||
mode-mon-col = 3;
|
||||
weeks-pos = "right";
|
||||
on-scroll = 1;
|
||||
on-click-right = "mode";
|
||||
format = {
|
||||
months = "<span color='#ffead3'><b>{}</b></span>";
|
||||
days = "<span color='#ecc6d9'><b>{}</b></span>";
|
||||
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
|
||||
weekdays = "<span color='#ffcc66'><b>日 月 火 水 木 金 土</b></span>"; # See https://github.com/Alexays/Waybar/issues/3132
|
||||
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
|
||||
modules = {
|
||||
"sway/workspaces" = {
|
||||
format = "{name}";
|
||||
};
|
||||
"sway/mode" = {
|
||||
format = "<span style=\"italic\">{}</span>";
|
||||
};
|
||||
"sway/window" = {
|
||||
max-length = 70;
|
||||
format = "{title}";
|
||||
"rewrite" = {
|
||||
"(.*) — Mozilla Firefox" = "[🌎] $1";
|
||||
"(.*) - Mozilla Thunderbird" = "[📧] $1";
|
||||
"(.*) - Kakoune" = "[⌨️] $1";
|
||||
"(.*) - fish" = "[>_] $1";
|
||||
"(.*) - Discord" = "[🗨️] $1";
|
||||
# ArmCord thing
|
||||
"• Discord \\| (.*)" = "[🗨️] $1";
|
||||
"\\((\\d+)\\) Discord \\| (.*)" = "[🗨️] {$1} $2";
|
||||
};
|
||||
};
|
||||
"niri/window" = {
|
||||
format = "{title}";
|
||||
"rewrite" = {
|
||||
"(.*) — Mozilla Firefox" = "[🌎] $1";
|
||||
"(.*) - Mozilla Thunderbird" = "[📧] $1";
|
||||
"(.*) - Kakoune" = "[⌨️] $1";
|
||||
"(.*) - fish" = "[>_] $1";
|
||||
"(.*) - Discord" = "[🗨️] $1";
|
||||
# ArmCord thing
|
||||
"• Discord \\| (.*)" = "[🗨️] $1";
|
||||
"\\((\\d+)\\) Discord \\| (.*)" = "[🗨️] {$1} $2";
|
||||
};
|
||||
};
|
||||
"tray" = {
|
||||
icon-size = 21;
|
||||
spacing = 10;
|
||||
};
|
||||
"clock" = {
|
||||
# format = "{:📅 %Y-%m-%d | 🕰️ %H:%M [%Z]}";
|
||||
format = "📅 {0:%Y-%m-%d} |️ 🕰️ {0:%H:%M [%Z]}";
|
||||
tooltip-format = "\n<span size='9pt' font_family='Noto Sans Mono CJK JP'>{calendar}</span>";
|
||||
timezones = [
|
||||
"Europe/Zurich"
|
||||
"America/Toronto"
|
||||
"Asia/Tokyo"
|
||||
"Asia/Ho_Chi_Minh"
|
||||
];
|
||||
calendar = {
|
||||
mode = "year";
|
||||
mode-mon-col = 3;
|
||||
weeks-pos = "right";
|
||||
on-scroll = 1;
|
||||
on-click-right = "mode";
|
||||
format = {
|
||||
months = "<span color='#ffead3'><b>{}</b></span>";
|
||||
days = "<span color='#ecc6d9'><b>{}</b></span>";
|
||||
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
|
||||
weekdays = "<span color='#ffcc66'><b>日 月 火 水 木 金 土</b></span>"; # See https://github.com/Alexays/Waybar/issues/3132
|
||||
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
|
||||
};
|
||||
};
|
||||
actions = {
|
||||
on-click-middle = "mode";
|
||||
on-click-right = "tz_up";
|
||||
on-scroll-up = "shift_up";
|
||||
on-scroll-down = "shift_down";
|
||||
};
|
||||
};
|
||||
"cpu" = {
|
||||
format = "{usage}% ";
|
||||
};
|
||||
"memory" = {
|
||||
format = "{}% ";
|
||||
};
|
||||
"temperature" = {
|
||||
# thermal-zone = 2;
|
||||
# hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
|
||||
critical-threshold = 80;
|
||||
# format-critical = "{temperatureC}°C ";
|
||||
format = "{temperatureC}°C ";
|
||||
};
|
||||
"backlight" = {
|
||||
# device = "acpi_video1";
|
||||
format = "{percent}% {icon}";
|
||||
states = [
|
||||
0
|
||||
50
|
||||
];
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
"battery" = lib.mkIf cfg.enableLaptopBars {
|
||||
states = {
|
||||
good = 95;
|
||||
warning = 30;
|
||||
critical = 15;
|
||||
};
|
||||
format = "{capacity}% {icon}";
|
||||
# format-good = ""; # An empty format will hide the module
|
||||
# format-full = "";
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
"battery#bat2" = lib.mkIf cfg.enableLaptopBars {
|
||||
bat = "BAT2";
|
||||
};
|
||||
"network" = {
|
||||
# interface = wlp2s0 # (Optional) To force the use of this interface
|
||||
format-wifi = "{essid} ({signalStrength}%) ";
|
||||
format-ethernet = "{ifname} ";
|
||||
format-disconnected = "Disconnected ⚠";
|
||||
interval = 7;
|
||||
on-click = "${cfg.terminal} ${lib.getExe' pkgs.iwd "iwctl"}";
|
||||
};
|
||||
"bluetooth" = {
|
||||
format = " {status}";
|
||||
format-connected = " {device_alias}";
|
||||
format-connected-battery = " {device_alias} {device_battery_percentage}%";
|
||||
# format-device-preference= [ "device1", "device2" ], // preference list deciding the displayed devic;
|
||||
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
|
||||
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
|
||||
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
|
||||
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
|
||||
on-click = "${pkgs.blueman}/bin/blueman-manager";
|
||||
};
|
||||
"pulseaudio" = {
|
||||
# scroll-step = 1;
|
||||
format = "{volume}% {icon}";
|
||||
format-bluetooth = "{volume}% {icon}";
|
||||
format-muted = "";
|
||||
format-icons = {
|
||||
headphones = "";
|
||||
handsfree = "";
|
||||
headset = "";
|
||||
phone = "";
|
||||
portable = "";
|
||||
car = "";
|
||||
default = [
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
|
||||
};
|
||||
"mpd" = {
|
||||
"format" =
|
||||
"{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) 🎧";
|
||||
"format-disconnected" = "Disconnected 🎧";
|
||||
"format-stopped" = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped 🎧";
|
||||
"interval" = 2;
|
||||
"consume-icons" = {
|
||||
"on" = " "; # Icon shows only when "consume" is on
|
||||
};
|
||||
"random-icons" = {
|
||||
"off" = "<span color=\"#f53c3c\"></span> "; # Icon grayed out when "random" is off;
|
||||
"on" = " ";
|
||||
};
|
||||
"repeat-icons" = {
|
||||
"on" = " ";
|
||||
};
|
||||
"single-icons" = {
|
||||
"on" = "1 ";
|
||||
};
|
||||
"state-icons" = {
|
||||
"paused" = "";
|
||||
"playing" = "";
|
||||
};
|
||||
"tooltip-format" = "MPD (connected)";
|
||||
"tooltip-format-disconnected" = "MPD (disconnected)";
|
||||
"on-click" = "${pkgs.mpc_cli}/bin/mpc toggle";
|
||||
"on-click-right" = "${pkgs.mpc_cli}/bin/mpc stop";
|
||||
"on-click-middle" = "${cfg.terminal} --class=kitty_ncmpcpp ${pkgs.ncmpcpp}/bin/ncmpcpp";
|
||||
};
|
||||
"custom/media" = {
|
||||
"format" = "{icon}{}";
|
||||
"return-type" = "json";
|
||||
"format-icons" = {
|
||||
"Playing" = " ";
|
||||
"Paused" = " ";
|
||||
};
|
||||
"max-length" = 80;
|
||||
"exec" =
|
||||
"${lib.getExe pkgs.playerctl} -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F";
|
||||
"on-click" = "${lib.getExe pkgs.playerctl} play-pause";
|
||||
};
|
||||
};
|
||||
};
|
||||
actions = {
|
||||
on-click-middle = "mode";
|
||||
on-click-right = "tz_up";
|
||||
on-scroll-up = "shift_up";
|
||||
on-scroll-down = "shift_down";
|
||||
};
|
||||
};
|
||||
"cpu" = {
|
||||
format = "{usage}% ";
|
||||
};
|
||||
"memory" = {
|
||||
format = "{}% ";
|
||||
};
|
||||
"temperature" = {
|
||||
# thermal-zone = 2;
|
||||
# hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
|
||||
critical-threshold = 80;
|
||||
# format-critical = "{temperatureC}°C ";
|
||||
format = "{temperatureC}°C ";
|
||||
};
|
||||
"backlight" = {
|
||||
# device = "acpi_video1";
|
||||
format = "{percent}% {icon}";
|
||||
states = [ 0 50 ];
|
||||
format-icons = [ "" "" ];
|
||||
};
|
||||
"battery" = lib.mkIf cfg.enableLaptopBars {
|
||||
states = {
|
||||
good = 95;
|
||||
warning = 30;
|
||||
critical = 15;
|
||||
};
|
||||
format = "{capacity}% {icon}";
|
||||
# format-good = ""; # An empty format will hide the module
|
||||
# format-full = "";
|
||||
format-icons = [ "" "" "" "" "" ];
|
||||
};
|
||||
"battery#bat2" = lib.mkIf cfg.enableLaptopBars {
|
||||
bat = "BAT2";
|
||||
};
|
||||
"network" = {
|
||||
# interface = wlp2s0 # (Optional) To force the use of this interface
|
||||
format-wifi = "{essid} ({signalStrength}%) ";
|
||||
format-ethernet = "{ifname} ";
|
||||
format-disconnected = "Disconnected ⚠";
|
||||
interval = 7;
|
||||
on-click = "${cfg.terminal} ${lib.getExe' pkgs.iwd "iwctl"}";
|
||||
};
|
||||
"bluetooth" = {
|
||||
format = " {status}";
|
||||
format-connected = " {device_alias}";
|
||||
format-connected-battery = " {device_alias} {device_battery_percentage}%";
|
||||
# format-device-preference= [ "device1", "device2" ], // preference list deciding the displayed devic;
|
||||
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
|
||||
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
|
||||
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
|
||||
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
|
||||
on-click = "${pkgs.blueman}/bin/blueman-manager";
|
||||
};
|
||||
"pulseaudio" = {
|
||||
# scroll-step = 1;
|
||||
format = "{volume}% {icon}";
|
||||
format-bluetooth = "{volume}% {icon}";
|
||||
format-muted = "";
|
||||
format-icons = {
|
||||
headphones = "";
|
||||
handsfree = "";
|
||||
headset = "";
|
||||
phone = "";
|
||||
portable = "";
|
||||
car = "";
|
||||
default = [ "" "" ];
|
||||
};
|
||||
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
|
||||
};
|
||||
"mpd" = {
|
||||
"format" = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) 🎧";
|
||||
"format-disconnected" = "Disconnected 🎧";
|
||||
"format-stopped" = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped 🎧";
|
||||
"interval" = 2;
|
||||
"consume-icons" = {
|
||||
"on" = " "; # Icon shows only when "consume" is on
|
||||
};
|
||||
"random-icons" = {
|
||||
"off" = "<span color=\"#f53c3c\"></span> "; # Icon grayed out when "random" is off;
|
||||
"on" = " ";
|
||||
};
|
||||
"repeat-icons" = {
|
||||
"on" = " ";
|
||||
};
|
||||
"single-icons" = {
|
||||
"on" = "1 ";
|
||||
};
|
||||
"state-icons" = {
|
||||
"paused" = "";
|
||||
"playing" = "";
|
||||
};
|
||||
"tooltip-format" = "MPD (connected)";
|
||||
"tooltip-format-disconnected" = "MPD (disconnected)";
|
||||
"on-click" = "${pkgs.mpc_cli}/bin/mpc toggle";
|
||||
"on-click-right" = "${pkgs.mpc_cli}/bin/mpc stop";
|
||||
"on-click-middle" = "${cfg.terminal} --class=kitty_ncmpcpp ${pkgs.ncmpcpp}/bin/ncmpcpp";
|
||||
};
|
||||
"custom/media" = {
|
||||
"format" = "{icon}{}";
|
||||
"return-type" = "json";
|
||||
"format-icons" = {
|
||||
"Playing" = " ";
|
||||
"Paused" = " ";
|
||||
};
|
||||
"max-length" = 80;
|
||||
"exec" = "${lib.getExe pkgs.playerctl} -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F";
|
||||
"on-click" = "${lib.getExe pkgs.playerctl} play-pause";
|
||||
};
|
||||
};
|
||||
}] ++
|
||||
cfg.extraSettings
|
||||
++ [ extraSettings ]);
|
||||
}
|
||||
]
|
||||
++ cfg.extraSettings
|
||||
++ [ extraSettings ]
|
||||
);
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
systemd.target = "sway-session.target";
|
||||
settings = cfg.makeBars barWith;
|
||||
style = ''
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: monospace, 'Font Awesome 5', 'Symbols Nerd Font Mono', 'SFNS Display', Helvetica, Arial, sans-serif;
|
||||
font-size: ${toString (cfg.fontSize * 1.1)}px;
|
||||
min-height: 0;
|
||||
}
|
||||
style =
|
||||
''
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: monospace, 'Font Awesome 5', 'Symbols Nerd Font Mono', 'SFNS Display', Helvetica, Arial, sans-serif;
|
||||
font-size: ${toString (cfg.fontSize * 1.1)}px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: rgba(43, 48, 59, 0.8);
|
||||
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
|
||||
color: #ffffff;
|
||||
}
|
||||
window#waybar {
|
||||
background: rgba(43, 48, 59, 0.8);
|
||||
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.0;
|
||||
}
|
||||
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
background: transparent;
|
||||
color: #ffffff;
|
||||
border-bottom: 3px solid transparent;
|
||||
}
|
||||
window#waybar.hidden {
|
||||
opacity: 0.0;
|
||||
}
|
||||
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
background: transparent;
|
||||
color: #ffffff;
|
||||
border-bottom: 3px solid transparent;
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
background: #64727D;
|
||||
border-bottom: 3px solid #ffffff;
|
||||
}
|
||||
#workspaces button.focused {
|
||||
background: #64727D;
|
||||
border-bottom: 3px solid #ffffff;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
#workspaces button.urgent {
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
|
||||
#window, #sway, #sway-window {
|
||||
padding-left: 1em;
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
#window, #sway, #sway-window {
|
||||
padding-left: 1em;
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
|
||||
#mode {
|
||||
background: #64727D;
|
||||
border-bottom: 3px solid #ffffff;
|
||||
}
|
||||
#mode {
|
||||
background: #64727D;
|
||||
border-bottom: 3px solid #ffffff;
|
||||
}
|
||||
|
||||
/* #clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #bluetooth, #custom-media, #tray, #mode, #idle_inhibitor, #mpd { */
|
||||
.modules-right > * > * {
|
||||
margin: 0.2em 0 0.4em 0;
|
||||
padding: 0.2em 0.5em;
|
||||
border: 1px solid rgba(0, 0, 0, 0.25);
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
/* #clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #bluetooth, #custom-media, #tray, #mode, #idle_inhibitor, #mpd { */
|
||||
.modules-right > * > * {
|
||||
margin: 0.2em 0 0.4em 0;
|
||||
padding: 0.2em 0.5em;
|
||||
border: 1px solid rgba(0, 0, 0, 0.25);
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
.modules-right > *:not(:last-child) > * {
|
||||
margin-right: 0.4em;
|
||||
}
|
||||
.modules-right > *:not(:last-child) > * {
|
||||
margin-right: 0.4em;
|
||||
}
|
||||
|
||||
#clock {
|
||||
background-color: #64727D;
|
||||
}
|
||||
#clock {
|
||||
background-color: #64727D;
|
||||
}
|
||||
|
||||
#battery {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
#battery {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#battery.charging {
|
||||
color: #ffffff;
|
||||
background-color: #26A65B;
|
||||
}
|
||||
#battery.charging {
|
||||
color: #ffffff;
|
||||
background-color: #26A65B;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
@keyframes blink {
|
||||
to {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
background: #f53c3c;
|
||||
color: #ffffff;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
#battery.critical:not(.charging) {
|
||||
background: #f53c3c;
|
||||
color: #ffffff;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
background: #2ecc71;
|
||||
color: #000000;
|
||||
}
|
||||
#cpu {
|
||||
background: #2ecc71;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#memory {
|
||||
background: #9b59b6;
|
||||
}
|
||||
#memory {
|
||||
background: #9b59b6;
|
||||
}
|
||||
|
||||
#backlight {
|
||||
background: #90b1b1;
|
||||
}
|
||||
#backlight {
|
||||
background: #90b1b1;
|
||||
}
|
||||
|
||||
#network {
|
||||
background: #2980b9;
|
||||
}
|
||||
#network {
|
||||
background: #2980b9;
|
||||
}
|
||||
|
||||
#network.disconnected {
|
||||
background: #f53c3c;
|
||||
}
|
||||
#network.disconnected {
|
||||
background: #f53c3c;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
background: #f1c40f;
|
||||
color: #000000;
|
||||
}
|
||||
#pulseaudio {
|
||||
background: #f1c40f;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#pulseaudio.muted {
|
||||
background: #90b1b1;
|
||||
}
|
||||
#pulseaudio.muted {
|
||||
background: #90b1b1;
|
||||
}
|
||||
|
||||
#bluetooth {
|
||||
background: DarkSlateBlue;
|
||||
color: white;
|
||||
}
|
||||
#bluetooth {
|
||||
background: DarkSlateBlue;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#custom-media {
|
||||
background: #66cc99;
|
||||
color: #2a5c45;
|
||||
}
|
||||
#custom-media {
|
||||
background: #66cc99;
|
||||
color: #2a5c45;
|
||||
}
|
||||
|
||||
.custom-spotify {
|
||||
background: #66cc99;
|
||||
}
|
||||
.custom-spotify {
|
||||
background: #66cc99;
|
||||
}
|
||||
|
||||
.custom-vlc {
|
||||
background: #ffa000;
|
||||
}
|
||||
.custom-vlc {
|
||||
background: #ffa000;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
background: #f0932b;
|
||||
}
|
||||
#temperature {
|
||||
background: #f0932b;
|
||||
}
|
||||
|
||||
#temperature.critical {
|
||||
background: #eb4d4b;
|
||||
}
|
||||
#temperature.critical {
|
||||
background: #eb4d4b;
|
||||
}
|
||||
|
||||
#tray {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
#tray {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
#idle_inhibitor {
|
||||
background-color: #2d3436;
|
||||
}
|
||||
#idle_inhibitor {
|
||||
background-color: #2d3436;
|
||||
}
|
||||
|
||||
#idle_inhibitor.activated {
|
||||
background-color: #ecf0f1;
|
||||
color: #2d3436;
|
||||
}
|
||||
#idle_inhibitor.activated {
|
||||
background-color: #ecf0f1;
|
||||
color: #2d3436;
|
||||
}
|
||||
|
||||
#mpd {
|
||||
background-color: teal;
|
||||
color: white;
|
||||
}
|
||||
'' + cfg.extraStyle;
|
||||
#mpd {
|
||||
background-color: teal;
|
||||
color: white;
|
||||
}
|
||||
''
|
||||
+ cfg.extraStyle;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
openconnect-epfl = pkgs.writeShellApplication {
|
||||
name = "openconnect-epfl";
|
||||
runtimeInputs = with pkgs; [ openconnect rbw ];
|
||||
runtimeInputs = with pkgs; [
|
||||
openconnect
|
||||
rbw
|
||||
];
|
||||
text = ''
|
||||
METHOD="Microsoft Entra ID"
|
||||
RBW_ENTRY="EPFL Microsoft Auth"
|
||||
|
@ -20,4 +28,3 @@ in
|
|||
{
|
||||
home.packages = [ openconnect-epfl ];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue