mirror of
https://github.com/nmasur/dotfiles
synced 2025-02-07 06:22:02 +00:00
more updates
This commit is contained in:
parent
e1f987e83b
commit
f77f0c2fd6
19
platforms/home-manager/modules/nmasur/presets/programs/rofi/brightness.nix
Executable file → Normal file
19
platforms/home-manager/modules/nmasur/presets/programs/rofi/brightness.nix
Executable file → Normal file
@ -1,14 +1,19 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
rofi = config.home-manager.users.${config.user}.programs.rofi.finalPackage;
|
||||
rofi = config.programs.rofi.finalPackage;
|
||||
in
|
||||
{
|
||||
|
||||
# Adapted from:
|
||||
# A rofi powered menu to execute brightness choices.
|
||||
|
||||
config.brightnessCommand = builtins.toString (
|
||||
config.brightnessCommand = lib.mkIf config.nmasur.presets.programs.rofi.enable builtins.toString (
|
||||
pkgs.writeShellScript "brightness" ''
|
||||
|
||||
dimmer=""
|
||||
@ -19,7 +24,7 @@ in
|
||||
"$dimmer" \
|
||||
"$medium" \
|
||||
"$brighter" \
|
||||
| ${rofi}/bin/rofi \
|
||||
| ${lib.getExe rofi} \
|
||||
-theme-str '@import "brightness.rasi"' \
|
||||
-hover-select \
|
||||
-me-select-entry ''' \
|
||||
@ -31,15 +36,15 @@ in
|
||||
|
||||
case "$chosen" in
|
||||
"$dimmer")
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 25; ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 25
|
||||
${lib.getExe pkgs.ddcutil} --display 1 setvcp 10 25; ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 25
|
||||
;;
|
||||
|
||||
"$medium")
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 75; ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 75
|
||||
${lib.getExe pkgs.ddcutil} --display 1 setvcp 10 75; ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 75
|
||||
;;
|
||||
|
||||
"$brighter")
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 100; ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 100
|
||||
${lib.getExe pkgs.ddcutil} --display 1 setvcp 10 100; ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 100
|
||||
;;
|
||||
|
||||
*) exit 1 ;;
|
||||
|
@ -11,6 +11,11 @@ in
|
||||
|
||||
{
|
||||
|
||||
imports = [
|
||||
./power.nix
|
||||
./brightness.nix
|
||||
];
|
||||
|
||||
options.nmasur.presets.programs.rofi.enable = lib.mkEnableOption "Rofi quick launcher";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
15
platforms/home-manager/modules/nmasur/presets/programs/rofi/power.nix
Executable file → Normal file
15
platforms/home-manager/modules/nmasur/presets/programs/rofi/power.nix
Executable file → Normal file
@ -1,7 +1,12 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
rofi = config.home-manager.users.${config.user}.programs.rofi.finalPackage;
|
||||
rofi = config.programs.rofi.finalPackage;
|
||||
in
|
||||
{
|
||||
|
||||
@ -9,7 +14,7 @@ in
|
||||
# https://gitlab.com/vahnrr/rofi-menus/-/blob/b1f0e8a676eda5552e27ef631b0d43e660b23b8e/scripts/rofi-power
|
||||
# A rofi powered menu to execute power related action.
|
||||
|
||||
config.powerCommand = builtins.toString (
|
||||
config.powerCommand = lib.mkIf config.nmasur.presets.programs.rofi.enable builtins.toString (
|
||||
pkgs.writeShellScript "powermenu" ''
|
||||
power_off=''
|
||||
reboot=''
|
||||
@ -23,7 +28,7 @@ in
|
||||
"$lock" \
|
||||
"$suspend" \
|
||||
"$log_out" \
|
||||
| ${rofi}/bin/rofi \
|
||||
| ${lib.getExe rofi} \
|
||||
-theme-str '@import "power.rasi"' \
|
||||
-hover-select \
|
||||
-me-select-entry "" \
|
||||
@ -46,7 +51,7 @@ in
|
||||
;;
|
||||
|
||||
"$lock")
|
||||
${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span
|
||||
${lib.getExe pkgs.betterlockscreen} --lock --display 1 --blur 0.5 --span
|
||||
;;
|
||||
|
||||
"$suspend")
|
||||
|
@ -7,13 +7,62 @@
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.i3;
|
||||
lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
||||
lockUpdate = "${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.i3.enable = lib.mkEnableOption "i3 window manager";
|
||||
options.nmasur.presets.services.i3 = {
|
||||
enable = lib.mkEnableOption "i3 window manager";
|
||||
commands = {
|
||||
launcher = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Application launcher";
|
||||
default = null;
|
||||
};
|
||||
lockScreen = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Screen lock";
|
||||
default = "${lib.getExe pkgs.betterlockscreen} --lock --display 1 --blur 0.5 --span";
|
||||
};
|
||||
updateLockScreen = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Update lock screen cache";
|
||||
default = "${lib.getExe pkgs.betterlockscreen} --update ${config.wallpaper} --display 1 --span";
|
||||
};
|
||||
toggleBar = lib.mkOption {
|
||||
};
|
||||
systemdSearch = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Search systemd";
|
||||
default = null;
|
||||
};
|
||||
audioSwitch = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Switch audio output";
|
||||
default = null;
|
||||
};
|
||||
applicationSwitch = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Application switcher";
|
||||
default = null;
|
||||
};
|
||||
power = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Launch power options menu";
|
||||
default = null;
|
||||
};
|
||||
brightness = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Launch brightness adjuster";
|
||||
default = null;
|
||||
};
|
||||
calculator = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Launch calculator";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
xsession.windowManager.i3 = {
|
||||
@ -105,36 +154,36 @@ in
|
||||
"Shift+F12" =
|
||||
# Disable dynamic sleep
|
||||
# https://github.com/rockowitz/ddcutil/issues/323
|
||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
|
||||
"exec ${lib.getExe pkgs.ddcutil} --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
|
||||
"Shift+F11" =
|
||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
|
||||
"exec ${lib.getExe pkgs.ddcutil} --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
|
||||
"XF86MonBrightnessUp" =
|
||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
|
||||
"exec ${lib.getExe pkgs.ddcutil} --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
|
||||
"XF86MonBrightnessDown" =
|
||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
|
||||
"exec ${lib.getExe pkgs.ddcutil} --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
|
||||
|
||||
# Media player controls
|
||||
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
|
||||
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
|
||||
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
|
||||
"XF86AudioPlay" = "exec ${lib.getExe pkgs.playerctl} play-pause";
|
||||
"XF86AudioStop" = "exec ${lib.getExe pkgs.playerctl} stop";
|
||||
"XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next";
|
||||
"XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous";
|
||||
|
||||
# Launchers
|
||||
"${modifier}+Return" = "exec --no-startup-id ${
|
||||
config.home-manager.users.${config.user}.programs.rofi.terminal
|
||||
}; workspace ${ws2}; layout tabbed";
|
||||
"${modifier}+space" = "exec --no-startup-id ${config.launcherCommand}";
|
||||
"${modifier}+Shift+s" = "exec --no-startup-id ${config.systemdSearch}";
|
||||
"${modifier}+Shift+a" = "exec --no-startup-id ${config.audioSwitchCommand}";
|
||||
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
|
||||
"${modifier}+Shift+period" = "exec --no-startup-id ${config.powerCommand}";
|
||||
"${modifier}+Shift+m" = "exec --no-startup-id ${config.brightnessCommand}";
|
||||
"${modifier}+c" = "exec --no-startup-id ${config.calculatorCommand}";
|
||||
"${modifier}+space" = "exec --no-startup-id ${cfg.commands.launcher}";
|
||||
"${modifier}+Shift+s" = "exec --no-startup-id ${cfg.commands.systemdSearch}";
|
||||
"${modifier}+Shift+a" = "exec --no-startup-id ${cfg.commands.audioSwitch}";
|
||||
"Mod1+Tab" = "exec --no-startup-id ${cfg.commands.altTab}";
|
||||
"${modifier}+Shift+period" = "exec --no-startup-id ${cfg.commands.power}";
|
||||
"${modifier}+Shift+m" = "exec --no-startup-id ${cfg.commands.brightness}";
|
||||
"${modifier}+c" = "exec --no-startup-id ${cfg.commands.calculator}";
|
||||
"${modifier}+Shift+c" = "reload";
|
||||
"${modifier}+Shift+r" = "restart";
|
||||
"${modifier}+Shift+q" =
|
||||
''exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
|
||||
"${modifier}+Shift+x" = "exec ${lockCmd}";
|
||||
"${modifier}+Shift+x" = "exec ${cfg.commands.lockScreen}";
|
||||
"${modifier}+Mod1+h" =
|
||||
"exec --no-startup-id ${
|
||||
config.home-manager.users.${config.user}.programs.rofi.terminal
|
||||
@ -262,7 +311,7 @@ in
|
||||
cacheDir = "${config.homePath}/.cache/betterlockscreen/current";
|
||||
in
|
||||
lib.mkIf config.services.xserver.enable (
|
||||
config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||
config.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||
if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then
|
||||
$DRY_RUN_CMD ${lockUpdate}
|
||||
fi
|
||||
|
8
platforms/nixos/modules/hostnames.nix
Normal file
8
platforms/nixos/modules/hostnames.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
options.hostnames = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user