Skip to content
  • Wiki
  • About Us
  • Rules
  • Categories
  • 0 Unread 0
  • Recent
  • Tags
  • Users
  • Groups
  • Into The Fediverse
  • Chats
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Spacelab)
  • No Skin
Collapse
Brand Logo

UnfinishedProjects

Lemmy/Piefed Mastodon Codeberg

Global Moderators

Private

Forum wide moderators

Posts


  • [www-gem] A tinkerer
    www-gemW www-gem

    Hey everyone!

    I’m a lifelong tinkerer who’s been running Arch Linux for about 25 years now. I’m a big FOSS advocate and feel most at home in the terminal. If there’s a CLI tool for it, I probably prefer it.
    I try to not be opinionated and always go by “the Linux community highest power is to offer a tool for everyone’s needs”. There’s no such thing like a best tool or distro.

    I spend a lot of time writing small scripts in Python and Bash to automate the boring stuff, and I have a mild (okay, not mild) obsession with tweaking dotfiles and config files. Over the years I’ve hopped through window managers like Awesomewm, i3, and Sway on X11, and I’m currently running Niri on Wayland.

    I also keep a blog where I write about overlooked CLI tools that deserve more love.

    Outside the terminal, I’m into 3D printing for 6 years now, long-distance trail running (because debugging scripts isn’t enough suffering), and home automation (HomeAssistant).
    I had a discussion with a friend recently that made me realize that there’s nothing I don’t tweak in my life 😄

    Looking forward to learning, sharing, and swapping tips with fellow tinkerers! I’d be happy to help with any unfinished projects you’ve got. I mostly throw out wild ideas, but every now and then, one of them actually works 🙂

    PS: I’m also one of the two moderators who have helped @Anthony with this project, so I’d love to see it being successful. That doesn’t mean becoming the cool kid around the blog, but rather to see it recapturing the old Internet vibe I’ve been missing where people come together to build something collaboratively.

    Introductions

  • [Seeking] Converting a script to a Neovim plugin
    www-gemW www-gem

    Thanks for taking the time to stop by and the kind words. Neovim really does everything it can to come across as unfriendly to new users, which is frustrating given how powerful it can be for improving your workflow 😞 I’ve tried getting others to use it, but it typically takes a couple of hours just to learn the basics, and then consistent use before it starts to feel natural. That’s too much involvement in today’s world.

    Are you planning on sharing any of your own projects here?

    Skill Exchange

  • [Seeking] Converting a script to a Neovim plugin
    www-gemW www-gem

    Seeked skill

    If you know how to build a Neovim plugin and allow for custom user keybinding, we can be friend 🙂

    The project

    Few months ago, I decided to build something that would allow one to stay in Neovim while interacting with Taskwarrior. I didn’t want to reinvent Taskwarrior so I went with a simple script limited to my needs. After sharing it online, some people showed interest in this tool. As a result, I’ve added few features, but the remaining issue is to convert this script as a real Neovim plugin.

    The features

    • Create/edit/update a task: Type #TW some text and use the default keybinding <leader>ta to create a task with some text as description, and add a task annotation in the form of “+line filepath” so you can easily access this task’s line from Taskwarrior.
      The script will recognize the #TW pattern and ask for a project name, start and due date, and tags for this task. By default, the due date is set to start+1h to fit my specific needs, but you can change that by editing line 90.
      All these fields are optional. The task will be added to Taskwarrior, and the task UUID will be appended to the line which will be commented.

    • Delete a task: Using the default <leader>td keybinding will delete the current line if it has a valid task UUID and remove the task in Taskwarrior. In the background, it will also add task’ annotations to all tasks below the current line.

    • Undo actions: Revert the last delete action with the default <leader>tu keybinding.

    • Retrieve task info summary: With the default <leader>ti keybinding, can call a notification window that will show you a summary of the task info.

    • Mark task as completed: Can be done using <leader>tc keybinding.

    The missing steps

    I’ve never built a real Neovim plugin. and this project was designed to be one more script to my collection. Hence, there are two issues remaining to be solved to convert this idea to a plugin:

    1. Create a correct git structure to allow for pulling by Neovim plugin managers.
    2. Allow for users to customize the keybindings.

    The current script

    local M = {}
    -- Default
    M.keybindings.keybindings = {
    	create_or_update_task = "<leader>ta",
    	task_delete = "<leader>td",
    	task_undo = "<leader>tu",
    	task_info = "<leader>ti",
    }
    
    -- Function to allow users to define their own keybindings
    function M.setup(custom_keybindings)
    	-- Merge custom keybindings with the default ones
    	if custom_keybindings then
    		for action, key in pairs(custom_keybindings) do
    			if M.keybindings[action] then
    				M.keybindings[action] = key
    			end
    		end
    	end
    
    	-- Rebind the keys based on the defined keybindings
    	vim.keymap.set("n", M.keybindings.create_or_update_task, function()
    		M.create_or_update_task()
    	end)
    
    	vim.keymap.set("n", M.keybindings.task_delete, function()
    		M.task_delete()
    	end)
    
    	vim.keymap.set("n", M.keybindings.task_undo, function()
    		M.task_undo()
    	end)
    
    	vim.keymap.set("n", M.keybindings.task_info, function()
    		M.task_info()
    	end)
    end
    
    -- Annotation update function
    function M.annotation_update(line_nb)
    	if line_nb == 0 then
    		line_nb = vim.fn.line(".")
    	end
    	local total_lines = vim.api.nvim_buf_line_count(0)
    
    	for line = line_nb, total_lines do
    		local current_line = vim.fn.getline(line)
    		local task_id = string.match(current_line, "UUID: ([%w-]+)")
    		local annot_line_cmd = string.format("task %s export | jq '.[].annotations.[-1].description'", task_id)
    		local annot = vim.fn.system(annot_line_cmd)
    		local annot_line = string.match(annot, "+(%d+)")
    		annot_line = tonumber(annot_line)
    
    		if annot ~= "" and annot_line ~= line then
    			local file_path = vim.fn.expand("%:p")
    			local annotation = string.format("+%s %s", line, vim.fn.shellescape(file_path))
    			local annotate_cmd = string.format('task %s annotate "%s"', task_id, annotation)
    			vim.fn.system(annotate_cmd)
    			vim.notify("Annotation(s) updated")
    		elseif task_id and annot == "" then
    			vim.notify("Can't find UUID on line " .. line)
    		end
    	end
    end
    
    -- Create or update task
    function M.create_or_update_task()
    	local current_line = vim.fn.getline(".")
    	local file_path = vim.fn.expand("%:p") -- Get full path of current file
    	local line_number = vim.fn.line(".") -- Get current line number
    
    	-- Ask for parameters
    	local task_tag = ""
    	local start = vim.fn.input("Start date (MMDDYYHH:MM): ")
    	local due = vim.fn.input("Due date (default: start+1h): ")
    	local project = vim.fn.input("Project name: ")
    	local has_note = false
    	local additional_tags_input = vim.fn.input("Tags (separated by spaces): ")
    	local additional_tags = {}
    
    	-- Keywords to look for
    	local keywords = { "#TW" }
    
    	for _, keyword in ipairs(keywords) do
    		local kw_start_index, kw_end_index = string.find(current_line, keyword)
    		-- Check line validity
    		if not kw_start_index then
    			vim.notify("No valid keyword found")
    		else
    			local id_keyword = ":: UUID:"
    			local task_id = string.match(current_line, "UUID: ([%w-]+)")
    			local id_start_index = string.find(current_line, id_keyword)
    			local task_cmd
    
    			if task_id then
    				local task_description = string.sub(current_line, kw_end_index + 2, id_start_index - 2)
    				task_cmd = string.format('task %s mod %s "%s"', task_id, task_tag, task_description)
    			else
    				local task_description = string.sub(current_line, kw_end_index + 1)
    				task_cmd = string.format('task add %s "%s"', task_tag, task_description)
    			end
    
    			-- Add additional tags if available
    			for tag in additional_tags_input:gmatch("%S+") do
    				table.insert(additional_tags, "+" .. tag)
    				if string.match(tag, "note") then
    					has_note = true
    				end
    			end
    
    			if #additional_tags > 0 then
    				task_cmd = task_cmd .. " " .. table.concat(additional_tags, " ")
    			end
    
    			-- Add project if available
    			if #project > 0 then
    				task_cmd = task_cmd .. " project:" .. project
    			elseif project == " " then
    				task_cmd = task_cmd .. " project:"
    			end
    
    			-- Add start date if available
    			if #start > 0 then
    				task_cmd = task_cmd .. " start:" .. start
    			end
    
    			-- Add due date if available and tag is not note
    			if #due > 0 and not has_note then
    				task_cmd = task_cmd .. " due:" .. due
    			elseif has_note then
    				task_cmd = task_cmd .. " due:"
    			elseif due == " " then
    				task_cmd = task_cmd .. " due:"
    			else
    				task_cmd = task_cmd .. " due:start+1h"
    			end
    
    			-- Execute the task add command
    			local output = vim.fn.system(task_cmd)
    
    			-- Task update notification
    			local task_id = string.match(current_line, "UUID: ([%w-]+)")
    			if task_id then
    				vim.notify("Task updated")
    			end
    
    			-- Add annotation to new task
    			local new_task_id = string.match(output, "Created task (%d+)%.")
    			if new_task_id then
    				local tasks_number_cmd = "task count status=pending"
    				local tasks_number = vim.fn.system(tasks_number_cmd)
    				tasks_number = tasks_number:gsub("%s+$", "")
    				local new_task_id_cmd = string.format("task %s export | jq '.[].uuid' | sed 's/\"//g'", tasks_number)
    				new_task_id = vim.fn.system(new_task_id_cmd)
    				new_task_id = new_task_id:gsub("%s+$", "")
    
    				-- Annotate task with filename and line number
    				local annotation = string.format("+%s %s", line_number, vim.fn.shellescape(file_path))
    				local annotate_cmd = string.format('task %s annotate "%s"', new_task_id, annotation)
    				vim.fn.system(annotate_cmd)
    				vim.notify("Task created")
    
    				-- Add UUID to line
    				local line_id = current_line .. " :: UUID: " .. new_task_id
    				vim.fn.setline(".", line_id)
    
    				-- Comment the line
    				vim.api.nvim_command("normal! gcc")
    			elseif not task_id then
    				vim.notify("Failed to extract task ID")
    			end
    
    			-- Update annotation on line change
    			M.annotation_update(0)
    		end
    	end
    end
    
    -- Task delete function
    function M.task_delete()
    	local current_line = vim.fn.getline(".")
    	local task_id = string.match(current_line, "UUID: ([%w-]+)")
    	local status_cmd = string.format("task %s export | jq '.[].status' | sed 's/\"//g'", task_id)
    
    	if task_id then
    		local delete_cmd = string.format("task rc.confirmation=off del %s", task_id)
    		vim.fn.system(delete_cmd)
    		vim.notify("Task " .. task_id .. " deleted")
    		vim.api.nvim_command("normal! dd")
    		M.annotation_update(0)
    	else
    		vim.notify("Can't find UUID task")
    	end
    end
    
    function M.task_complete()
    	local current_line = vim.fn.getline(".")
    	local task_id = string.match(current_line, "UUID: ([%w-]+)")
    
    	if task_id then
    		local complete_cmd = string.format("task %s mod status:completed", task_id)
    		vim.fn.system(complete_cmd)
    		vim.notify("Task " .. task_id .. " completed")
    		M.annotation_update(0)
    	else
    		vim.notify("Can't find UUID task")
    	end
    end
    
    -- Undo function
    function M.task_undo()
    	local undo_cmd = string.format("task rc.confirmation=off undo")
    	local undo_output = vim.fn.system(undo_cmd)
    	vim.cmd("undo")
    	vim.notify("Undo output: ", undo_output)
    end
    
    -- Task info function
    function M.task_info()
    	local current_line = vim.fn.getline(".")
    	local task_id = string.match(current_line, "UUID: ([%w-]+)")
    	local info_cmd = string.format("task %s info | head -n 12", task_id)
    	local info = vim.fn.system(info_cmd)
    	vim.notify(info)
    end
    
    return M
    
    Skill Exchange

  • Testing Custom tags
    A alectronic

    I think it is best not to create a custom tag per project because the tags will continue to grow indefinitely making searching tags difficult to search. The forum’s search function already fills this role in my opinion.

    Testing

  • Poll Test: Fruit
    A alectronic

    If you all don’t like apples we can not be friends.

    Testing

  • Hexmeister (CC0) [Boardgame]
    A alectronic

    I purposely put them in clusters so that they are eaiser to find, just like Sequence does. I guess it is still possible to rotate the the grid in 60 degrees and maintain the clusters, and clusters can also swap position between each other.

    One thing I really want to try is the 3 team game, the 1v1 game can get crowded fast and the 3 team game will be only worse leading to draws. The solutions on mind are:

    • Increasing the cards pers hand
    • Once a player plays a six they can place another card in their turn
    • Once a player plays a six they add/remove another piece wherever
    • Once a player plays a six they can activate yellow hexagons for their team or deactivate other team’s hexagons.
    • Sixes could have other powers like seeing opponents hand and swapping a card of choice.

    It would be would to test them and assign them to different game modes. And finally decide whether to keep the one game mode or several.

    Project Showcase active cc0

  • Hexmeister (CC0) [Boardgame]
    A alectronic

    This is the svg of the board. For a platform like playingcards.io I think it is better that the coordinate labels have one direction, I will upload one soon. Come to think of it, if I get to make the game work online (on a platform of some sort), it would be cool that the players could orientate the board as they wish and that the coordinates rotated with them along some other crazy stuff. I also have some ideas for the design of the cards but at the moment it is just day dreaming and I should probably contact an artist for that.

    The colors are not the best I just chose default colors on Inkscape. Any theming ideas are welcome, personally I will try to come up with medieval-like colors.

    hexmeixter_one.svg

    I already have some idea of the logo for the game, I had it done for an old version game with an 11x11 trapezoid shape and where jokers are actually wildcards (to add/remove anywhere).

    hexmeister-copy.pdf

    The pdf is all messed up, and it does not matter at the moment since I want to use and OFL font similar to the one there and remake the logo.

    As for other game mechanic improvements, it could be possible that the board gets choked up quickly and even more so with three teams playing. I have some ideas of re-arranging the hexagons, with the only condition that the board has to have rotational symmetry so that the board is equal for every team.

    Anyway, thank you very much for playing the game, I’m glad you enjoyed it.

    Project Showcase active cc0

  • Markdown
    A alectronic

    You missed some “suffix” dots for some.

    1. first
    69. second
        1. second first
        58008. second second
    420. easy peasy lemon squeezy
    

    Hmm, it seems I forgot that the first ordered list item number must be “1”.

    1. first
    2. second
      1. second first
      2. second second
    3. easy peasy lemon squeezy
    Testing

Member List

www-gemW www-gem
A alectronic
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Wiki
  • About Us
  • Rules
  • Categories
  • Unread 0
  • Recent
  • Tags
  • Users
  • Groups
  • Into The Fediverse
  • Chats