You are not logged in.

#151 2012-01-28 17:59:12

bootleg
Member
Registered: 2010-12-08
Posts: 38

Re: herbstluftwm

With 'focus_follows_mouse' unset, if I click on a window, the focus doesn't change.
None of your conditions matches, and I tried with all apps I could (urxvt, luakit, gimp, ...). I don't think I have any proprietary app hmm
The weird thing is mouse following works like a charm ...

Thanks.

Offline

#152 2012-01-28 19:06:29

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

bootleg wrote:

With 'focus_follows_mouse' unset, if I click on a window, the focus doesn't change.
None of your conditions matches, and I tried with all apps I could (urxvt, luakit, gimp, ...). I don't think I have any proprietary app hmm
The weird thing is mouse following works like a charm ...

The Problem is that handling clicks is different from handling mouse motion. I still guess that it is the same problem as the one caused by the things mentioned above. It's just caused by something else. (I don't have any problems using urxvt, luakit and gimp). I will try to fix the known problem, then maybe your issue also is fixed.

By the way: does the behaviour change if you enable or disable NumLock? (This was a problem once)

Offline

#153 2012-01-28 19:21:16

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: herbstluftwm

thorsten wrote:
kcirick wrote:

In floating mode, when you resize ($mod+right click in default) it anchors the client in the center and resizes in all directions. This is kind of annoying in practice... Is it possible to modify it so that it only resizes in the direction of the nearest corner where the mouse is.

It's just a matter of configuration. Replace the mousebind-block in your autostart by this:

# mouse
hc mouseunbind
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize

Hi... I don't think I explained myself clear... What I mean is when I resize a window (in stacking mode), the window grows/shrinks in all directions when I drag the mouse. I only want it to grow in one direction (if the mouse is at lower right corner, then I want the window to grow only in that direction)

Offline

#154 2012-01-28 19:31:54

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: herbstluftwm

^ the resize command is what you want here. If you don't believe me or thorsten, try resizing a window in stacking mode, but press the middle mouse-button instead of the left.

Offline

#155 2012-01-28 19:42:20

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

kcirick wrote:
thorsten wrote:
kcirick wrote:

In floating mode, when you resize ($mod+right click in default) it anchors the client in the center and resizes in all directions. This is kind of annoying in practice... Is it possible to modify it so that it only resizes in the direction of the nearest corner where the mouse is.

It's just a matter of configuration. Replace the mousebind-block in your autostart by this:

# mouse
hc mouseunbind
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize

Hi... I don't think I explained myself clear... What I mean is when I resize a window (in stacking mode), the window grows/shrinks in all directions when I drag the mouse. I only want it to grow in one direction (if the mouse is at lower right corner, then I want the window to grow only in that direction)

I think I understood you quite clear. So you resize with $Mod- Rightclick? If you add the code i gave you to your autostart, then hlwm behaves as follows:
If you press $Mod and the right mouse button, then the current window is resized like in the most window managers (openbox, kwin, ...).

Last edited by thorsten (2012-01-28 19:42:58)

Offline

#156 2012-01-28 19:42:49

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: herbstluftwm

Ugh... I feel stupid now

@thorsten Sorry, I was only misinterpreted what you said. Works great. Thanks for your help

Offline

#157 2012-01-28 23:40:43

bootleg
Member
Registered: 2010-12-08
Posts: 38

Re: herbstluftwm

thorsten wrote:

By the way: does the behaviour change if you enable or disable NumLock? (This was a problem once)

Yes it works without NumLock!

Offline

#158 2012-01-29 18:23:51

guelfi
Member
From: /home/guelfi
Registered: 2011-07-01
Posts: 111

Re: herbstluftwm

I already posted in this topic because I seperated my config handling the
layouts from the autostart so I could add layouts and their configs on-the-fly.
Now, I took it a step further: I created this little bash script, herbstlayout,
which, well, manages layouts. It can be used with command line arguments or a
(pseudo-)interactive dmenu interface and features loading layouts, saving them
to a file as well as an improved way for removing tags. See the comments for
further explanations.

