Refactoring

This commit is contained in:
2026-09-30 17:03:12 +01:00
parent 657851bc02
commit 9b7e3507d8
9 changed files with 198 additions and 93 deletions
-19
View File
@@ -165,25 +165,6 @@ hl.window_rule {
}, },
} }
-- Scratchpad apps
hl.window_rule {
workspace = 'special:music',
match = {
class = 'Spotify|psysonic',
},
}
hl.window_rule {
workspace = 'special:comms',
match = {
class = '^(chrome-discord.com__channels_@me-Default|chrome-web.whatsapp.com__-Default|signal)$',
},
}
hl.window_rule {
workspace = 'special:prod',
match = {
class = '^(superproductivity|org.station.notes)$',
},
}
-- Float Nextcloud -- Float Nextcloud
hl.window_rule { hl.window_rule {
float = true, float = true,
+11 -1
View File
@@ -6,6 +6,12 @@ hl.on('hyprland.start', function()
exec '/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1' exec '/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1'
exec 'dbus-update-activation-environment --systemd --all' exec 'dbus-update-activation-environment --systemd --all'
exec 'station-bg-set' exec 'station-bg-set'
-- hl.dispatch(
-- dispatch_exec(
-- 'station-launch-tui btop',
-- { move = { workspace = 'special:monitor' } }
-- )
-- )
local monitors = hl.get_monitors() local monitors = hl.get_monitors()
@@ -17,6 +23,10 @@ end)
hl.on('config.reloaded', function() hl.on('config.reloaded', function()
toggle_laptop_monitor() toggle_laptop_monitor()
exec 'station-bg-set'
-- exec(
-- 'station-launch-tui btop',
-- { move = { workspace = 'special:monitor' } }
-- )
end) end)
-37
View File
@@ -232,43 +232,6 @@ bind(
'Move window down' 'Move window down'
) )
-- Control scratchpad
bind(
'SUPER + S',
hl.dsp.workspace.toggle_special 'scratchpad',
'Toggle scratchpad'
)
bind(
'SUPER + ALT + S',
hl.dsp.window.move { workspace = 'special:scratchpad' },
'Move window to scratchpad'
)
bind('SUPER + N', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'prod')
local windows = hl.get_windows { workspace = 'special:prod' }
if #windows == 0 then
exec 'station-launch-or-focus ^superProductivity$ "uwsm-app -- super-productivity"'
exec 'uwsm-app -- xdg-terminal-exec --app-id=org.station.notes nvim ~/Notes'
end
end, 'Toggle productivity workspace')
bind('SUPER + M', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'music')
local windows = hl.get_windows { workspace = 'special:music' }
if #windows == 0 then
exec 'station-launch-or-focus spotify'
exec 'station-launch-or-focus psysonic'
end
end, 'Toggle music workspace')
bind('SUPER + D', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'comms')
local windows = hl.get_windows { workspace = 'special:comms' }
if #windows == 0 then
exec 'station-launch-or-focus ^signal$ "uwsm-app -- signal-desktop"'
exec 'station-launch-or-focus ^chrome-web.whatsapp.com__-Default$ "station-launch-webapp https://web.whatsapp.com"'
exec 'station-launch-or-focus ^chrome-discord.com__channels_@me-Default$ "station-launch-webapp https://discord.com/channels/@me"'
end
end, 'Toggle comms workspace')
-- Cycle through applications on active workspace -- Cycle through applications on active workspace
bind( bind(
'SUPER + TAB', 'SUPER + TAB',
+5 -1
View File
@@ -1,5 +1,9 @@
DEFAULT_LAYOUT = 'master' DEFAULT_LAYOUT = 'master'
LAPTOP_MONITOR_NAME = 'BOE NE160QDM-NZ6'
LEFT_MONITOR_NAME = 'Samsung Electric Company LU28R55 HNMN500475'
RIGHT_MONITOR_NAME = 'Samsung Electric Company LU28R55 HNMN500462'
dispatch_exec = hl.dsp.exec_cmd dispatch_exec = hl.dsp.exec_cmd
exec = hl.exec_cmd exec = hl.exec_cmd
shortcut = hl.dsp.send_shortcut shortcut = hl.dsp.send_shortcut
@@ -73,6 +77,6 @@ end
function is_laptop_screen_focused() function is_laptop_screen_focused()
local monitor = hl.get_active_monitor() local monitor = hl.get_active_monitor()
return monitor and monitor.description == 'BOE NE160QDM-NZ6' return monitor and monitor.description == LAPTOP_MONITOR_NAME
end end
+1
View File
@@ -7,4 +7,5 @@ require 'looknfeel'
require 'input' require 'input'
require 'windows' require 'windows'
require 'monitors' require 'monitors'
require 'scratchpad'
+103 -19
View File
@@ -25,8 +25,7 @@ hl.config {
-- Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on -- Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false, allow_tearing = false,
-- layout = scrolling, # Change to niri-like side-scrolling layout layout = DEFAULT_LAYOUT,
layout = 'master',
}, },
-- https://wiki.hyprland.org/Configuring/Variables/#decoration -- https://wiki.hyprland.org/Configuring/Variables/#decoration
@@ -119,6 +118,7 @@ hl.config {
cursor = { cursor = {
hide_on_key_press = true, hide_on_key_press = true,
warp_on_change_workspace = 1, warp_on_change_workspace = 1,
no_hardware_cursors = 1,
}, },
-- Auto toggle scratchpad on switching workspace from scratchpad -- Auto toggle scratchpad on switching workspace from scratchpad
@@ -138,31 +138,115 @@ hl.config {
} }
-- Default curves and animations, see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/ -- Default curves and animations, see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/
hl.curve('easeOutQuint', { type = 'bezier', points = { { 0.23, 1 }, { 0.32, 1 } } }) hl.curve(
hl.curve('easeInOutCubic', { type = 'bezier', points = { { 0.65, 0.05 }, { 0.36, 1 } } }) 'easeOutQuint',
{ type = 'bezier', points = { { 0.23, 1 }, { 0.32, 1 } } }
)
hl.curve(
'easeInOutCubic',
{ type = 'bezier', points = { { 0.65, 0.05 }, { 0.36, 1 } } }
)
hl.curve('linear', { type = 'bezier', points = { { 0, 0 }, { 1, 1 } } }) hl.curve('linear', { type = 'bezier', points = { { 0, 0 }, { 1, 1 } } })
hl.curve('almostLinear', { type = 'bezier', points = { { 0.5, 0.5 }, { 0.75, 1 } } }) hl.curve(
'almostLinear',
{ type = 'bezier', points = { { 0.5, 0.5 }, { 0.75, 1 } } }
)
hl.curve('quick', { type = 'bezier', points = { { 0.15, 0 }, { 0.1, 1 } } }) hl.curve('quick', { type = 'bezier', points = { { 0.15, 0 }, { 0.1, 1 } } })
-- Default springs -- Default springs
hl.curve('easy', { type = 'spring', mass = 1, stiffness = 71.2633, dampening = 15.8273644 }) hl.curve(
'easy',
{ type = 'spring', mass = 1, stiffness = 71.2633, dampening = 15.8273644 }
)
hl.animation { leaf = 'global', enabled = true, speed = 10, bezier = 'default' } hl.animation { leaf = 'global', enabled = true, speed = 10, bezier = 'default' }
hl.animation { leaf = 'border', enabled = true, speed = 5.39, bezier = 'easeOutQuint' } hl.animation {
leaf = 'border',
enabled = true,
speed = 5.39,
bezier = 'easeOutQuint',
}
hl.animation { leaf = 'windows', enabled = true, speed = 4.79, spring = 'easy' } hl.animation { leaf = 'windows', enabled = true, speed = 4.79, spring = 'easy' }
hl.animation { leaf = 'windowsIn', enabled = true, speed = 4.1, spring = 'easy', style = 'popin 87%' } hl.animation {
hl.animation { leaf = 'windowsOut', enabled = true, speed = 1.49, bezier = 'linear', style = 'popin 87%' } leaf = 'windowsIn',
hl.animation { leaf = 'fadeIn', enabled = true, speed = 1.73, bezier = 'almostLinear' } enabled = true,
hl.animation { leaf = 'fadeOut', enabled = true, speed = 1.46, bezier = 'almostLinear' } speed = 4.1,
spring = 'easy',
style = 'popin 87%',
}
hl.animation {
leaf = 'windowsOut',
enabled = true,
speed = 1.49,
bezier = 'linear',
style = 'popin 87%',
}
hl.animation {
leaf = 'fadeIn',
enabled = true,
speed = 1.73,
bezier = 'almostLinear',
}
hl.animation {
leaf = 'fadeOut',
enabled = true,
speed = 1.46,
bezier = 'almostLinear',
}
hl.animation { leaf = 'fade', enabled = true, speed = 3.03, bezier = 'quick' } hl.animation { leaf = 'fade', enabled = true, speed = 3.03, bezier = 'quick' }
hl.animation { leaf = 'layers', enabled = true, speed = 3.81, bezier = 'easeOutQuint' } hl.animation {
hl.animation { leaf = 'layersIn', enabled = true, speed = 4, bezier = 'easeOutQuint', style = 'fade' } leaf = 'layers',
hl.animation { leaf = 'layersOut', enabled = true, speed = 1.5, bezier = 'linear', style = 'fade' } enabled = true,
hl.animation { leaf = 'fadeLayersIn', enabled = true, speed = 1.79, bezier = 'almostLinear' } speed = 3.81,
hl.animation { leaf = 'fadeLayersOut', enabled = true, speed = 1.39, bezier = 'almostLinear' } bezier = 'easeOutQuint',
hl.animation { leaf = 'workspaces', enabled = true, speed = 1.94, bezier = 'almostLinear', style = 'fade' } }
hl.animation { leaf = 'workspacesIn', enabled = true, speed = 1.21, bezier = 'almostLinear', style = 'fade' } hl.animation {
hl.animation { leaf = 'workspacesOut', enabled = true, speed = 1.94, bezier = 'almostLinear', style = 'fade' } leaf = 'layersIn',
enabled = true,
speed = 4,
bezier = 'easeOutQuint',
style = 'fade',
}
hl.animation {
leaf = 'layersOut',
enabled = true,
speed = 1.5,
bezier = 'linear',
style = 'fade',
}
hl.animation {
leaf = 'fadeLayersIn',
enabled = true,
speed = 1.79,
bezier = 'almostLinear',
}
hl.animation {
leaf = 'fadeLayersOut',
enabled = true,
speed = 1.39,
bezier = 'almostLinear',
}
hl.animation {
leaf = 'workspaces',
enabled = true,
speed = 1.94,
bezier = 'almostLinear',
style = 'fade',
}
hl.animation {
leaf = 'workspacesIn',
enabled = true,
speed = 1.21,
bezier = 'almostLinear',
style = 'fade',
}
hl.animation {
leaf = 'workspacesOut',
enabled = true,
speed = 1.94,
bezier = 'almostLinear',
style = 'fade',
}
hl.animation { leaf = 'zoomFactor', enabled = true, speed = 7, bezier = 'quick' } hl.animation { leaf = 'zoomFactor', enabled = true, speed = 7, bezier = 'quick' }
-- Style Gum confirm to match terminal theme -- Style Gum confirm to match terminal theme
+3 -3
View File
@@ -2,19 +2,19 @@
-- List current monitors and resolutions possible: hyprctl monitors -- List current monitors and resolutions possible: hyprctl monitors
hl.monitor { hl.monitor {
output = 'desc:Samsung Electric Company LU28R55 HNMN500475', output = 'desc:' .. LEFT_MONITOR_NAME,
mode = '3840x2160@30', mode = '3840x2160@30',
position = '0x0', position = '0x0',
scale = 1.5, scale = 1.5,
} }
hl.monitor { hl.monitor {
output = 'desc:Samsung Electric Company LU28R55 HNMN500462', output = 'desc:' .. RIGHT_MONITOR_NAME,
mode = '3840x2160@30', mode = '3840x2160@30',
position = '2560x0', position = '2560x0',
scale = 1.5, scale = 1.5,
} }
hl.monitor { hl.monitor {
output = 'desc:BOE NE160QDM-NZ6', output = 'desc:' .. LAPTOP_MONITOR_NAME,
mode = '2560x1600', mode = '2560x1600',
position = '5120x720', position = '5120x720',
scale = 'auto', scale = 'auto',
+60
View File
@@ -0,0 +1,60 @@
-- Scratchpad apps
hl.window_rule {
workspace = 'special:music',
match = {
class = 'Spotify|psysonic',
},
}
hl.window_rule {
workspace = 'special:comms',
match = {
class = '^(chrome-discord.com__channels_@me-Default|chrome-web.whatsapp.com__-Default|signal)$',
},
}
hl.window_rule {
workspace = 'special:prod',
match = {
class = '^(superproductivity|org.station.notes)$',
},
}
-- Control scratchpad
bind(
'SUPER + S',
hl.dsp.workspace.toggle_special 'scratchpad',
'Toggle scratchpad'
)
bind(
'SUPER + ALT + S',
hl.dsp.window.move { workspace = 'special:scratchpad' },
'Move window to scratchpad'
)
bind('SUPER + N', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'prod')
local windows = hl.get_windows { workspace = 'special:prod' }
if #windows == 0 then
exec 'station-launch-or-focus ^superProductivity$ "uwsm-app -- super-productivity"'
exec 'uwsm-app -- xdg-terminal-exec --app-id=org.station.notes nvim ~/Notes'
end
end, 'Toggle productivity workspace')
bind('SUPER + M', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'music')
local windows = hl.get_windows { workspace = 'special:music' }
if #windows == 0 then
exec 'station-launch-or-focus spotify'
exec 'station-launch-or-focus psysonic'
end
end, 'Toggle music workspace')
bind('SUPER + D', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'comms')
local windows = hl.get_windows { workspace = 'special:comms' }
if #windows == 0 then
exec 'station-launch-or-focus ^signal$ "uwsm-app -- signal-desktop"'
exec 'station-launch-or-focus ^chrome-web.whatsapp.com__-Default$ "station-launch-webapp https://web.whatsapp.com"'
exec 'station-launch-or-focus ^chrome-discord.com__channels_@me-Default$ "station-launch-webapp https://discord.com/channels/@me"'
end
end, 'Toggle comms workspace')
bind('SUPER + X', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'monitor')
end, 'Toggle monitor workspace')
+11 -9
View File
@@ -85,24 +85,26 @@ hl.on('config.reloaded', setup_monitors)
hl.bind('switch:off:Lid Switch', setup_monitors) hl.bind('switch:off:Lid Switch', setup_monitors)
hl.bind('switch:on:Lid Switch', setup_monitors) hl.bind('switch:on:Lid Switch', setup_monitors)
function set_laptop_workspace_to_monocle() local function set_laptop_workspaces_to_monocle()
local workspace = get_active_workspace() local workspaces = hl.get_workspaces()
if not workspace then for i = 1, #workspaces do
return local workspace = workspaces[i]
end if
workspace.monitor
if is_laptop_screen_focused() then and workspace.monitor.description == LAPTOP_MONITOR_NAME
then
hl.workspace_rule { hl.workspace_rule {
workspace = 'name:' .. tostring(workspace.name), workspace = 'name:' .. tostring(workspace.name),
layout = 'monocle', layout = 'monocle',
} }
end end
end
end end
hl.on('monitor.focused', set_laptop_workspace_to_monocle) hl.on('monitor.focused', set_laptop_workspaces_to_monocle)
hl.on('config.reloaded', set_laptop_workspace_to_monocle) hl.on('config.reloaded', set_laptop_workspaces_to_monocle)
hl.on('window.open', function() hl.on('window.open', function()
local windows = hl.get_windows() local windows = hl.get_windows()