LinArcX / wmenu

A dmenu clone for windows operating system written with pure win32 API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wmenu

A dmenu clone for the Windows operating system written in pure win32 API.

why?

wmenu is a hybrid GUI/terminal application inspired by dmenu. There are some reasons that i started to develop this software:

  • I missed my linux workflow.

    When I met dmenu for the first time, I said to myself: "This simple tool can change your workflow completely", And surprisingly it did! I started to use dmenu to automate almost everything in my machine. From searching through applications, managing software(installing/deleting/updating), running custom scripts, browsing through my favorite directories, playing music, etc...

    But the problem is that dmenu uses Xlib under the hood which is not available on Windows. There are some hacky ways like compiling dmenu using Cygwin, but.. no. I didn't like those ways.

    So I started from scratch to clone dmenu using win32 API, without any emulation. This is how wmenu was born :)

  • To notify myself and others that we are the ones who should control the computers, not the opposite.

    We can feel that with the rise of AI + Cloud Computing, we'll no longer understand what's happening inside our machines.

  • To show you how we can create a simple and minimal c/win32 application without using visual studio. without using trendy/bubbly ideas like clean code, design patters, etc..

    You just need a set of fucking simple tools: shell/editor/compiler/debugger. And those are enough for you and me. :)

  • To encourage people to challenge their habits. (even if you are a programmer or not.)

    Microsoft tried so hard during the last years (And they are trying more than before) to force people to use Windows in a specific way. They pay huge amounts of money to engineers to create a palace!(default environment) At the end, you will become a good user(follower!) But man! it's the computer world. No one can tell you HOW you can use your computer.

code of conduct

Previously i was using c++, design patterns and following uncle Bob's Clean Code for wmenu. After a lot of experiences, i realized that a source-code can be call clean when:

  • it's written in a simplest form even a noob can read and rationalize about it's structure and intention easily.
  • we don't overcomplicate things.
    • smart solutions sometimes lead to add more complexities. so: KISS.
  • you can debug your code more easily.

shots

Application launcher: application_launcher

Jump to favorite directories: jump_to_favorite_dirs

PowerManager: power_manager

build/debug/run

p.bat

if you prefer minimal environment and independent tools like me, and don't want to rely on visual studio for building/debugging, please download and install:

  • fzf
  • windgb
  • Build Tools for Visual Studio 2022.

I provide a batch script called: p.bat that is using fzf and p.txt to make a menu for you in cmd. After run it, you can choose to:

  • build
  • debug
  • clean
  • run

Troubleshooting

Error: VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ** error VsDev.cmd

Open regedit and go to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor Change: Autorun = "cls" To: Autorun = ""

Visual Studio

  • If you prefer visual studio, you can just download visual studio and open .sln in the root of the project with it.
    • All the debugging/building/cleaning the project will be happen inside this magic box.

How it works?

wmenu as it's core is a "GUI echo" utility. If you pass a list of items to it via: -elements option, wmenu shows you a ComboBox and and you're able to select one of them. After that, it echos back that item on your terminal. If you omit -elements, wmenu starts acting like a GUI TextBox. Now you can type something and by pressing ENTER, it will echo the content of TextBox on the screen.

Since wmenu uses the WINDOWS subsystem when compiling, you can't use stdout directly.

So you should pipe it with more command:

wmenu.exe -elements "wmenu,dmenu,dwm" | more

Or if you want to use a specific delimiter:

wmenu.exe -element-delimiter ":" -elements "wmenu:dmenu:dwm" | more

For more information about how using wmenu: wmenu.exe -help | more

Now let's create a file called apps.bat and paste these lines into it:

@echo off
start /B wmenu.exe -elements "notepad;explorer;paint;" | more > %temp%/apps.txt

for /f "tokens=*" %%s in (%temp%\apps.txt) do (
  if "%%s"=="notepad" ( start %%s)
  else if "%%s"=="explorer" ( start %%s )
  else if "%%s"=="paint" ( start mspaint )
  else ( REM default case...)
)

del "%temp%\apps.txt"

You can use clavier+ to bind it to a key. As i said, i use wmenu for almost anything. Enjoy hacking your workflow :)

License

License

About

A dmenu clone for windows operating system written with pure win32 API.

License:GNU General Public License v3.0


Languages

Language:C++ 96.2%Language:Batchfile 3.8%