NoPaste

Devilspie 2 Readme

von geier22

Dein Code:
  1. #
  2. # Copyright © 2011-2015 Andreas Rönnquist.
  3. # This file is distributed under the same license
  4. # as the devilspie2 package, see COPYING file.
  5. #
  6.  
  7. Devilspie 2
  8. -----------
  9.  
  10. Devilspie 2 is based on the excellent program Devil's Pie by Ross Burton, and
  11. takes a folder as indata, and checks that folder for Lua scripts. These
  12. scripts are run each time a window is opened or closed, and the rules in them
  13. are applied on the window.
  14.  
  15. Unfortunately the rules of the original Devils Pie are not supported.
  16.  
  17. If you don't give devilspie2 any folder with --folder, it will read Lua scripts
  18. from the folder that it gets from the GLib function g_get_user_config_dir with
  19. devilspie2/ added to the end - g_get_user_config_dir returns the config
  20. directory as defined in the XDG Base Directory Specification. In most cases
  21. would be the ~/.config/devilspie2/ folder, and this folder will be created if
  22. it doesn't already exist. This folder is changeable with the --folder option.
  23. If devilspie2 doesn't find any Lua files in the folder, it will stop execution.
  24.  
  25. Devilspie2 will load all the Lua files in this folder in alphabetical order.
  26.  
  27. Devilspie2 takes some options:
  28.  
  29. -h, --help          Show help options
  30.  
  31. -d, --debug         Print debug information to stdout
  32. -e, --emulate       Don't apply any rules, but only emulate execution
  33. -f, --folder        From which folder should we load our Lua scripts
  34. -v, --version       Print program version and quit
  35. -w, --wnck-version  Show version of libwnck and quit
  36.  
  37.  
  38. Config
  39. -------
  40.  
  41. A config is read from the folder where we read all scripts, and is customizable
  42. by the --folder option. By default this folder is ~/.config/devilspie2/.
  43.  
  44. If there is a file named devilspie2.lua in this folder, it is read and it is
  45. searched for a variable (a lua table of strings) named either
  46. scripts_window_close, scripts_window_focus or scripts_window_blur -
  47. The filenames in the strings in this table will be called when windows are
  48. closed, focused or blurred respectively. If these variables isn't present in
  49. this file, it will be called as a devilspie2 script file like any other.
  50.  
  51. For example:
  52.  
  53. --
  54. scripts_window_close = {
  55.    "file1.lua",
  56.    "file2.lua"
  57. }
  58.  
  59. This would make the files file1.lua and file2.lua interpreted when windows are
  60. closing instead of when windows are opening.
  61.  
  62.  
  63. Scripting
  64. ---------
  65.  
  66. You can choose to have all script functionality in one file, or you can split
  67. it up into several, Devilspie2 runs on all Lua files in your requested
  68. devilspie2 folder, by default ~/.config/devilspie2 - that is all files with a
  69. .lua extension.
  70.  
  71. The scripting language used is Lua (see www.lua.org) - See FAQ at
  72.  
  73. www.lua.org/FAQ.html
  74.  
  75. , documentation at
  76.  
  77. www.lua.org/docs.html
  78.  
  79. , and tutorials at
  80.  
  81. http://lua-users.org/wiki/TutorialDirectory
  82.  
  83.  
  84. The following commands are recognized by the Devilspie2 Lua interpreter:
  85.  
  86. First; a function to show some debug info
  87.  
  88.  
  89. debug_print(string)
  90.  
  91.    Debug helper that prints a string to stdout. The string is only printed to
  92.    stdout if devilspie2 is run with the --debug option, otherwise nothing will
  93.    be printed.
  94.  
  95.  
  96.  
  97.  
  98. Then, there's the functions to get the properties of a window, and related
  99. information:
  100.  
  101.  
  102. get_window_name()
  103.  
  104.   returns a string containing the name of the current window.
  105.  
  106.  
  107. get_window_has_name()
  108.  
  109.   return true or false depending on if the window has a name or not
  110.   (from version 0.20)
  111.  
  112.  
  113. get_application_name()
  114.  
  115.   returns the application name of the current window.
  116.  
  117.  
  118. get_window_geometry()
  119.  
  120.   Returns the window geometry as four numbers - x-position, y-position,
  121.   width and height. (from version 0.16) - for example you can do something
  122.         like this:
  123.  
  124.         x, y, width, height = get_window_geometry();
  125.         print("X: "..x..", Y: "..y..", width: "..width..", height: "..height);
  126.  
  127.  
  128. get_window_client_geometry()
  129.  
  130.   returns the window geometry excluding the window manager borders as four
  131.   numbers, x-position, y-position, width and height. (from version 0.16) -
  132.         see get_window_geometry for an example on how to use this function.
  133.  
  134.  
  135. get_window_is_maximized()
  136.  
  137.   Returns true if the window is maximized, false otherwise. (available from
  138.   version 0.21)
  139.  
  140.  
  141. get_window_is_maximized_vertically()
  142.  
  143.   Returns true if the window is vertically maximized, false otherwise.
  144.   (available from version 0.21)
  145.  
  146.  
  147. get_window_is_maximized_horizontally()
  148.  
  149.   Returns true if the window is horizontally maximized, false otherwise.
  150.   (available from version 0.21)
  151.  
  152.  
  153. get_window_type()
  154.  
  155.   Returns the type of the window - The result type is a string, and can
  156.   be one of the following:
  157.  
  158.   "WINDOW_TYPE_NORMAL"
  159.   "WINDOW_TYPE_DESKTOP"
  160.   "WINDOW_TYPE_DOCK"
  161.   "WINDOW_TYPE_DIALOG"
  162.   "WINDOW_TYPE_TOOLBAR"
  163.   "WINDOW_TYPE_MENU"
  164.   "WINDOW_TYPE_UTILITY"
  165.   "WINDOW_TYPE_SPLASHSCREEN"
  166.  
  167.   or "WINDOW_TYPE_UNRECOGNIZED" if libwnck didn't recognize the type.
  168.  
  169.    If the function for some reason didn't have a window to work on the string
  170.   result is "WINDOW_ERROR".
  171.  
  172.   (available from version 0.21)
  173.  
  174.  
  175. get_class_instance_name()
  176.  
  177.   Gets the class instance name from the WM_CLASS Property for the current
  178.   window. Only available on libwnck 3+, and in devilspie2 version 0.21 or
  179.   later.
  180.  
  181.  
  182. get_window_property(property)
  183.  
  184.   Returns the window property described in the property string. For a list of
  185.   available properties, you should see the page
  186.   http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
  187.  
  188.   (Available from version 0.21)
  189.  
  190.  
  191. get_window_role
  192.  
  193.   Returns a string describing the current window role of the matched window as
  194.   defined by it's WM_WINDOW_ROLE hint.
  195.  
  196.  
  197. get_window_xid
  198.  
  199.    Returns the X window id of the current window.
  200.  
  201.  
  202. get_window_class
  203.  
  204.    Returns a string representing the class of the current window.
  205.  
  206.  
  207. get_workspace_count
  208.  
  209.         Return the number of workspaces available (available from version 0.27)
  210.  
  211.  
  212. get_screen_geometry
  213.  
  214.         Returns the screen geometry (two numbers) for the screen of the
  215.         current window (available from version 0.29)
  216.  
  217.  
  218. get_window_fullscreen
  219. get_fullscreen
  220.  
  221.         Returns TRUE if the window is fullscreen, FALSE otherwise
  222.         (available from version 0.32)
  223.  
  224.  
  225. and the rest of the commands are used to modify the properties of the windows:
  226.  
  227.  
  228. set_window_position(xpos, ypos)
  229.  
  230.    Set the position of a window.
  231.  
  232.  
  233. set_window_position2(xpos, ypos)
  234.  
  235.    Set the position of a window - Compared to set_window_position, this
  236.    function uses XMoveWindow instead of wnck_window_set_geometry which
  237.    gives a slightly different result.
  238.    (Available from version 0.21)
  239.  
  240.  
  241. set_window_size (xsize, ysize)
  242.  
  243.    Sets the size of a window - takes xsize and ysize as parameters.
  244.  
  245.  
  246. set_window_geometry (xpos, ypos, xsize, ysize)
  247.  
  248.    Sets both size and position of a window in one command. Takes four
  249.    parameters, xpos, ypos, xsize and ysize.
  250.  
  251.  
  252. set_window_geometry2 (xpos, ypos, xsize, ysize)
  253.  
  254.    Sets the window geometry just as set_window_geometry, using
  255.    XMoveResizeWindow instead of its libwnck alternative. This results in
  256.    different coordinates than the set_window_geometry function, and results
  257.    are more similar to the results of the original devilspie geometry function.
  258.    (available from version 0.21)
  259.  
  260.  
  261. make_always_on_top()
  262.  
  263.    Sets a window always on top.
  264.  
  265.  
  266. set_on_top()
  267.  
  268.    sets a window on top of the others. (unlike make_always_on_top, it doesn't
  269.   lock the window in this position.)
  270.  
  271.  
  272. shade()
  273.  
  274.   "Shades" a window, showing only the title-bar.
  275.  
  276.  
  277. unshade()
  278.  
  279.   Unshades a window - the opposite of "shade"
  280.  
  281.  
  282. maximize()
  283.  
  284.   maximizes a window
  285.  
  286.  
  287. unmaximize()
  288.  
  289.   unmaximizes a window
  290.  
  291.  
  292. maximize_vertically()
  293.  
  294.   maximizes the current window vertically.
  295.  
  296.  
  297. maximize_horizontally()
  298.  
  299.   maximizes the current window horizontally.
  300.  
  301.  
  302. minimize()
  303.  
  304.   minimizes a window
  305.  
  306.  
  307. unminimize()
  308.  
  309.   unminimizes a window, that is bringing it back to screen from the minimized
  310.   position/size.
  311.  
  312.  
  313. decorate_window()
  314.  
  315.   Shows all window decoration.
  316.  
  317.  
  318. undecorate_window()
  319.  
  320.   Removes all window decorations.
  321.  
  322.  
  323. close_window()
  324.  
  325.         Closes the window. (Available from 0.31)
  326.  
  327.  
  328. set_window_workspace(number)
  329.  
  330.   Moves a window to another workspace. The number variable starts counting at
  331.   1.
  332.  
  333.  
  334. change_workspace(number)
  335.  
  336.   Changes the current workspace to another. The number variable starts counting
  337.   at 1.
  338.  
  339.  
  340. pin_window()
  341.  
  342.   asks the window manager to put the window on all workspaces.
  343.  
  344.  
  345. unpin_window()
  346.  
  347.   Asks the window manager to put window only in the currently active workspace.
  348.  
  349.  
  350. stick_window()
  351.  
  352.   Asks the window manager to keep the window's position fixed on the screen,
  353.    even when the workspace or viewport scrolls.
  354.  
  355.  
  356. unstick_window()
  357.  
  358.    Asks the window manager to not have window's position fixed on the screen
  359.   when the workspace or viewport scrolls.
  360.  
  361.  
  362. set_skip_tasklist(skip)
  363.  
  364.   Set this to true if you would like the window to skip listing in your
  365.   tasklist. Takes a boolean(true or false) as value. (from version 0.16)
  366.  
  367.  
  368. set_skip_pager(skip)
  369.  
  370.   Set this to true if you would like the window to skip listing in your pager.
  371.   Takes a boolean(true or false) as value. (from version 0.16)
  372.  
  373.  
  374. set_window_above([above])
  375.  
  376.   Set the current window above all normal windows. (available from version
  377.   0.21)
  378.   Optionally takes a boolean(true or false) as value.
  379.  
  380.  
  381. set_window_below([below])
  382.  
  383.   Set the current window below all normal windows. (available from version
  384.   0.21)
  385.   Optionally takes a boolean(true or false) as value.
  386.  
  387.  
  388. set_window_fullscreen(fullscreen)
  389.  
  390.   Asks the window manager to set the fullscreen state of the window according
  391.   to the fullscreen boolean. (available from version 0.24)
  392.  
  393.  
  394. set_viewport(viewport)
  395.  
  396.   Using one indata, moves the window to the requested viewport - Counting
  397.         starts at number 1. (Available from version 0.25)
  398.         - Also see the alternative usage of this function below.
  399.  
  400. set_viewport(x, y)
  401.        
  402.         If you are using two indata to the set_viewport function, you can decide
  403.         where in the viewport the window will be placed.
  404.         (Available from version 0.40)
  405.  
  406. center()
  407.  
  408.   Centers the current window on the current workspace.
  409.   (Available from version 0.26)
  410.  
  411.  
  412. set_opacity(value)
  413. set_window_opacity(value)
  414.  
  415.         Sets the window opacity, takes a float value, 1.0 = completely opaque,
  416.         0.0, completely see-through. Both set_opacity and set_window_opacity
  417.         will do the same thing.
  418.         (Available from version 0.28, set_window_opacity from 0.29)
  419.  
  420.  
  421. set_window_type(type)
  422.  
  423.         Sets the window type, according to _NET_WM_WINDOW_TYPE. The allowed types
  424.         are the standard _NET_WM ones (formatted as a string):
  425.  
  426.         "_NET_WM_WINDOW_TYPE_DESKTOP"
  427.         "_NET_WM_WINDOW_TYPE_DOCK"
  428.         "_NET_WM_WINDOW_TYPE_TOOLBAR"
  429.         "_NET_WM_WINDOW_TYPE_MENU"
  430.         "_NET_WM_WINDOW_TYPE_UTILITY"
  431.         "_NET_WM_WINDOW_TYPE_SPLASH"
  432.         "_NET_WM_WINDOW_TYPE_DIALOG"
  433.         "_NET_WM_WINDOW_TYPE_NORMAL"
  434.  
  435.         or shorter versions of the same values
  436.  
  437.         "WINDOW_TYPE_DESKTOP"
  438.         "WINDOW_TYPE_DOCK"
  439.         "WINDOW_TYPE_TOOLBAR"
  440.         "WINDOW_TYPE_MENU"
  441.         "WINDOW_TYPE_UTILITY"
  442.         "WINDOW_TYPE_SPLASH"
  443.         "WINDOW_TYPE_DIALOG"
  444.         "WINDOW_TYPE_NORMAL"
  445.  
  446.         (Function is available from version 0.28)
  447.  
  448. focus()
  449. focus_window()
  450.  
  451.         Focuses the current window. (Function is available from version 0.30)
  452.  
  453.  
  454. set_window_strut(left, right, top, bottom)
  455.  
  456.         Set the reserved area at the borders of the desktop for a docking area such
  457.         as a taskbar or a panel (available from version 0.32)
  458.  
  459.  
  460. xy(x, y), xy()
  461.    Set the position of a window, or if you don't give any input, get the
  462.     position of a window
  463.  
  464.  
  465. xywh(x, y, w, h), xywh()
  466.     Set the position and size of a window, or if you don't give any input, get
  467.    the position and size of a window.
  468.  
  469.  
  470. Please note that strings comparisons are case sensitive, comparing
  471. "SomeProgram" with "someprogram" will not report equality.
  472.  
  473.  
  474. Simple script example
  475. ---------------------
  476.  
  477.  
  478. ---------------------8<---------------------
  479.  
  480. -- the debug_print command does only print anything to stdout
  481. -- if devilspie2 is run using the --debug option
  482. debug_print("Window Name: " .. get_window_name());
  483. debug_print("Application name: " .. get_application_name())
  484.  
  485. -- I want my Xfce4-terminal to the right on the second screen of my two-monitor
  486. -- setup. (String comparison are case sensitive, please note this when
  487. -- creating rule scripts.)
  488. if (get_window_name() == "Terminal") then
  489.   -- x,y, xsize, ysize
  490.   set_window_geometry(1600, 300, 900, 700);
  491. end
  492.  
  493. -- Make Iceweasel always start maximized.
  494. if (get_application_name() == "Iceweasel") then
  495.   maximize();
  496. end
  497.  
  498. --------------------->8---------------------
  499.  
  500.  
  501. Translations
  502. ------------
  503.  
  504. Devilspie2 is now translatable using gettext - see README.translators for more
  505. information.
  506.  
  507.  
  508. Authors
  509. -------
  510.  
  511. see the AUTHORS file
  512.  
  513.  
  514. Contact
  515. -------
  516.  
  517. Author: Andreas Rönnquist
  518. E-mail: devilspie2 (at) gusnan (dot) se
  519. Homepage: http://www.gusnan.se/devilspie2
  520. Mailinglist: devilspie2-discuss@nongnu.org,
  521.             https://lists.nongnu.org/mailman/listinfo/devilspie2-discuss
  522.  
  523. IRC: #devilspie2 on irc.freenode.net

Quellcode

Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. Alternativ kannst du den gesamten Eintrag auch als Datei herunterladen.