mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
5670fd39bb
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12301-1.html)
|
||||
[#]: subject: (How to Install Nvidia Drivers on Fedora Linux)
|
||||
[#]: via: (https://itsfoss.com/install-nvidia-drivers-fedora/)
|
||||
[#]: author: (John Paul https://itsfoss.com/author/john/)
|
||||
@ -10,6 +10,8 @@
|
||||
如何在 Fedora Linux 中安装 Nvidia 驱动
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202006/10/094702c7of7scjyucmc5f1.jpg)
|
||||
|
||||
与大多数 Linux 发行版一样,[Fedora][1] 并未默认安装专有的 [Nvidia][2] 驱动。
|
||||
|
||||
默认的开源 [Nouveau 驱动][3]在大多数情况下都可以使用,但是你可能会遇到屏幕撕裂等问题。
|
||||
@ -38,15 +40,15 @@ sudo dnf update
|
||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
不喜欢终端么?那使用 GUI 的方法添加 RPMFusion 仓库。
|
||||
|
||||
如果你使用 Firefox,那么还可以从浏览器添加 RPMFusion 仓库。进入[配置页面][7],然后向下滚动到 “Graphical Setup via Firefox web browser”。单击自由和非自由仓库链接。这将下载 .rpm 文件,并安装仓库。
|
||||
|
||||
![RPMFusion Browser Installation][8]
|
||||
|
||||
你可以双击下载的 RPM 文件进行安装。
|
||||
|
||||
![RPMFusion in the Software Center][9]
|
||||
> 不喜欢终端么?那使用 GUI 的方法添加 RPMFusion 仓库。
|
||||
>
|
||||
> 如果你使用 Firefox,那么还可以从浏览器添加 RPMFusion 仓库。进入这个[配置页面][7],然后向下滚动到 “Graphical Setup via Firefox web browser”。单击自由和非自由仓库的链接。这将下载 .rpm 文件,并安装仓库。
|
||||
>
|
||||
> ![RPMFusion Browser Installation][8]
|
||||
>
|
||||
> 你可以双击下载的 RPM 文件进行安装。
|
||||
>
|
||||
> ![RPMFusion in the Software Center][9]
|
||||
|
||||
#### 步骤 3
|
||||
|
||||
@ -64,7 +66,7 @@ lspci -vnn | grep VGA
|
||||
|
||||
#### 步骤 4
|
||||
|
||||
要安装所需的驱动,请在终端中输入以下一个命令。下面的命令是用于显卡的命令。根据你的系统进行更新。
|
||||
要安装所需的驱动,请在终端中输入以下一个命令。下面的命令是用于我的显卡的命令。根据你的系统相应调整。
|
||||
|
||||
```
|
||||
sudo dnf install akmod-nvidia sudo dnf install xorg-x11-drv-nvidia-390xx akmod-nvidia-390xx sudo dnf install xorg-x11-drv-nvidia-340xx akmod-nvidia-340xx
|
||||
@ -74,13 +76,13 @@ sudo dnf install akmod-nvidia sudo dnf install xorg-x11-drv-nvidia-390xx akmod-n
|
||||
|
||||
#### 步骤 5
|
||||
|
||||
要使更改生效,请重启系统。你的系统重启可能需要更长的时间,因为它将 Nvidia 驱动注入到 Linux 内核中。
|
||||
要使更改生效,请重启系统。你的系统重启可能需要比较长的时间,因为它将 Nvidia 驱动注入到 Linux 内核中。
|
||||
|
||||
重启并登录系统后,你会看到更好的视觉效果,并且不会出现屏幕撕裂的情况。
|
||||
|
||||
![Fedora with Nvidia drivers][15]
|
||||
|
||||
#### 额外的提示:
|
||||
### 额外的提示
|
||||
|
||||
这是可选步骤,但建议这样做。添加 RPMFusion 仓库时,你可以访问常规仓库中不可用的多媒体包。
|
||||
|
||||
@ -96,7 +98,7 @@ sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=Pack
|
||||
sudo dnf groupupdate sound-and-video
|
||||
```
|
||||
|
||||
希望本教程对在 Fedora 上安装 Nvidia 驱动很有用。你还想在 It’s FOSS 上看到其他 Fedora 教程吗?
|
||||
希望本教程对在 Fedora 上安装 Nvidia 驱动很有用。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -105,7 +107,7 @@ via: https://itsfoss.com/install-nvidia-drivers-fedora/
|
||||
作者:[John Paul][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,131 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Track Your Screen Time in Linux with ActivityWatch)
|
||||
[#]: via: (https://itsfoss.com/activitywatch/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Track Your Screen Time in Linux with ActivityWatch
|
||||
======
|
||||
|
||||
_**Brief: ActivityWatch is an open-source privacy-friendly app that tracks how you spend your time on a desktop computer or on a mobile device.**_
|
||||
|
||||
### ActivityWatch: An open-source app to track how much time you spend on which application
|
||||
|
||||
![ActivityWatch lets you check the time spent on various applications][1]
|
||||
|
||||
[ActivityWatch][2] is a cross-platform open-source app that helps you track time to gauge your productivity. It lets you track the time you spent on applications, browsers, and if you were AFK (away from keyboard) or the system was hibernating.
|
||||
|
||||
Not just limited to tracking time, but it offers a bunch of useful features with visualizations that help you easily analyze how you spent time to potentially improve your productivity.
|
||||
|
||||
![][3]
|
||||
|
||||
It’s a great alternative to proprietary options like [RescueTime][4] and [ManicTime][5].
|
||||
|
||||
ActivityWatch is available for Linux, Windows, macOS and [Android][6]. It also offers browser extensions for both Chrome and Firefox. As of now, there’s no app available for iOS on the App Store.
|
||||
|
||||
![][7]
|
||||
|
||||
It’s fairly new to the scene and is being actively developed to address any existing issues and introduce new features like the ability to sync your activity data across multiple devices.
|
||||
|
||||
_**For privacy-focused users, I should mention that the data collected is stored locally on your device. That’s a good thing as you can track your spent time without being tracked by someone else.**_
|
||||
|
||||
### Features of ActivityWatch
|
||||
|
||||
![][8]
|
||||
|
||||
Basically, ActivityWatch lets you monitor your activity to analyze bad screen time or improve the time management for what you do on your device.
|
||||
|
||||
To break it down, it offers several useful options that I’d like to highlight here:
|
||||
|
||||
* Summary of your daily activity with apps/programs sorted as per the time spent using it.
|
||||
* Track the time of your browser activity using the extension to get the exact data on time spent on every active tab.
|
||||
* Tracks AFK and not-AFK time. (AFK — abbreviation for “Away From Keyboard” i.e. you’re not in front of your computer)
|
||||
* Offers different visualizations of timelines to monitor your activity
|
||||
* Ability to track the time you spend writing code on an editor using [watchers][9].
|
||||
* History of your activity to analyze your productivity
|
||||
* Categorize the time spent to help you analyze in detail
|
||||
* Lets you add more categories and tweak the duration of timeline.
|
||||
* Ability to export/import your data as [JSON][10] file.
|
||||
* Experimental stopwatch feature
|
||||
* Stores data locally to respect user privacy.
|
||||
|
||||
|
||||
|
||||
### Installing ActivityWatch on Linux
|
||||
|
||||
_**Note:** If your Linux distribution does not support system tray icons, you will have to follow the [documentation][11] for a workaround._
|
||||
|
||||
Unfortunately, you won’t find an AppImage, Flatpak or Snap for it.
|
||||
|
||||
However, you do get an [AUR][12] package to install for Manjaro or Arch Linux.
|
||||
|
||||
For all other Linux distributions, you get a ZIP file which includes an **aw-qt** application to run.
|
||||
|
||||
To do that, you have to [extract the zip archive file][13] and then run the binary to install it by double-clicking on the aw-qt application.
|
||||
|
||||
![Aw Qt][14]
|
||||
|
||||
You can also use the terminal as follows:
|
||||
|
||||
```
|
||||
cd activitywatch-v0.9.2-linux-x86_64
|
||||
sudo ./aw-qt
|
||||
```
|
||||
|
||||
The location and filename of the extracted folder might differ – so make sure you navigate to the correct directory and then use the commands above. Once done, you can access ActivityWatch from the system tray icon or simply head to [localhost:5600][15] to access it.
|
||||
|
||||
You can also check out their [GitHub page][16] or the [official website][2] to explore more about it.
|
||||
|
||||
[Download ActivityWatch][2]
|
||||
|
||||
Just for your information, if you plan on using ActivityWatch regularly, you should move the downloaded files to the /opt directory and create a link to aw-qt executable in /usr/share/bin directory. This way, the application will be available as a regular command for all the users on the system. A similar method has been demonstrated in the [PopcornTime installation tutorial][17].
|
||||
|
||||
### My Thoughts On ActivityWatch
|
||||
|
||||
![][18]
|
||||
|
||||
The time tracking works perfectly fine on [Pop!_OS 20.04][19] with the system tray icon support. You might encounter a bug that doesn’t let you access ActivityWatch from your system tray icon (which is also a [known issue on GitHub][20]). In that case, you need to access it through [localhost:5600][15].
|
||||
|
||||
Personally, I’m quite satisfied with the features offered considering that I use it on my desktop and have no plans to use it on my smartphone.
|
||||
|
||||
I’d definitely recommend you try this nice open-source project and support them along the way. If you like the project, feel free to show your appreciation by adding a star or sponsoring [their GitHub repository][21].
|
||||
|
||||
Feel free to let me know your thoughts in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/activitywatch/
|
||||
|
||||
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch.png?fit=800%2C607&ssl=1
|
||||
[2]: https://activitywatch.net/
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-afk.jpg?ssl=1
|
||||
[4]: https://itsfoss.com/recommends/rescuetime/
|
||||
[5]: https://www.manictime.com/
|
||||
[6]: https://play.google.com/store/apps/details?id=net.activitywatch.android
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-timeline.jpg?ssl=1
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-settings.jpg?ssl=1
|
||||
[9]: https://docs.activitywatch.net/en/latest/watchers.html
|
||||
[10]: https://en.wikipedia.org/wiki/JSON
|
||||
[11]: https://docs.activitywatch.net/en/latest/getting-started.html
|
||||
[12]: https://aur.archlinux.org/packages/activitywatch-bin/
|
||||
[13]: https://itsfoss.com/unzip-linux/
|
||||
[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/aw-qt.jpg?ssl=1
|
||||
[15]: https://itsfoss.com/activitywatch/5600
|
||||
[16]: https://github.com/ActivityWatch
|
||||
[17]: https://itsfoss.com/popcorn-time-ubuntu-linux/
|
||||
[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-screenshot.jpg?ssl=1
|
||||
[19]: https://itsfoss.com/pop-os-20-04-review/
|
||||
[20]: https://github.com/ActivityWatch/activitywatch/issues/208
|
||||
[21]: https://github.com/ActivityWatch/activitywatch
|
@ -1,221 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Add interactivity to your Python plots with Bokeh)
|
||||
[#]: via: (https://opensource.com/article/20/5/bokeh-python)
|
||||
[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan)
|
||||
|
||||
Add interactivity to your Python plots with Bokeh
|
||||
======
|
||||
Plotting in Bokeh is a little more complicated than in some of the other
|
||||
plotting libraries, but there's a payoff for the extra effort.
|
||||
![Hands on a keyboard with a Python book ][1]
|
||||
|
||||
In this series of articles, I'm looking at the characteristics of different Python plotting libraries by making the same multi-bar plot in each one. This time I'm focusing on [Bokeh][2] (pronounced "BOE-kay").
|
||||
|
||||
Plotting in Bokeh is a little more complicated than in some of the [other plotting libraries][3], but there's a payoff for the extra effort. Bokeh is designed both to allow you to create your own interactive plots on the web _and_ to give you detailed control over how the interactivity works. I'll show this by adding a tooltip to the multi-bar plot I've been using in this series. It plots data from UK election results between 1966 and 2020.
|
||||
|
||||
![A zoomed-in view on the plot][4]
|
||||
|
||||
A zoomed-in view on the plot (© 2019 [Anvil][5])
|
||||
|
||||
### Making the multi-bar plot
|
||||
|
||||
To make the multi-bar plot, you need to massage your data a little.
|
||||
|
||||
The original data looks like this:
|
||||
|
||||
|
||||
```
|
||||
>> print(long)
|
||||
year party seats
|
||||
0 1966 Conservative 253
|
||||
1 1970 Conservative 330
|
||||
2 Feb 1974 Conservative 297
|
||||
3 Oct 1974 Conservative 277
|
||||
4 1979 Conservative 339
|
||||
.. ... ... ...
|
||||
103 2005 Others 30
|
||||
104 2010 Others 29
|
||||
105 2015 Others 80
|
||||
106 2017 Others 59
|
||||
107 2019 Others 72
|
||||
|
||||
[60 rows x 3 columns]
|
||||
```
|
||||
|
||||
You can think of the data as a series of `seats` values for each possible `(year, party)` combination. That's exactly how Bokeh thinks of it. You need to make a list of `(year, party)` tuples:
|
||||
|
||||
|
||||
```
|
||||
# import the DataFrame shown above
|
||||
from votes import long as df
|
||||
|
||||
# Get a tuple for each possible (year, party) combination
|
||||
x = [(str(r[1]['year']), r[1]['party']) for r in df.iterrows()]
|
||||
|
||||
# This comes out as [('1922', 'Conservative'), ('1923', 'Conservative'), ... ('2019', 'Others')]
|
||||
```
|
||||
|
||||
These will be the x-values. The y-values are simply the seats:
|
||||
|
||||
|
||||
```
|
||||
` y = df['seats']`
|
||||
```
|
||||
|
||||
Now you have data that looks something like this:
|
||||
|
||||
|
||||
```
|
||||
x y
|
||||
('1966', 'Conservative') 253
|
||||
('1970', 'Conservative') 330
|
||||
('Feb 1974', 'Conservative') 297
|
||||
('Oct 1974', 'Conservative') 277
|
||||
('1979', 'Conservative') 339
|
||||
... ... ...
|
||||
('2005', 'Others') 30
|
||||
('2010', 'Others') 29
|
||||
('2015', 'Others') 80
|
||||
('2017', 'Others') 59
|
||||
('2019', 'Others') 72
|
||||
```
|
||||
|
||||
Bokeh needs you to wrap your data in some objects it provides, so it can give you the interactive functionality. Wrap your x and y data structures in a `ColumnDataSource` object:
|
||||
|
||||
|
||||
```
|
||||
from bokeh.models import ColumnDataSource
|
||||
|
||||
source = ColumnDataSource(data={'x': x, 'y': y})
|
||||
```
|
||||
|
||||
Then construct a `Figure` object and pass in your x-data wrapped in a `FactorRange` object:
|
||||
|
||||
|
||||
```
|
||||
from bokeh.plotting import figure
|
||||
from bokeh.models import FactorRange
|
||||
|
||||
p = figure(x_range=FactorRange(*x), width=2000, title="Election results")
|
||||
```
|
||||
|
||||
You need to get Bokeh to create a colormap—this is a special `DataSpec` dictionary it produces from a color mapping you give it. In this case, the colormap is a simple mapping between the party name and a hex value:
|
||||
|
||||
|
||||
```
|
||||
from bokeh.transform import factor_cmap
|
||||
|
||||
cmap = {
|
||||
'Conservative': '#0343df',
|
||||
'Labour': '#e50000',
|
||||
'Liberal': '#ffff14',
|
||||
'Others': '#929591',
|
||||
}
|
||||
fill_color = factor_cmap('x', palette=list(cmap.values()), factors=list(cmap.keys()), start=1, end=2)
|
||||
```
|
||||
|
||||
Now you can create the bar chart:
|
||||
|
||||
|
||||
```
|
||||
` p.vbar(x='x', top='y', width=0.9, source=source, fill_color=fill_color, line_color=fill_color)`
|
||||
```
|
||||
|
||||
Visual representations of data on Bokeh charts are referred to as glyphs, so you've created a set of bar glyphs.
|
||||
|
||||
Tweak the details of the graph to get it looking how you want:
|
||||
|
||||
|
||||
```
|
||||
p.y_range.start = 0
|
||||
p.x_range.range_padding = 0.1
|
||||
p.yaxis.axis_label = 'Seats'
|
||||
p.xaxis.major_label_orientation = 1
|
||||
p.xgrid.grid_line_color = None
|
||||
```
|
||||
|
||||
And finally, tell Bokeh you'd like to see your plot now:
|
||||
|
||||
|
||||
```
|
||||
from bokeh.io import show
|
||||
|
||||
show(p)
|
||||
```
|
||||
|
||||
This writes the plot to an HTML file and opens it in the default web browser. Here's the result:
|
||||
|
||||
![A multi-bar plot in Bokeh][6]
|
||||
|
||||
A multi-bar plot in Bokeh (© 2019 [Anvil][5])
|
||||
|
||||
This already has some interactive features, such as a box zoom:
|
||||
|
||||
![Bokeh's built-in box zoom][7]
|
||||
|
||||
Bokeh's built-in box zoom (© 2019 [Anvil][5])
|
||||
|
||||
But the great thing about Bokeh is how you can add your own interactivity. Explore that in the next section by adding tooltips to the bars.
|
||||
|
||||
### Adding tooltips to the bars
|
||||
|
||||
To add tooltips to the bars, you just need to create a `HoverTool` object and add it to your figure:
|
||||
|
||||
|
||||
```
|
||||
h = HoverTool(tooltips=[
|
||||
('Seats', '@y'),
|
||||
('(Year, Party)', '(@x)')
|
||||
])
|
||||
p.add_tools(h)
|
||||
```
|
||||
|
||||
The arguments define what data is displayed on the tooltips. The variables `@y` and `@x` refer to the variables you passed into the `ColumnDataSource`. There are a few other values you could use; for example, the position of the cursor on the plot is given by `$x` and `$y` (no relation to `@x` and `@y`).
|
||||
|
||||
Here's the result:
|
||||
|
||||
![The election graph, now with tooltips][8]
|
||||
|
||||
The election graph, now with tooltips (© 2019 [Anvil][5])
|
||||
|
||||
Thanks to Bokeh's HTML output, you get the full interactive experience when you embed the plot in a web app. You can copy this example as an Anvil app [here][9] (Note: Anvil requires registration to use).
|
||||
|
||||
Now you can see the reason for the extra effort of wrapping all your data in Bokeh in objects such as `ColumnDataSource`. In return, you can add interactivity with relative ease.
|
||||
|
||||
### Back to simplicity: Altair
|
||||
|
||||
Bokeh is one of the four most popular plotting libraries, and this series is looking into [what makes each of them special][3].
|
||||
|
||||
I'm also looking at a couple of libraries that stand out for their interesting approach. Next, I'll look at [Altair][10], whose declarative API means it can make really complex plots without causing brain ache.
|
||||
|
||||
* * *
|
||||
|
||||
_This article is based on [How to make plots using Bokeh][5] on Anvil's blog and is reused with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/5/bokeh-python
|
||||
|
||||
作者:[Shaun Taylor-Morgan][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/shaun-taylor-morgan
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book )
|
||||
[2]: https://bokeh.org/
|
||||
[3]: https://opensource.com/article/20/4/plot-data-python
|
||||
[4]: https://opensource.com/sites/default/files/uploads/bokeh-closeup.png (A zoomed-in view on the plot)
|
||||
[5]: https://anvil.works/blog/plotting-in-bokeh
|
||||
[6]: https://opensource.com/sites/default/files/uploads/bokeh_0.png (A multi-bar plot in Bokeh)
|
||||
[7]: https://opensource.com/sites/default/files/uploads/bokeh-box-zoom.gif (Bokeh's built-in box zoom)
|
||||
[8]: https://opensource.com/sites/default/files/uploads/bokeh-tooltips.gif (The election graph, now with tooltips)
|
||||
[9]: https://anvil.works/build#clone:CFRUWSM6PQ6JUUXH%3dSX4SACDSXBB4UOIVEVPWXH55%7cMYTOLCU2HM5WKJYM%3d6VJKGRSF74TCCVDG5CTVDOCS
|
||||
[10]: https://altair-viz.github.io/
|
@ -1,104 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using AppImage for Linux package management)
|
||||
[#]: via: (https://opensource.com/article/20/6/appimages)
|
||||
[#]: author: (David Clinton https://opensource.com/users/dbclinton)
|
||||
|
||||
Using AppImage for Linux package management
|
||||
======
|
||||
AppImage distributes applications within self-contained environments
|
||||
that work on any Linux distribution.
|
||||
![Gift box opens with colors coming out][1]
|
||||
|
||||
A big part of administrating Linux machines—especially remote machines—is managing and installing software. When something goes wrong with a local application or when something on the filesystem breaks and needs fixing, you're often going to want to push updates without having to travel many miles to sit down in front of a physical screen. As I explain in my Pluralsight course [Linux system maintenance and troubleshooting][2], a lot of problems can be solved through Bash scripts of course, but there are still plenty of cases where there's no alternative to a good, old fashioned binary.
|
||||
|
||||
Imagine that some of your remote systems need new applications installed, so the team members using those computers will be able to perform some business function. Being able to leverage the integration and automation of one of the major Linux repository systems—like Debian or RPM—can make your administration tasks a whole lot easier.
|
||||
|
||||
As Linus Torvalds never tires of reminding us, the problem with many Linux software management systems is that there are [too many Linux software management systems][3]. Over the years, app development and even Linux adoption have been complicated by the fact that all the time and work you invest in preparing your software for, say, Debian repos, won't help you if you want to get them into RPM systems. And neither will help for SUSE's Zypper manager.
|
||||
|
||||
One promising solution to the software silo problem is to distribute applications with their own self-contained environments that'll work on any Linux distribution. One option of a standard in this young and growing field is [AppImage][4].
|
||||
|
||||
### Working with AppImages
|
||||
|
||||
I'm all-in on AppImage. Like the other package management systems I've mentioned, there's plenty of complexity available should you want it. But, at its core, AppImages are actually quite straightforward. Rather than working through a repo like most other package managers, AppImages are single, standalone files that can be sent directly or shared through a website.
|
||||
|
||||
Here's an illustration of its beauty. While I was playing around with AppImages, I came across a very old discussion on a tech forum that led me to an equally old and abandoned GitHub project and associated YAML and recipe files. They were designed to automatically build the rather complex infrastructure required to prepare the archive needed to generate an AppImage package. Although that infrastructure was all built to run on a five-year-old release of Ubuntu, when I put it all together and ran the `appimagetool` command against it, it created an AppImage file that worked seamlessly on my current desktop. I don't think there are too many five-year-old GitHub projects of that complexity that could run using other technologies without some serious reworking.
|
||||
|
||||
But I'm not going to go there. Instead, I'm going to show you how it works with a very simple Hello World application. First, make sure the AppStream package is installed locally.
|
||||
|
||||
For Debian-based system, run:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo apt install appstream`
|
||||
```
|
||||
|
||||
And for RPM systems, use:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install appstream`
|
||||
```
|
||||
|
||||
Clone the Git repo referenced in [this article][5], which I based this example on:
|
||||
|
||||
|
||||
```
|
||||
$ git clone <https://github.com/boolean-world/appimage-resources>
|
||||
$ cd appimage-resources
|
||||
$ ls hello-world-appimage
|
||||
```
|
||||
|
||||
Next, `cd` into the new directory Git created, and take a look around. There are two directories here. Use `hello-world-appimage`; the other one is a more complex project, and you should consider giving it a try, too.
|
||||
|
||||
The `helloworld.desktop` file is what Linux GUI systems read to know how to handle the way they present a desktop icon. As it turns out, the way the file is currently written will give you trouble a bit later, so make one minor edit: add a `Categories=` line and give it the value `GNOME`. And don't forget the semicolon at the end:
|
||||
|
||||
|
||||
```
|
||||
$ nano hello-world-appimage/helloworld.desktop
|
||||
add Categories=GNOME;
|
||||
```
|
||||
|
||||
Download a precompiled copy of the `appimagetool` binary from [the AppImage GitHub project][6]. Make a point of visiting the GitHub site—there's plenty of excellent documentation and resources there. Once the binary is downloaded, make the file executable and point it at the `hello-world-appimage` directory. But first, you need to tell it what architecture you want. For some reason, a tool with a name that ends in `x86_64` is all wobbly when it comes to choosing whether to build an application using x86_64 or not (I'm not sure what's going on there):
|
||||
|
||||
|
||||
```
|
||||
$ wget <https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86\_64.AppImage>
|
||||
$ chmod +x appimagetool-x86_64.AppImage
|
||||
$ ARCH=x86_64 ./appimagetool-x86_64.AppImage hello-world-appimage
|
||||
```
|
||||
|
||||
If you don't see any angry error messages, you're all set to give it a run:
|
||||
|
||||
|
||||
```
|
||||
$ ls
|
||||
$ ./hello-world-appimage-x86_64.AppImage
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
AppImage is an incredibly effective choice for package management. As you explore it, I think you'll find it's a great alternative to the defaults Linux distributions provide.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/appimages
|
||||
|
||||
作者:[David Clinton][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/dbclinton
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
|
||||
[2]: https://pluralsight.pxf.io/VMKQj
|
||||
[3]: https://itsfoss.com/desktop-linux-torvalds/
|
||||
[4]: https://appimage.org/
|
||||
[5]: https://www.booleanworld.com/creating-linux-apps-run-anywhere-appimage/
|
||||
[6]: https://github.com/AppImage/AppImageKit/releases
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: ()
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,130 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Style your data plots in Python with Pygal)
|
||||
[#]: via: (https://opensource.com/article/20/6/pygal-python)
|
||||
[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan)
|
||||
|
||||
Style your data plots in Python with Pygal
|
||||
======
|
||||
An introduction one of the more stylish Python plotting libraries.
|
||||
![Python in a coffee cup.][1]
|
||||
|
||||
[Python][2] is full of libraries that can visualize data. One of the more interactive options comes from Pygal, which I consider the library for people who like things to look good. It generates beautiful SVG (Scalable Vector Graphics) files that users can interact with. SVG is a standard format for interactive graphics, and it can lead to rich user experiences with only a few lines of Python.
|
||||
|
||||
### Using Pygal for stylish Python plots
|
||||
|
||||
In this introduction, we want to recreate this multi-bar plot, which represents the UK election results from 1966 to 2020:
|
||||
|
||||
![Pygal plot][3]
|
||||
|
||||
Before we go further, note that you may need to tune your Python environment to get this code to run, including the following.
|
||||
|
||||
* Running a recent version of Python (instructions for [Linux][4], [Mac][5], and [Windows][6])
|
||||
* Verify you're running a version of Python that works with these libraries
|
||||
|
||||
|
||||
|
||||
The data is available online and can be imported using pandas:
|
||||
|
||||
|
||||
```
|
||||
import pandas as pd
|
||||
df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv>')
|
||||
```
|
||||
|
||||
Now we're ready to go. The data looks like this:
|
||||
|
||||
|
||||
```
|
||||
year conservative labour liberal others
|
||||
0 1966 253 364 12 1
|
||||
1 1970 330 287 6 7
|
||||
2 Feb 1974 297 301 14 18
|
||||
.. ... ... ... ... ...
|
||||
12 2015 330 232 8 80
|
||||
13 2017 317 262 12 59
|
||||
14 2019 365 202 11 72
|
||||
```
|
||||
|
||||
|
||||
|
||||
Plotting this in Pygal builds up in a way that I find easy to read. First, we define the style object in a way that will simplify our bar chart definition. Then we pass the custom style along with other metadata to a `Bar` object:
|
||||
|
||||
|
||||
```
|
||||
import pygal
|
||||
from pygal.style import Style
|
||||
|
||||
custom_style = Style(
|
||||
colors=('#0343df', '#e50000', '#ffff14', '#929591'),
|
||||
font_family='Roboto,Helvetica,Arial,sans-serif',
|
||||
background='transparent',
|
||||
label_font_size=14,
|
||||
)
|
||||
|
||||
c = pygal.Bar(
|
||||
title="UK Election Results",
|
||||
style=custom_style,
|
||||
y_title='Seats',
|
||||
width=1200,
|
||||
x_label_rotation=270,
|
||||
)
|
||||
```
|
||||
|
||||
Then, we `add` our data into the `Bar` object:
|
||||
|
||||
|
||||
```
|
||||
c.add('Conservative', df['conservative'])
|
||||
c.add('Labour', df['labour'])
|
||||
c.add('Liberal', df['liberal'])
|
||||
c.add('Others', df['others'])
|
||||
|
||||
c.x_labels = df['year']
|
||||
```
|
||||
|
||||
Finally, we save the plot as an SVG file:
|
||||
|
||||
|
||||
```
|
||||
`c.render_to_file('pygal.svg')`
|
||||
```
|
||||
|
||||
The result is an interactive SVG plot you can see in this gif:
|
||||
|
||||
![The Python pygal library can generate rich SVG files as seen here][7]
|
||||
|
||||
Beautifully simple, and with beautiful results.
|
||||
|
||||
### Conclusion
|
||||
|
||||
Some plotting options in Python require building every object in great detail, and Pygal gives you that functionality from the start. Give Pygal a go if you have data on hand and you want to make a clean, beautiful, and simple plot for user interaction.
|
||||
|
||||
\---
|
||||
|
||||
_This article was first shared [here][8] and is edited and republished with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/pygal-python
|
||||
|
||||
作者:[Shaun Taylor-Morgan][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/shaun-taylor-morgan
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.)
|
||||
[2]: https://opensource.com/article/20/4/plot-data-python
|
||||
[3]: https://opensource.com/sites/default/files/uploads/pygal_1.png (Pygal plot)
|
||||
[4]: https://opensource.com/article/20/4/install-python-linux
|
||||
[5]: https://opensource.com/article/19/5/python-3-default-mac
|
||||
[6]: https://opensource.com/article/19/8/how-install-python-windows
|
||||
[7]: https://opensource.com/sites/default/files/uploads/pygal-interactive_3.gif (The Python pygal library can generate rich SVG files as seen here)
|
||||
[8]: https://anvil.works/blog/plotting-in-pygal
|
@ -0,0 +1,85 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (humanID Project: Restoring Civil Discussion Through Better Online Identity)
|
||||
[#]: via: (https://www.linux.com/audience/developers/humanid-project-restoring-civil-discussion-through-better-online-identity/)
|
||||
[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/)
|
||||
|
||||
humanID Project: Restoring Civil Discussion Through Better Online Identity
|
||||
======
|
||||
|
||||
[![][1]][2]
|
||||
|
||||
[![][1]][2]
|
||||
|
||||
Every day, billions of people use social sign-ons, such as “Login with Facebook”, to access applications over the Internet. A major drawback of this system is the inability to distinguish a real human user from a bot.
|
||||
|
||||
Nonprofit organization [humanID][3], a recipient of [Harvard University’s Social Impact Fund][4], came up with an innovative idea: develop a one-click anonymous sign-on that serves as an alternative to social sign-on.
|
||||
|
||||
“With humanID, everyone can use services without giving up privacy or having their data sold. Bot networks are automatically excluded, while applications can easily block abusive users and trolls, creating more civil digital communities,” says [Bastian Purrer, Co-Founder of humanID][5].
|
||||
|
||||
humanID was born during Purrer’s stint in Indonesia. He was helping out a political party’s campaign and was aghast to discover how much of the political conversation during the election was controlled by bots and trolls.
|
||||
|
||||
When he realized that political parties routinely deploy bots to promote propaganda and false facts, it became clear that the key to restoring civil discussion, and the vision of an internet for everyone, was better online identity.
|
||||
|
||||
**The mission
|
||||
** Besides Purrer, humanID’s other co-founders are [Sidiq Permana][6] and [Shuyao Kong][7]. Together, they lead a 20-person organization, with the tech team based in Indonesia while the business team is in Boston.
|
||||
|
||||
“Fixing the Internet is the core mission that unites all three co-founders. Having witnessed how public opinions and sentiments are swayed by fake accounts, we believe that restoring online identity is the first step to restoring authenticity and accountability on the Internet,” says Kong. “We target consumer use cases that are currently serviced by email-and- password, or social sign-ons. This includes the majority of apps on our phones.”
|
||||
|
||||
Purrer says the goal of the project is to have one humanID per person. “We want people to have control over their own identity from a privacy perspective. We want humanID to be so intuitive and prevalent that it becomes the default identity layer for applications.”
|
||||
|
||||
An identity is a permanent representation within a certain context. On the Internet, just like in real life, our identity differs from community to community. humanID enables this, by giving users a different, unique identity in every community.
|
||||
|
||||
“It is, if the user chooses so, also a different identity than their offline identity. This is where anonymity comes in. Anonymity means that your offline identity, your physical self, cannot be revealed based on your digital identity,” says Kong, who has worked previously in the blockchain and privacy space.
|
||||
|
||||
Permana, who’s leading humanID’s technical development, says, “We achieve this by hashing users’ phone numbers, with a unique, different hash for each user and each application — making cross-referencing between communities impossible. The irreversibility of the hashes ensures secure anonymity. The fact that we do not permanently save any unhashed information makes it impossible, not just for our partner applications but even for ourselves, to reveal a user’s offline identity in the form of his phone number.”
|
||||
|
||||
The humanID team believes a persistent, safe identity will be better than any of the existing online identities that are not safe from surveillance and cannot be held accountable for their online behavior.
|
||||
|
||||
**The underlying tech
|
||||
** humanID reached out to the Linux Foundation because it saw “tremendous value to be part of the force that’s driving the industry standard.”
|
||||
|
||||
“The Internet is built on layers of open-source, free-to-use protocols. humanID is created in this tradition. The solution hashes users’ phone numbers and email addresses, securing them safely away from hackers and media giants. Each user will have a unique hash for each application he or she signs on so there’s no cross-referencing,” explains Purrer.
|
||||
|
||||
“Our database stores users’ country codes, but relinquishes access to the rest of the information we hash. We are using OAuth at the moment, but actively exploring tech that enhances the security of humanID. Developers can implement the social login within a few hours of work,” he says.
|
||||
|
||||
**The use cases
|
||||
** One use case they are deploying for their first client [GreenZone][8] is tracking COVID without sacrificing users’ privacy. Permana explains, “GreenZone is a tracking application that doesn’t track users’ location. Instead, it shows ‘green zones’ of low-risk areas where no symptoms are reported, therefore, alleviating anxiety by showing users whether they are in a safe zone or not. All data is entirely peer-to-peer and there is no government, police or regulators involved.”
|
||||
|
||||
According to him, humanID’s first set of customers will be those that are privacy-conscious because their customers demand native privacy when using their product. These businesses include COVID-tracking, health and self-tracking apps, self-help forums, and VPNs.
|
||||
|
||||
“We also target social networks, petition sites, and any site with a forum or comment section. All of these businesses suffer heavily from spam abuse and automated accounts. With humanID, everyone can use services without giving away privacy or having their data sold. Bot networks are automatically excluded, while applications can easily block abusive users and trolls,” he says.
|
||||
|
||||
Purrer clarifies that humanID does not intend to replace government-issued IDs or business-internal identity management.
|
||||
|
||||
“We don’t intend to compete with these existing businesses or standards, but to add a new and fresh idea in the struggle to bring back privacy, safety and accountability on the web,” he says.
|
||||
|
||||
The project has been driven by open source and volunteer work for 1.5 years. “We’re actively seeking support and grants to accelerate our work to bring humanID to market and sign up clients. Beyond this, we aim to cover our cost from our client base and not be dependent on charitable donations beyond 2022,” Purrer adds.
|
||||
|
||||
Check out the demo below, if you have any questions feel free to contact the team on [github][9].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/audience/developers/humanid-project-restoring-civil-discussion-through-better-online-identity/
|
||||
|
||||
作者:[Swapnil Bhartiya][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://www.linux.com/author/swapnil/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linux.com/wp-content/uploads/2020/06/icon-1080750_1920-1068x1068.png (icon-1080750_1920)
|
||||
[2]: https://www.linux.com/wp-content/uploads/2020/06/icon-1080750_1920.png
|
||||
[3]: https://www.human-id.org/
|
||||
[4]: https://innovationlabs.harvard.edu/social-impact-fellowship-fund/#:~:text=What%20is%20the%20social%20impact,five%20years%2C%20beginning%20in%202019.
|
||||
[5]: https://www.linkedin.com/in/bastianpurrer/
|
||||
[6]: https://www.linkedin.com/in/sidiqpermana/
|
||||
[7]: https://www.linkedin.com/in/shuyao-kong/
|
||||
[8]: https://greenzone.live/beta/
|
||||
[9]: https://github.com/bluenumberfoundation
|
@ -0,0 +1,130 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Change Folder Color in Ubuntu 20.04)
|
||||
[#]: via: (https://itsfoss.com/folder-color-ubuntu/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
How to Change Folder Color in Ubuntu 20.04
|
||||
======
|
||||
|
||||
The default Yaru theme in [Ubuntu 20.04][1] gives it a polished, modern look. The folders in the default Yaru theme have a purple-aubergine touch to keep in line with the branding of Ubuntu.
|
||||
|
||||
If you are not a fan of the purple shade, you have the freedom to change the color theme in Ubuntu.
|
||||
|
||||
You may change the theme of Ubuntu to give it a different color but that would mean ditching Yaru theme.
|
||||
|
||||
If you just want to change the folder color in Ubuntu 20.04, there are two ways to do that:
|
||||
|
||||
* Give a different color and emblem to selected folders (for better organizing the files and folders)
|
||||
* Change the colors for all folders by changing the Yaru color theme
|
||||
|
||||
|
||||
|
||||
Let me show you both methods.
|
||||
|
||||
### Change folder colors and emblem for selected files and folders
|
||||
|
||||
![][2]
|
||||
|
||||
I know that some people keep their folders in different color/location to indicate whether a work is in progress or pending or completed.
|
||||
|
||||
If you are one of those people, you can use the [Folder Color utility][3] and change the color of the folders. You may also add emblem to the folders (the green tick sign for competition, + sign for new, exclamation mark for important etc). You can see some examples in the previous image.
|
||||
|
||||
You can also use the Folder Color utility on files. You cannot change the color files icons but you can add emblems to them.
|
||||
|
||||
If you are [using Yaru theme][4] in Ubuntu 20.04, you can use the [official PPA][5]:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:costales/yaru-colors-folder-color
|
||||
```
|
||||
|
||||
Now install Folder Color with Yaru compatibility package.
|
||||
|
||||
```
|
||||
sudo apt install folder-color yaru-colors-folder-color
|
||||
```
|
||||
|
||||
Once installed, you’ll have to restart Nautilus file manager using **nautilus -q** command. After that, you can go to the file manager, right click on a folder or file. You’ll see a Folder’s Color option in the context menu. You’ll see the color and emblem options here.
|
||||
|
||||
![][6]
|
||||
|
||||
You can also **restore the original folder color by choosing Default** in the menu.
|
||||
|
||||
For Ubuntu 18.04 or older versions, Folder Color is available to install from the software center. The Folder Color utility is also available for Linux Mint/Cinnamon desktop’s Nemo file manager and MATE desktop’s [Caja file manager][7].
|
||||
|
||||
How to remove Folder Color tool?
|
||||
|
||||
If you don’t want to use Folder Color, you may remove the app and delete the PPA. First remove the app:
|
||||
|
||||
```
|
||||
sudo apt remove folder-color yaru-colors-folder-color
|
||||
```
|
||||
|
||||
Now [remove the PPA][8]:
|
||||
|
||||
```
|
||||
sudo add-apt-repository -r ppa:costales/yaru-colors-folder-color
|
||||
```
|
||||
|
||||
### Yaru Colors theme pack to change the color variant of Yaru theme
|
||||
|
||||
![Yaru Colors Blue Theme Variant][9]
|
||||
|
||||
If you want to keep on using Yaru theme but with a different color variant, [Yaru Colors theme pack][10] is what you need.
|
||||
|
||||
Yaru Colors consists of 12 color variants of Yaru. The colors are aqua, blue, brown, deep blue, green, grey, MATE green, orange, pink, purple, red and yellow.
|
||||
|
||||
The themes consist of GTK theme, icons, cursor them and GNOME shell theme.
|
||||
|
||||
* Icons- Changes the accent color of folders
|
||||
* GTK themes- Changes the accent color of the application windows
|
||||
* cursor theme- Adds an almost negligible colored outline to the cursor
|
||||
* GNOME Shell theme- Changes the accent color in the message tray and system tray
|
||||
|
||||
|
||||
|
||||
You can download Yaru Colors theme pack from its GitHub repository:
|
||||
|
||||
Download Yaru Colors theme pack
|
||||
|
||||
When you extract the content you’ll find icons, Themes folders and both of these folders contains the twelve mentioned color variants. You can copy the icons and Themes folder in ~/.local/share/.icons and ~/.local/share/themes folders respectively.
|
||||
|
||||
If you are not comfortable doing it all by yourself, you’ll find the install.sh shell script in the extract folder. You can run it to install all or selected few themes via an interactive terminal session.
|
||||
|
||||
![][11]
|
||||
|
||||
To change the GNOME Shell theme, you’ll have to [use GNOME Tweak tool][12]. You may also use GNOME Tweak to change the icons and themes back to the default ones.
|
||||
|
||||
![][13]
|
||||
|
||||
Enjoy adding color to your Ubuntu life :)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/folder-color-ubuntu/
|
||||
|
||||
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/download-ubuntu-20-04/
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/folder-colors-yaru-ubuntu.png?ssl=1
|
||||
[3]: https://foldercolor.tuxfamily.org/
|
||||
[4]: https://itsfoss.com/ubuntu-community-theme/
|
||||
[5]: https://launchpad.net/folder-color
|
||||
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/change-folder-color-ubuntu.png?ssl=1
|
||||
[7]: https://github.com/mate-desktop/caja
|
||||
[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/yaru-colors-blue-theme-variant.jpg?ssl=1
|
||||
[10]: https://github.com/Jannomag/Yaru-Colors
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/yaru-colors-theme-install.png?resize=800%2C513&ssl=1
|
||||
[12]: https://itsfoss.com/gnome-tweak-tool/
|
||||
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/restore-yaru-gnome-tweak.png?resize=800%2C557&ssl=1
|
@ -0,0 +1,127 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Track Your Screen Time in Linux with ActivityWatch)
|
||||
[#]: via: (https://itsfoss.com/activitywatch/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
使用 ActivityWatch 跟踪你在 Linux 中的屏幕使用时间
|
||||
======
|
||||
|
||||
> ActivityWatch 是一款开源的隐私友好型应用程序,可追踪你在台式电脑或移动设备上的使用时间。
|
||||
|
||||
### ActivityWatch: 一个追踪你在哪个应用程序上花了多少时间的开源应用程序
|
||||
|
||||
![ActivityWatch lets you check the time spent on various applications][1]
|
||||
|
||||
[ActivityWatch][2] 是一款跨平台的开源应用,可以帮助你追踪时间,衡量你的工作效率。它可以追踪你花在应用程序、浏览器上的时间,以及你是否 AFK(远离键盘)或系统处于休眠状态。
|
||||
|
||||
不只是追踪时间,它还提供了一堆有用的功能,通过可视化的方式帮助你轻松分析你是如何花费时间的,从而有可能提高你的生产力。
|
||||
|
||||
![][3]
|
||||
|
||||
它是 [RescueTime][4] 和 [ManicTime][5] 等专有产品的绝佳替代品。
|
||||
|
||||
ActivityWatch 可用于 Linux、Windows、macOS 和 [Android][6]。它还提供了 Chrome 和 Firefox 的浏览器扩展。截至目前,App Store 上还没有它的 iOS 版应用。
|
||||
|
||||
![][7]
|
||||
|
||||
它刚刚进入该领域,正在积极开发,以解决任何现有的问题,并引入新的功能,如在多个设备上同步你的活动数据的能力。
|
||||
|
||||
**对于注重隐私的用户来说,我应该提到,收集的数据被存储在你本地的设备上。这是一件好事,因为你可以跟踪你的花费时间,而不会被别人跟踪。**
|
||||
|
||||
### ActivityWatch 的功能
|
||||
|
||||
![][8]
|
||||
|
||||
基本上,ActivityWatch 可以让你监控你的活动,以分析不良的屏幕使用时间,或改善你在设备上做事的时间管理。
|
||||
|
||||
具体来说,它提供了几个有用的功能,主要有:
|
||||
|
||||
* 摘要你的日常活动及按使用时间排序的应用和程序列表。
|
||||
* 追踪你的浏览器活动的时间,使用浏览器扩展来获得每个活动标签所花费时间的确切数据。
|
||||
* 追踪 AFK 和非 AFK 时间。(AFK - “Away From Keyboard” 的缩写,即不在电脑前)
|
||||
* 提供不同的可视化时间线,以监测你的活动。
|
||||
* 能够使用 [watchers][9] 跟踪你在编辑器上写代码的时间。
|
||||
* 记录你的活动,以分析你的生产力。
|
||||
* 将花费的时间进行分类,可以帮助你详细分析。
|
||||
* 可以添加更多的类别和调整时间轴的持续时长。
|
||||
* 能够将数据导出/导入为 [JSON][10] 文件。
|
||||
* 实验性的秒表功能。
|
||||
* 本地存储数据,以尊重用户隐私。
|
||||
|
||||
### 在 Linux 上安装 ActivityWatch
|
||||
|
||||
> 注:如果你的 Linux 发行版不支持系统托盘图标,你需要遵循这个[文档][11]来解决这个问题。
|
||||
|
||||
不幸的是,你找不到 AppImage、Flatpak 或 Snap 软件包。然而,对于 Manjaro 或 Arch Linux 有可以安装的 [AUR][12] 包。
|
||||
|
||||
对于所有其它的 Linux 发行版,你会得到一个 ZIP 文件,其中包括一个要运行的 `aw-qt` 应用程序。
|
||||
|
||||
要运行它,你需要[解压 zip 归档文件][13],然后通过双击 `aw-qt` 应用程序运行二进制文件来安装它。
|
||||
|
||||
![Aw Qt][14]
|
||||
|
||||
你也可以使用终端:
|
||||
|
||||
```
|
||||
cd activitywatch-v0.9.2-linux-x86_64
|
||||
sudo ./aw-qt
|
||||
```
|
||||
|
||||
解压文件夹的位置和文件名可能会有所不同 —— 所以请确保你导航到正确的目录,然后使用上面的命令。完成后,你可以从系统托盘图标访问 ActivityWatch,或者直接前往 [localhost:5600][15] 访问它。
|
||||
|
||||
你也可以查看他们的 [GitHub 页面][16]或[官方网站][2]来探索更多关于它的信息。
|
||||
|
||||
- [下载 ActivityWatch][2]
|
||||
|
||||
顺便提一句,如果你计划经常使用 ActivityWatch,你应该将下载的文件移动到 `/opt` 目录下,并在 `/usr/share/bin` 目录下创建一个链接到 `aw-qt` 可执行文件符号链接。这样一来,该应用程序可以作为一个常规命令供系统上的所有用户使用。类似的方法在 [PopcornTime 安装教程][17]中也有演示。
|
||||
|
||||
### 我对 ActivityWatch 的看法
|
||||
|
||||
![][18]
|
||||
|
||||
在 [Pop!_OS 20.04][19] 上,时间跟踪功能可以完全正常地工作,也支持系统托盘图标。你可能会遇到一个错误,不能让你从系统托盘图标访问 ActivityWatch(这也是一个 [GitHub 上的已知问题][20])。在这种情况下,你需要通过 [localhost:5600][15] 来访问它。
|
||||
|
||||
就个人而言,考虑到我在桌面上使用它,并且没有计划在智能手机上使用它,我对提供的功能相当满意。
|
||||
|
||||
我必须得向你推荐尝试这个不错的开源项目,并一路支持他们。如果你喜欢这个项目,请随时通过添加星标或赞助[他们的 GitHub 仓库][21]来表示你的赞赏。
|
||||
|
||||
欢迎在下面的评论中告诉我你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/activitywatch/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch.png?fit=800%2C607&ssl=1
|
||||
[2]: https://activitywatch.net/
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-afk.jpg?ssl=1
|
||||
[4]: https://itsfoss.com/recommends/rescuetime/
|
||||
[5]: https://www.manictime.com/
|
||||
[6]: https://play.google.com/store/apps/details?id=net.activitywatch.android
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-timeline.jpg?ssl=1
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-settings.jpg?ssl=1
|
||||
[9]: https://docs.activitywatch.net/en/latest/watchers.html
|
||||
[10]: https://en.wikipedia.org/wiki/JSON
|
||||
[11]: https://docs.activitywatch.net/en/latest/getting-started.html
|
||||
[12]: https://aur.archlinux.org/packages/activitywatch-bin/
|
||||
[13]: https://itsfoss.com/unzip-linux/
|
||||
[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/aw-qt.jpg?ssl=1
|
||||
[15]: https://itsfoss.com/activitywatch/5600
|
||||
[16]: https://github.com/ActivityWatch
|
||||
[17]: https://itsfoss.com/popcorn-time-ubuntu-linux/
|
||||
[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-screenshot.jpg?ssl=1
|
||||
[19]: https://itsfoss.com/pop-os-20-04-review/
|
||||
[20]: https://github.com/ActivityWatch/activitywatch/issues/208
|
||||
[21]: https://github.com/ActivityWatch/activitywatch
|
@ -0,0 +1,235 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Add interactivity to your Python plots with Bokeh)
|
||||
[#]: via: (https://opensource.com/article/20/5/bokeh-python)
|
||||
[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan)
|
||||
|
||||
使用 Bokeh 为你的 Python 绘图添加交互性
|
||||
======
|
||||
|
||||
> Bokeh 中的绘图比其他一些绘图库要复杂一些,但付出额外的努力是有回报的。
|
||||
|
||||
![Hands on a keyboard with a Python book ][1]
|
||||
|
||||
在这一系列文章中,我通过在每个 Python 绘图库中制作相同的多条形绘图,来了解不同 Python 绘图库的特点。这次我重点介绍的是 [Bokeh][2](读作“BOE-kay”)。
|
||||
|
||||
Bokeh 中的绘图比[其它一些绘图库][3]要复杂一些,但额外的努力是有回报的。Bokeh 的设计既允许你在网络上创建自己的交互式绘图,又能让你详细控制交互性如何工作。我将通过给我在这个系列中使用的多条形图添加一个工具提示来展示这一点。它绘制了 1966 年到 2020 年之间英国选举结果的数据。
|
||||
|
||||
![][4]
|
||||
|
||||
*绘图的放大视图(©2019 年 [Anvil][5])*
|
||||
|
||||
### 制作多条形图
|
||||
|
||||
在我们继续之前,请注意你可能需要调整你的 Python 环境来让这段代码运行,包括以下:
|
||||
|
||||
- 运行最新版本的 Python ([Linux][11]、[Mac][12] 和 [Windows][13] 的说明)
|
||||
- 确认你运行的 Python 版本能与这些库一起工作。
|
||||
|
||||
网上有数据,可以用 pandas 导入。
|
||||
|
||||
```
|
||||
import pandas as pd
|
||||
df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv')
|
||||
```
|
||||
|
||||
现在我们可以继续进行了。
|
||||
|
||||
为了做出多条形图,你需要对你的数据进行一下调整。
|
||||
|
||||
原始数据是这样的:
|
||||
|
||||
```
|
||||
>> print(long)
|
||||
year party seats
|
||||
0 1966 Conservative 253
|
||||
1 1970 Conservative 330
|
||||
2 Feb 1974 Conservative 297
|
||||
3 Oct 1974 Conservative 277
|
||||
4 1979 Conservative 339
|
||||
.. ... ... ...
|
||||
103 2005 Others 30
|
||||
104 2010 Others 29
|
||||
105 2015 Others 80
|
||||
106 2017 Others 59
|
||||
107 2019 Others 72
|
||||
|
||||
[60 rows x 3 columns]
|
||||
```
|
||||
|
||||
你可以把数据看成是每一个可能的 `(year, party)` 组合的一系列 `seats` 值。这正是 Bokeh 处理的方式。你需要做一个 `(year, party)` 元组的列表:
|
||||
|
||||
|
||||
```
|
||||
# Get a tuple for each possible (year, party) combination
|
||||
x = [(str(r[1]['year']), r[1]['party']) for r in df.iterrows()]
|
||||
|
||||
# This comes out as [('1922', 'Conservative'), ('1923', 'Conservative'), ... ('2019', 'Others')]
|
||||
```
|
||||
|
||||
这些将是 x 值。y 值是简单的席位。
|
||||
|
||||
|
||||
```
|
||||
y = df['seats']
|
||||
```
|
||||
|
||||
现在你的数据看起来像这样:
|
||||
|
||||
|
||||
```
|
||||
x y
|
||||
('1966', 'Conservative') 253
|
||||
('1970', 'Conservative') 330
|
||||
('Feb 1974', 'Conservative') 297
|
||||
('Oct 1974', 'Conservative') 277
|
||||
('1979', 'Conservative') 339
|
||||
... ... ...
|
||||
('2005', 'Others') 30
|
||||
('2010', 'Others') 29
|
||||
('2015', 'Others') 80
|
||||
('2017', 'Others') 59
|
||||
('2019', 'Others') 72
|
||||
```
|
||||
|
||||
Bokeh 需要你将数据封装在它提供的一些对象中,这样它就能给你提供交互功能。将你的 x 和 y 数据结构封装在一个 `ColumnDataSource` 对象中。
|
||||
|
||||
|
||||
```
|
||||
from bokeh.models import ColumnDataSource
|
||||
|
||||
source = ColumnDataSource(data={'x': x, 'y': y})
|
||||
```
|
||||
|
||||
然后构造一个 `Figure` 对象,并传入你的用 `FactorRange` 对象封装的 x 数据。
|
||||
|
||||
|
||||
```
|
||||
from bokeh.plotting import figure
|
||||
from bokeh.models import FactorRange
|
||||
|
||||
p = figure(x_range=FactorRange(*x), width=2000, title="Election results")
|
||||
```
|
||||
|
||||
你需要让 Bokeh 创建一个颜色表--这是一个特殊的 `DataSpec` 字典,它根据你给它的颜色映射生成。在这种情况下,颜色表是一个简单的党派名称和一个十六进制值之间的映射。
|
||||
|
||||
```
|
||||
from bokeh.transform import factor_cmap
|
||||
|
||||
cmap = {
|
||||
'Conservative': '#0343df',
|
||||
'Labour': '#e50000',
|
||||
'Liberal': '#ffff14',
|
||||
'Others': '#929591',
|
||||
}
|
||||
fill_color = factor_cmap('x', palette=list(cmap.values()), factors=list(cmap.keys()), start=1, end=2)
|
||||
```
|
||||
|
||||
现在你可以创建条形图了:
|
||||
|
||||
|
||||
```
|
||||
p.vbar(x='x', top='y', width=0.9, source=source, fill_color=fill_color, line_color=fill_color)
|
||||
```
|
||||
|
||||
Bokeh 图表上数据的可视化表示被称为“<ruby>字形<rt>glyphs</rt></ruby>”,因此你已经创建了一组条形字形。
|
||||
|
||||
调整图表的细节,让它看起来像你想要的样子。
|
||||
|
||||
|
||||
```
|
||||
p.y_range.start = 0
|
||||
p.x_range.range_padding = 0.1
|
||||
p.yaxis.axis_label = 'Seats'
|
||||
p.xaxis.major_label_orientation = 1
|
||||
p.xgrid.grid_line_color = None
|
||||
```
|
||||
|
||||
最后,告诉 Bokeh 你现在想看你的绘图:
|
||||
|
||||
|
||||
```
|
||||
from bokeh.io import show
|
||||
|
||||
show(p)
|
||||
```
|
||||
|
||||
这将绘图写入一个 HTML 文件,并在默认的 Web 浏览器中打开它。如下结果:
|
||||
|
||||
![][6]
|
||||
|
||||
*Bokeh 中的多条形绘图(©2019年[Anvil][5])*
|
||||
|
||||
这已经有了一些互动功能,比如方框缩放。
|
||||
|
||||
![][7] 。
|
||||
|
||||
*Bokeh 内置的方框缩放(©2019[Anvil][5])*
|
||||
|
||||
但 Bokeh 的厉害之处在于你可以添加自己的交互性。在下一节中,我们通过在条形图中添加工具提示来探索这个问题。
|
||||
|
||||
### 给条形图添加工具提示
|
||||
|
||||
要在条形图上添加工具提示,你只需要创建一个 `HoverTool` 对象并将其添加到你的图中。
|
||||
|
||||
|
||||
```
|
||||
h = HoverTool(tooltips=[
|
||||
('Seats', '@y'),
|
||||
('(Year, Party)', '(@x)')
|
||||
])
|
||||
p.add_tools(h)
|
||||
```
|
||||
|
||||
参数定义了哪些数据会显示在工具提示上。变量 `@y` 和 `@x` 是指你传入 `ColumnDataSource` 的变量。你还可以使用一些其他的值。例如,光标在图上的位置由 `$x` 和 `$y` 给出(与 `@x` 和 `@y` 没有关系)。
|
||||
|
||||
下面是结果:
|
||||
|
||||
![][8]
|
||||
|
||||
*选举图,现在带有工具提示(© 2019 [Anvil][5])*
|
||||
|
||||
多亏了 Bokeh 的 HTML 输出,当你将绘图嵌入到 Web 应用中时,你可以获得完整的交互体验。你可以把这个例子复制为一个 Anvil 应用[这里][9](注:Anvil 需要注册才能使用)。
|
||||
|
||||
现在,你可以看到在 Bokeh 中用 `ColumnDataSource` 等对象包装所有数据而付出额外努力的原因了。作为回报,你可以相对轻松地添加交互性。
|
||||
|
||||
### 回归简单:Altair
|
||||
|
||||
Bokeh 是四大最流行的绘图库之一,本系列将研究[它们各自的特别之处][3]。
|
||||
|
||||
我也在研究几个因其有趣的方法而脱颖而出的库。接下来,我将看看 [Altair][10],它的声明式 API 意味着它可以做出非常复杂的情节,而不会让你头疼。
|
||||
|
||||
* * *
|
||||
|
||||
*本文根据 Anvil 博客上的[如何使用 Bokeh 制作绘图][5]改编,经允许后转载。*
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/5/bokeh-python
|
||||
|
||||
作者:[Shaun Taylor-Morgan][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/shaun-taylor-morgan
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book )
|
||||
[2]: https://bokeh.org/
|
||||
[3]: https://opensource.com/article/20/4/plot-data-python
|
||||
[4]: https://opensource.com/sites/default/files/uploads/bokeh-closeup.png (A zoomed-in view on the plot)
|
||||
[5]: https://anvil.works/blog/plotting-in-bokeh
|
||||
[6]: https://opensource.com/sites/default/files/uploads/bokeh_0.png (A multi-bar plot in Bokeh)
|
||||
[7]: https://opensource.com/sites/default/files/uploads/bokeh-box-zoom.gif (Bokeh's built-in box zoom)
|
||||
[8]: https://opensource.com/sites/default/files/uploads/bokeh-tooltips.gif (The election graph, now with tooltips)
|
||||
[9]: https://anvil.works/build#clone:CFRUWSM6PQ6JUUXH%3dSX4SACDSXBB4UOIVEVPWXH55%7cMYTOLCU2HM5WKJYM%3d6VJKGRSF74TCCVDG5CTVDOCS
|
||||
[10]: https://altair-viz.github.io/
|
||||
[11]: https://opensource.com/article/20/4/install-python-linux
|
||||
[12]: https://opensource.com/article/19/5/python-3-default-mac
|
||||
[13]: https://opensource.com/article/19/8/how-install-python-windows
|
@ -0,0 +1,103 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using AppImage for Linux package management)
|
||||
[#]: via: (https://opensource.com/article/20/6/appimages)
|
||||
[#]: author: (David Clinton https://opensource.com/users/dbclinton)
|
||||
|
||||
使用 AppImage 进行 Linux 软件包管理
|
||||
======
|
||||
AppImage 在独立环境中分发应用, 它适用于任何 Linux 发行版。
|
||||
![Gift box opens with colors coming out][1]
|
||||
|
||||
管理 Linux 机器(尤其是远程机器)的很大一部分是管理和安装软件。当本地应用出现问题时,或者文件系统上的某些文件损坏需要修复时,你通常会希望推送更新,而不必走很多路坐在屏幕前。正如我在 Pluralsight 课程 [Linux 系统维护和故障排除][2]中所解释的那样,可以通过 Bash 脚本解决许多问题,但是在很多情况下,没有什么可以替代传统的老式二进制文件了。
|
||||
|
||||
想象一下,你的某些远程系统需要安装新的应用,因此使用这些计算机的团队成员将能够做某些业务。能够利用 Debian 或 RPM 之类的主要 Linux 仓库系统之一的集成和自动化,可以使你的管理任务变得更加容易。
|
||||
|
||||
正如 Linus Torvalds 永不厌倦地提醒我们的那样,许多 Linux 软件管理系统的问题在于[太多的 Linux 软件管理系统][3]。多年来,由于你花费了大量的时间和精力来准备软件(例如 Debian 仓库),如果你想将它们引入 RPM 系统,那么对应用程序开发乃至 Linux 的采用都将变得复杂。SUSE 的 Zypper 管理器也没有帮助。
|
||||
|
||||
解决软件孤岛问题的一种有前途的方案是使用可以在任何 Linux 发行版上运行的独立的环境来发行应用。在这个年轻且不断发展的领域中,一种选择是 [AppImage][4]。
|
||||
|
||||
### 使用 AppImages
|
||||
|
||||
我全部投入 AppImage。就像我提到的其他软件包管理系统一样,如果你需要的话,会有很多的复杂性。但是,从本质上讲,AppImages 非常简单。AppImage 不像大多数其他包管理器一样通过仓库工作,它使用单个,独立的文件,可以直接发送或通过网站共享。
|
||||
|
||||
下面是个展示它美丽的例子。当我在用 AppImages 时,我在一个技术论坛上看到了一个非常久的讨论,我同时进入了一个同样久远且废弃的 GitHub 项目以及相关的 YAML 和配套文件。它们旨在自动构建准备生成 AppImage 包所需的相当复杂的基础架构。尽管该基础架构全部是在有 5 年历史 Ubuntu 版本上构建的,但是当我将它们放在一起并运行 `appimagetool` 命令时,它创建了一个 AppImage 文件,它可在当前桌面上无缝运行。我不认为有很多有五年历史的 GitHub 复杂项目可以无需认真重做的情况下使用其他技术。
|
||||
|
||||
但是我不会这么做。相反,我将向你展示它如何用一个简单的 Hello World 程序实现。首先,本地已安装请确保 AppStream 包。
|
||||
|
||||
对于基于 Debian 的系统,运行:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo apt install appstream`
|
||||
```
|
||||
|
||||
对于 RPM 系统,请使用:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install appstream`
|
||||
```
|
||||
|
||||
克隆[这篇文章][5]中引用的 Git 仓库,我会基于它示例:
|
||||
|
||||
|
||||
```
|
||||
$ git clone <https://github.com/boolean-world/appimage-resources>
|
||||
$ cd appimage-resources
|
||||
$ ls hello-world-appimage
|
||||
```
|
||||
|
||||
接下来,使用 `cd` 进入 Git 新创建的目录。这里有两个目录。请使用 `hello-world-appimage`。另一个是更复杂的项目,你也应该考虑尝试一下。
|
||||
|
||||
Linux GUI 系统读取 `helloworld.desktop` 文件来知道如何呈现桌面图标。事实证明,当前的文件会在以后给你带来麻烦,因此请进行一些小修改:添加 `Categories=` 这行并为其赋予值 `GNOME`。不要忘记最后的分号:
|
||||
|
||||
|
||||
```
|
||||
$ nano hello-world-appimage/helloworld.desktop
|
||||
add Categories=GNOME;
|
||||
```
|
||||
|
||||
从 [AppImage GitHub 项目][6]下载 `appimagetool` 预编译的二进制文件。访问 GitHub 的原因之一:那里有很多出色的文档和资源。下载二进制文件后,使文件可执行,并指向 `hello-world-appimage` 目录。但是首先,你需要告诉它你想要的架构。由于某些原因,在选择是否使用 x86_64 构建应用时,以 `x86_64` 结尾的名为的工具会不稳定。(我不知道发生了什么)
|
||||
|
||||
|
||||
```
|
||||
$ wget <https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86\_64.AppImage>
|
||||
$ chmod +x appimagetool-x86_64.AppImage
|
||||
$ ARCH=x86_64 ./appimagetool-x86_64.AppImage hello-world-appimage
|
||||
```
|
||||
|
||||
如果你没有看到任何错误消息,那么表示完成了,请运行:
|
||||
|
||||
|
||||
```
|
||||
$ ls
|
||||
$ ./hello-world-appimage-x86_64.AppImage
|
||||
```
|
||||
|
||||
### 总结
|
||||
|
||||
AppImage 是软件包管理的非常有效的选择。当你探索它时,我想你会发现它是 Linux 发行版提供的默认替代品。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/appimages
|
||||
|
||||
作者:[David Clinton][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/dbclinton
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
|
||||
[2]: https://pluralsight.pxf.io/VMKQj
|
||||
[3]: https://itsfoss.com/desktop-linux-torvalds/
|
||||
[4]: https://appimage.org/
|
||||
[5]: https://www.booleanworld.com/creating-linux-apps-run-anywhere-appimage/
|
||||
[6]: https://github.com/AppImage/AppImageKit/releases
|
Loading…
Reference in New Issue
Block a user