You are not logged in.
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
The weird thing is mouse following works like a charm ...
Thanks.
Offline
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
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
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
^ 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
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
Ugh... I feel stupid now
@thorsten Sorry, I was only misinterpreted what you said. Works great. Thanks for your help
Offline
By the way: does the behaviour change if you enable or disable NumLock? (This was a problem once)
Yes it works without NumLock!
Offline
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
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
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
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
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
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
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
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
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
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 But i can try to implement a some ideas if i have time.
Offline
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
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
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
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)
Offline
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
Offline
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
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
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
Offline
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
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
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