You are not logged in.
Hello. I am using Debian 8.5 (Jessie) and have XFCE 4.10 installed.
Right now the Window Manager keyboard short actions are limited to:
Tile window to the top
Tile window to the bottom
Tile window to the left
Tile window to the right
I was wondering if there is anyway to add additional options like:
Tile window to the top left
Tile window to the bottom left
Tile window to the top right
Tile window to the bottom right
I know XFCE 4.12 has the options but I was wondering if I could add them with XFCE 4.10?
Offline
Unfortunately no. Corner tiling was implemented in version 4.11.3.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Unfortunately no. Corner tiling was implemented in version 4.11.3.
Could I add those diffs to 4.10 and recompile just the files I need?
Offline
You could try, but doesn't that defeat the purpose of running a stable distribution? Plus there is no guarantee that doing it this way would not introduce some other sort of bug.
.
Another option would be to use xdotool to resize and move the active window to a given corner. Assign this command to a keyboard shortcut and you would get a sort of "corner tiling" (I say "sort of" because the current implementation of tiling in xfwm saves the pre-tiled window dimensions and restores them when you move a tiled window. This method would only tile).
To use this method, first align 4 windows in each of the corners and adjust them to fit. On my 1366x768 screen (adjusting for a 24 pixel top panel) this becomes:
Height/width of all windows:
- width = 681
- height = 351
- Top-Left coordinates:
- x = 0
- y = 20
- Top-Right coordinates:
- x = 683
- y = 20
- Bottom-Left coorindates:
- x = 0
- y = 396
- Bottom-right coordinates:
- x = 683
- y = 396
Therefore, to tile to:
- top left = "xdotool getactivewindow windowsize 681 351 windowmove 0 20"
- top right = "xdotool getactivewindow windowsize 681 351 windowmove 683 20"
- bottom left = "xdotool getactivewindow windowsize 681 351 windowmove 0 396"
- bottom right = "xdotool getactivewindow windowsize 681 351 windowmove 683 396"
Then you can assign these commands to shortcut keys.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Another option would be to use xdotool to resize and move the active window to a given corner. Assign this command to a keyboard shortcut and you would get a sort of "corner tiling" (I say "sort of" because the current implementation of tiling in xfwm saves the pre-tiled window dimensions and restores them when you move a tiled window. This method would only tile).
I love you.
Thanks. This sounds fantastic. Will try it out.
Offline
I've made a script to tile, based on this script https://forum.xfce.org/viewtopic.php?id=6841
Here's the script:
#!/bin/bash
# Get active window
method="getactivewindow"
# Select window
#method="selectwindow"
function is_desktop {
xwininfo -id "$*" | grep '"Desktop"'
return "$?"
}
function get_desktop_dim {
#desktop dimensions
if (( ${#DIM[@]} == 0 )) ; then
DIM=(`wmctrl -d | egrep "^0" | sed 's/.*DG: \([0-9]*x[0-9]*\).*/\1/g' | sed 's/x/ /g'`)
fi
half_w=`expr ${DIM[0]} / 2`
half_h=`expr ${DIM[1]} / 2`
}
function win_top_left {
get_desktop_dim
wid1=`xdotool $method 2>/dev/null`
is_desktop "$wid1" && return
commands="windowsize $wid1 $half_w $half_h"
commands="$commands windowmove $wid1 0 0"
commands="$commands windowactivate $wid1"
wmctrl -i -r $wid1 -b remove,maximized_vert,maximized_horz
echo "$commands" | xdotool -
}
function win_top_right {
get_desktop_dim
wid2=`xdotool $method 2>/dev/null`
is_desktop "$wid2" && return
commands="windowsize $wid2 $half_w $half_h"
commands="$commands windowmove $wid2 $half_w 0"
commands="$commands windowactivate $wid2"
wmctrl -i -r $wid2 -b remove,maximized_vert,maximized_horz
echo "$commands" | xdotool -
}
function win_bottom_left {
get_desktop_dim
wid3=`xdotool $method 2>/dev/null`
is_desktop "$wid3" && return
commands="windowsize $wid3 $half_w $half_h"
commands="$commands windowmove $wid3 1 $half_h"
commands="$commands windowactivate $wid3"
wmctrl -i -r $wid3 -b remove,maximized_vert,maximized_horz
echo "$commands" | xdotool -
}
function win_bottom_right {
get_desktop_dim
wid4=`xdotool $method 2>/dev/null`
is_desktop "$wid4" && return
commands="windowsize $wid4 $half_w $half_h"
commands="$commands windowmove $wid4 $half_w $half_h"
commands="$commands windowactivate $wid4"
wmctrl -i -r $wid4 -b remove,maximized_vert,maximized_horz
echo "$commands" | xdotool -
}
for command in ${@} ; do
if [[ "$command" == "topleft" ]] ; then
win_top_left
elif [[ "$command" == "topright" ]] ; then
win_top_right
elif [[ "$command" == "bottomleft" ]] ; then
win_bottom_left
elif [[ "$command" == "bottomright" ]] ; then
win_bottom_right
fi
done
2 Methods of launching I can think of:
1. As toz said, shortcut keys
Usage example:
# top left
/path/to/script.sh topleft
# top right
/path/to/script.sh topright
# bottom left
/path/to/script.sh bottomleft
# bottom right
/path/to/script.sh bottomright
2. By using the next python script (cb-hotcorners), which launches commands on screen hot corners. This way the active window will follow the mouse pointer as you move the pointer to the window corners.
Script requires: wmctrl, xdotool & python-xlib
Script starts with: cb-hotcorners --daemon
#!/usr/bin/env python
# cb-hotcorners:
# A script for adding hot corners to Openbox.
# Written for CrunchBang Linux <http://crunchbang.org/>
# by Philip Newborough <corenominal@corenominal.org>
# ----------------------------------------------------------------------
# License:
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
# ----------------------------------------------------------------------
from Xlib import display
from Xlib.ext.xtest import fake_input
from Xlib import X
from subprocess import Popen, PIPE, STDOUT
import sys, time, os, ConfigParser, re
check_intervall = 0.2
p = Popen(['xdotool','getdisplaygeometry'], stdout=PIPE, stderr=STDOUT)
Dimensions = p.communicate()
Dimensions = Dimensions[0].replace('\n', '')
Dimensions = Dimensions.split(' ')
width = int(Dimensions[0])
height = int(Dimensions[1])
hw = width / 2
rt = width - 1
bt = height - 1
def print_usage():
print "cb-hotcorners: usage:"
print " --help show this message and exit"
print " --kill attempt to kill any running instances"
print " --daemon run daemon and listen for cursor triggers"
print ""
exit()
if len(sys.argv) < 2 or sys.argv[1] == "--help":
print_usage()
elif sys.argv[1] == "--kill":
print "Attempting to kill any running instances..."
os.system('pkill -9 -f cb-hotcorners')
exit()
elif sys.argv[1] == "--daemon":
Config = ConfigParser.ConfigParser()
cfgdir = os.getenv("HOME")+"/.config/cb-hotcorners"
rcfile = cfgdir+"/cb-hotcornersrc"
bounce = 40
disp = display.Display()
root=display.Display().screen().root
def mousepos():
data = root.query_pointer()._data
return data["root_x"], data["root_y"], data["mask"]
def mousemove(x, y):
fake_input(disp, X.MotionNotify, x=x, y=y)
disp.sync()
try:
cfgfile = open(rcfile)
except IOError as e:
if not os.path.exists(cfgdir):
os.makedirs(cfgdir)
cfgfile = open(rcfile,'w')
Config.add_section('Hot Corners')
Config.set('Hot Corners','top_left_corner_command', 'gmrun')
Config.set('Hot Corners','top_right_corner_command', '')
Config.set('Hot Corners','bottom_left_corner_command', '')
Config.set('Hot Corners','bottom_right_corner_command', '')
Config.write(cfgfile)
cfgfile.close()
while True:
Config.read(rcfile)
time.sleep(check_intervall)
pos = mousepos()
if pos[0] == 0 and pos[1] == 0:
if Config.get('Hot Corners','top_left_corner_command') != '':
time.sleep(0.2)
pos = mousepos()
if pos[0] == 0 and pos[1] == 0:
mousemove(pos[0] + bounce, pos[1] + bounce)
os.system('(' + Config.get('Hot Corners','top_left_corner_command') + ') &')
mousemove(pos[0] + bounce, pos[1] + bounce)
time.sleep(2)
elif pos[0] == rt and pos[1] == 0:
if Config.get('Hot Corners','top_right_corner_command') != '':
time.sleep(0.2)
pos = mousepos()
if pos[0] == rt and pos[1] == 0 :
mousemove(pos[0] - bounce, pos[1] + bounce)
os.system('(' + Config.get('Hot Corners','top_right_corner_command') + ') &')
mousemove(pos[0] - bounce, pos[1] + bounce)
time.sleep(2)
elif pos[0] == 0 and pos[1] == bt:
if Config.get('Hot Corners','bottom_left_corner_command') != '':
time.sleep(0.2)
pos = mousepos()
if pos[0] == 0 and pos[1] == bt:
mousemove(pos[0] + bounce, pos[1] - bounce)
os.system('(' + Config.get('Hot Corners','bottom_left_corner_command') + ') &')
mousemove(pos[0] + bounce, pos[1] - bounce)
time.sleep(2)
elif pos[0] == rt and pos[1] == bt:
if Config.get('Hot Corners','bottom_right_corner_command') != '':
time.sleep(0.2)
pos = mousepos()
if pos[0] == rt and pos[1] == bt:
mousemove(pos[0] - bounce, pos[1] - bounce)
os.system('(' + Config.get('Hot Corners','bottom_right_corner_command') + ') &')
mousemove(pos[0] - bounce, pos[1] - bounce)
time.sleep(2)
else:
print_usage()
Configuration file for this script is /home/your_username/.config/cb-hotcorner/cb-hotcornersrc
This is how to set the configuration file (just change the path and script name)
[Hot Corners]
top_left_corner_command = /path/to/tile.sh topleft
top_right_corner_command = /path/to/tile.sh topright
bottom_left_corner_command = path/to/tile.sh bottomleft
bottom_right_corner_command = path/to/tile.sh bottomright
Cheers
Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c
Offline
Nice. Thanks.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
I've made a script to tile, based on this script https://forum.xfce.org/viewtopic.php?id=6841
Wow! This is awesome. Thank you so much!
Offline
[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 592.36 KiB (Peak: 609.64 KiB) ]