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 = ,XF86AudioNext, exec, <% opt.commands.media.next %>
bind = ,XF86AudioPrev, exec, <% opt.commands.media.prev %> 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 # Control keys
bind = SUPER SHIFT, E, exit, bind = SUPER SHIFT, E, exit,
bind = SUPER SHIFT, Q, killactive, bind = SUPER SHIFT, Q, killactive,

View file

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

View file

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

View file

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

View file

@ -44,7 +44,7 @@
wayland-protocols wayland-protocols
haxe haxe
mpv-unwrapped mpv-unwrapped
zig_0_12 zig_0_13
] ++ ] ++
# shorthands for setup.rkt # shorthands for setup.rkt
builtins.map 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 /// Retrieve some confgen options given a relative path to the dotfile root and a struct type
/// with a field for each option. /// with a field for each option.
pub fn confgenGet(comptime T: type, alloc: std.mem.Allocator) !T { 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, .{}); var file = try std.fs.cwd().openFile(optjson_path, .{});
defer file.close(); defer file.close();
var buf_reader = std.io.bufferedReader(file.reader()); 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, next: [:0]const u8,
prev: [:0]const u8, prev: [:0]const u8,
}, },
backlight_up: [:0]const u8,
backlight_down: [:0]const u8,
}, },
cursor: struct { cursor: struct {
theme: [:0]const u8, theme: [:0]const u8,

View file

@ -45,6 +45,10 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
.{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ opt.commands.media.prev }, .{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ opt.commands.media.prev },
.{ "None", "XF86AudioNext", "spawn", journal_prefix ++ opt.commands.media.next }, .{ "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 // control maps
.{ "Super+Shift", "E", "exit" }, .{ "Super+Shift", "E", "exit" },
.{ "Super", "Space", "toggle-float" }, .{ "Super", "Space", "toggle-float" },

View file

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