add backlight control keybinds

This commit is contained in:
LordMZTE 2024-06-29 21:36:13 +02:00
parent a364d99b55
commit f061a1b3b5
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
9 changed files with 24 additions and 9 deletions

View file

@ -8,6 +8,10 @@ bind = ,XF86AudioStop, exec, <% opt.commands.media.stop %>
bind = ,XF86AudioNext, exec, <% opt.commands.media.next %>
bind = ,XF86AudioPrev, exec, <% opt.commands.media.prev %>
# Backlight keys
bind = ,XF86MonBrightnessUp, exec, <% opt.commands.backlight_up %>
bind = ,XF86MonBrightnessDown, exec, <% opt.commands.backlight_down %>
# Control keys
bind = SUPER SHIFT, E, exit,
bind = SUPER SHIFT, Q, killactive,

View file

@ -26,17 +26,21 @@ exec --no-startup-id nm-applet
# layout manager
exec --no-startup-id i3man
# media keys
bindsym XF86AudioRaiseVolume exec <% opt.commands.media.volume_up %>
bindsym XF86AudioLowerVolume exec <% opt.commands.media.volume_down %>
bindsym XF86AudioMute exec <% opt.commands.media.mute_sink %>
bindsym XF86AudioMicMute exec <% opt.commands.media.mute_source %>
# media keys
bindsym XF86AudioPlay exec <% opt.commands.media.play_pause %>
bindsym XF86AudioStop exec <% opt.commands.media.stop %>
bindsym XF86AudioNext exec <% opt.commands.media.next %>
bindsym XF86AudioPrev exec <% opt.commands.media.prev %>
# Backlight keys
bindsym XF86MonBrightnessUp exec <% opt.commands.backlight_up %>
bindsym XF86MonBrightnessDown exec <% opt.commands.backlight_down %>
# other fancy keys
bindsym XF86Mail exec <% opt.commands.email %>
bindsym XF86Calculator exec <% opt.commands.calculator %>

View file

@ -77,6 +77,8 @@ opts.commands = {
next = "playerctl next",
prev = "playerctl previous",
},
backlight_up = "light -A 15";
backlight_down = "light -U 15";
}
opts.gamemode = {

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1718318537,
"narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=",
"lastModified": 1719506693,
"narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420",
"rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a",
"type": "github"
},
"original": {

View file

@ -44,7 +44,7 @@
wayland-protocols
haxe
mpv-unwrapped
zig_0_12
zig_0_13
] ++
# shorthands for setup.rkt
builtins.map

View file

@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
/// Retrieve some confgen options given a relative path to the dotfile root and a struct type
/// with a field for each option.
pub fn confgenGet(comptime T: type, alloc: std.mem.Allocator) !T {
const optjson_path = comptime std.fs.path.dirname(@src().file).? ++ "/../../cgout/opts.json";
const optjson_path = comptime std.fs.path.dirname(@src().file).? ++ "/../../cgout/_cgfs/opts.json";
var file = try std.fs.cwd().openFile(optjson_path, .{});
defer file.close();
var buf_reader = std.io.bufferedReader(file.reader());

View file

@ -28,6 +28,8 @@ pub fn build(b: *std.Build) !void {
next: [:0]const u8,
prev: [:0]const u8,
},
backlight_up: [:0]const u8,
backlight_down: [:0]const u8,
},
cursor: struct {
theme: [:0]const u8,

View file

@ -44,6 +44,10 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
.{ "None", "XF86AudioPlay", "spawn", journal_prefix ++ opt.commands.media.play_pause },
.{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ opt.commands.media.prev },
.{ "None", "XF86AudioNext", "spawn", journal_prefix ++ opt.commands.media.next },
// light control
.{ "None", "XF86MonBrightnessUp", "spawn", journal_prefix ++ opt.commands.backlight_up },
.{ "None", "XF86MonBrightnessDown", "spawn", journal_prefix ++ opt.commands.backlight_down },
// control maps
.{ "Super+Shift", "E", "exit" },

View file

@ -127,10 +127,9 @@
(cmd "haxe" "build.hxml")))
(define-logging (generate-cgopt-json)
(unless (directory-exists? "cgout")
(make-directory "cgout"))
(make-directory* "cgout/_cgfs")
(call-with-output-file* #:exists 'truncate/replace
"cgout/opts.json"
"cgout/_cgfs/opts.json"
(λ (outfile)
(parameterize ([log-calls #f] [current-output-port outfile])
(cmd "confgen" "--json-opt" "confgen.lua")))))