Comments (3)
I've added an FAQ entry about this: http://herbstluftwm.org/faq.html#_q_how_can_i_have_some_of_the_tags_on_specific_monitors_only
Basically for each tag, you need to save the desired monitor name or index in the tagβs attributes. Before switching to another tag, check whether it has such an attribute, and if so, switch to that monitor first. The code for the autostart is as follows. It allows both static configuration of lockings and dynamically creation of lockings via the Mod-t and Mod-Shift-t keybindings:
# Replace the default section for tags in your autostart by the following:
# This is the default tag section of the autostart, with a single change:
# In the use_index keybinding, check the presence of the my_monitor attribute,
# before focusing the desired tag.
hc rename default "${tag_names[0]}" || true
for i in ${!tag_names[@]} ; do
hc add "${tag_names[$i]}"
key="${tag_keys[$i]}"
if ! [ -z "$key" ] ; then
# first check if the tag is locked to some monitor.
# if so, first focus the monitor
hc keybind "$Mod-$key" \
chain , silent substitute M tags."$i".my_monitor \
focus_monitor M \
, use_index "$i"
hc keybind "$Mod-Shift-$key" move_index "$i"
fi
done
# Add a keybinding for locking the current tag to the monitor it is displayed
# on. This is done by safing the current monitor index in the my_monitor
# attribute of the focused tag. If the monitor has a (nonempty) name, use the
# monitor name instead of its index.
herbstclient keybind $Mod-t chain \
, new_attr string tags.focus.my_monitor \
, substitute M monitors.focus.index set_attr tags.focus.my_monitor M \
, try and \
. compare monitors.focus.name != "" \
. substitute M monitors.focus.name \
set_attr tags.focus.my_monitor M
# Add a keybinding for removing the lock
herbstclient keybind $Mod-Shift-t \
remove_attr tags.focus.my_monitor
# Statically define which tag should be send to which monitor
lock_tag_to_monitor() {
herbstclient chain \
, new_attr string tags.by-name."$1".my_monitor \
, set_attr tags.by-name."$1".my_monitor "$2"
}
# Already lock some of the tags to a monitor, for example:
# lock the tag 8 to the monitor with index 1 (i.e. the second monitor)
lock_tag_to_monitor 8 1
from herbstluftwm.
You can achieve this feature easily by writing your own script that discerns the action based on workspace name. You can then bind to that instead.
You can do this either with an external script or hlwms internal scripting. The latter has some benefits in practice. I am not versed in that so I don't have a concrete example for you. It should only be a one-liner though.
On January 3, 2016 4:11:26 PM GMT+01:00, PureTryOut [email protected] wrote:
Using 2 screens, you can have all workspaces on whatever monitor you
desire. I would like an option so lock a workspace to a specified
monitor. Say workspace 8 to monitor 2.
If you press the key combination to get to that workspace, it would
move your mouse and focus to the workspace on the screen it's locked
to. This makes it for example easy to have a web-browser on a second
monitor at all times (except when you manually move the window to a
different container/workspace of course).
Reply to this email directly or view it on GitHub:
#61
from herbstluftwm.
This does not synergize with:
hc use_index +1
or hc use_index -1
Also issues with hc use_previous
can occur. Basically every command to reach a workspace that is not the standard keybind will cause issues. I still believe true locking monitors to workspace is necessary.
from herbstluftwm.
Related Issues (20)
- Floating windows are always on top HOT 3
- Running old HLWM on ubuntu 20/ dependencies HOT 4
- Tests fail with GCC 12 (maybe change in error strings for regex library or similar?) HOT 3
- smart_window_surroundings and tabbed_max settings conflict with each other HOT 4
- `settings.focus_follows_mouse` should be called `settings.sloppy_focus` HOT 3
- Placing float windows in the middle of its parent HOT 3
- option to make `smart_window_surroundings` only hide if there is only one window on a tag
- Numpad keys binding ? HOT 4
- How do I use conky/any desktop widgets? HOT 2
- Window with em-dash in title causes missing `focus_changed` hook (xconnection.cpp: 347: Can not create text list) HOT 2
- Move window to previous tag HOT 2
- rule to close window HOT 2
- Move floating window in single axis only? HOT 2
- focus seems odd after using a flameshot
- Client border not cleared when urgent client is focused
- Unable to move floating window if sent to another tag while still moving
- Typing in unmanaged window HOT 3
- q3terminal script does not show an empty frame HOT 4
- I would like to be able to use non-english letters (German Umlauts) in keybindings HOT 2
- Move client to tag? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from herbstluftwm.