Compare commits
15 commits
b030f710bd
...
2c88edc511
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c88edc511 | |||
| a371ab9406 | |||
| 452a1e9645 | |||
| 537e16501b | |||
| f02465091c | |||
| ba6d0ee918 | |||
| 8233f8e3d9 | |||
| 5381aa79de | |||
| 4086e94d3c | |||
| 457d4841ea | |||
| c2f07a6529 | |||
| 8e0ea3593c | |||
| 70f651c5fa | |||
| 6a7037f2a6 | |||
| 4d9bab8daf |
8 changed files with 73 additions and 76 deletions
|
|
@ -4,11 +4,19 @@ let
|
|||
|
||||
term = config.my.home.terminal.default;
|
||||
|
||||
vimCommandLine = {
|
||||
alacritty = ''-e "vim" "%f" "+normal!%lGzv%c|"'';
|
||||
# Termite wants the whole command in a single argument...
|
||||
termite = ''-e "vim %f '+normal!%lGzv%c|'"'';
|
||||
};
|
||||
vimCommandLine =
|
||||
let
|
||||
# Termite wants the whole command in a single argument...
|
||||
brokenExecCommand = {
|
||||
termite = true;
|
||||
};
|
||||
# Assume most other terminals are sane and not broken...
|
||||
isBroken = brokenExecCommand.${term} or false;
|
||||
in
|
||||
if isBroken then
|
||||
''-e "vim %f '+normal!%lGzv%c|'"''
|
||||
else
|
||||
''-e "vim" "%f" "+normal!%lGzv%c|"'';
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
|
@ -17,9 +25,9 @@ in
|
|||
# Use my configured terminal
|
||||
term
|
||||
# Make it easy to pick out with a window class name
|
||||
"--class tridactyl_editor"
|
||||
"--title=tridactyl_editor"
|
||||
# Open vim with the cursor in the correct position
|
||||
vimCommandLine.${term}
|
||||
vimCommandLine
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.home.terminal;
|
||||
cfg = config.my.home.terminal.alacritty;
|
||||
inherit (config.my.home.terminal) colors;
|
||||
in
|
||||
{
|
||||
|
|
@ -8,9 +8,15 @@ in
|
|||
default = mkOption {
|
||||
type = with types; nullOr (enum [ "alacritty" ]);
|
||||
};
|
||||
|
||||
alacritty = {
|
||||
enable = mkEnableOption "alacritty" // {
|
||||
default = config.my.home.terminal.default == "alacritty";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.default == "alacritty") {
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.home.terminal;
|
||||
cfg = config.my.home.terminal.termite;
|
||||
inherit (config.my.home.terminal) colors;
|
||||
in
|
||||
{
|
||||
|
|
@ -8,9 +8,15 @@ in
|
|||
default = mkOption {
|
||||
type = with types; nullOr (enum [ "termite" ]);
|
||||
};
|
||||
|
||||
termite = {
|
||||
enable = mkEnableOption "termite" // {
|
||||
default = config.my.home.terminal.default == "termite";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.default == "termite") {
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.termite = {
|
||||
enable = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ local function treesitter_try_attach(buf, language)
|
|||
-- Syntax highlighting
|
||||
vim.treesitter.start(buf, language)
|
||||
-- Indentation
|
||||
vim.bo.indentexpr = "v:lua.require('nvim-treesitter').indentexpr()"
|
||||
vim.bo[buf].indentexpr = "v:lua.require('nvim-treesitter').indentexpr()"
|
||||
|
||||
return true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
mkRelatedOption = description: relatedWMs:
|
||||
let
|
||||
|
|
@ -20,14 +20,14 @@ in
|
|||
|
||||
options.my.home.wm = with lib; {
|
||||
windowManager = mkOption {
|
||||
type = with types; nullOr (enum [ "i3" ]);
|
||||
type = with types; nullOr (enum [ ]);
|
||||
default = null;
|
||||
example = "i3";
|
||||
description = "Which window manager to use for home session";
|
||||
};
|
||||
|
||||
cursor = {
|
||||
enable = mkRelatedOption "dunst configuration" [ "i3" ];
|
||||
enable = mkRelatedOption "cursor configuration" [ "i3" ];
|
||||
};
|
||||
|
||||
dunst = {
|
||||
|
|
@ -68,29 +68,14 @@ in
|
|||
};
|
||||
|
||||
screen-lock = {
|
||||
enable = mkRelatedOption "automatic X screen locker" [ "i3" ];
|
||||
enable = mkRelatedOption "automatic screen locker" [ "i3" ];
|
||||
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
default = "${lib.getExe pkgs.i3lock} -n -c 000000";
|
||||
example = "\${lib.getExe pkgs.i3lock} -n -i lock.png";
|
||||
description = "Locker command to run";
|
||||
};
|
||||
|
||||
cornerLock = {
|
||||
enable = my.mkDisableOption ''
|
||||
Move mouse to upper-left corner to lock instantly, lower-right corner to
|
||||
disable auto-lock.
|
||||
'';
|
||||
|
||||
delay = mkOption {
|
||||
type = types.int;
|
||||
default = 5;
|
||||
example = 15;
|
||||
description = "How many seconds before locking this way";
|
||||
};
|
||||
};
|
||||
|
||||
notify = {
|
||||
enable = my.mkDisableOption "Notify when about to lock the screen";
|
||||
|
||||
|
|
@ -100,17 +85,15 @@ in
|
|||
example = 15;
|
||||
description = ''
|
||||
How many seconds in advance should there be a notification.
|
||||
This value must be at lesser than or equal to `cornerLock.delay`
|
||||
when both options are enabled.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
timeout = mkOption {
|
||||
type = types.ints.between 1 60;
|
||||
type = types.int;
|
||||
default = 15;
|
||||
example = 1;
|
||||
description = "Inactive time interval to lock the screen automatically";
|
||||
description = "Inactive time interval (in minutes) to lock the screen automatically";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,15 +47,25 @@ let
|
|||
if ${systemctlUser} is-active xautolock-session.service; then
|
||||
${systemctlUser} stop --user xautolock-session.service
|
||||
xset s off
|
||||
xset s 0 0
|
||||
xset -dpms
|
||||
${notify} "Disabled Xautolock"
|
||||
else
|
||||
${systemctlUser} start xautolock-session.service
|
||||
xset s on
|
||||
xset s 0 0
|
||||
xset +dpms
|
||||
${notify} "Enabled Xautolock"
|
||||
fi
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.my.home.wm = with lib; {
|
||||
windowManager = mkOption {
|
||||
type = with types; nullOr (enum [ "i3" ]);
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf isEnabled {
|
||||
home.packages = with pkgs; [
|
||||
ambroisie.dragger # drag-and-drop from the CLI
|
||||
|
|
@ -65,6 +75,9 @@ in
|
|||
xdotool # Used by 'rofi-rbw', in a mapping
|
||||
];
|
||||
|
||||
# Set `i3lock` as the (default) lock command
|
||||
my.home.wm.screen-lock.command = lib.mkDefault "${lib.getExe pkgs.i3lock} -n -c 000000";
|
||||
|
||||
xsession.windowManager.i3 = {
|
||||
enable = true;
|
||||
|
||||
|
|
@ -123,7 +136,7 @@ in
|
|||
inherit modifier;
|
||||
|
||||
criteria = [
|
||||
{ class = "^tridactyl_editor$"; }
|
||||
{ title = "^tridactyl_editor$"; }
|
||||
{ class = "^Blueman-.*$"; }
|
||||
{ title = "^htop$"; }
|
||||
{ class = "^Thunderbird$"; instance = "Mailnews"; window_role = "filterlist"; }
|
||||
|
|
@ -387,5 +400,10 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Use a grey background
|
||||
xsession.profileExtra = ''
|
||||
${lib.getExe pkgs.xsetroot} -solid '#333333'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,32 +2,22 @@
|
|||
let
|
||||
cfg = config.my.home.wm.screen-lock;
|
||||
|
||||
notificationCmd =
|
||||
let
|
||||
duration = toString (cfg.notify.delay * 1000);
|
||||
notifyCmd = "${lib.getExe pkgs.libnotify} -u critical -t ${duration}";
|
||||
in
|
||||
# Needs to be surrounded by quotes for systemd to launch it correctly
|
||||
''"${notifyCmd} -- 'Locking in ${toString cfg.notify.delay} seconds'"'';
|
||||
lockNotifier = pkgs.writeShellApplication {
|
||||
name = "lock-notifier";
|
||||
runtimeInputs = [
|
||||
pkgs.libnotify
|
||||
];
|
||||
text = ''
|
||||
duration=${toString cfg.notify.delay}
|
||||
notify-send \
|
||||
-u critical \
|
||||
-t "$((duration * 1000))" -- \
|
||||
"Locking in $duration seconds"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
let
|
||||
inherit (cfg) cornerLock notify;
|
||||
bothEnabled = cornerLock.enable && notify.enable;
|
||||
cornerLockHigherThanNotify = cornerLock.delay >= notify.delay;
|
||||
in
|
||||
bothEnabled -> cornerLockHigherThanNotify;
|
||||
message = ''
|
||||
`config.my.home.wm.notify.delay` cannot have a value higher than
|
||||
`config.my.home.wm.cornerLock.delay`.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
services.screen-locker = {
|
||||
enable = true;
|
||||
|
||||
|
|
@ -36,19 +26,11 @@ in
|
|||
lockCmd = cfg.command;
|
||||
|
||||
xautolock = {
|
||||
extraOptions = lib.optionals cfg.cornerLock.enable [
|
||||
# Mouse corners: instant lock on upper-left, never lock on lower-right
|
||||
"-cornerdelay"
|
||||
"${toString cfg.cornerLock.delay}"
|
||||
"-cornerredelay"
|
||||
"${toString cfg.cornerLock.delay}"
|
||||
"-corners"
|
||||
"+00-"
|
||||
] ++ lib.optionals cfg.notify.enable [
|
||||
extraOptions = lib.optionals cfg.notify.enable [
|
||||
"-notify"
|
||||
"${toString cfg.notify.delay}"
|
||||
"-notifier"
|
||||
notificationCmd
|
||||
(lib.getExe lockNotifier)
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.x;
|
||||
in
|
||||
|
|
@ -10,12 +10,6 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver.enable = true;
|
||||
# Nice wallpaper
|
||||
services.xserver.displayManager.lightdm.background =
|
||||
let
|
||||
wallpapers = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers";
|
||||
in
|
||||
"${wallpapers}/summer_1am/contents/images/2560x1600.jpg";
|
||||
|
||||
# X configuration
|
||||
my.home.x.enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue