launch_on_workspace:该脚本允许在Linux中的指定工作空间上启动应用程序。 经过Ubuntu和Gnome测试

  • w3_397771
    了解作者
  • 9.2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-01 20:57
    上传日期
在工作空间中启动 在Linux中的指定工作空间上启动应用程序。 脚本实现了几个有用的功能,这些功能可以(以可编写脚本的方式)在Linux中的X的指定工作空间上启动应用程序。 依靠来操纵工作区上的窗口。 脚本将移动窗口以类似的方式显示。 现在,它依靠来获取显示到工作空间坐标的映射。 您可以自己提供wmctrl的正确坐标,甚至在没有xrandr的情况下也可以使用它。 该脚本使用的功能,提供的功能是推出具体方案。 对于非标准情况,它们是一些实现细节的轻松抽象。 这些动机有三方面: 有些程序需要谨慎处理,因为它们(a)在启动时使用了一些临时窗口,而我们实际上想移动第二个窗口( texstudio ),或者(b)您通常在系统中有其他实例在运行,并且没有创建新进程( firefox 它简化了提供参数( terminal ) 某些应用程序需要移动2个或更多窗口( jupyter-lab )当
launch_on_workspace-master.zip
  • launch_on_workspace-master
  • .gitignore
    53B
  • README.md
    2.3KB
  • .github
  • workflows
  • python-publish.yml
    864B
  • LICENSE
    1KB
  • launch_on_workspace
  • custom_launchers.py
    4.1KB
  • displays.py
    2.8KB
  • launcher.py
    5.3KB
  • __init__.py
    569B
  • setup.py
    853B
内容介绍
# Launch-on-workspace Launch applications on a specified workspace in Linux. The script [launcher](launcher.py) implements several useful functions that can launch (in a scriptable manner) applications on designated workspaces on X in Linux. Relies on [wmctrl](http://tripie.sweb.cz/utils/wmctrl/) to manipulate windows on workspaces. The scripts [displays](displays.py) moves windows to displays in similar manner. Right now it relies on [xrandr](https://www.x.org/wiki/Projects/XRandR/) to get mapping of displays to workspace coordinates. You can use it even without `xrandr` by supplying the right coordinates for `wmctrl` by yourself. The script [custom_launchers](custom_launchers.py) uses the functionality of [launcher](launcher.py) to provide functions that launch specific programs. They serve as an easy abstraction from some implementation details for non-standard situations. The motivation for these is threefold: 1. Some programs need carefull treatment as they (a) use some temporary window at startup and we actually want to move the second one (`texstudio`), or (b) you usually have some other instances running in the system and no new process is created (`firefox`) 2. It simplifies supplying arguments (`terminal`) 3. Some applications need 2 or more windows to be moved (`jupyter-lab`) Currently, we have functions for launching: * `gnome-terminal` * `firefox` * `jupyter_lab` * `texstudio` All these functions return the IDs of windows they create so they can be further positioned on monitors using the functions from [displays](displays.py). ## Installation ### Requirements * Python 3.6+ * [wmctrl](http://tripie.sweb.cz/utils/wmctrl/) * [xrandr](https://www.x.org/wiki/Projects/XRandR/) * and compatible window manager tested with Gnome 3.34.1 on Ubuntu 19.10 ``` python3 -m pip install launch_on_workspace ``` ## Usage examples The following command launches a new window of Firefox that opens YouTube on workspace 2 (in wmctrl) which is a workspace 3 in Gnome. It is then moved to display connected to DisplayPort#1 (name "DP-1" in `xrandr`) and switched to fullscreen mode. ```python import launch_on_workspace as low wid = low.firefox(2, "youtube.com") low.move_win_to_display(wid, "DP-1", "full") ``` The following command opens a gedit on workspace 4 in Gnome ```python low.launch_and_move(['gedit'], 3) ```
评论
    相关推荐