mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-05 03:22:32 +01:00
manage media key commands with confgen
This commit is contained in:
parent
9f77ff9849
commit
e08e2da259
6 changed files with 59 additions and 44 deletions
|
@ -1,12 +1,12 @@
|
|||
# Media keys
|
||||
bind = ,XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
bind = ,XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
bind = ,XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
bind = ,XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
bind = ,XF86AudioPlay, exec, playerctl play-pause
|
||||
bind = ,XF86AudioStop, exec, playerctl stop
|
||||
bind = ,XF86AudioNext, exec, playerctl next
|
||||
bind = ,XF86AudioPrev, exec, playerctl previous
|
||||
bind = ,XF86AudioRaiseVolume, exec, <% opt.commands.media.volume_up %>
|
||||
bind = ,XF86AudioLowerVolume, exec, <% opt.commands.media.volume_down %>
|
||||
bind = ,XF86AudioMute, exec, <% opt.commands.media.mute_sink %>
|
||||
bind = ,XF86AudioMicMute, exec, <% opt.commands.media.mute_source %>
|
||||
bind = ,XF86AudioPlay, exec, <% opt.commands.media.play_pause %>
|
||||
bind = ,XF86AudioStop, exec, <% opt.commands.media.stop %>
|
||||
bind = ,XF86AudioNext, exec, <% opt.commands.media.next %>
|
||||
bind = ,XF86AudioPrev, exec, <% opt.commands.media.prev %>
|
||||
|
||||
# Control keys
|
||||
bind = SUPER SHIFT, E, exit,
|
||||
|
|
|
@ -26,17 +26,16 @@ exec --no-startup-id nm-applet
|
|||
# layout manager
|
||||
exec --no-startup-id i3man
|
||||
|
||||
# Use pactl to adjust volume in PulseAudio.
|
||||
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
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 playerctl play-pause
|
||||
bindsym XF86AudioStop exec playerctl stop
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
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 %>
|
||||
|
||||
# other fancy keys
|
||||
bindsym XF86Mail exec <% opt.commands.email %>
|
||||
|
|
11
cg_opts.lua
11
cg_opts.lua
|
@ -66,6 +66,17 @@ opts.commands = {
|
|||
wl = "mako",
|
||||
},
|
||||
screen_lock = string.format("i3lock -ti %s/.local/share/backgrounds/mzte.png", os.getenv "HOME"),
|
||||
media = {
|
||||
volume_up = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+",
|
||||
volume_down = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-",
|
||||
mute_sink = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
|
||||
mute_source = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle",
|
||||
|
||||
play_pause = "playerctl play-pause",
|
||||
stop = "playerctl stop",
|
||||
next = "playerctl next",
|
||||
prev = "playerctl previous",
|
||||
},
|
||||
}
|
||||
|
||||
opts.gamemode = {
|
||||
|
|
|
@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {
|
|||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const cg_opt = try common.confgenGet(struct {
|
||||
const CgOpt = struct {
|
||||
catppuccin: struct {
|
||||
red: [:0]const u8,
|
||||
sky: [:0]const u8,
|
||||
|
@ -17,22 +17,27 @@ pub fn build(b: *std.Build) !void {
|
|||
commands: struct {
|
||||
file_manager: [:0]const u8,
|
||||
browser: [:0]const u8,
|
||||
media: struct {
|
||||
volume_up: [:0]const u8,
|
||||
volume_down: [:0]const u8,
|
||||
mute_sink: [:0]const u8,
|
||||
mute_source: [:0]const u8,
|
||||
|
||||
play_pause: [:0]const u8,
|
||||
stop: [:0]const u8,
|
||||
next: [:0]const u8,
|
||||
prev: [:0]const u8,
|
||||
},
|
||||
},
|
||||
cursor: struct {
|
||||
theme: [:0]const u8,
|
||||
size: u32,
|
||||
},
|
||||
}, b.allocator);
|
||||
};
|
||||
const cg_opt = try common.confgenGet(CgOpt, b.allocator);
|
||||
|
||||
const opts = b.addOptions();
|
||||
opts.addOption([:0]const u8, "catppuccin_red", cg_opt.catppuccin.red);
|
||||
opts.addOption([:0]const u8, "catppuccin_sky", cg_opt.catppuccin.sky);
|
||||
opts.addOption(bool, "nvidia", cg_opt.nvidia);
|
||||
opts.addOption([:0]const u8, "term_command", cg_opt.term.command);
|
||||
opts.addOption([:0]const u8, "file_manager_command", cg_opt.commands.file_manager);
|
||||
opts.addOption([:0]const u8, "browser_command", cg_opt.commands.browser);
|
||||
opts.addOption([:0]const u8, "cursor_theme", cg_opt.cursor.theme);
|
||||
opts.addOption(u32, "cursor_size", cg_opt.cursor.size);
|
||||
opts.addOption(CgOpt, "cg", cg_opt);
|
||||
|
||||
const scanner = Scanner.create(b, .{});
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const std = @import("std");
|
||||
const opts = @import("opts");
|
||||
const opt = @import("opts").cg;
|
||||
|
||||
const log = std.log.scoped(.init);
|
||||
|
||||
|
@ -23,9 +23,9 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
|
|||
// Normal-Mode keyboard mappings
|
||||
inline for (.{
|
||||
// "run command" maps
|
||||
.{ "Super", "Return", "spawn", journal_prefix ++ opts.term_command },
|
||||
.{ "Super+Control", "E", "spawn", journal_prefix ++ opts.file_manager_command },
|
||||
.{ "Super+Control", "B", "spawn", journal_prefix ++ opts.browser_command },
|
||||
.{ "Super", "Return", "spawn", journal_prefix ++ opt.term.command },
|
||||
.{ "Super+Control", "E", "spawn", journal_prefix ++ opt.commands.file_manager },
|
||||
.{ "Super+Control", "B", "spawn", journal_prefix ++ opt.commands.browser },
|
||||
.{ "Super+Control", "V", "spawn", journal_prefix ++ "vinput md" },
|
||||
.{ "Super+Control", "L", "spawn", journal_prefix ++ "physlock" },
|
||||
.{ "Super+Shift", "P", "spawn", journal_prefix ++ "gpower2" },
|
||||
|
@ -36,14 +36,14 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
|
|||
|
||||
// media keys
|
||||
.{ "None", "XF86Eject", "spawn", journal_prefix ++ "eject -T" },
|
||||
.{ "None", "XF86AudioRaiseVolume", "spawn", journal_prefix ++ "pactl set-sink-volume @DEFAULT_SINK@ +5%" },
|
||||
.{ "None", "XF86AudioLowerVolume", "spawn", journal_prefix ++ "pactl set-sink-volume @DEFAULT_SINK@ -5%" },
|
||||
.{ "None", "XF86AudioMute", "spawn", journal_prefix ++ "pactl set-sink-mute @DEFAULT_SINK@ toggle" },
|
||||
.{ "None", "XF86AudioMicMute", "spawn", journal_prefix ++ "pactl set-source-mute @DEFAULT_SINK@ toggle" },
|
||||
.{ "None", "XF86AudioMedia", "spawn", journal_prefix ++ "playerctl play-pause" },
|
||||
.{ "None", "XF86AudioPlay", "spawn", journal_prefix ++ "playerctl play-pause" },
|
||||
.{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ "playerctl previous" },
|
||||
.{ "None", "XF86AudioNext", "spawn", journal_prefix ++ "playerctl next" },
|
||||
.{ "None", "XF86AudioRaiseVolume", "spawn", journal_prefix ++ opt.commands.media.volume_up },
|
||||
.{ "None", "XF86AudioLowerVolume", "spawn", journal_prefix ++ opt.commands.media.volume_down },
|
||||
.{ "None", "XF86AudioMute", "spawn", journal_prefix ++ opt.commands.media.mute_sink },
|
||||
.{ "None", "XF86AudioMicMute", "spawn", journal_prefix ++ opt.commands.media.mute_source },
|
||||
.{ "None", "XF86AudioMedia", "spawn", journal_prefix ++ opt.commands.media.play_pause },
|
||||
.{ "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 },
|
||||
|
||||
// control maps
|
||||
.{ "Super+Shift", "E", "exit" },
|
||||
|
@ -156,15 +156,15 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
|
|||
|
||||
try con.runCommand(&.{ "set-repeat", "50", "300" });
|
||||
|
||||
try con.runCommand(&.{ "border-color-focused", "0x" ++ opts.catppuccin_red });
|
||||
try con.runCommand(&.{ "border-color-unfocused", "0x" ++ opts.catppuccin_sky });
|
||||
try con.runCommand(&.{ "border-color-focused", "0x" ++ opt.catppuccin.red });
|
||||
try con.runCommand(&.{ "border-color-unfocused", "0x" ++ opt.catppuccin.sky });
|
||||
|
||||
try con.runCommand(&.{ "hide-cursor", "when-typing", "enabled" });
|
||||
|
||||
try con.runCommand(&.{
|
||||
"xcursor-theme",
|
||||
opts.cursor_theme,
|
||||
std.fmt.comptimePrint("{}", .{opts.cursor_size}),
|
||||
opt.cursor.theme,
|
||||
std.fmt.comptimePrint("{}", .{opt.cursor.size}),
|
||||
});
|
||||
|
||||
try con.runCommand(&.{ "rule-add", "-app-id", "vinput-editor", "float" });
|
||||
|
|
|
@ -72,7 +72,7 @@ pub fn main() !void {
|
|||
try env.append("QT_QPA_PLATFORM=wayland");
|
||||
try env.append("XDG_CURRENT_DESKTOP=river");
|
||||
|
||||
if (opts.nvidia) {
|
||||
if (opts.cg.nvidia) {
|
||||
try env.append("WLR_NO_HARDWARE_CURSORS=1");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue