From 982d46b461fda0ba974bb610806148c551478d6a Mon Sep 17 00:00:00 2001 From: Yessiest Date: Wed, 19 Jan 2022 14:36:40 +0400 Subject: [PATCH] removed abandoned widget --- widgets/stickers/image.lua | 68 -------------------------------------- widgets/stickers/init.lua | 54 ------------------------------ 2 files changed, 122 deletions(-) delete mode 100644 widgets/stickers/image.lua delete mode 100644 widgets/stickers/init.lua diff --git a/widgets/stickers/image.lua b/widgets/stickers/image.lua deleted file mode 100644 index 8078856..0000000 --- a/widgets/stickers/image.lua +++ /dev/null @@ -1,68 +0,0 @@ -local awful = require("awful") -local gears = require("gears") -local wibox = require("wibox") - -local function start_moving(widget) - local mouse_coords = mouse.coords() - local offset_x = widget.x - mouse_coords.x - local offset_y = widget.y - mouse_coords.y - if not mousegrabber.isrunning() then - mousegrabber.run(function(coords) - widget.x = coords.x + offset_x - widget.y = coords.y + offset_y - return coords.buttons[3] - end,"plus") - end -end - -return function(args) - local args = args or {} - local container_settings = { - screen = s, - bg = "#00000000", - visible = true, - type = "desktop", - height = args.height or 64, - width = args.width or 64, - x = args.x or 40, - y = args.y or 40 - } - - local widget = wibox.widget { - { - image = args.image, - resize = true, - widget = wibox.widget.imagebox, - id = "imagebox" - }, - widget = wibox.widget.background, - layout = wibox.layout.fixed.vertical - } - container = wibox(container_settings) - widget:get_children_by_id("imagebox")[1]:connect_signal("button::press", - function(self,x,y,button) - if button == 1 then - awful.spawn(args.command) - elseif button == 3 then - start_moving(container) - elseif button == 4 then - container.height = container.height / 0.9 - container.width = container.width / 0.9 - elseif button == 5 then - container.height = container.height * 0.9 - container.width = container.width * 0.9 - end - end) - widget:get_children_by_id("imagebox")[1]:connect_signal("button::release", - function() - if mousegrabber.isrunning() then - mousegrabber.stop() - end - args.x = container.x - args.y = container.y - args.width = container.width - args.height = container.height - end) - container:set_widget(widget) - return container -end diff --git a/widgets/stickers/init.lua b/widgets/stickers/init.lua deleted file mode 100644 index a71c141..0000000 --- a/widgets/stickers/init.lua +++ /dev/null @@ -1,54 +0,0 @@ -local dkjson = require("dkjson") -local handler = io.open(global.config_dir.."stickers.json","r") -local stickers = {} -local objects = {} -if handler then - stickers = dkjson.decode(handler:read("*a") or "[]") or {} -end -local image = require("widgets.stickers.image") -return function(s) - objects.image = objects.image or {} - for id, args in pairs(stickers.image or {}) do - s["sticker_image"..tostring(args.id)] = image(args) - objects[args.type][args.id] = s["sticker_image"..tostring(args.id)] - end - awesome.connect_signal("stickers::add",function(x,y,h,w,cmd,t,arg) - if t == "image" then - stickers.image = stickers.image or {} - objects.image = objects.image or {} - local args = { - x = x, - y = y, - height = h, - width = w, - command = cmd, - image = arg, - type = "image", - id = #stickers.image+1 - } - table.insert(stickers.image,args) - s["sticker_image"..tostring(#stickers.image)] = image(args) - objects.image[#stickers.image] = s["sticker_image"..tostring(#stickers.image)] - end - end) - awesome.connect_signal("stickers::remove",function(type,id) - if stickes[type] and stickers[type][id] then - stickers[type][id] = nil - objects[type][id] = nil - end - s["sticker_"..tostring(type)..tostring(id)] = nil - end) - awesome.connect_signal("stickers::save",function() - for type, obj_list in pairs(objects) do - for id, obj in pairs(obj_list) do - stickers[type][id].x = obj.x - stickers[type][id].y = obj.y - stickers[type][id].width = obj.width - stickers[type][id].height = obj.height - end - end - local handler = io.open(global.config_dir.."stickers.json","w") - handler:write(dkjson.encode(stickers) or "") - handler:close() - end) -end