Skip to content

Commit

Permalink
Fixed several bugs, including tab deletion bug and a few logic flaws.
Browse files Browse the repository at this point in the history
Logic has numerous oversights. Bugs fixed, code cleaned up and shortened.
  • Loading branch information
LycanDarko666 authored and SaintRyoh committed Jun 30, 2024
1 parent 0a18cac commit a2d7dd3
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions rabbithole/components/widgets/taglist/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,21 @@ function TaglistController:create_tag_callback(tag_template, tag, index, objects
if tag.selected then
animation.target = 1
-- Highlight the tag on its own screen
for _, screen in ipairs(tag.screen.outputs) do
if screen == self.screen then
tag_template.bg = self.colors.blend_colors(beautiful.bg_normal, beautiful.bg_focus, 1)
if tag.screen then
for _, screen in ipairs(tag.screen.outputs) do
if screen == self.screen then
tag_template.bg = self.colors.blend_colors(beautiful.bg_normal, beautiful.bg_focus, 1)
end
end
end
else
animation.target = 0
-- Reset the tag color on its own screen
for _, screen in ipairs(tag.screen.outputs) do
if screen == self.screen then
tag_template.bg = self.colors.blend_colors(beautiful.bg_normal, beautiful.bg_focus, 0)
if tag.screen then
for _, screen in ipairs(tag.screen.outputs) do
if screen == self.screen then
tag_template.bg = self.colors.blend_colors(beautiful.bg_normal, beautiful.bg_focus, 0)
end
end
end
end
Expand Down Expand Up @@ -185,22 +189,10 @@ function TaglistController:create_tag_callback(tag_template, tag, index, objects
self.hovered_tag = nil -- clear the hovered tag so the mouse doesnt act weird
end)

tag_template:connect_signal('button::press', function()
-- When the tag is pressed, only update if it's not the currently selected tag
if not tag.selected then
animation.target = 1
end
end)

tag_template:connect_signal('button::release', function()
-- After the button is released, update the tags to their correct colors
if tag.selected then
animation.target = 1
else
animation.target = 0
end

self.dragndrop:drop(self.hovered_tag)
tag:connect_signal('tag::deleted', function()
-- Handle cleanup if necessary
hover_timer:stop()
animation.target = 0
end)
end

Expand Down

0 comments on commit a2d7dd3

Please sign in to comment.