#!/bin/bash
# herbstlayout - loads layouts for herbstluftwm, optionally with dmenu
#
# Requires a folder ($layouts_path) which contains one file for each layout.
# Each of these are bash-syntax files containing
#	- $layout, a variable holding the layout in "herbstclient dump"-format.
#	- autostart() (optional), a function executed when loading the layout
# 
# General syntax is "herbstlayout <COMMAND> <LAYOUTFILE>".
# Available commands:
#	- load: apply $layout to the current tag, and executes 
#	        autostart()
#	- reload: same as load, but uses the tag named LAYOUTFILE, not the current
# 	- add: creates a tag named LAYOUTFILE, binds it to $mod-(Shift-)N
#	       (where N is the greatest digit available), an loads it.
# Without arguments, it launches dmenu and asks for them.

# customize these variables
layouts_path=${layouts_path:-$XDG_CONFIG_HOME/herbstluftwm/layouts}
mod=Mod4
dmenu_cmd=${dmenu_cmd:-dmenu}

# do the actual loading (source the file, apply layout and execute autostart)
function load() {
	source "$layouts_path/$1"
	if ! herbstclient load "$2" "$layout" ; then
		echo "$0: applying layout $1 failed!" >&2
		exit 1
	fi
	autostart
}

# handle the action reported by dmenu ($1 -> command, $2 -> tag)
function action() {
	case $1 in
		# add tag with keybinding and load layout there
		add)
			if [[ ! -r $layouts_path/$2 ]] ; then
				echo "$0: could not find layout \"$2\"\!" >&2
				exit 1
			fi
			if herbstclient tag_status | grep "$2" >/dev/null ; then
				echo "$0: tag $2 already exists, use \"reload\" or \"load\"!" >&2
				exit 1
			fi
			herbstclient add "$2"
			tags=$(herbstclient tag_status | wc -w)
			if (( $tags > 9 )) ; then
				echo "$0: too many tags; will not get a keybinding" >&2
			else 
				herbstclient keybind "$mod-$tags" use "$2"
				herbstclient keybind "$mod-Shift-$tags" move "$2"
			fi
			load $2 $2
			herbstclient use $2
			;;
		# get current tag and load layout there
		load)
			tag=$(herbstclient tag_status | grep -oE '#[[:graph:]]*')
			load $2 ${tag:1}
			;;
		# load layout on the tag with the layout's name
		reload)
			if herbstclient tag_status | grep "$2" >/dev/null ; then
				load $2 $2
			fi	
			;;
		remove)
			tag=$(herbstclient tag_status | grep -oE '#[[:graph:]]*')

			# don't try to remove the current tag
			if [[ ${tag:1} = $2 ]] ; then

				# get the previous tag 
				prevtag=$(herbstclient tag_status \
				| grep -oE '[[:graph:]]*[[:space:]]*#' \
				| awk '{print $1}')

				# don't try remove the last tag
				if [[ -n $prevtag ]] ; then
					herbstclient use ${prevtag:1}
					herbstclient merge_tag $2 ${prevtag:1}
				fi

			else
				herbstclient merge_tag $2
			fi
			;;
		# save the current layout
		save)
			if [[ -e $layouts_path/$2 ]] ; then
				while true ; do
					reply=$(echo -e "yes\nno" \
					| $dmenu_cmd -p "$2 already exists. Overwrite?")

					case $reply in
						yes|Yes|y|Y)
							break
							;;
						no|No|n|N)
							return;
							;;
						*)
							:
							;;
					esac
				done
			fi

			# strip WINIDs from the dump
			layout=$(herbstclient dump | sed 's/ 0x[[:digit:]abcdef]*//g')
			cat > "$layouts_path/$2" <<- EOT
			#!/bin/bash
			# $layouts_path/$2
			# generated by herbstlayout
			layout='$layout'

			#function autostart() {
			# customize this as you like
			# for example, you can execute the rules for this layout here
			#}
			EOT
			;;
		*)
			echo "$0: unkown command!" >&2
			exit 1
			;;
	esac
}

