translated

This commit is contained in:
Donkey-Hao 2022-06-22 14:17:29 +08:00
parent 33b6273a6c
commit 5a18d2ce6a
2 changed files with 140 additions and 137 deletions

View File

@ -1,137 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (Donke-Hao)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Configure a Linux workspace remotely from the command line)
[#]: via: (https://opensource.com/article/21/1/remote-configuration-xfce4)
[#]: author: (David Both https://opensource.com/users/dboth)
Configure a Linux workspace remotely from the command line
======
Nearly everything can be done from the Linux command line, including
remote configuration of Xfce4.
![Coding on a computer][1]
One of the things I appreciate about Linux versus proprietary operating systems is that almost everything can be managed and configured from the command line. That means that nearly everything can be configured locally or even remotely via an SSH login connection. Sometimes it takes a bit of time spent on Internet searches, but if you can think of a task, it can probably be done from the command line.
### The problem
Sometimes it is necessary to make remote modifications to a desktop using the command line. In this particular case, I needed to reduce the number of workspaces on the [Xfce][2] panel from four to three at the request of a remote user. This configuration only required about 20 minutes of searching on the Internet.
The default workspace count and many other settings for **xfwm4** can be found and changed in the **/usr/share/xfwm4/defaults** file. So setting _workspace_count=4_ to _workspace_count=2_ changes the default for all users on the host. Also, the **xfconf-query** command can be run by non-root users to query and set various attributes for the **xfwm4** window manager. It should be used by the user account that requires the change and not by root.
In the sample below, I have first verified the current setting of _four_ workspaces, then set the number to _two_, and finally confirmed the new setting.
```
[user@test1 ~]# xfconf-query -c xfwm4 -p /general/workspace_count
4
[user@test1 ~]# xfconf-query -c xfwm4 -p /general/workspace_count -s 2
[user@test1 ~]# xfconf-query -c xfwm4 -p /general/workspace_count
2
[user@test1 ~]#
```
This change takes place immediately and is visible to the user without a reboot or even logging out and back in. I had a bit of fun with this on my workstation by watching the workspace switcher change as I entered commands to set different numbers of workspaces. I get my amusements where I can these days. ;-)
### More exploration
Now that I fixed the problem, I decided to explore the **xfconf-query** command in a bit more detail. Unfortunately, there are no man or info pages for this tool, nor is there any documentation in **/usr/share**. The usual fallback of using the **-h** option resulted in little helpful information.
```
$ xfconf-query -h
 Usage:
   xfconf-query [OPTION…] - Xfconf commandline utility
 Help Options:
   -h, --help            Show help options
 Application Options:
   -V, --version         Version information
   -c, --channel         The channel to query/modify
   -p, --property        The property to query/modify
   -s, --set             The new value to set for the property
   -l, --list            List properties (or channels if -c is not specified)
   -v, --verbose         Verbose output
   -n, --create          Create a new property if it does not already exist
   -t, --type            Specify the property value type
   -r, --reset           Reset property
   -R, --recursive       Recursive (use with -r)
   -a, --force-array     Force array even if only one element
   -T, --toggle          Invert an existing boolean property
   -m, --monitor         Monitor a channel for property changes
```
This is not a lot of help, but we can figure out a good bit from it anyway. First, _channels_ are groupings of properties that can be modified. I made the change above to the **general** channel, and the property is **workspace_count**. Lets look at the complete list of channels.
```
$ xfconf-query -l
Channels:
  xfwm4
  xfce4-keyboard-shortcuts
  xfce4-notifyd
  xsettings
  xfdashboard
  thunar
  parole
  xfce4-panel
  xfce4-appfinder
  xfce4-settings-editor
  xfce4-power-manager
  xfce4-session
  keyboards
  displays
  keyboard-layout
  ristretto
  xfcethemer
  xfce4-desktop
  pointers
  xfce4-settings-manager
  xfce4-mixer
```
The properties for a given channel can also be viewed using the following syntax. I have used the **less** pager because the result is a long stream of data. I have pruned the listing below but left enough to see the type of entries you can expect to find.
```
$ xfconf-query -c xfwm4 -l | less
/general/activate_action
/general/borderless_maximize
/general/box_move
/general/box_resize
/general/button_layout
/general/button_offset
<SNIP>
/general/workspace_count
/general/workspace_names
/general/wrap_cycle
/general/wrap_layout
/general/wrap_resistance
/general/wrap_windows
/general/wrap_workspaces
/general/zoom_desktop
(END)
```
You can explore all the channels in this manner. I discovered that the channels generally correspond to the various settings in the **Settings Manager**. The properties are the ones that you would set in those dialogs. Note that not all the icons you will find in the **Settings Manager** dialog window are part of the **Xfce** desktop, so there are no corresponding channels for them. The **Screensaver** is one example because it is a generic GNU screensaver and not unique to **Xfce**. The **Settings Manager** is just a good central place for **Xfce** to locate many of these configuration tools.
### Documentation
As mentioned previously, there do not appear to be any man or info pages for the **xconf-query** command, and I found a lot of incorrect and poorly documented information on the Internet. The best documentation I found for **Xfce4** is on the [Xfce website][2], and some specific information on **xconf-query** can be found here.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/1/remote-configuration-xfce4
作者:[David Both][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer)
[2]: https://www.xfce.org/

View File

@ -0,0 +1,140 @@
[#]: collector: (lujun9972)
[#]: translator: (Donke-Hao)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Configure a Linux workspace remotely from the command line)
[#]: via: (https://opensource.com/article/21/1/remote-configuration-xfce4)
[#]: author: (David Both https://opensource.com/users/dboth)
从命令行远程配置 Linux 工作区
======
几乎所有的事情都可以从 Linux 命令行完成,包括 Xfce4 的远程配置。
![Coding on a computer][1]
几乎所有的事情都可以通过命令行管理和配置。意味着几乎所有的事情都可以在本地或者通过 SSH 远程登录进行管理。有时候在互联网上搜索会花费一点时间但是如果译者个人感觉这里上下文有省略一些意思我感觉是“如果利用这段时间你能想到…”——_**请校对者注意并删除括号内的话**_你能想到一个可能可以从命令行完成的任务。
### 问题
有时候需要使用命令行进行远程修改。在这种特殊情况下,我需要响应远程用户的请求将在 [Xfce][2] 控制板上的工作区从四个减少到三个。这种配置仅需要在互联网上搜索约 20 分钟。
默认工作区数量和许多其他 **xfwm4** 设置可以在 **/usr/share/xfwm4/defaults** 这个文件中找到并修改。因此将 _workspace_count=2_ 设置为 _workspace_count=4_ 改变了所有主机的默认值。 同时,非 root 用户可以执行 **xfconf-query** 命令来查询并修改 **xfwm4** 窗口管理器的不同属性。它应该由需要更改的用户帐户使用,而不是由 root 使用。
在下面的例子中,首先我验证了当前工作区数量为 _4_ ,然后将数量改为 _2_ ,最后确认了新设置。
```
[user@test1 ~]# xfconf-query -c xfwm4 -p /general/workspace_count
4
[user@test1 ~]# xfconf-query -c xfwm4 -p /general/workspace_count -s 2
[user@test1 ~]# xfconf-query -c xfwm4 -p /general/workspace_count
2
[user@test1 ~]#
```
此更改会立即发生,并且用户可以看到,无需重新启动,甚至无需注销并重新登录。当我输入命令以设置不同数量的工作区时,通过观察工作区切换器的变化,使我在我的工作站上有些快乐。 这些天,我尽我所能获得娱乐。 ;-)
### 更多探索
现在我解决了问题,我决定更详细的探索一下 **xfconf-query** 命令。不幸的是,该工具没有手册或信息页,**/usr/share** 中也没有任何文档。退而求其次,使用 **-h** 选项获取一些帮助信息。
```
$ xfconf-query -h
 Usage:
   xfconf-query [OPTION…] - Xfconf commandline utility
 Help Options:
   -h, --help            显示帮助选项
 Application Options:
   -V, --version         版本信息
   -c, --channel         询问/修改通道
   -p, --property        询问/修改属性
   -s, --set             更新权限的值
   -l, --list            罗列属性(或者通道 如果没有用 -c 指定)
   -v, --verbose         详细输出
   -n, --create          当新属性不存在,则创建它
   -t, --type            指定属性值类型
   -r, --reset           重置属性
   -R, --recursive       递归(与 -r 一起使用)
   -a, --force-array     即使只有一个元素也强制数组
   -T, --toggle          反转现有的布尔属性
   -m, --monitor         监视属性更改的通道
```
这没有多大帮助,但无论如何我们都可以从中找出一些好处。首先, _通道_ 以属性分组便于修改。我对 **general** 通道进行了更改,属性为 **workspace_count** 。 让我们看看完整的通道列表。
```
$ xfconf-query -l
Channels:
  xfwm4
  xfce4-keyboard-shortcuts
  xfce4-notifyd
  xsettings
  xfdashboard
  thunar
  parole
  xfce4-panel
  xfce4-appfinder
  xfce4-settings-editor
  xfce4-power-manager
  xfce4-session
  keyboards
  displays
  keyboard-layout
  ristretto
  xfcethemer
  xfce4-desktop
  pointers
  xfce4-settings-manager
  xfce4-mixer
```
给定通道的属性也可以用下列的命令来查看。我使用 **less** 寻呼机,因为结果是一长串数据。我已经缩减了下表,但留下了足够的空间来查看你可以找到的条目类型。
```
$ xfconf-query -c xfwm4 -l | less
/general/activate_action
/general/borderless_maximize
/general/box_move
/general/box_resize
/general/button_layout
/general/button_offset
<SNIP>
/general/workspace_count
/general/workspace_names
/general/wrap_cycle
/general/wrap_layout
/general/wrap_resistance
/general/wrap_windows
/general/wrap_workspaces
/general/zoom_desktop
(END)
```
你可以用这种方式探索所有的通道。我发现频道通常对应 **设置管理器** 中的各种设置。属性是你将在这些对话框中设置的属性。请注意,并非您会在 **设置管理器** 对话窗口中找到的所有图标都是 **Xfce** 桌面的一部分,因此它们没有对应的通道。 **屏幕保护程序** 就是一个例子,因为它是通用的 GNU 屏幕保护程序,并不是 **Xfce** 独有的。 **设置管理器****Xfce** 定位这些配置工具的一个很好的中心位置。
### 总结
综上所述,在 **xconf-query** 命令似乎没有任何手册或信息页,并且我在网上发现了一些错误的糟糕的记录信息。我发现对 **Xfce4** 来说最好的文件是 [Xfce 网站][2],以及一些具体信息可以在 **xconf-query** 找到。、
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/1/remote-configuration-xfce4
作者:[David Both][a]
选题:[lujun9972][b]
译者:[Donke-Hao](https://github.com/Donke-Hao)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer)
[2]: https://www.xfce.org/