lua switch
This commit is contained in:
266
.config/hypr/hyprland.lua
Normal file
266
.config/hypr/hyprland.lua
Normal file
@@ -0,0 +1,266 @@
|
||||
------------------------------------------
|
||||
-- Hyprland
|
||||
------------------------------------------
|
||||
|
||||
------------------------------------------
|
||||
-- My Programs
|
||||
------------------------------------------
|
||||
|
||||
local terminal = "kitty"
|
||||
local fileManager = "dolphin"
|
||||
local menu = "wofi"
|
||||
|
||||
local webBrowser = "firefox"
|
||||
local codeEditor = "code-insiders"
|
||||
|
||||
------------------------------------------
|
||||
local mainMod = "SUPER"
|
||||
|
||||
------------------------------------------
|
||||
-- Monitor
|
||||
------------------------------------------
|
||||
|
||||
hl.monitor({
|
||||
output = "DP-1",
|
||||
mode = "2560x1440@144",
|
||||
position = "0x0",
|
||||
scale = 1
|
||||
})
|
||||
|
||||
hl.monitor({
|
||||
output = "DP-2",
|
||||
mode = "1920x1200@60",
|
||||
position = "2560x0",
|
||||
scale = 1
|
||||
})
|
||||
|
||||
------------------------------------------
|
||||
-- GPU NVIDIA
|
||||
------------------------------------------
|
||||
|
||||
local env_vars = {
|
||||
NVD_BACKEND = "direct",
|
||||
LIBVA_DRIVER_NAME = "nvidia",
|
||||
XDG_SESSION_TYPE = "wayland",
|
||||
GBM_BACKEND = "nvidia-drm",
|
||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia",
|
||||
|
||||
XDG_CURRENT_DESKTOP = "Hyprland",
|
||||
XDG_SESSION_DESKTOP = "Hyprland",
|
||||
QT_QPA_PLATFORMTHEME = "hyprqt6engine",
|
||||
|
||||
-- Cursor size
|
||||
XCURSOR_SIZE = "24",
|
||||
HYPRCURSOR_SIZE = "24"
|
||||
}
|
||||
|
||||
for key, val in pairs(env_vars) do
|
||||
hl.env(key, val)
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
-- Autostart
|
||||
------------------------------------------
|
||||
|
||||
-- In 0.55 werden Autostarts am besten über das `hyprland.start` Event ausgeführt
|
||||
hl.on("hyprland.start", function()
|
||||
hl.exec_cmd(terminal)
|
||||
hl.exec_cmd("waybar")
|
||||
hl.exec_cmd("hyprpaper")
|
||||
hl.exec_cmd("hypridle")
|
||||
hl.exec_cmd("pass-secret-service")
|
||||
end)
|
||||
|
||||
-- ==========================================
|
||||
-- ALLGEMEINE KONFIGURATION
|
||||
-- ==========================================
|
||||
hl.config({
|
||||
general = {
|
||||
gaps_in = 5,
|
||||
gaps_out = 10,
|
||||
border_size = 2,
|
||||
|
||||
col = {
|
||||
active_border = { colors = {"rgba(ff7b3bee)", "rgba(e0274aee)"}, angle = 45 },
|
||||
inactive_border = "rgba(595959aa)",
|
||||
},
|
||||
|
||||
resize_on_border = false,
|
||||
allow_tearing = false,
|
||||
layout = "dwindle"
|
||||
},
|
||||
decoration = {
|
||||
rounding = 10,
|
||||
rounding_power = 2,
|
||||
active_opacity = 1.0,
|
||||
inactive_opacity = 1.0,
|
||||
shadow = {
|
||||
enabled = true,
|
||||
range = 4,
|
||||
render_power = 3,
|
||||
color = "rgba(1a1a1aee)"
|
||||
},
|
||||
blur = {
|
||||
enabled = true,
|
||||
size = 3,
|
||||
passes = 1,
|
||||
vibrancy = 0.1696
|
||||
}
|
||||
},
|
||||
animations = {
|
||||
enabled = true,
|
||||
beziers = {
|
||||
{"easeOutQuint", 0.23, 1, 0.32, 1},
|
||||
{"easeInOutCubic", 0.65, 0.05, 0.36, 1},
|
||||
{"linear", 0, 0, 1, 1},
|
||||
{"almostLinear", 0.5, 0.5, 0.75, 1},
|
||||
{"quick", 0.15, 0, 0.1, 1}
|
||||
},
|
||||
animations = {
|
||||
{"global", true, 10, "default"},
|
||||
{"border", true, 5.39, "easeOutQuint"},
|
||||
{"windows", true, 4.79, "easeOutQuint"},
|
||||
{"windowsIn", true, 4.1, "easeOutQuint", "popin 87%"},
|
||||
{"windowsOut", true, 1.49, "linear", "popin 87%"},
|
||||
{"fadeIn", true, 1.73, "almostLinear"},
|
||||
{"fadeOut", true, 1.46, "almostLinear"},
|
||||
{"fade", true, 3.03, "quick"},
|
||||
{"layers", true, 3.81, "easeOutQuint"},
|
||||
{"layersIn", true, 4, "easeOutQuint", "fade"},
|
||||
{"layersOut", true, 1.5, "linear", "fade"},
|
||||
{"fadeLayersIn", true, 1.79, "almostLinear"},
|
||||
{"fadeLayersOut", true, 1.39, "almostLinear"},
|
||||
{"workspaces", true, 1.94, "almostLinear", "fade"},
|
||||
{"workspacesIn", true, 1.21, "almostLinear", "fade"},
|
||||
{"workspacesOut", true, 1.94, "almostLinear", "fade"},
|
||||
{"zoomFactor", true, 7, "quick"}
|
||||
}
|
||||
},
|
||||
dwindle = {
|
||||
preserve_split = true
|
||||
-- Hinweis: 'pseudotile' existiert ab v0.55 nicht mehr und wurde entfernt!
|
||||
},
|
||||
master = {
|
||||
new_status = "master"
|
||||
},
|
||||
misc = {
|
||||
force_default_wallpaper = 0,
|
||||
disable_hyprland_logo = true
|
||||
},
|
||||
input = {
|
||||
kb_layout = "de",
|
||||
follow_mouse = 1,
|
||||
sensitivity = 0,
|
||||
touchpad = {
|
||||
natural_scroll = false
|
||||
}
|
||||
},
|
||||
devices = {
|
||||
{ name = "epic-mouse-v1", sensitivity = -0.5 }
|
||||
}
|
||||
})
|
||||
|
||||
-- Swipes und Gesten
|
||||
hl.gesture({
|
||||
fingers = 3,
|
||||
direction = "horizontal",
|
||||
action = "workspace"
|
||||
})
|
||||
|
||||
-- ==========================================
|
||||
-- WORKSPACE BINDINGS
|
||||
-- ==========================================
|
||||
-- Ungerade Workspaces auf DP-1
|
||||
for _, ws in ipairs({1, 3, 5, 7, 9}) do
|
||||
hl.workspace_rule({ workspace = tostring(ws), monitor = "DP-1" })
|
||||
end
|
||||
|
||||
-- Gerade Workspaces auf DP-2
|
||||
for _, ws in ipairs({2, 4, 6, 8, 10}) do
|
||||
hl.workspace_rule({ workspace = tostring(ws), monitor = "DP-2" })
|
||||
end
|
||||
|
||||
-- ==========================================
|
||||
-- KEYBINDS
|
||||
-- ==========================================
|
||||
-- Die neue hl.bind()-Funktion kombiniert Modifier und Taste per String
|
||||
|
||||
hl.bind(mainMod .. " + D", hl.dsp.exec_cmd("discord"))
|
||||
hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd(terminal))
|
||||
hl.bind(mainMod .. " + C", hl.dsp.window.close())
|
||||
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'"))
|
||||
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager))
|
||||
hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }))
|
||||
hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu .. " --show drun --conf ~/.config/wofi/config --style ~/.config/wofi/style.css"))
|
||||
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
|
||||
hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit"))
|
||||
|
||||
hl.bind(mainMod .. " + SHIFT + B", hl.dsp.exec_cmd("~/.config/waybar/refrech.sh"))
|
||||
hl.bind(mainMod .. " + L", hl.dsp.exec_cmd("hyprlock"))
|
||||
hl.bind(mainMod .. " + SHIFT + L", hl.dsp.exec_cmd("systemctl suspend"))
|
||||
hl.bind(mainMod .. " + SHIFT + R", hl.dsp.exec_cmd("~/.config/hypr/toggle_remote.sh"))
|
||||
|
||||
-- Move focus with mainMod + arrow keys
|
||||
hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" }))
|
||||
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
|
||||
hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" }))
|
||||
hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" }))
|
||||
|
||||
-- Switch workspaces with mainMod + [0-9]
|
||||
-- Move active window to a workspace with mainMod + SHIFT + [0-9]
|
||||
for i = 1, 10 do
|
||||
local key = i % 10 -- 10 maps to key 0
|
||||
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i}))
|
||||
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
|
||||
end
|
||||
|
||||
-- Scratchpad
|
||||
hl.bind(mainMod .. " + A", hl.dsp.workspace.toggle_special("magic"))
|
||||
hl.bind(mainMod .. " + SHIFT + A", hl.dsp.window.move({ workspace = "special:magic" }))
|
||||
|
||||
-- Screenshots
|
||||
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.exec_cmd([[grim -g "$(slurp)" - | wl-copy]]))
|
||||
hl.bind("Print", hl.dsp.exec_cmd([[grim -g "$(slurp)" - | swappy -f -]]))
|
||||
hl.bind("SHIFT + Print", hl.dsp.exec_cmd([[grim ~/Bilder/Screenshots/Screenshot_$(date +'%Y%m%d_%H%M%S').png]]))
|
||||
|
||||
-- Mausrad-Workspaces
|
||||
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
|
||||
hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
|
||||
|
||||
-- Maus-Verschieben/Vergrößern (mouse:272 = LMB, mouse:273 = RMB)
|
||||
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||
|
||||
-- Laptop multimedia keys for volume and LCD brightness
|
||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
|
||||
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true, repeating = true })
|
||||
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = true })
|
||||
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true })
|
||||
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true })
|
||||
hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true })
|
||||
|
||||
-- Requires playerctl
|
||||
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
|
||||
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
|
||||
|
||||
|
||||
-- ==========================================
|
||||
-- FENSTERREGELN (hl.window_rule)
|
||||
-- ==========================================
|
||||
-- In v0.55 nutzt du für Fensterregeln eine saubere Table-Struktur für Matches
|
||||
hl.window_rule({ match = { class = "^(discord)$" }, workspace = "2" })
|
||||
hl.window_rule({ match = { class = "^(steam)$", title = "^(Steam)$" }, workspace = "5" })
|
||||
|
||||
-- Maximize-Events von allen Apps unterdrücken
|
||||
hl.window_rule({ match = { class = ".*" }, suppress_event = "maximize" })
|
||||
|
||||
-- XWayland Dragging-Fix
|
||||
hl.window_rule({
|
||||
match = { class = "^$", title = "^$", xwayland = true, float = true, fullscreen = false, pin = false },
|
||||
no_focus = true
|
||||
})
|
||||
|
||||
-- hyprland-run Modifikationen
|
||||
hl.window_rule({ match = { class = "hyprland-run" }, float = true, move = "20 monitor_h-120" })
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
SECOND_MONITOR="DP-2"
|
||||
|
||||
# Prüfen, ob der Monitor in der Liste der aktiven Monitore auftaucht
|
||||
if hyprctl monitors | grep -q "$SECOND_MONITOR"; then
|
||||
# Monitor ausschalten
|
||||
hyprctl keyword monitor "$SECOND_MONITOR, disable"
|
||||
# Monitor ausschalten (Lua-Tabellen-Syntax)
|
||||
hyprctl keyword monitor "{ output = '$SECOND_MONITOR', disable = true }"
|
||||
notify-send "RustDesk Modus" "DP-2 deaktiviert"
|
||||
else
|
||||
# Monitor wieder mit exakt deinen Config-Werten einschalten
|
||||
hyprctl keyword monitor "$SECOND_MONITOR, 1920x1200@60, 2560x0, 1"
|
||||
# Monitor wieder mit exakt deinen Config-Werten einschalten (Lua-Tabellen-Syntax)
|
||||
hyprctl keyword monitor "{ output = '$SECOND_MONITOR', mode = '1920x1200@60', position = '2560x0', scale = 1 }"
|
||||
notify-send "Desktop Modus" "DP-2 aktiviert"
|
||||
fi
|
||||
Reference in New Issue
Block a user