# check for command line arguments
if (( $# == 2 )) ; then
	action $1 $2
	exit 0
fi

# dmenu stuff
cd "$layouts_path"
layouts=(*)
cd - >/dev/null

commands=$(cat <<- EOT
add
load
reload
remove
save
EOT
)

command=$($dmenu_cmd -p "herbstlayout " <<< "$commands")
(( $? != 0 )) && exit 125

layout=$(printf '%s\n' "${layouts[@]}" | $dmenu_cmd -p "herbstlayout $command")
(( $? != 0 )) && exit 125

action $command $layout

exit 0

For better illustration of the file format, here is my file for my "terms"-tag:

#!/bin/bash

# layout
layout='
(split horizontal:0.450000:1
  (split vertical:0.500000:0
    (split vertical:0.500000:1
	  (clients vertical:0 )
	  (clients vertical:0 ))
   	(clients horizontal:0 ))
  (split vertical:0.550000:0
    (clients vertical:0 )
   	(clients vertical:0 )))'

# autostart applications
autostart() {
	herbstclient rule instance=newsbeuter tag=terms index=000
	herbstclient rule instance=mutt tag=terms index=001
	herbstclient rule instance=irssi tag=terms index=10
	herbstclient rule instance=ncmpcpp tag=terms index=01
	herbstclient rule instance=wyrd tag=terms index=11
	pgrep newsbeuter >/dev/null || urxvtc -name newsbeuter -e newsbeuter &
	pgrep mutt >/dev/null || urxvtc -name mutt -e mutt &
	pgrep ncmpcpp >/dev/null || urxvtc -name ncmpcpp -e ncmpcpp &
	screen -ls | grep "irssi[[:space:]]*(Attached)" >/dev/null \
	|| urxvtc -name irssi -e screen -S irssi -xR irssi &
	pgrep wyrd >/dev/null || urxvtc -name wyrd -e wyrd &
}

EDIT: fixed a mistake in the script (hexadecimal letters weren't stripped
from the dump correctly)

Last edited by guelfi (2012-02-03 17:03:16)

Offline

#159 2012-02-08 01:07:48

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: herbstluftwm

Is there an option in hl where when you spawn a new client and if there is an empty frame, it will open in the empty frame, as opposed to always opening in the focused frame? musca does this and I like that better...

Offline

#160 2012-02-09 12:52:01

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

kcirick wrote:

Is there an option in hl where when you spawn a new client and if there is an empty frame, it will open in the empty frame, as opposed to always opening in the focused frame? musca does this and I like that better...

No, it is not possible yet.

Offline

#161 2012-02-10 03:02:53

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: herbstluftwm

thorsten wrote:
thorsten wrote:
bloom wrote:

Can you add a focus_changed WINID hook?

I will add it quite soon.

I added it. But it only is emited if the focus changes (and not if the window title changes). The window_title_changed hook needs some more time i currently don't have wink

Maybe it's old news now, but this has been added in the git version of the herbstluftwm. I just realized after doing my own dirty modification on the old version. It works great. For the status bar you can update the window id as follows:

  case "${cmd[0]}" in
  tag*)
     TAGS=( $(herbstclient tag_status $monitor) )
     ;;
  focus_changed|window_title_changed)
     windowtitle="${cmd[@]:2}"
     ;;
  esac

Edit: ugh.. thorsten you're too thorough! I just realized this is already in the panel.sh in the new package. Oh well, I hope what I wrote will help some lazy people who never look through the package content (like myself)

Last edited by kcirick (2012-02-10 03:13:28)

Offline

#162 2012-02-10 12:16:31

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

kcirick wrote:

