mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-24 02:34:52 +00:00
rofi brightness menu
This commit is contained in:
parent
d6611ca7a2
commit
8283480fd1
@ -21,6 +21,10 @@
|
||||
type = lib.types.str;
|
||||
description = "Command to use for switching audio sink";
|
||||
};
|
||||
brightnessCommand = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Command to use for adjusting brightness";
|
||||
};
|
||||
toggleBarCommand = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Command to hide and show the status bar.";
|
||||
|
@ -121,6 +121,8 @@ in {
|
||||
"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}+Shift+c" = "reload";
|
||||
"${modifier}+Shift+r" = "restart";
|
||||
"${modifier}+Shift+q" = ''
|
||||
|
@ -6,7 +6,7 @@ let
|
||||
|
||||
in {
|
||||
|
||||
imports = [ ./rofi/power.nix ];
|
||||
imports = [ ./rofi/power.nix ./rofi/brightness.nix ];
|
||||
|
||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
||||
|
||||
|
49
modules/nixos/graphical/rofi/brightness.nix
Executable file
49
modules/nixos/graphical/rofi/brightness.nix
Executable file
@ -0,0 +1,49 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
|
||||
rofi = config.home-manager.users.${config.user}.programs.rofi.finalPackage;
|
||||
|
||||
in {
|
||||
|
||||
# Adapted from:
|
||||
# A rofi powered menu to execute brightness choices.
|
||||
|
||||
config.brightnessCommand = builtins.toString
|
||||
(pkgs.writeShellScript "brightness" ''
|
||||
|
||||
dimmer=""
|
||||
medium=""
|
||||
brighter=""
|
||||
|
||||
chosen=$(printf '%s;%s;%s\n' \
|
||||
"$dimmer" \
|
||||
"$medium" \
|
||||
"$brighter" \
|
||||
| ${rofi}/bin/rofi \
|
||||
-theme-str '@import "brightness.rasi"' \
|
||||
-hover-select \
|
||||
-me-select-entry ''' \
|
||||
-me-accept-entry MousePrimary \
|
||||
-dmenu \
|
||||
-sep ';' \
|
||||
-selected-row 1)
|
||||
|
||||
case "$chosen" in
|
||||
"$dimmer")
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 25; ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 25
|
||||
;;
|
||||
|
||||
"$medium")
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 75; ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 75
|
||||
;;
|
||||
|
||||
"$brighter")
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 100; ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 100
|
||||
;;
|
||||
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
||||
'');
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# THEME="$HOME/.config/rofi/config.rasi"
|
||||
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_OPT=""
|
||||
options="$ICON_UP\n$ICON_OPT\n$ICON_DOWN"
|
||||
chosen="$(echo -e "$options" | rofi -theme-str 'listview { layout:horizontal; }' -dmenu)"
|
||||
echo "$chosen"
|
@ -23,7 +23,10 @@ in {
|
||||
"$suspend" \
|
||||
"$log_out" \
|
||||
| ${rofi}/bin/rofi \
|
||||
-theme-str '@import "power.rasi"' \
|
||||
-theme-str '@import "power.rasi"' \
|
||||
-hover-select \
|
||||
-me-select-entry ''' \
|
||||
-me-accept-entry MousePrimary \
|
||||
-dmenu \
|
||||
-sep ';' \
|
||||
-selected-row 2)
|
||||
|
@ -31,6 +31,9 @@ done
|
||||
|
||||
chosen=$(printf '%s;%s\n' "$yes" "$no" |
|
||||
rofi -theme-str '@import "prompt.rasi"' \
|
||||
-hover-select \
|
||||
-me-select-entry '' \
|
||||
-me-accept-entry MousePrimary \
|
||||
-p "$query" \
|
||||
-dmenu \
|
||||
-sep ';' \
|
||||
|
6
modules/nixos/graphical/rofi/themes/brightness.rasi
Normal file
6
modules/nixos/graphical/rofi/themes/brightness.rasi
Normal file
@ -0,0 +1,6 @@
|
||||
@import "common.rasi"
|
||||
|
||||
#window {
|
||||
width: 605px;
|
||||
height: 230px;
|
||||
}
|
@ -33,11 +33,6 @@
|
||||
vpn-textbox-prompt-colon-padding: @network-textbox-prompt-colon-padding;
|
||||
}
|
||||
|
||||
#window {
|
||||
width: 980px;
|
||||
height: 230px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings used in every rofi option menu:
|
||||
*/
|
||||
|
@ -1 +1,6 @@
|
||||
@import "common.rasi"
|
||||
|
||||
#window {
|
||||
width: 980px;
|
||||
height: 230px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user