From 1d0bfa1156ed085ef21b0ab620d7cd4917660613 Mon Sep 17 00:00:00 2001 From: SIGKILL64 Date: Thu, 29 Oct 2026 22:43:41 +0800 Subject: [PATCH] 20261029 --- .config/hypr/.luarc.json | 7 +- .config/hypr/hyprland.lua | 11 +- .config/hypr/land/binds.lua | 93 +++++++------ .config/hypr/land/events.lua | 2 +- .config/hypr/land/general.lua | 27 ++-- .config/hypr/land/plugins.lua | 17 ++- .config/hypr/land/rules.lua | 38 ++++-- .config/hypr/land/tools/deskentry.lua | 27 ++++ .config/hypr/land/tools/dropdown.lua | 122 ++++++++++++------ .config/hypr/land/tools/tofipower.lua | 43 ++++++ .config/waybar/config.hypr.long | 89 ++++++++----- .config/waybar/style.css | 4 +- .local/bin/proton-run | 39 +++++- .local/bin/wait-joystick | 10 +- .../applications/proton/Endfield.desktop | 2 +- .../applications/proton/GenshinImpact.desktop | 2 +- .../proton/GenshinImpactHDR.desktop | 2 +- .../instances/ProtonACE/services.toml | 2 + 18 files changed, 381 insertions(+), 156 deletions(-) create mode 100644 .config/hypr/land/tools/deskentry.lua create mode 100644 .config/hypr/land/tools/tofipower.lua diff --git a/.config/hypr/.luarc.json b/.config/hypr/.luarc.json index 4466a2a..02370d9 100644 --- a/.config/hypr/.luarc.json +++ b/.config/hypr/.luarc.json @@ -1,5 +1,8 @@ { "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", - "runtime.version": "Lua 5.5", - "workspace.library": ["/usr/share/hypr/stubs"] + "runtime": { + "version": "Lua 5.5", + "path": ["/usr/share/lua/5.5/?/init.lua"] + }, + "workspace.library": ["/usr/share/hypr/stubs", "/usr/share/lua/5.5"] } diff --git a/.config/hypr/hyprland.lua b/.config/hypr/hyprland.lua index af13473..e6f91bf 100644 --- a/.config/hypr/hyprland.lua +++ b/.config/hypr/hyprland.lua @@ -3,7 +3,16 @@ TaskE = 'taskset 0xffffff00 ' NotifyTimeout = 4000 NotifyIcons = { NONE = -1, WARNING = 0, INFO = 1, HINT = 2, ERROR = 3, CONFUSED = 4, OK = 5 } -require('land.plugins').load_all() +local CURSOR_THEME = 'layan-white-cursors' +local CURSOR_SIZE = 24 +hl.env('XCURSOR_THEME', CURSOR_THEME) +hl.env('XCURSOR_SIZE', CURSOR_SIZE) +hl.env('HYPRCURSOR_THEME', CURSOR_THEME) +hl.env('HYPRCURSOR_SIZE', CURSOR_SIZE) + +hl.env('AQ_DRM_DEVICES', '/dev/dri/card-dgpu-amd:/dev/dri/card-igpu-intel') + +require('land.plugins') require('land.events') require('land.general') require('land.animation') diff --git a/.config/hypr/land/binds.lua b/.config/hypr/land/binds.lua index 480360c..4bb90e8 100644 --- a/.config/hypr/land/binds.lua +++ b/.config/hypr/land/binds.lua @@ -3,6 +3,7 @@ local task_e = TaskE or '' local utils = require('land.utils') local dropdown = require('land.tools.dropdown') +local deskentry = require('land.tools.deskentry') ------------- -- Hyprland @@ -10,35 +11,10 @@ local dropdown = require('land.tools.dropdown') -- -- base -- -hl.bind(main_mod .. ' + H', utils.layout_bind { - monocle = hl.dsp.layout('cycleprev'), - default = hl.dsp.focus { direction = 'l' }, -}) -hl.bind(main_mod .. ' + L', utils.layout_bind { - monocle = hl.dsp.layout('cyclenext'), - default = hl.dsp.focus { direction = 'r' } -}) -hl.bind(main_mod .. ' + J', hl.dsp.focus { direction = 'd' }) -hl.bind(main_mod .. ' + K', hl.dsp.focus { direction = 'u' }) - -hl.bind('ALT + H', hl.dsp.focus {monitor = 'l'}) -hl.bind('ALT + L', hl.dsp.focus {monitor = 'r'}) -hl.bind('ALT + J', hl.dsp.focus {monitor = 'd'}) -hl.bind('ALT + K', hl.dsp.focus {monitor = 'u'}) -hl.bind(main_mod .. ' + CTRL + H', hl.dsp.focus {monitor = 'l'}) -hl.bind(main_mod .. ' + CTRL + L', hl.dsp.focus {monitor = 'r'}) -hl.bind(main_mod .. ' + CTRL + J', hl.dsp.focus {monitor = 'd'}) -hl.bind(main_mod .. ' + CTRL + K', hl.dsp.focus {monitor = 'u'}) - -hl.bind(main_mod .. ' + TAB', hl.dsp.focus { monitor = '+1' }) -hl.bind('ALT + TAB', hl.dsp.focus { monitor = '+1' }) - -for i = 1, 9 do - hl.bind(main_mod .. ' + CTRL + ' .. i, hl.dsp.dpms { action = 'toggle', monitor = 'DP-' .. i }) -- toggle monitors on/off(not physically, as in idle-screensaver.) -end -hl.bind(main_mod .. ' + CTRL + 0', hl.dsp.dpms()) +hl.bind(main_mod .. ' + R', hl.dsp.reload_config()) hl.bind(main_mod .. ' + SHIFT + E', hl.dsp.exec_raw('tofi-power --height=240')) +--hl.bind(main_mod .. ' + SHIFT + E', tofipower.dsp.run()) -- -- window @@ -55,18 +31,31 @@ hl.bind(main_mod .. ' + mouse:272', hl.dsp.window.drag(), { mouse = true }) hl.bind(main_mod .. ' + mouse:273', hl.dsp.window.resize(), { mouse = true }) hl.bind(main_mod .. ' + SHIFT + mouse:273', hl.dsp.window.resize { keep_aspect_ratio = true }, { mouse = true }) +hl.bind(main_mod .. ' + H', utils.layout_bind { + monocle = hl.dsp.layout('cycleprev'), + default = hl.dsp.focus { direction = 'l' }, +}) +hl.bind(main_mod .. ' + L', utils.layout_bind { + monocle = hl.dsp.layout('cyclenext'), + default = hl.dsp.focus { direction = 'r' } +}) +hl.bind(main_mod .. ' + J', hl.dsp.focus { direction = 'd' }) +hl.bind(main_mod .. ' + K', hl.dsp.focus { direction = 'u' }) + hl.bind(main_mod .. ' + SHIFT + H', utils.layout_bind { + scrolling = hl.dsp.window.swap { direction = 'l' }, default = hl.dsp.window.move { direction = 'l' }, }) +hl.bind(main_mod .. ' + SHIFT + H', hl.dsp.window.move { direction = 'l' }, { long_press = true }) hl.bind(main_mod .. ' + SHIFT + L', utils.layout_bind { + scrolling = hl.dsp.window.swap { direction = 'r' }, default = hl.dsp.window.move { direction = 'r' }, }) +hl.bind(main_mod .. ' + SHIFT + L', hl.dsp.window.move { direction = 'r' }, { long_press = true }) hl.bind(main_mod .. ' + SHIFT + J', utils.layout_bind { - scrolling = hl.dsp.window.move { monitor = 'd' }, default = hl.dsp.window.move { direction = 'd' }, }) hl.bind(main_mod .. ' + SHIFT + K', utils.layout_bind { - scrolling = hl.dsp.window.move { monitor = 'u' }, default = hl.dsp.window.move { direction = 'u' }, }) @@ -91,6 +80,36 @@ hl.bind(main_mod .. ' + period', hl.dsp.focus { workspace = 'm+1' }) hl.bind(main_mod .. ' + N', hl.dsp.workspace.toggle_special()) hl.bind(main_mod .. ' + M', hl.dsp.window.move { workspace = 'special' }) +----------- +-- Layout +----------- +hl.bind(main_mod .. ' + minus', hl.dsp.layout('colresize -conf')) +hl.bind(main_mod .. ' + equal', hl.dsp.layout('colresize +conf')) + +-- +-- monitor +-- +hl.bind('ALT + H', hl.dsp.focus {monitor = 'l'}) +hl.bind('ALT + L', hl.dsp.focus {monitor = 'r'}) +hl.bind('ALT + J', hl.dsp.focus {monitor = 'd'}) +hl.bind('ALT + K', hl.dsp.focus {monitor = 'u'}) +hl.bind(main_mod .. ' + CTRL + H', hl.dsp.focus {monitor = 'l'}) +hl.bind(main_mod .. ' + CTRL + L', hl.dsp.focus {monitor = 'r'}) +hl.bind(main_mod .. ' + CTRL + J', hl.dsp.focus {monitor = 'd'}) +hl.bind(main_mod .. ' + CTRL + K', hl.dsp.focus {monitor = 'u'}) + +hl.bind(main_mod .. ' + TAB', hl.dsp.focus { monitor = '+1' }) +hl.bind('ALT + TAB', hl.dsp.focus { monitor = '+1' }) + +hl.bind(main_mod .. ' + F1', hl.dsp.window.move { monitor = 'DP-1' }) +hl.bind(main_mod .. ' + F2', hl.dsp.window.move { monitor = 'DP-2' }) +hl.bind(main_mod .. ' + F4', hl.dsp.window.move { monitor = 'DP-4' }) + +for i = 1, 9 do + hl.bind(main_mod .. ' + CTRL + ' .. i, hl.dsp.dpms { action = 'toggle', monitor = 'DP-' .. i }) -- toggle monitors on/off(not physically, as in idle-screensaver.) +end +hl.bind(main_mod .. ' + CTRL + 0', hl.dsp.dpms()) + -- -- group -- @@ -99,12 +118,6 @@ hl.bind(main_mod .. ' + M', hl.dsp.window.move { workspace = 'special' }) -- cursor -- ------------ --- Layout ------------ -hl.bind(main_mod .. ' + minus', hl.dsp.layout('colresize -conf')) -hl.bind(main_mod .. ' + equal', hl.dsp.layout('colresize +conf')) - --------- -- Apps --------- @@ -125,21 +138,19 @@ hl.bind(main_mod .. ' + bracketright', hl.dsp.exec_raw('playerctl next')) hl.bind(main_mod .. ' + SHIFT + bracketleft', hl.dsp.exec_raw('playerctl position 5-'), { repeating = true }) hl.bind(main_mod .. ' + SHIFT + bracketright', hl.dsp.exec_raw('playerctl position 5+'), { repeating = true }) --- screenshot -hl.bind('Print', hl.plugin.hyprcapture.open) -hl.bind(main_mod .. ' + S', hl.plugin.hyprcapture.open) - -- waybar -hl.bind(main_mod .. ' + T', hl.dsp.exec_raw('killall waybar || waybar')) +hl.bind(main_mod .. ' + T', hl.dsp.exec_raw('pkill -USR1 waybar')) -- terminal hl.bind(main_mod .. ' + Return', hl.dsp.exec_raw(task_e .. 'kitty')) hl.bind(main_mod .. ' + SHIFT + Return', hl.dsp.exec_cmd(task_e .. 'kitty', { float = true, center = true, size = {1200, 800} })) +hl.bind('XF86AudioMute', dropdown.dsp.toggle(task_e .. 'kitty --class kitty-musicfox musicfox')) hl.bind(main_mod .. ' + F9', dropdown.dsp.toggle(task_e .. 'kitty --class kitty-musicfox musicfox')) -- browser +--hl.bind(main_mod .. ' + B', hl.dsp.exec_cmd('dex /var/lib/flatpak/exports/share/applications/app.zen_browser.zen.desktop', { workspace = 3 })) +hl.bind(main_mod .. ' + B', deskentry.dsp.exec('/var/lib/flatpak/exports/share/applications/app.zen_browser.zen.desktop', nil, { workspace = 3 })) hl.bind(main_mod .. ' + SHIFT + B', hl.dsp.exec_cmd('chromany', { workspace = 3 })) -hl.bind(main_mod .. ' + B', hl.dsp.exec_cmd('dex /var/lib/flatpak/exports/share/applications/app.zen_browser.zen.desktop', { workspace = 3 })) hl.bind(main_mod .. ' + Y', function () if hl.get_window('') then diff --git a/.config/hypr/land/events.lua b/.config/hypr/land/events.lua index 6548877..0f22a7b 100644 --- a/.config/hypr/land/events.lua +++ b/.config/hypr/land/events.lua @@ -3,7 +3,7 @@ local task_e = TaskE or '' hl.on('hyprland.start', function() hl.exec_cmd('systemctl --user start hyprland-session.target') hl.exec_cmd('dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP') - hl.exec_cmd('exec ' .. task_e .. 'dunst') + hl.exec_cmd('exec ' .. task_e .. 'mako') hl.exec_cmd('exec ' .. task_e .. 'waybar') hl.exec_cmd('exec ' .. task_e .. 'fcitx5') hl.exec_cmd('exec ' .. task_e .. 'hyprpaper') diff --git a/.config/hypr/land/general.lua b/.config/hypr/land/general.lua index 62783b1..2203f44 100644 --- a/.config/hypr/land/general.lua +++ b/.config/hypr/land/general.lua @@ -4,7 +4,7 @@ hl.monitor { position = '0x0', scale = 1, vrr = 1, - cm = 'hdr', + cm = 'hdredid', bitdepth=10, min_luminance = 0, max_luminance = 1000, @@ -55,6 +55,8 @@ hl.config { }, }, decoration = { + border_part_of_window = false, + rounding = 4, rounding_power = 2.0, @@ -64,36 +66,43 @@ hl.config { dim_modal = true, dim_inactive = true, - dim_strength = 0.05, - dim_special = 0.8, + dim_strength = 0.35, + dim_special = 0, dim_around = 0.4, blur = { enabled = true, - size = 6, + + size = 4, passes = 1, new_optimizations = true, xray = false, - special = false, + special = true, popups = true, popups_ignorealpha = 0.2, input_methods = true, input_methods_ignorealpha = 0.2, + + -- [kawase]|acrylic|aurora|drops|fluid_jar|frost|haze|heat_shimmer|prism|ripple|water + --variant = 'kawase', }, shadow = { enabled = false, }, glow = { - enabled = true, + enabled = false, }, motion_blur = { enabled = false, }, + wobble = { + enabled = true, + }, }, animations = { enabled = true, @@ -133,7 +142,7 @@ hl.config { render = { direct_scanout = 1, -- 0 off 1 on 2 auto on type 'game' cm_enabled = true, - cm_auto_hdr = 1, -- 0 off 1 cm hdr 2 cm hdredid + cm_auto_hdr = 2, -- 0 off 1 cm hdr 2 cm hdredid non_shader_cm = 1, -- 0 off 1 whenener possible 2 DS and passthrough only 3 disable and ignore CM issues non_shader_cm_interop = 0, -- 0 disabled in fullscreen 1 enabled in fullscreen 2 disabled for fullscreen photo/video/game new_render_scheduling = true, @@ -164,7 +173,7 @@ hl.config { screencopy_force_8b = false, }, quirks = { - prefer_hdr = 1, -- 0 off 1 always 2 gamescope only + prefer_hdr = 2, -- 0 off 1 always 2 gamescope only skip_non_kms_dmabuf_formats = true, }, scrolling = { @@ -181,5 +190,5 @@ hl.config { master = { mfact = 0.65, }, - plugin = require('land.plugins').config, + --plugin = require('land.plugins').config, } diff --git a/.config/hypr/land/plugins.lua b/.config/hypr/land/plugins.lua index a9851a2..6cad684 100644 --- a/.config/hypr/land/plugins.lua +++ b/.config/hypr/land/plugins.lua @@ -1,10 +1,6 @@ -local M = {} +hl.plugin.load(os.getenv('HOME') .. '/.config/hypr/plugin/libhyprcapture.so') -function M.load_all() - hl.plugin.load(os.getenv('HOME') .. '/.config/hypr/plugin/libhyprcapture.so') -end - -M.config = { +hl.config { plugin = { hyprcapture = { -- capture options default_mode = 'region', -- [region]/fullscreen/window @@ -17,7 +13,7 @@ M.config = { include_cursor = false, -- [false] language = 'auto', -- [auto]/en/zh_CN/zh_TW/ja/de/fr/es/ko remember_settings = false, -- [false] - allow_quick = false, -- [false] + allow_quick = true, -- [false] confirm_before_capture = false, -- [false] fusion_mode = true, -- [true] capture_fullscreen_clients_as_monitor = false, -- [false] @@ -67,6 +63,9 @@ M.config = { thumbnail_monitor = 'primary', -- [active]/primary/all/(output_name) helper = os.getenv('HOME') .. '/.config/hypr/plugin/hyprcapture-ui', -- [], by default: HYPRCAPTURE_HELPER -> $HOME/.local/bin/hyprcapture-ui }, -} +} } -return M +local main_mod = MainMod or 'SUPER' +hl.bind('Print', hl.plugin.hyprcapture.open) +hl.bind(main_mod .. ' + SHIFT + Print', function() hl.plugin.hyprcapture.quick('window') end) +hl.bind(main_mod .. ' + S', hl.plugin.hyprcapture.open) diff --git a/.config/hypr/land/rules.lua b/.config/hypr/land/rules.lua index 9d01160..d905ea4 100644 --- a/.config/hypr/land/rules.lua +++ b/.config/hypr/land/rules.lua @@ -3,7 +3,8 @@ --------------- hl.layer_rule { name = 'layer_waybar', - match = { namespace = 'waybar|launcher' }, + match = { namespace = '(?:launcher|waybar)' }, + -- notifications blur = true, blur_popups = true, @@ -19,27 +20,34 @@ for i = 1, 10 do hl.workspace_rule { workspace = i, monitor = 'DP-1' } end hl.workspace_rule { - workspace = 'name:ws_dp2', + workspace = 'name:dp2', monitor = 'DP-2', default = true, layout = 'master', layout_opts = { orientation = 'top' }, } hl.workspace_rule { - workspace = 'name:ws_dp4', + workspace = 'name:dp4', monitor = 'DP-4', default = true, } hl.workspace_rule { - workspace = 'n[s:ws_dp]', + workspace = 'n[s:dp]', --layout = 'monocle', gaps_in = 0, gaps_out = 0, float_gaps = 0, border_size = 0, no_border = true, no_shadow = true, no_rounding = true, decorate = false, persistent = false, } -hl.window_rule { match = { workspace = 'name:ws_dp4' }, scrolling_width = 1.0, } -hl.window_rule { match = { workspace = 'n[s:ws_dp]' }, no_blur = true, } +hl.window_rule { match = { workspace = 'name:dp4' }, scrolling_width = 1.0, } +hl.window_rule { match = { workspace = 'n[s:dp]' }, no_blur = true, } + +hl.workspace_rule { + workspace = 'name:dropdown', + monitor = 'DP-1', + no_border = true, + animation = 'slidefade 60%', +} ---------------- -- Window Rule @@ -53,7 +61,7 @@ hl.window_rule { hl.window_rule { name = 'games', - match = { class = '(?:yuanshen|starrail|zenlesszonezero)\\.exe|(?:steam|gamescope)|steam_app_.*' }, + match = { initial_class = '(?:yuanshen|starrail|zenlesszonezero)\\.exe|(?:steam|gamescope)|steam_app_.*' }, workspace = 4, @@ -61,14 +69,23 @@ hl.window_rule { immediate = true, float = true, - center = true, + --center = true, } +--hl.window_rule { +-- name = 'game_hsr', +-- match = { initial_class = 'gamescope', initial_title = '崩坏:星穹铁道' }, +-- +-- workspace = 'name:dp2', +-- +-- content = 'game', +-- immediate = true, +--} hl.window_rule { name = 'videos', match = { class = 'com\\.example\\.piliplus' }, - workspace = 'name:ws_dp4', + workspace = 'name:dp4', content = 'video', } @@ -121,5 +138,6 @@ hl.window_rule { name = 'godot_debug', match = { class = 'org\\.godotengine\\.Editor', title = '.*\\(DEBUG\\)'}, - workspace = 'name:ws_dp4', + workspace = 'name:dp4', + float = true, } diff --git a/.config/hypr/land/tools/deskentry.lua b/.config/hypr/land/tools/deskentry.lua new file mode 100644 index 0000000..e8e5f8d --- /dev/null +++ b/.config/hypr/land/tools/deskentry.lua @@ -0,0 +1,27 @@ +local M = { dsp = {} } + +---@param entryfile string +---@param action? string +---@param rules? table +function M.dsp.exec(entryfile, action, rules) + local file = io.open(entryfile, 'r') + if file then + local group_line = action and '[Desktop Action ' .. action .. ']' or '[Desktop Entry]' + local line + local cmd + repeat line = file:read('l') + until line == group_line + repeat line = file:read('l') + if line:sub(1, 5) == 'Exec=' then + cmd = line:sub(6, -1) + break + end + until not line or (line:sub(1, 1) == '[' and line:sub(-1, -1) == ']') + cmd = cmd:gsub(' *%%[fFuUdDnNickvm] *', ' ') -- https://specifications.freedesktop.org/desktop-entry/latest-single/#exec-variables + if cmd then + return hl.dsp.exec_cmd(cmd, rules) + end + end +end + +return M diff --git a/.config/hypr/land/tools/dropdown.lua b/.config/hypr/land/tools/dropdown.lua index 05af72a..037407a 100644 --- a/.config/hypr/land/tools/dropdown.lua +++ b/.config/hypr/land/tools/dropdown.lua @@ -1,29 +1,34 @@ -local M = {} +local M = { dsp = {} } -local WINDOW_WIDTH = 960 -local WINDOW_HEIGHT = 480 -local POSITION_X = 1594 -local VISIBLE_Y = 40 -local HIDDEN_X = -WINDOW_HEIGHT +local GAPS = { left = 6, top = 6, right = 6, bottom = 6 } +-- TARGET_POS: +-- | 0 | 1 | 2 | +-- | 3 | 4 | 5 | +-- | 6 | 7 | 8 | +local TARGET_POS = 2 -local WS_HIDE = 'special:wsDropdown' -local TAG_NEW = 'dropdownNew' +local WINDOW_SIZE = { 960, 480 } -local window_addrs = {} +local WS_HIDE = 'special:dropdown' +local TAG_NEW = 'dropdownNew' + +local windows = {} +local window_pos_cache = {} local new_id = nil -hl.on('window.open', function (w) - for _, v in ipairs(w.tags) do +hl.on('window.open', function (window) + for _, v in ipairs(window.tags) do if v == TAG_NEW .. '*' and new_id then - window_addrs[new_id] = w.address - hl.dispatch(hl.dsp.window.tag { tag = '-' .. TAG_NEW, window = 'address:' .. w.address }) + windows[new_id] = window + hl.dispatch(hl.dsp.window.tag { tag = '-' .. TAG_NEW .. '*', window = window }) new_id = nil return end end end) - +---@param cmd string +---@return string local function generate_id(cmd) local id = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } @@ -35,69 +40,100 @@ local function generate_id(cmd) id_idx = id_idx % id_len + 1 end - local CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - local CHARS_LEN = #CHARS + -- human-readable id + --local CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + --local CHARS_LEN = #CHARS + --for i = 1, id_len do + -- local pos = id[i] % CHARS_LEN + 1 + -- id[i] = CHARS:sub(pos, pos) + --end for i = 1, id_len do - local pos = id[i] % CHARS_LEN + 1 - id[i] = CHARS:sub(pos, pos) + id[i] = string.char(id[i]) end return table.concat(id) end +---@param absolute boolean +---@return table +local function get_pos(absolute) + local m = hl.get_active_monitor() + if not m then return { 0, 0 } end + + local pos = window_pos_cache[m.name] + if not pos then + local r = m.reserved + local dis_pos = absolute and { m.x + r.left, m.y + r.top } or { r.left, r.top } + local dis_width = (m.transform % 2 == 0 and m.width or m.height) // m.scale - r.left - r.right + local dis_height = (m.transform % 2 == 0 and m.height or m.width) // m.scale - r.top - r.bottom + local targetX = TARGET_POS % 3 + local targetY = TARGET_POS // 3 + pos = { + targetX == 0 and dis_pos[1] + GAPS.left or ( + targetX == 1 and dis_pos[1] + (dis_width - WINDOW_SIZE[1]) // 2 or + dis_pos[1] + dis_width - GAPS.right - WINDOW_SIZE[1] + ), + targetY == 0 and dis_pos[2] + GAPS.top or ( + targetY == 1 and dis_pos[2] + (dis_height - WINDOW_SIZE[2]) // 2 or + dis_pos[2] + dis_height - GAPS.bottom - WINDOW_SIZE[2] + ), + } + window_pos_cache[m.name] = pos + end + return pos +end + +---@param window HL.Window local function hide_window(window) hl.dispatch(hl.dsp.window.pin { action = 'off', window = window }) - hl.dispatch(hl.dsp.window.move { x = POSITION_X, y = HIDDEN_X, relative = false, window = window }) + --hl.dispatch(hl.dsp.window.move { x = POSITION_X, y = HIDDEN_X, relative = false, window = window }) hl.dispatch(hl.dsp.window.move { workspace = WS_HIDE, follow = false, window = window }) end +---@param window HL.Window local function hide_others_and_show(window) - for id, addr in pairs(window_addrs) do - local current_window = 'address:' .. addr - if current_window ~= window then - local hl_window = hl.get_window(current_window) - if hl_window then - if hl.get_window(current_window).pinned then - hide_window(current_window) - end - else - window_addrs[id] = nil - end + for _, w in pairs(windows) do + if w == window then + local pos = get_pos(true) + hl.dispatch(hl.dsp.window.move { workspace = 'm+0', follow = true, window = w }) + hl.dispatch(hl.dsp.window.move { x = pos[1], y = pos[2], relative = false, window = w }) + hl.dispatch(hl.dsp.window.pin { action = 'on', window = w }) else - hl.dispatch(hl.dsp.window.move { workspace = 'm+0', follow = true, window = window }) - hl.dispatch(hl.dsp.window.move { x = POSITION_X, y = VISIBLE_Y, relative = false, window = window }) - hl.dispatch(hl.dsp.window.pin { action = 'on', window = window }) + hide_window(w) end end end -M.dsp = {} +---@param cmd string function M.dsp.toggle(cmd) assert(cmd) return function () + if new_id then return end + local id = generate_id(cmd) - local addr = window_addrs[id] - if addr then - local window = 'address:' .. addr - local hl_window = hl.get_window(window) - if hl_window then - if hl_window.pinned then + local window = windows[id] + if window then + if hl.get_window(window) then + if window.pinned and window.monitor == hl.get_active_monitor() then hide_window(window) else hide_others_and_show(window) end return + else + windows[id] = nil end end - hide_others_and_show('') + hide_others_and_show(nil) new_id = id hl.exec_cmd(cmd, { float = true, - size = { WINDOW_WIDTH, WINDOW_HEIGHT }, - move = { POSITION_X, VISIBLE_Y }, + size = WINDOW_SIZE, + move = get_pos(false), pin = true, tag = TAG_NEW, + animation = 'slide', }) end end diff --git a/.config/hypr/land/tools/tofipower.lua b/.config/hypr/land/tools/tofipower.lua new file mode 100644 index 0000000..d9c4f1f --- /dev/null +++ b/.config/hypr/land/tools/tofipower.lua @@ -0,0 +1,43 @@ +local unistd = require('posix.unistd') + +local M = { dsp = {} } + +local dsps = {} +dsps['󰗽 Logout'] = hl.dsp.exit +dsps['󰖔 Suspend'] = hl.dsp.exec_raw('systemctl suspend') +dsps['󰑐 Reboot'] = hl.dsp.exec_raw('systemctl reboot') +dsps['󰐥 Shutdown'] = hl.dsp.exec_raw('systemctl poweroff -i') +local tofi_text = '' +for text, _ in pairs(dsps) do + tofi_text = tofi_text .. text .. '\n' +end + +function M.dsp.run() + return function() + local fd_r, fd_w = unistd.pipe() + assert(fd_r); + local pid = unistd.fork() + + if pid == -1 then + return + elseif pid == 0 then + -- sub process + unistd.dup2(fd_r, 0) + unistd.dup2(fd_w, 1) + unistd.close(fd_r) + unistd.close(fd_w) + unistd.exec('/usr/bin/tofi', { '--height=240' }) + os.exit(127) + end + unistd.write(fd_w, tofi_text) + unistd.close(fd_w) + local selected = unistd.read(fd_r, 16) + unistd.close(fd_r) + if selected then + --hl.dispatch(dsps[selected]) + hl.notification.create { text = selected, timeout = 10000 } + end + end +end + +return M diff --git a/.config/waybar/config.hypr.long b/.config/waybar/config.hypr.long index 040e6ee..103e1ad 100644 --- a/.config/waybar/config.hypr.long +++ b/.config/waybar/config.hypr.long @@ -1,36 +1,48 @@ -{ +[{ "layer": "top", - "output": ["DP-1", "DP-2", "DP-4"], + "output": ["DP-1"], "position": "top", "height": 34, - "width": 2560, + //"width": 2560, "margin": "0, 0, 0, 0", "fixed-center": true, - "modules-left": ["hyprland/workspaces", "mpris"], + "modules-left": ["hyprland/workspaces", "mpris", "hyprland/submap"], "modules-center": ["clock"], "modules-right": ["network", "wireplumber", "tray"], "hyprland/workspaces": { "format": "{icon}", "format-icons": { - "1": "1: ", - "2": "2: ", - "3": "3:  ", - "4": "4:  ", - "5": "5: ", - "6": "6: ", - "7": "7: ", - "8": "8: ", - "9": "9: ", - "10": "", - "urgent": "", - "focused": "", - "default": "" + "1": "1  ", + "2": "2  ", + "3": "3  ", + "4": "4  ", + "5": "5  ", + "6": "6  ", + "7": "7  ", + "8": "8  ", + "9": "9  ", + "10": "0  ", + "dp1": " 1", + "dp2": " 2", + "dp3": " 3", + "dp4": " 4", + "special": " ", + "special:dropdown": " ", + "urgent": " ", + "focused": " ", + "default": " " }, "show-special": true, - "on-scroll-up": "hyprctl dispatch workspace e-1", - "on-scroll-down": "hyprctl dispatch workspace e+1", - "on-click": "activate" + "special-visible-only": false, + "enable-bar-scroll": true + //"on-click": "activate" + }, + + "hyprland/submap": { + "format": "{submap}", + "max-length": 24, + "tooltip": false, }, "mpris": { @@ -38,8 +50,8 @@ "format-paused": "{status_icon} {dynamic}", "dynamic-order": ["title", "artist"], "status-icons": { - "playing": "▶", - "paused": "⏸" + "playing": "▶ ", + "paused": "⏸ " }, "title-len": 48, "artist-len": 16, @@ -78,8 +90,7 @@ }, "clock": { - "interval": 1, - "locale": "C", + "interval": 10, "format": "{:%R}", "format-alt": " {:%m/%d %R}", //"tooltip-format": " {:%b %d, %a}" @@ -102,15 +113,15 @@ }, "network": { - "interval": 1, + "interval": 2, "format": "{bandwidthTotalBytes} {icon}", "format-alt": "{icon}{ipaddr}/{cidr}", "format-alt-click": "click-right", "format-wifi": "{bandwidthTotalBytes} {icon}", "format-icons": { - "wifi": ["睊", "直" ,""], - "ethernet": [""], - "disconnected": [""] + "wifi": [" "], + "ethernet": [" "], + "disconnected": [" "] }, "tooltip-format": "{ifname}: {ipaddr}", }, @@ -124,7 +135,21 @@ }, "tray": { - "icon-size": 15, - "spacing": 2, - }, -} + "icon-size": 17, + "spacing": 1 + } +}, { + "layer": "top", + "output": ["DP-2"], + "position": "top", + "height": 34, + "margin": "0, 0, 0, 0", + "fixed-center": true, + "modules-left": ["hyprland/submap"], + "modules-center": ["clock"], + "clock": { + "interval": 10, + "format": " {:%m/%d %R}", + "format-alt": "{:%R}" + } +}] diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 73a1fc6..42288ef 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -1,7 +1,7 @@ * { transition: none; box-shadow: none; - font-family: "FiraCode Nerd Font", "Font Awesome 6 Free"; + font-family: "FiraCode Nerd Font", "Font Awesome 7 Free"; font-size: 13px; color: rgb(204, 238, 255); margin: 1px; @@ -50,7 +50,7 @@ tooltip { #mpris, #mpd { padding-left: 16px; - font-family: "LXGW WenKai Mono", "Font Awesome 6 Free"; + font-family: "LXGW WenKai Mono", "Font Awesome 7 Free"; } #tray { diff --git a/.local/bin/proton-run b/.local/bin/proton-run index 076df9b..d89473f 100755 --- a/.local/bin/proton-run +++ b/.local/bin/proton-run @@ -39,6 +39,39 @@ if [[ "$1" = '-i' ]]; then fi case "$1" in + hoyold) + export WINEPREFIX="$HOME/.local/data/wineprefix/miHoYold" + + # For GI/ZZZ + export WINE_ENABLE_TIMEOUT_FIX=1 + export UMU_USE_STEAM=1 + + case "$2" in + 'gih') + export GAMEID=umu-gi + umu-run 'G:\GenshinImpact\genshin-hdr.exe' -o 1 -m 1000 -s 500 -u 450 + exec env ${HDR_ENVS[@]} gamemoderun umu-run 'G:\GenshinImpact\ungi.exe' 90 'G:\GenshinImpact\CN\YuanShen.exe' -popupwindow -window-mode borderless + ;; + 'gi') + GAMEID=umu-gi exec gamemoderun umu-run 'G:\GenshinImpact\ungi.exe' 90 'G:\GenshinImpact\CN\YuanShen.exe' + ;; + #GAMEID=umu-zzz PROTON_DXVK_LLASYNC=1 \ + 'zzz') + GAMEID=umu-zzz exec gamemoderun umu-run 'G:\ZenlessZoneZero\CN\ZenlessZoneZero.exe' -use-d3d12 + ;; + #gamescope -W 1080 -H 660 -r 60 -S integer --adaptive-sync -- \ + 'hsr') + GAMEID=umu-hsr exec taskset 0xffffff00 \ + umu-run 'G:\HonkaiStarRail\CN\StarRail.exe' + ;; + 'launcher') + GAMEID=umu-hoyolauncher exec umu-run 'C:\Program Files\miHoYo Launcher\launcher.exe' + ;; + 'wine') + shift 2; GAMEID=umu-hoyo exec umu-run "$@" + ;; + esac + ;; hoyo|mi[Hh]o[Yy]o) export WINEPREFIX="$HOME/.local/data/wineprefix/miHoYo" @@ -59,8 +92,10 @@ case "$1" in 'zzz') GAMEID=umu-zzz exec gamemoderun umu-run 'G:\ZenlessZoneZero\CN\ZenlessZoneZero.exe' -use-d3d12 ;; + #gamescope -W 1080 -H 660 -r 60 -S integer --adaptive-sync -- \ 'hsr') - GAMEID=umu-hsr exec taskset 0xffffff00 umu-run 'G:\HonkaiStarRail\CN\StarRail.exe' + GAMEID=umu-hsr exec taskset 0xffffff00 \ + umu-run 'G:\HonkaiStarRail\CN\StarRail.exe' ;; 'launcher') GAMEID=umu-hoyolauncher exec umu-run 'C:\Program Files\miHoYo Launcher\launcher.exe' @@ -74,6 +109,8 @@ case "$1" in export WINEPREFIX="$HOME/.local/data/wineprefix/ACE" case "$2" in 'taoyuan') GAMEID=umu-taoyuan exec gamemoderun linuwux $GAMESCOPE_CLI umu-run 'G:\Tencent\Taoyuan\launcher\yc_launcher.exe';; + 'endfield') GAMEID=umu-endfield exec gamemoderun umu-run 'G:\Hypergryph\Arknights Endfield\EndfieldDirectLauncher.exe';; + 'hypergryph') GAMEID=umu-hypergryph exec gamemoderun umu-run 'G:\Hypergryph\Hypergryph Launcher\Launcher.exe';; 'wine') shift 2; GAMEID=umu-ace exec umu-run "$@";; esac ;; diff --git a/.local/bin/wait-joystick b/.local/bin/wait-joystick index 987c912..bf1f90c 100755 --- a/.local/bin/wait-joystick +++ b/.local/bin/wait-joystick @@ -4,10 +4,16 @@ set -e SECONDS=0 -if [[ ! -c /dev/input/js0 ]]; then +if systemctl status keyd.service; then + DEV_JS='/dev/input/js1' +else + DEV_JS='/dev/input/js0' +fi + +if [[ ! -c "${DEV_JS}" ]]; then hyprctl notify 2 5000 0 'Connect joystick to continue.' sleep 1.5 - until [[ -c /dev/input/js0 ]]; do + until [[ -c "${DEV_JS}" ]]; do if (( SECONDS > 30 )); then hyprctl notify 3 5000 0 'No joystick detected.' exit 1 diff --git a/.local/share/applications/proton/Endfield.desktop b/.local/share/applications/proton/Endfield.desktop index 0a91019..670f687 100755 --- a/.local/share/applications/proton/Endfield.desktop +++ b/.local/share/applications/proton/Endfield.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Name=Endfield Comment=[Proton] AK Endfield CN -Exec=bubblejail run ProtonACE /home/roku/.local/bin/proton-run ace endfield +Exec=bubblejail run ProtonACE /home/roku/.local/bin/proton-run ace hypergryph #Path=/home/roku/.cache/__proton/ Terminal=false Type=Application diff --git a/.local/share/applications/proton/GenshinImpact.desktop b/.local/share/applications/proton/GenshinImpact.desktop index 719a3ec..ed6486f 100755 --- a/.local/share/applications/proton/GenshinImpact.desktop +++ b/.local/share/applications/proton/GenshinImpact.desktop @@ -2,7 +2,7 @@ Name=Genshin Impact Comment=[Proton] Genshin Impact CN #Exec=wait-joystick bubblejail run ProtonHoyo /home/roku/.local/bin/proton-run hoyo gi -Exec=proton-run hoyo gi +Exec=wait-joystick proton-run hoyo gi Path=/home/roku/.cache/__proton/ Terminal=false Type=Application diff --git a/.local/share/applications/proton/GenshinImpactHDR.desktop b/.local/share/applications/proton/GenshinImpactHDR.desktop index 707abac..5d48ef7 100755 --- a/.local/share/applications/proton/GenshinImpactHDR.desktop +++ b/.local/share/applications/proton/GenshinImpactHDR.desktop @@ -2,7 +2,7 @@ Name=Genshin Impact HDR Comment=[Proton] Genshin Impact CN HDR #Exec=wait-joystick bubblejail run ProtonHoyo /home/roku/.local/bin/proton-run hoyo gih -Exec=proton-run hoyo gih +Exec=wait-joystick proton-run hoyo gih Path=/home/roku/.cache/__proton/ Terminal=false Type=Application diff --git a/.local/share/bubblejail/instances/ProtonACE/services.toml b/.local/share/bubblejail/instances/ProtonACE/services.toml index 0c6be86..d0c8fa7 100644 --- a/.local/share/bubblejail/instances/ProtonACE/services.toml +++ b/.local/share/bubblejail/instances/ProtonACE/services.toml @@ -11,6 +11,8 @@ home_paths = [ ".local/data/proton/default", ".local/bin/proton-run", ".local/share/umu", + "Games/WinGames/Downloads", + "Games/WinGames/Hypergryph", ] [direct_rendering]