LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-10-2018, 11:46 PM   #1
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled
How to find the active tag in vanilla dwm-6.1?


There was a patch for an older version of dwm https://dwm.suckless.org/patches/current_desktop/ , but I want to stick to vanilla dwm-6.1 and I'm looking for a way to find out the active tag from a script.

Is there any trivial keylogging software that could write something to a file everytime Alt-[1-9] is pressed?

Any other suggestions?
 
Old 07-11-2018, 06:27 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
maybe it's possible to query dwm itself for the desired data, then update the root window properties accordingly?
for that, a small self-made daemon (just a shell script) would be enough.

does dwm 6.1 update the root window's properties at all? if so, how?

what exactly do you want to achieve?

fwiw, i don't think keylogging is the best approach here.
i also don't see any reason not to use this patch (it can be checked against the current version; maybe it doesn't even require any modification at all).
 
Old 07-11-2018, 10:11 AM   #3
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
maybe it's possible to query dwm itself for the desired data
I have no clue how would I do that, I can't dig up the sources of dwm, I'm not even C literate to read past simplest hello world.

Quote:
Originally Posted by ondoho View Post
does dwm 6.1 update the root window's properties at all? if so, how?
I have no clue about it. All I could do was to:

Code:
1. Hit Alt-1 to go to first tag (I still treat them as worspaces)
2. Do xprop -root > file1
3. Hit Alt-2 to go to second tag
4. Do xprop -root > file2
5. Diff file1 and file2: the only difference was in the _NET_ACTIVE_WINDOW (different window ids, nothing related to tags)
Quote:
Originally Posted by ondoho View Post
what exactly do you want to achieve?
In the example above, for KEY in [1..9], after I hit Alt-KEY (I never switch tags/workspaces with the mouse, that's why I thought about keylogging), I want to run a script and get the numeric value of KEY so I can use it in a custom status bar.

I could do it with wmctrl for the older, patched dwm version, but like I said, rather prefer to use some ugly third party hack than step aside from vanilla dwm this time.

Quote:
Originally Posted by ondoho View Post
fwiw, i don't think keylogging is the best approach here.
I never claimed it's the best approach. I even admit that the idea looks like a very ugly hack, but at least it could give me what I want in a reasonably painless way, assuming I can find some trivial keylogging software that I could set up to catch just Alt-[1-9] keypresses so it logs it to a file.


Quote:
Originally Posted by ondoho View Post
i also don't see any reason not to use this patch (it can be checked against the current version; maybe it doesn't even require any modification at all).
Main reason is that I want to stick to vanilla dwm, I don't want to resort to patches since I only need this very little thing that dwm doesn't seem to be able to do by default to make me happy. And as I mentioned above, I don't have the skills to verify the patch. Even if it would apply cleanly to 6.1 as source, I don't want to expose myself to the risk of hitting functional troubles later during usage of blindly modified software. Not to mention that if it would be a legit patch for 6.1, they could bother to update it in a few years since it was released for the older version.
 
Old 07-12-2018, 02:34 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by FlinchX View Post
I have no clue how would I do that, I can't dig up the sources of dwm, I'm not even C literate to read past simplest hello world.
i meant a running instance of dwm.
but come to think of it, i don't think dwm provides that sort of functionality.
its design concept is to be as unconfigurable and static and primitive as possible in its compiled form.
Quote:
I want to run a script and get the numeric value of KEY so I can use it in a custom status bar.
maybe you should be looking at existing custom status bars designed to work with dwm.

Quote:
I could do it with wmctrl for the older, patched dwm version, but like I said, rather prefer to use some ugly third party hack than step aside from vanilla dwm this time.
this doesn't make sense.
dwm is meant to be hacked.

Quote:
And as I mentioned above, I don't have the skills to verify the patch. Even if it would apply cleanly to 6.1 as source, I don't want to expose myself to the risk of hitting functional troubles later during usage of blindly modified software.
it's a simple patch; you can see what it does (even i can see it and i don't know C at all), and it should be simple enough to check against current dwm.c.
i'll say it again: dwm is meant to be hacked - here's a quote from suckless.org:
Quote:
dwm is customized through editing its source code, which makes it extremely fast and secure - it does not process any input data which isn’t known at compile time, except window titles and status text read from the root window’s name. You don’t have to learn Lua/sh/ruby or some weird configuration file format (like X resource files), beside C, to customize it for your needs: you only have to learn C (at least in order to edit the header file).
Because dwm is customized through editing its source code, it’s pointless to make binary packages of it. This keeps its userbase small and elitist. No novices asking stupid questions.
i know, it's harsh. i don't like it either, but there it is.
i don't use dwm.
 
Old 07-21-2018, 05:21 AM   #5
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
I settled for manually merging the current_desktop patch into dwm and recompiling. Seems to work
 
Old 08-01-2018, 03:59 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
well done!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Need to find all contents of XML tag if certain parameter value match addy54 Programming 2 05-06-2016 06:41 AM
DWM - tag issue Novartum Linux - Desktop 0 03-30-2011 07:28 PM
how to find the end tag in xml file. mariakumar Linux - General 1 12-21-2010 10:12 AM
How to find the tag value in xml file through unix shell script hussain.s Linux - General 2 11-03-2010 07:52 AM
find an TAG in a file and specify a parm mcandy_123 Programming 2 01-17-2008 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration