Package: xsessionp
xsessionpOverviewA declarative window instantiation utility for x11 sessions, heavily inspired by tmuxp.InstallationFrompypi.org$ pip install xsessionpFrom source code$gitclonehttps://github.com/crashvb/xsessionp
$cdxsessionp
$virtualenvenv
$sourceenv/bin/activate
$python-mpipinstall--editable.[dev]UsageTL;DRDefine a configuration file(s) declaring the desired end state:# ~/.xsessionp/example.yml---desktop:0environment:xsp:makes_life_easywindows:-command:-/usr/bin/xed---new-windowcopy_environment:falsefocus:truedimensions:926x656hints:name:^Unsaved Document.*position:166,492-command:-/usr/bin/gnome-terminal----tmuxdesktop:0environment:GNOME_TERMINAL_SCREEN:""dimensions:1174x710hints:name:^Terminal$class:^\['gnome-terminal-server', 'Gnome-terminal'\]$position:213,134shell:truestart_directory:/tmpA configuration can be instantiated using theloadcommand:$xsploadexample
Loading:/home/user/.xsessionp/example.ymlCommandsThis packages makes available thexsessionpcommand, and the shorterxspalias.A listing of commands is available by executing:xsp --help. Command-specific usage is available by executing--helpafter the command (e.g.:xsp ls --help).close-windowCloses a managed window(s).$xspclose-window--target/home/user/.xsessionp/example.yml:window[0]:262512556
Closedwindow:119537674learnCapture metadata from a graphically selected window. Intended to assist with developing workspace configurations.$xsplearn
---
windows:
-command:-nemo-/home/userdesktop:0dimensions:1667x918environment:-DBUS_SESSION_BUS_ADDRESS=unix:path/run/user/1000/bushints:name:^Home$position:1717,264list-windowsLists managed windows in a given format.$xsplist-windows
IDXSP:NAMEDESKTOPPOSITIONDIMENSIONSNAME119537674/tmp/tmpqf3bcpzt/xclock.yml:window[0]:2625125560[25,49][300,300]xclock138412043/tmp/tmpqf3bcpzt/xclock.yml:window[1]:2625127110[25,399][300,40]xclockloadLoads an xsessionp workspace for each instance of CONFIG specified.$xsploadexample
Loading:/home/user/.xsessionp/example.ymllsLists xsessionp workspace(s) discovered within each default configuration directory.$xspls
example
$xspls--qualified
/home/user/.xsessionp/example.ymlreposition-windowAligns the current position of a managed window(s) to match the embedded metadata.$xspreposition-window-t/tmp/tmpqf3bcpzt/xclock.yml:window[0]:262512556
Repositionedwindow:119537674testPerform basic acceptance tests by launching two xclock instances on the current desktop$xsptest...
Loading:/tmp/tmpqf3bcpzt/xclock.ymlversion$xspversion
x.y.zConfigurationAny key defined at the root level (globals) will propagate to all windows as the default value for that key.
Globals can be overridden in individual window configurations (locals), or omitted by added a key with a "no_" prefix (e.g.: no_dimensions).
Keys with ano_prefix have a higher precedence then those without.command (type:list,str)Command used to launch the window. Provided asargstosubprocess.Popen.copy_environment (type:bool, default:True)If true, the environment of xsessionp will be used as the base for launched windows. Otherwise, and empty environment will be used instead. This does not affect values declared viaenvironment.desktop (type:int)The X11 desktop to be assigned to the launched window. If not provided, desktop assignment is not performed, and defaults to the behavior of the underlying window manager.dimensions (type:str)The dimensions (geometry) to assigned to the launched window. Values should take the form of{width}x{height}or{width},{height}. If not provided, no sizing is performed.disabled (type:bool, default:False)If true, the window will not be selected when the configuration is loaded. This is intended to allow complex window configuration(s) to remain inline without needing to comment them.environment (typeDict[str, str])Key value pairs to be provided via the environment of the launched window. These values have precedence over the "base" environment; seecopy_environment.focus (type:bool, default:False)If true, the window will be activated after all windows have been launched. If more than one window contains this value, the value is ignored.hint_method (type:enum, values:AND,OR)Boolean method by whichhintsare evaluated.hints (type:Dict[str, str])Distinguishing characteristics of the launched window that can be used to identify (guess) amongst otherwise ambiguous deltas.Deterministically identifying the X11 window(s) that are created when a process is launched is difficult. Often theWM_PIDatom is missing, or doesn't align with the PID of the process that was invoked, for various reasons.
As such, a listing of X11 windows is captured bothbeforeandafterthe process is executed, and the difference (delta) is used to guess the correct window. If the size of the delta is equal to 1, then it is assumed to correspond to the executed process.
If the size of the delta is greater than 1, then these hints are used to restrict which window is selected.Common hints include:class,name,state, andtype. Hint values are compiled into regular expression patterns prior to evaluating.name (type:str, default:generated)Name (xsp:name) use to select windows when the configuration is loaded, and to identify the window when executing commands.position (type:str)The position to assigned to the launched window. Values should take the form of{x},{y}or{x}x{y}. If not provided, no positioning is performed.search_delay (type:float, default:0)The amount of time, in seconds, to wait before searching for launched windows. Seehintsfor an explanation of the methodology.shell (type:bool, default:False)If true,commandwill be executed via a shell. Provided asshelltosubprocess.Popen.snapped (type:bool, default:False)If true, supporting window managers will be instructed tosnap, rather than tile, the launched window.start_directory (type:str, default:/)The working directory of the launched window. Provided ascwdtosubprocess.Popen.start_timeout (type:int, default:3)The maximum amount of time, in seconds, to wait for launched windows to be visible, prior to sizing and positioning.tile (type:str)Mode to use when tiling the launched window. Tiling occurs after window sizing and positioning. If not specified, no tiling is performed.Supported Tiling ModesLinux Mint Cinnamon:BOTTOM,LEFT,LEFT_BOTTOM,LEFT_TOP,MAXIMIZE,NONE,RIGHT,RIGHT_BOTTOM,RIGHT_TOP,TOPEnvironment VariablesVariableDefault ValueDescriptionXSESSIONP_CONFIGDIR~/.xsessionpxsessionp configuration directory.DevelopmentSource Control