Maybe it's old news now, but this has been added in the git version of the herbstluftwm. I just realized after doing my own dirty modification on the old version. It works great. For the status bar you can update the window id as follows:
[...]
Edit: [..] Oh well, I hope what I wrote will help some lazy people who never look through the package content (like myself)

I don't write here very often. But there are three ways to get informed about new features:

  • read the NEWS file in the git repository

  • read the same NEWS file on the homepage (but it's updated less often)

  • join #herbstluftwm on freenode - new features are announced there just a few seconds after they have been added

Last edited by thorsten (2012-02-10 12:17:19)

Offline

#163 2012-02-10 12:47:55

moneylcj
Member
Registered: 2011-04-07
Posts: 14

Re: herbstluftwm

when i run "zenity --info text 'focus text'" from another application (eg. xterm vifm
vim), when i click the ok button of zenity to exit, the application which
call zenity(eg. xterm vifm) will get the focus, but in herbstluftwm it's not like this.
it's oddness.

excuse me for my poor english.

Offline

#164 2012-02-10 13:35:43

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

moneylcj wrote:

when i run "zenity --info text 'focus text'" from another application (eg. xterm vifm
vim), when i click the ok button of zenity to exit, the application which
call zenity(eg. xterm vifm) will get the focus, but in herbstluftwm it's not like this.
it's oddness.

That's because zenity marks the original application window as it's "parent" (i.e. zenity sets WM_TRANSIENT_FOR). Other window managers probably focus the original window after such a dialog is closed. herbstluftwm doesn't do this, because I couldn't find a nice solution for handling dialogs (in a configurable way) yet.

Offline

#165 2012-02-10 14:21:51

moneylcj
Member
Registered: 2011-04-07
Posts: 14

Re: herbstluftwm

thorsten wrote:
moneylcj wrote:

when i run "zenity --info text 'focus text'" from another application (eg. xterm vifm
vim), when i click the ok button of zenity to exit, the application which
call zenity(eg. xterm vifm) will get the focus, but in herbstluftwm it's not like this.

That's because zenity marks the original application window as it's "parent" (i.e. zenity sets WM_TRANSIENT_FOR). Other window managers probably focus the original window after such a dialog is closed. herbstluftwm doesn't do this, because I couldn't find a nice solution for handling dialogs (in a configurable way) yet.

firefox and it's dialog has the same problem. it's so oddness. if you can fixed it in a fixed way first, then change it to configurable way in future?

Offline

#166 2012-02-10 14:51:14

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

moneylcj wrote:

firefox and it's dialog has the same problem. it's so oddness. if you can fixed it in a fixed way first, then change it to configurable way in future?

That's because it acts exactly the same way. "Fix" it? In my opinion the current behaviour isn't broken wink But i can try to implement a some ideas if i have time.

Offline

#167 2012-02-12 09:07:53

moneylcj
Member
Registered: 2011-04-07
Posts: 14

Re: herbstluftwm

If herherbstclient can bind  multi commands to one key?

Like vim uses '|' to split commands
hc keybind Mod4-Shift-r  reload | spawn notify-send "config reload"
hc keybind $Mod-h split horizontal 0.5 | emit_hook hoz_split

Offline

#168 2012-02-12 12:17:41

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

moneylcj wrote:

If herherbstclient can bind  multi commands to one key?

Like vim uses '|' to split commands
hc keybind Mod4-Shift-r  reload | spawn notify-send "config reload"
hc keybind $Mod-h split horizontal 0.5 | emit_hook hoz_split

Currently it is only possible by using a small shellscript:

hc keybind Mod4-Shift-r spawn  bash -c 'herbstclient reload ; notify-send "config reload"'
hc keybind $Mod-h spawn bash -c "herbstclient split horizontal 0.5 ; herbstclient emit_hook hoz_split"

The Problem is that introducing a mechanism to bind a key to multiple commands would cause quite ugly escaping and quoting problems. Normal shells already handle quoting and escaping => spawn a shell wink

The only solution would be something like a keybindadd:

# warning: this code does not work, it is just the result of a 1min brainstorming session:
hc keybind    Mod4-Shift-r reload
hc keybindadd Mod4-Shift-r spawn notify-send "config reload"
hc keybind    $Mod-h split horizontal 0.5
hc keybindadd $Mod-h emit_hook hoz_split

Does someone see another solution to bind multiple commands to one key?

Offline

#169 2012-02-12 14:10:14

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: herbstluftwm

I would like to be able to apply shadows (through compton) only on floating windows.

Could you add a custom window property (_HLWM_WINDOW_STATE ?) to indicate the state of the window (tiled, pseudo-tiled, floating, fullscreen, ...)?

If you can do that, I'll ask the compton developer to implement custom shadow disabling rules.

Last edited by bloom (2012-02-12 14:14:55)


gh · da · ds

Offline

#170 2012-02-12 14:15:48

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

bloom wrote:

I would like to be able to apply shadows (through compton) only on floating windows.

Could you add a custom window property (HLWM_WINDOW_STATE ?) to indicate the state of the window (tiled, pseudo-tiled, floating, fullscreen, ...)?

If you can do that, I'll ask the compton developer to implement custom shadow disabling rules.

Sounds cool. I'll add this to my todo list. But don't expect this to be implemented soon wink

Offline

#171 2012-02-13 06:49:14

moneylcj
Member
Registered: 2011-04-07
Posts: 14

Re: herbstluftwm

thorsten wrote:
moneylcj wrote:

If herherbstclient can bind  multi commands to one key?

Does someone see another solution to bind multiple commands to one
key?

I use emit_hook and a hook handler to bind multiple commads to one key.

WAITHOOK="/usr/bin/herbstclient --no-newline  --wait"
HWMC="/usr/bin/herbstclient"

while true;do
    hook="$($WAITHOOK)"
    case "$hook" in
        tag_flags)
            fid=$(echo "ibase=10; obase=16; $(xdotool getactivewindow)" | bc)
            echo "fid is $fid"
            [[ "X$fid" == "X" ]] && exit 
            pid=$(xprop -id 0x$fid | grep WM_TRANSIENT_FOR | cut -d'#' -f2)
            echo "pid is $pid"
            $WAITHOOK focus_changed
            xdotool windowactivate $pid
            ;;
        reconfig)
            $HWMC reload
            zenity --info --text "herbstluftwm config is reload"
            ;;
        hoz_split)
            $HWMC set frame_border_width 1
            ~/.config/herbstluftwm/examples/savestate.sh >/tmp/.herbstluftwm-undo
            $HWMC split horizontal 0.65
            ;;
        vert_split)
            $HWMC set frame_border_width 1
            ~/.config/herbstluftwm/examples/savestate.sh >/tmp/.herbstluftwm-undo
            $HWMC split vertical 0.5
            ;;
        undo)
            $HWMC set frame_border_width 0
            ~/.config/herbstluftwm/examples/loadstate.sh </tmp/.herbstluftwm-undo
            ;;
        *)
            echo "hook is $hook"
            ;;
    esac
