Changed Hyprland from Hyprlang to Lua

This commit is contained in:
2026-05-26 23:35:31 +02:00
parent c344fbbe0e
commit 7f0bf6c219
7 changed files with 515 additions and 125 deletions
Generated
+24 -10
View File
@@ -293,9 +293,7 @@
"hyprutils": "hyprutils_2",
"hyprwayland-scanner": "hyprwayland-scanner",
"hyprwire": "hyprwire",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems_2",
"xdph": "xdph"
@@ -707,15 +705,15 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1779508470,
"narHash": "sha256-Ap9KJX+5xHIn3bPIpfNgT6MEXdAECECwo4/rmlQD74M=",
"owner": "nixos",
"lastModified": 1779560665,
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "29916453413845e54a65b8a1cf996842300cd299",
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
"type": "github"
},
"original": {
"owner": "nixos",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@@ -753,6 +751,22 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1779508470,
"narHash": "sha256-Ap9KJX+5xHIn3bPIpfNgT6MEXdAECECwo4/rmlQD74M=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "29916453413845e54a65b8a1cf996842300cd299",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1779259093,
"narHash": "sha256-7DKWmH23hL2eYdkxCKeqj2i+yljTKuU+3Nk1UPHOnxc=",
@@ -771,7 +785,7 @@
"nixvim": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"systems": "systems_3"
},
"locked": {
@@ -822,7 +836,7 @@
"nix-homebrew": "nix-homebrew",
"nixcord": "nixcord",
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs_2",
"nixvim": "nixvim",
"sops-nix": "sops-nix",
"spicetify-nix": "spicetify-nix"
-1
View File
@@ -19,7 +19,6 @@
# declarative Hyprland
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland-plugins = {
+1 -7
View File
@@ -1,5 +1,4 @@
{ pkgs, ... }:
{
_: {
imports = [
./hyprland
./rofi
@@ -10,11 +9,6 @@
_module.args.compositor = "hyprland";
home.packages = with pkgs; [
waypaper
awww
onlyoffice-desktopeditors
];
home.file.".config/waypaper/config.ini".source = ./waypaper.ini;
programs = {
+4 -2
View File
@@ -1,4 +1,4 @@
{ inputs, pkgs, ... }:
{ pkgs, ... }:
{
imports = [
./hypridle.nix
@@ -19,6 +19,8 @@
systemd.user.targets.hyprland-session.Unit.Wants = [ "xdg-desktop-autostart.target" ];
services.awww.enable = true;
wayland.windowManager.hyprland = {
package = null;
enable = true;
@@ -31,6 +33,6 @@
enableXdgAutostart = false;
};
extraConfig = builtins.readFile ./hyprland.lua;
extraConfig = builtins.readFile ./hyprland-scrolling.lua;
};
}
@@ -0,0 +1,310 @@
-- hyprland.lua — migrated from hyprlang for Hyprland 0.55+
-- https://wiki.hypr.land/Configuring/Start/
-- ── Variables ────────────────────────────────────────────────────────────────
local super = "SUPER"
local terminal = "kitty"
local fileManager = "yazi"
local theme = "-theme $HOME/.config/rofi/custom.rasi"
local menu = "rofi -show drun " .. theme
local filebrowser = "rofi -show filebrowser " .. theme
local power = "rofi -show p -modi p:rofi-power-menu -theme $HOME/.config/rofi/power.rasi"
local apps = "rofi -show window " .. theme
local screenshot = "$HOME/Pictures/Screenshots/$(date +'%s_grim.png')"
-- ── Helpers ───────────────────────────────────────────────────────────────────
-- Bind a list of { key, action [, opts] } entries
local function bind_all(list)
for _, b in ipairs(list) do
hl.bind(b[1], b[2], b[3])
end
end
-- Bind a list of { key, cmd [, opts] } entries as exec_cmd actions
local function bind_exec(list)
for _, b in ipairs(list) do
hl.bind(b[1], hl.dsp.exec_cmd(b[2]), b[3])
end
end
-- Bind a list of { key, layout_msg } entries as layout actions
local function bind_layout(list)
for _, b in ipairs(list) do
hl.bind(b[1], hl.dsp.layout(b[2]))
end
end
-- ── Monitors ─────────────────────────────────────────────────────────────────
local monitors = {
{ output = "DP-1", mode = "1920x1080@60", position = "1920x0", scale = 1 },
{ output = "HDMI-A-2", mode = "1920x1080@60", position = "0x0", scale = 1 },
}
for _, m in ipairs(monitors) do
hl.monitor(m)
end
-- ── Environment ──────────────────────────────────────────────────────────────
local env_vars = {
NIXOS_OZONE_WL = "1",
MOZ_ENABLE_WAYLAND = "1",
MOZ_WEBRENDER = "1",
_JAVA_AWT_WM_NONREPARENTING = "1",
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1",
QT_QPA_PLATFORM = "wayland",
SDL_VIDEODRIVER = "wayland",
GDK_BACKEND = "wayland,x11",
XCURSOR_SIZE = "24",
XCURSOR_THEME = "catppuccin-mocha-dark",
EDITOR = "nvim",
GSK_RENDERER = "gl",
HYPRCURSOR_THEME = "catppuccin-mocha-dark",
HYPRCURSOR_SIZE = "24",
}
for k, v in pairs(env_vars) do
hl.env(k, v)
end
-- ── Autostart ────────────────────────────────────────────────────────────────
local wallpaper = "$HOME/Pictures/Wallpapers/Ghost_in_the_Shell.png"
local autostart = {
"sleep 2 && waybar & disown",
}
hl.on("hyprland.start", function()
for _, cmd in ipairs(autostart) do
hl.exec_cmd(cmd)
end
end)
-- ── Config ───────────────────────────────────────────────────────────────────
hl.config({
debug = {
disable_logs = false,
enable_stdout_logs = false,
},
input = {
kb_layout = "de",
kb_variant = "mac",
kb_options = "apple:fn_lock",
repeat_rate = 50,
repeat_delay = 300,
accel_profile = "flat",
follow_mouse = 1,
mouse_refocus = false,
sensitivity = 0,
numlock_by_default = true,
touchpad = {
natural_scroll = true,
tap_to_click = true,
},
},
general = {
gaps_in = 2,
gaps_out = 0,
border_size = 4,
col = {
active_border = "rgba(a6e3a1ff)",
inactive_border = "rgba(f38ba8ff)",
},
layout = "scrolling",
allow_tearing = false,
},
decoration = {
rounding = 1,
shadow = {
enabled = false,
range = 16,
render_power = 4,
color = "rgba(a6e3a1ff)",
color_inactive = "rgba(f38ba8ff)",
},
blur = {
enabled = false,
size = 1,
passes = 3,
new_optimizations = true,
noise = 0.04,
},
},
animations = {
enabled = true,
},
scrolling = {
column_width = 0.5,
fullscreen_on_one_column = true,
focus_fit_method = 1,
follow_focus = true,
follow_min_visible = 0.4,
explicit_column_widths = "0.333, 0.5, 0.667, 1.0",
wrap_focus = true,
wrap_swapcol = true,
direction = "right",
},
misc = {
force_default_wallpaper = 0,
disable_hyprland_logo = true,
disable_splash_rendering = true,
mouse_move_enables_dpms = true,
key_press_enables_dpms = true,
vrr = 0,
},
})
-- ── Animations ───────────────────────────────────────────────────────────────
hl.curve("myBezier", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } })
hl.curve("mySpring", { type = "spring", mass = 0.6, stiffness = 70.00, dampening = 10.00 })
local animations = {
{ leaf = "windows", enabled = true, speed = 10, spring = "mySpring" },
{ leaf = "windowsOut", enabled = true, speed = 10, spring = "mySpring", style = "popin 80%" },
{ leaf = "border", enabled = true, speed = 10, spring = "mySpring" },
{ leaf = "borderangle", enabled = true, speed = 10, spring = "mySpring" },
{ leaf = "fade", enabled = true, speed = 10, spring = "mySpring" },
{ leaf = "workspaces", enabled = true, speed = 10, spring = "mySpring" },
}
for _, anim in ipairs(animations) do
hl.animation(anim)
end
-- ── Devices ──────────────────────────────────────────────────────────────────
local devices = {
{ name = "usb-optical-mouse-", sensitivity = 0 },
}
for _, d in ipairs(devices) do
hl.device(d)
end
-- ── Window Rules ─────────────────────────────────────────────────────────────
local window_rules = {
{ name = "kitty_width", match = { class = "kitty" }, scrolling_width = 0.5 },
{ name = "browser_width", match = { class = "floorp" }, scrolling_width = 0.667 },
{ name = "obsidian_width", match = { class = "obsidian" }, scrolling_width = 0.5 },
{ name = "nautilus_width", match = { class = "nautilus" }, scrolling_width = 0.333 },
{ name = "thunderbird_width", match = { class = "thunderbird" }, scrolling_width = 0.667 },
}
for _, rule in ipairs(window_rules) do
hl.window_rule(rule)
end
-- ── Binds ────────────────────────────────────────────────────────────────────
-- Applications & launchers
bind_exec({
{ super .. " + Q", terminal },
{ super .. " + E", fileManager },
{ super .. " + O", "obsidian" },
{ super .. " + I", "floorp" },
{ super .. " + G", "thunderbird" },
{ "XF86Mail", "thunderbird" },
{ super .. " + N", "nautilus" },
{ "XF86Search", "nautilus" },
-- Rofi
{ super .. " + F", filebrowser },
{ super .. " + A", apps },
{ "Menu", apps },
{ super .. " + R", menu },
{ "XF86LaunchA", menu },
{ super .. " + S", power },
{ "XF86LaunchB", power },
-- Screenshots
{ super .. " + Z", 'grim -g "$(slurp)" ' .. screenshot },
{ super .. " + U", "grim " .. screenshot },
-- Media & brightness (locked = works on lockscreen, repeating = held key)
{ "XF86AudioMute", "pamixer -t", { locked = true } },
{ "XF86AudioPlay", "playerctl play-pause", { locked = true } },
{ "XF86AudioNext", "playerctl next", { locked = true } },
{ "XF86AudioPrev", "playerctl previous", { locked = true } },
{ "XF86AudioRaiseVolume", "pamixer -i 5", { locked = true, repeating = true } },
{ "XF86AudioLowerVolume", "pamixer -d 5", { locked = true, repeating = true } },
{ "XF86MonBrightnessUp", "brightnessctl set +5%", { locked = true, repeating = true } },
{ "XF86MonBrightnessDown", "brightnessctl set 5%-", { locked = true, repeating = true } },
})
-- Window actions
bind_all({
{ super .. " + M", hl.dsp.exit() },
{ super .. " + V", hl.dsp.window.float({ action = "toggle" }) },
{ super .. " + C", hl.dsp.window.close() },
-- Mouse move/resize
{ super .. " + mouse:272", hl.dsp.window.drag() },
{ super .. " + mouse:273", hl.dsp.window.drag({ resize = true }) },
-- Switch workspaces with mouse wheel
{ super .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }) },
{ super .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }) },
})
-- Directional focus (up/down move within a column; left/right scroll between columns)
for _, dir in ipairs({ "left", "right", "up", "down" }) do
hl.bind(super .. " + " .. dir, hl.dsp.layout("focus " .. dir))
end
-- Scrolling layout commands
bind_layout({
-- Column navigation
{ super .. " + period", "move +col" },
{ super .. " + comma", "move -col" },
-- Column swap
{ super .. " + SHIFT + period", "swapcol r" },
{ super .. " + SHIFT + comma", "swapcol l" },
-- Column resize (cycle through explicit_column_widths)
{ super .. " + equal", "colresize +conf" },
{ super .. " + minus", "colresize -conf" },
-- Fine-grained resize
{ super .. " + SHIFT + equal", "colresize +0.05" },
{ super .. " + SHIFT + minus", "colresize -0.05" },
-- Fit operations
{ super .. " + F1", "fit active" },
{ super .. " + F2", "fit visible" },
{ super .. " + F3", "fit all" },
-- Promote window to its own column / consume into previous
{ super .. " + RETURN", "promote" },
{ super .. " + SHIFT + RETURN", "consume_or_expel prev" },
-- Expel/consume explicitly
{ super .. " + bracketright", "expel" },
{ super .. " + bracketleft", "consume" },
-- Toggle scroll lock for active workspace
{ super .. " + SHIFT + S", "inhibit_scroll" },
})
-- Workspaces 110 (key 0 maps to workspace 10)
for i = 1, 10 do
local key = tostring(i % 10)
hl.bind(super .. " + " .. key, hl.dsp.focus({ workspace = i }))
hl.bind(super .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
end
-- Special workspace (scratchpad)
hl.bind(super .. " + grave", hl.dsp.window.move({ workspace = "special:magic" }))
-- ── Workspace Rules ───────────────────────────────────────────────────────────
local workspace_rules = {
{ workspace = "1", layout_opts = { direction = "right" } },
{ workspace = "2", layout_opts = { direction = "right" } },
{ workspace = "3", layout_opts = { direction = "right" } },
}
for _, rule in ipairs(workspace_rules) do
hl.workspace_rule(rule)
end
+174 -103
View File
@@ -1,9 +1,7 @@
-- hyprland.lua — migrated from hyprlang for Hyprland 0.55+
-- https://wiki.hypr.land/Configuring/Start/
--------------------
---- VARIABLES -----
--------------------
-- ── Variables ────────────────────────────────────────────────────────────────
local super = "SUPER"
local terminal = "kitty"
@@ -13,46 +11,80 @@ local menu = "rofi -show drun " .. theme
local filebrowser = "rofi -show filebrowser " .. theme
local power = "rofi -show p -modi p:rofi-power-menu -theme $HOME/.config/rofi/power.rasi"
local apps = "rofi -show window " .. theme
local screenshot = "$HOME/Pictures/Screenshots/$(date +'%s_grim.png')"
--------------------
---- MONITORS ------
--------------------
-- ── Helpers ───────────────────────────────────────────────────────────────────
hl.monitor({ output = "DP-1", mode = "1920x1080@60", position = "1920x0", scale = 1 })
hl.monitor({ output = "HDMI-A-2", mode = "1920x1080@60", position = "0x0", scale = 1 })
-- Bind a list of { key, action [, opts] } entries
local function bind_all(list)
for _, b in ipairs(list) do
hl.bind(b[1], b[2], b[3])
end
end
-----------------------------
---- ENVIRONMENT VARIABLES --
-----------------------------
-- Bind a list of { key, cmd [, opts] } entries as exec_cmd actions
local function bind_exec(list)
for _, b in ipairs(list) do
hl.bind(b[1], hl.dsp.exec_cmd(b[2]), b[3])
end
end
hl.env("NIXOS_OZONE_WL", "1")
hl.env("MOZ_ENABLE_WAYLAND", "1")
hl.env("MOZ_WEBRENDER", "1")
hl.env("_JAVA_AWT_WM_NONREPARENTING", "1")
hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1")
hl.env("QT_QPA_PLATFORM", "wayland")
hl.env("SDL_VIDEODRIVER", "wayland")
hl.env("GDK_BACKEND", "wayland,x11")
hl.env("XCURSOR_SIZE", "24")
hl.env("XCURSOR_THEME", "catppuccin-mocha-dark")
hl.env("EDITOR", "nvim")
hl.env("GSK_RENDERER", "gl")
hl.env("HYPRCURSOR_THEME", "catppuccin-mocha-dark")
hl.env("HYPRCURSOR_SIZE", "24")
-- Bind a list of { key, layout_cmd } entries as layout actions
local function bind_layout(list)
for _, b in ipairs(list) do
hl.bind(b[1], hl.dsp.layout(b[2]))
end
end
--------------------
---- AUTOSTART -----
--------------------
-- ── Monitors ─────────────────────────────────────────────────────────────────
local monitors = {
{ output = "DP-1", mode = "1920x1080@60", position = "1920x0", scale = 1 },
{ output = "HDMI-A-2", mode = "1920x1080@60", position = "0x0", scale = 1 },
}
for _, m in ipairs(monitors) do
hl.monitor(m)
end
-- ── Environment ──────────────────────────────────────────────────────────────
local env_vars = {
NIXOS_OZONE_WL = "1",
MOZ_ENABLE_WAYLAND = "1",
MOZ_WEBRENDER = "1",
_JAVA_AWT_WM_NONREPARENTING = "1",
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1",
QT_QPA_PLATFORM = "wayland",
SDL_VIDEODRIVER = "wayland",
GDK_BACKEND = "wayland,x11",
XCURSOR_SIZE = "24",
XCURSOR_THEME = "catppuccin-mocha-dark",
EDITOR = "nvim",
GSK_RENDERER = "gl",
HYPRCURSOR_THEME = "catppuccin-mocha-dark",
HYPRCURSOR_SIZE = "24",
}
for k, v in pairs(env_vars) do
hl.env(k, v)
end
-- ── Autostart ────────────────────────────────────────────────────────────────
local autostart = {
"awww-daemon --no-cache & disown",
"awww img ~/Pictures/Wallpapers/Ghost_in_the_Shell.png",
"waybar &",
}
hl.on("hyprland.start", function()
hl.exec_cmd("awww-daemon --no-cache & disown")
hl.exec_cmd("awww img ~/Pictures/Wallpapers/Ghost_in_the_Shell.png")
hl.exec_cmd("waybar &")
for _, cmd in ipairs(autostart) do
hl.exec_cmd(cmd)
end
end)
--------------------
---- CONFIG --------
--------------------
-- ── Config ───────────────────────────────────────────────────────────────────
hl.config({
debug = {
@@ -73,7 +105,7 @@ hl.config({
numlock_by_default = true,
touchpad = {
natural_scroll = true,
tap_to_click = true, -- note: underscore, not hyphen
tap_to_click = true,
},
},
@@ -85,7 +117,7 @@ hl.config({
active_border = "rgba(a6e3a1ff)",
inactive_border = "rgba(f38ba8ff)",
},
layout = "dwindle",
layout = "master",
allow_tearing = false,
},
@@ -111,8 +143,16 @@ hl.config({
enabled = true,
},
dwindle = {
preserve_split = true,
master = {
new_status = "slave",
new_on_top = false,
new_on_active = "after",
orientation = "left",
mfact = 0.55,
allow_small_split = false,
smart_resizing = true,
drop_at_cursor = true,
focus_master_on_close = false,
},
misc = {
@@ -125,60 +165,102 @@ hl.config({
},
})
-- Animations (bezier curves + animation tree)
-- ── Animations ───────────────────────────────────────────────────────────────
hl.curve("myBezier", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } })
hl.animation({ leaf = "windows", enabled = true, speed = 7, bezier = "myBezier" })
hl.animation({ leaf = "windowsOut", enabled = true, speed = 7, bezier = "default", style = "popin 80%" })
hl.animation({ leaf = "border", enabled = true, speed = 10, bezier = "default" })
hl.animation({ leaf = "borderangle", enabled = true, speed = 8, bezier = "default" })
hl.animation({ leaf = "fade", enabled = true, speed = 7, bezier = "default" })
hl.animation({ leaf = "workspaces", enabled = true, speed = 6, bezier = "default" })
local animations = {
{ leaf = "windows", enabled = true, speed = 7, bezier = "myBezier" },
{ leaf = "windowsOut", enabled = true, speed = 7, bezier = "default", style = "popin 80%" },
{ leaf = "border", enabled = true, speed = 10, bezier = "default" },
{ leaf = "borderangle", enabled = true, speed = 8, bezier = "default" },
{ leaf = "fade", enabled = true, speed = 7, bezier = "default" },
{ leaf = "workspaces", enabled = true, speed = 6, bezier = "default" },
}
-- Per-device config
hl.device({
name = "usb-optical-mouse-",
sensitivity = 0,
for _, anim in ipairs(animations) do
hl.animation(anim)
end
-- ── Devices ──────────────────────────────────────────────────────────────────
local devices = {
{ name = "usb-optical-mouse-", sensitivity = 0 },
}
for _, d in ipairs(devices) do
hl.device(d)
end
-- ── Binds ────────────────────────────────────────────────────────────────────
-- Applications & launchers
bind_exec({
{ super .. " + Q", terminal },
{ super .. " + E", fileManager },
{ super .. " + O", "obsidian" },
{ super .. " + I", "floorp" },
{ super .. " + G", "thunderbird" },
{ "XF86Mail", "thunderbird" },
{ super .. " + N", "nautilus" },
{ "XF86Search", "nautilus" },
-- Rofi
{ super .. " + F", filebrowser },
{ super .. " + A", apps },
{ "Menu", apps },
{ super .. " + R", menu },
{ "XF86LaunchA", menu },
{ super .. " + S", power },
{ "XF86LaunchB", power },
-- Screenshots
{ super .. " + Z", 'grim -g "$(slurp)" ' .. screenshot },
{ super .. " + U", "grim " .. screenshot },
-- Media & brightness (locked = works on lockscreen, repeating = held key)
{ "XF86AudioMute", "pamixer -t", { locked = true } },
{ "XF86AudioPlay", "playerctl play-pause", { locked = true } },
{ "XF86AudioNext", "playerctl next", { locked = true } },
{ "XF86AudioPrev", "playerctl previous", { locked = true } },
{ "XF86AudioRaiseVolume", "pamixer -i 5", { locked = true, repeating = true } },
{ "XF86AudioLowerVolume", "pamixer -d 5", { locked = true, repeating = true } },
{ "XF86MonBrightnessUp", "brightnessctl set +5%", { locked = true, repeating = true } },
{ "XF86MonBrightnessDown", "brightnessctl set 5%-", { locked = true, repeating = true } },
})
--------------------
---- KEYBINDINGS ---
--------------------
-- Window actions
bind_all({
{ super .. " + M", hl.dsp.exit() },
{ super .. " + P", hl.dsp.window.pseudo() },
{ super .. " + V", hl.dsp.window.float({ action = "toggle" }) },
{ super .. " + C", hl.dsp.window.close() },
-- Mouse move/resize
{ super .. " + mouse:272", hl.dsp.window.drag() },
{ super .. " + mouse:273", hl.dsp.window.drag({ resize = true }) },
-- Scroll through workspaces
{ super .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }) },
{ super .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }) },
})
-- Application bindings
hl.bind(super .. " + Q", hl.dsp.exec_cmd(terminal))
hl.bind(super .. " + E", hl.dsp.exec_cmd(fileManager))
hl.bind(super .. " + O", hl.dsp.exec_cmd("obsidian"))
hl.bind(super .. " + I", hl.dsp.exec_cmd("floorp"))
hl.bind(super .. " + G", hl.dsp.exec_cmd("thunderbird"))
hl.bind("XF86Mail", hl.dsp.exec_cmd("thunderbird"))
hl.bind(super .. " + N", hl.dsp.exec_cmd("nautilus"))
hl.bind("XF86Search", hl.dsp.exec_cmd("nautilus"))
-- Directional focus
for _, dir in ipairs({ "left", "right", "up", "down" }) do
hl.bind(super .. " + " .. dir, hl.dsp.focus({ direction = dir }))
end
-- Exit
hl.bind(super .. " + M", hl.dsp.exit())
-- Master layout commands
bind_layout({
{ super .. " + RETURN", "swapwithmaster auto" },
{ super .. " + SHIFT + RETURN", "focusmaster auto" },
{ super .. " + TAB", "cyclenext" },
{ super .. " + SHIFT + TAB", "cycleprev" },
{ super .. " + bracketright", "swapnext" },
{ super .. " + bracketleft", "swapprev" },
{ super .. " + period", "addmaster" },
{ super .. " + comma", "removemaster" },
{ super .. " + SHIFT + O", "orientationcycle left top right bottom" },
{ super .. " + equal", "mfact +0.05" },
{ super .. " + minus", "mfact -0.05" },
})
-- Rofi bindings
hl.bind(super .. " + F", hl.dsp.exec_cmd(filebrowser))
hl.bind(super .. " + A", hl.dsp.exec_cmd(apps))
hl.bind("Menu", hl.dsp.exec_cmd(apps))
hl.bind(super .. " + R", hl.dsp.exec_cmd(menu))
hl.bind("XF86LaunchA", hl.dsp.exec_cmd(menu))
hl.bind(super .. " + S", hl.dsp.exec_cmd(power))
hl.bind("XF86LaunchB", hl.dsp.exec_cmd(power))
-- Move focus
hl.bind(super .. " + left", hl.dsp.focus({ direction = "left" }))
hl.bind(super .. " + right", hl.dsp.focus({ direction = "right" }))
hl.bind(super .. " + up", hl.dsp.focus({ direction = "up" }))
hl.bind(super .. " + down", hl.dsp.focus({ direction = "down" }))
-- Window modifiers
hl.bind(super .. " + P", hl.dsp.window.pseudo())
hl.bind(super .. " + V", hl.dsp.window.float({ action = "toggle" }))
hl.bind(super .. " + C", hl.dsp.window.close())
-- Workspaces (1-10, 0 maps to 10)
-- Workspaces 110 (key 0 maps to workspace 10)
for i = 1, 10 do
local key = tostring(i % 10)
hl.bind(super .. " + " .. key, hl.dsp.focus({ workspace = i }))
@@ -188,24 +270,13 @@ end
-- Special workspace (scratchpad)
hl.bind(super .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))
-- Scroll through workspaces with mouse wheel
hl.bind(super .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
hl.bind(super .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
-- ── Workspace Rules ───────────────────────────────────────────────────────────
-- Screenshot
hl.bind(super .. " + Z", hl.dsp.exec_cmd("grim -g \"$(slurp)\" $HOME/Pictures/Screenshots/$(date +'%s_grim.png')"))
hl.bind(super .. " + U", hl.dsp.exec_cmd("grim $HOME/Pictures/Screenshots/$(date +'%s_grim.png')"))
local workspace_rules = {
{ workspace = "1", layout_opts = { orientation = "left" } },
{ workspace = "2", layout_opts = { orientation = "top" } },
}
-- Media controls (locked = works on lockscreen, repeating = held key)
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("pamixer -t"), { locked = true })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("pamixer -i 5"), { locked = true, repeating = true })
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("pamixer -d 5"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set +5%"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 5%-"), { locked = true, repeating = true })
-- Mouse bindings for move/resize
hl.bind(super .. " + mouse:272", hl.dsp.window.drag())
hl.bind(super .. " + mouse:273", hl.dsp.window.drag({ resize = true }))
for _, rule in ipairs(workspace_rules) do
hl.workspace_rule(rule)
end
+2 -2
View File
@@ -150,11 +150,11 @@
format = "{}";
return-type = "json";
exec = ''
curl -s -X GET "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat $OPENWEATHER_API_KEY)&units=metric&lang=en" | jq -c '{text: "\(.name) \(.main.temp)C°"}'
curl -sf --max-time 10 "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat ~/.config/sops-nix/secrets/OPENWEATHER_API_KEY)&units=metric&lang=en" | jq -c '{text: "\(.name) \(.main.temp)C°"}'
'';
interval = 120;
on-click = ''
data=$(curl -s -X GET "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat $OPENWEATHER_API_KEY)&units=metric&lang=en")
data=$(curl -sf --max-time 10 "https://api.openweathermap.org/data/2.5/weather?lat=52.281311&lon=10.527029&appid=$(cat ~/.config/sops-nix/secrets/OPENWEATHER_API_KEY)&units=metric&lang=en")
city=$(echo "$data" | jq -r '.name')
temp=$(echo "$data" | jq -r '.main.temp')
feels=$(echo "$data" | jq -r '.main.feels_like')