Code Monkey home page Code Monkey logo

wmenu's Introduction

!! Archived: I lost interest in Windows OS, due to many factors including: 1. win32 API, 2. lack of developer-friendly tools. and many others...

msys2+scoop was my latest attempt to make a living in Windows more comfortable. but still, it was terrible. You can find all my efforts here: https://github.com/LinArcX/winconf

And if anyone is interested, he/she can fork this repo! but I strongly recommend you switch to a better OS!

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

Debugging

You can use winDbg for debugging wmenu. eigher install Windows Driver Kit(WDK) or newer winDbg alone.

  • Not forget to add the executable of winDbg to your PATh environment variable, since p.bat will use it.
  • If you are on windows 10, you need to be sure that you have: Windows 10 Anniversary Update (version 1607) or newer. you can install it with choco: choco install windows-10-update-assistant --version=1.4.9200.22175

Then just run p.bat and select debug option.

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

wmenu's People

Contributors

linarcx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wmenu's Issues

Screenshots

Use wmenu:

  1. As a application launcher:
    application_launcher

  2. As a tool to jump to favorite directories:
    jump_to_favorite_directory

  3. As power-manager:
    power_manager

Adding a delimiter for elements

Hi can I add a feature where you can use any character for a delimiter for parsing options aside from using ";"? Even though it is okay for options without any symbols but it is not ideal for some strings that may contains it. It even parses using \n just like how dmenu works originally. You specify the delimiter by using the -element-delimiter.

Examples:

When using \n:
image
image
image

When using ;:
image
image
image

When using ,:
image
image
image

When using a space:
image
image
image

and if -element-delimiter is not specified, it uses a default delimiter.

Note: \n does not work in cmd or in batch scripts and it only works in other shells like powershell or in WSL according to my tests so far.

Center wmenu

Hey there, thanks for the tool

Is there is anyway to center wmenu in the middle with a fixed width ?

Please enable github sponsors

Hey man thanks for this! Your tool saves me a lot of time to a point where I feel guilty to use it for free. Please enable github sponsors so I can pay you.

when i type and then enter the output is not printing

set dirs=C:,Home,.ssh,LocalAppData,.emacs.d,nvim,lf,mpv,Clavier.ini,Downloads,D:,algoworks,wmenu,vivre,languages,video(D:),proramming(books),E:,video(E:),ConnectToPhone(Ftp)
start /B wmenu.exe -elements "%dirs%" -prompt "Directories: " -fontName "Cascadia Code" -fontSize 8 -caseInsensitive -lineNumber 8 | more > %temp%/dirs.txt

for eg. if i type algo. The list displays algoworks. When i select and press enter it does not display output.

-lineNumber Option does not work

Hey nice project, finally a dmenu-like program for windows :)

The -lineNumber Option does not seem to work for me.

Running wmenu -elements "one,two,three,four,five,six,seven,eight,nine,ten" everything works as expected:
grafik

If i add -lineNumber 4 to the previous line no elements show up:
grafik

(The more i increase the fontSize the less elements appear, e.g.:)
wmenu -elements "one,two,three,four,five,six,seven,eight,nine,ten" -fontName Arial -fontSize 14
grafik

How do I build this?

I didn't find any binaries, so I assume we need to build this ourselves?

I ran into problems building with VS 2022. Are there any build instructions?

Have the first item in the list be highlighted by default

Currently in wmenu to select an item from the list, you need to first use the arrow keys to highlight what you need, then press Enter to select that item.
Most of the time (after filtering) the needed item is the first one. If the first item were highlighted by default, the arrow key press would be unnecessary.
That way you just search for an item and hit Enter to select it.
It would be nice if this were the default behavior or an option that could be passed. This is the default behavior in fzf.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.