done

in autostart

hc keybind Mod4-r emit_hook reconfig
hc keybind Mod4-u emit_hook undo 
hc keybind Mod4-v emit_hook vert_split
hc keybind Mod4-b emit_hook hoz_split
pgrep hook-handler.sh >/dev/null || ~/.config/herbstluftwm/hook-handler.sh&

Offline

#172 2012-02-14 12:33:00

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: herbstluftwm

Whenever the client is in pseudo-tile mode, it gets placed right in the centre of the frame and it's not possible to "move" using $mod+drag. Would it be possible/easy to have it so that with $mod+drag the pseudo-tiled clients can be moved within the frame? This is useful if the frame layout is max and I have several pseudo-tiled clients which I want staggered (like many stacking wm's do)

Offline

#173 2012-02-14 13:35:35

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

kcirick wrote:

Whenever the client is in pseudo-tile mode, it gets placed right in the centre of the frame and it's not possible to "move" using $mod+drag. Would it be possible/easy to have it so that with $mod+drag the pseudo-tiled clients can be moved within the frame? This is useful if the frame layout is max and I have several pseudo-tiled clients which I want staggered (like many stacking wm's do)

Many people already requested this feature. I'm thinking about it wink

Offline

#174 2012-02-26 05:57:06

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: herbstluftwm

thorsten wrote:
kcirick wrote:

Whenever the client is in pseudo-tile mode, it gets placed right in the centre of the frame and it's not possible to "move" using $mod+drag. Would it be possible/easy to have it so that with $mod+drag the pseudo-tiled clients can be moved within the frame? This is useful if the frame layout is max and I have several pseudo-tiled clients which I want staggered (like many stacking wm's do)

Many people already requested this feature. I'm thinking about it wink

I just couldn't wait for the next release ;-) This can be achieved by editing the mouse.c (line ~77):

     if (g_win_drag_client->tag->floating == false && !g_win_drag_client->pseudotile) {
         // only can drag wins in  floating mode or pseudotile
         g_win_drag_client = NULL;
         g_drag_bind = NULL;
         return;
     }

Also, if you want to be able to resize your client too, change clientslist.c (line ~360):

   if (client->fullscreen && (m = find_monitor_with_tag(client->tag))) {
       client_resize_fullscreen(client, m);
   } else if (client->pseudotile && (m = find_monitor_with_tag(client->tag))) {
        client_resize_floating(client, m);
   } else {
       client_resize(client, rect);
   }

Note that if you do this, your pseudo-tiled client can wander outside the frame (i.e. will have a real floating behaviour but still attached to a frame).

Offline

#175 2012-02-26 11:33:43

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 168

Re: herbstluftwm

kcirick wrote:

I just couldn't wait for the next release ;-) This can be achieved by editing the mouse.c (line ~77):
[...]
Also, if you want to be able to resize your client too, change clientslist.c (line ~360): Note that if you do this, your pseudo-tiled client can wander outside the frame (i.e. will have a real floating behaviour but still attached to a frame).

And it has some other smaller problems, so I won't add this to master. But you can patch it on your own, by saving the folowin patch to file.patch and applying it with: git am file.patch

From 0933b084ee3a71fcb1a602d68f5703a2ff3357fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorsten=20Wi=C3=9Fmann?= <edu@thorsten-wissmann.de>
Date: Sun, 26 Feb 2012 12:28:54 +0100
Subject: [PATCH] temporary fix: make pseudotile to floating

Problems:
    - there still is some space reserved for the client in it's frame
    - it snaps to the floating position of other clients
    - not tested - try it on your own risk ;)
---
 src/clientlist.c |    2 ++
 src/mouse.c      |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/clientlist.c b/src/clientlist.c
index 40d1923..9595d8d 100644
--- a/src/clientlist.c
+++ b/src/clientlist.c
@@ -351,6 +351,8 @@ void client_resize_tiling(HSClient* client, XRectangle rect) {
     HSMonitor* m;
     if (client->fullscreen && (m = find_monitor_with_tag(client->tag))) {
         client_resize_fullscreen(client, m);
+    } else if (client->pseudotile && (m = find_monitor_with_tag(client->tag))) {
+        client_resize_floating(client, m);
     } else {
         client_resize(client, rect);
     }
diff --git a/src/mouse.c b/src/mouse.c
index df13d60..7a00cbf 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -73,7 +73,7 @@ void mouse_start_drag(XEvent* ev) {
         g_drag_bind = NULL;
         return;
     }
-    if (g_win_drag_client->tag->floating == false) {
+    if (g_win_drag_client->tag->floating == false && !g_win_drag_client->pseudotile) {
         // only can drag wins in  floating mode
         g_win_drag_client = NULL;
         g_drag_bind = NULL;
-- 
1.7.9.1

Offline

Board footer

Powered by FluxBB