Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What to pay attention to when running Linux on MacBook

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces what you need to pay attention to when running Linux on MacBook. What is introduced in this article is very detailed and has a certain reference value. Interested friends must finish reading it!

Reason for switching

The main reason for switching is a killer application; i3 window manager. Keyboard shortcuts, tiled windows and lightning-fast experience are like a piece of software designed for people who often hack computers.

After installing Linux, I adjusted the configuration to:

Use maim to take screenshots of keyboard shortcuts similar to OSX.

Always open a web browser on Workspace 1

Remove title block

5a3e5f0f32b05f8.png "target=" _ blank ">

I wrote note-taking software for my own use because I was not satisfied with any solution on the market. The software uses SQLite, rendering markdown, and supports LaTeX and full-text search. I3wm's scratchpad feature makes it easy to take notes. I wrote my own FUSE file system, mounted my notes on my machine for editing, and synchronized them back to the server.

My favorite feature is "scratchpad", where you can use keyboard shortcuts to open and close a window in the same workspace. This is definitely good news for some of the custom note-taking software I wrote, which I installed through FUSE. It's fun to take notes because there's not much need for context switching.

Software

The rise of Web browsers made me realize that native GUI software is no longer needed. I seem to use only one Web browser, Visual Studio Code and one terminal on OSX, and configure a lot of CLI/TUI software through a set of dotfiles.

I'm a heavy gamer at heart, but I'm lucky to have a powerful PC console and a range of terminals to meet this need, so I can't evaluate Linux's ability to support it.

So switching operating systems is not a big obstacle for most of my usage scenarios.

Installation

I was a little anxious at the beginning of the installation. first of all, I didn't want to mess up the boot partition of Mac in case something went wrong. I spent some time searching for a clean installation method.

Fortunately, Alex Dzyoba wrote an article on how to create a dual-boot partition.

Https://alex.dzyoba.com/blog/macbook-air-linux/

Once the startup is complete, most of the features are ready to work. WiFi, the sound is fine, so I installed i3, applied my dotfiles and started working.

Problems with the keyboard

The first problem I encountered was trying to match the keyboard settings with the Macbook layout, especially on localized keyboards, which I needed to adjust to achieve the Caps Lock and Ctrl switches I was used to.

You solved this problem with setxkbmap, but you must run it at login.

Setxkbmap-layout gb-model apple_laptop-variant mac-option "ctrl:swapcaps"

In addition, sometimes I put my laptop on my desk and plug in an external keyboard (not Apple-branded), which requires additional adjustment when I plug it in, because the alt/windows key is swapped for some reason.

Setxkbmap-layout gb-model apple_laptop-variant mac\-option "altwin:swap_lalt_lwin"-option "ctrl:swapcaps"

It took a while to complete these settings, but I was satisfied.

Copy and paste problem

Moving from OSX to Linux means forgetting 10 years of keyboard shortcuts. The Cmd+C and Cmd+V of the clipboard can't be used without a lot of adjustment, and it doesn't seem worth it to me to put too much effort into it. Put it aside and study it when you have time.

So I had to train myself to go back to using Ctrl as a modifier key. I was not used to it at first, but how quickly I got used to it was amazing. The annoying part is that when copying / pasting to the terminal, you must remember to press the Shift key.

Display configuration

As mentioned earlier, I often plug my laptop into an external monitor, which, like keyboard adjustment, takes a lot of effort. First of all, I put my laptop under the external monitor, so I like to use the top and bottom layout. I spent a lot of time trying and finding decent xrandr settings to support this. Every time I put it on, the monitor floats to the bottom of the laptop screen.

I finally found a good tool, arandr, which provides a GUI interface to generate the appropriate settings.

Unfortunately, I haven't found a way to apply these settings automatically when the monitor is unplugged / plugged in, so I have to write a script to run when switching (including the setxkbmap settings above).

Xrandr-- output eDP1-- primary-- mode 2560x1600-- pos 640x2400\-- rotate normal-- output DP1-- scale 2x2-mode 1920x1200-- pos 0x0\-- rotate normal

Retinal screen

It takes some effort to get everything to scale well on your laptop, but fortunately, Doug Beney has written a detailed guide that is easy to implement.

Https://dougie.io/linux/hidpi-retina-i3wm/

Brightness adjustment

It's not easy to change the brightness of the screen, and it took me a while to figure it out. Thanks to the instructions in the askubuntu post, some of the i3wm configuration settings have been modified to make the brightness keys work in much the same way as you expected.

Https://askubuntu.com/questions/715306/xbacklight-no-outputs-have-backlight-property-no-sys-class-backlight-folder

# screen brightness control bindsym XF86MonBrightnessUp exec xbacklight-inc 5. Bindsym XF86MonBrightnessDown exec xbacklight-dec 5

Sleep function

When you close the lid on your laptop, you should pause the operating system, but it never seems to work, and I often find my machine boiling hot with 30 minutes of battery left the next morning.

To solve this problem through a post from Josh Sherman, you also need to prevent the USB controller from waking up the system.

Https://joshtronic.com/2017/03/13/getting-suspend-in-linux-working-on-a-macbook-pro/

Unfortunately, the above setting needs to be enabled manually every time it starts, so I wrote a systemd service and script to enable this feature.

Https://gist.github.com/djhworld/734fd6fc36768ecff639cd2d6c656f5a

Bid farewell to Firefox

This is probably the most depressing part of the switch. I've always been a big fan of Firefox, especially extensions like Tree Style Tabs, which contributed to my bad habit of hoarding tags.

Unfortunately, on Linux, Firefox is a piece of x, slow, it takes a long time to start, and the rendering speed of the site is very slow. Switching between tabs will make you feel drowsy and feel like the fire on the fox has been extinguished.

I tried everything to solve this problem, changing the settings in about:config, trying Firefox Nightly, and enabling WebRender, but it didn't seem to work.

By contrast, the speed of Google Chrome is as fast as lightning, which is really the difference between heaven and earth, so for my trip to Linux, unfortunately, I have to choose Big G for the time being.

Other tools and features

The terminal uses alacritty, which is very smooth, fast and has a good font rendering effect.

Redshift is like f.lux on OSX, which is not dazzling at night.

The setup of Dropbox is very simple, especially when adding systemd services (thanks to Joe Roback).

Visual Studio Code-as expected, no problem.

GIMP-you can edit screenshots very well and make do with it.

The fun of the new environment

After setting everything up the way I like, what else is there?

I3wm

I3wm is really explosive use, switching between workspaces, moving windows and getting used to tiling requires a small learning curve, but that means I use a lot less mouse.

The added benefit is that everything feels fast, which may just be a matter of perception, but sometimes perception is important.

Note: I know that the configuration of swaywm is compatible with i3 and runs on Wayland. I've tried it, it looks neat, and it may solve the keyboard / monitor problem described above, but on my Retina monitor, Chrome looks very blurry. I guess it is because it is rendered through XWayland, and once this problem is solved, I will consider conversion.

Systemd

Systemd has received a lot of criticism in the community, but I really like it. I have written some of my own services that can perform tasks or run software, installed under .config / systemd/user, and are easy to write.

Getting familiar with the use of these tools is a difficult process, but it feels much better than previous init.d scripts.

DNF

I use Fedora in headless mode on other machines, so I'm pretty used to these tools, and it's nice to have a decent package manager that keeps everything up to date. Homebrew on OSX is an effort, but it's still a lot worse.

A troublesome question

WiFi is offline.

I haven't figured it out yet, but the WiFi driver may stop working once or twice a week. To solve this problem, I must issue a command to reload the kernel module.

Sudo modprobe-r brcmfmac & & sudo modprobe brcmfmac

Cameras are not supported

I sometimes use Skype and Zoom to communicate with my family, but the webcam doesn't seem to work, and a reverse engineering is trying to fix this problem, but the iPad can be used as a good video call device, so I haven't had time to fix it yet.

Browsers do not support video hardware acceleration

Web browsers in Linux do not support GPU video acceleration. Once again, I found it when I was watching a YouTube video about boiled eggs. The book was hot enough to boil an egg.

Obviously, there is a patch version of Chromium that is said to support it, but so far, browser vendors don't see this as an important task.

But installing VLC and intel drivers works, so that's it.

The difference of OSX / Linux

The following OSX functions are missed after switching, but most of them seem to have Linux equivalents or workarounds.

Screenshot editing. On OSX, it's convenient to take a screenshot and immediately jump into the built-in editor to add comments and adjustments. To some extent, it can be implemented with maim+GIMP.

Pbcopy/pbpaste: these are command-line tools that interact with the clipboard. The equivalent under Linux is xclip.

Spotlight/Alfred . I just use it as a quickcalc, and I've never used so much file search function. Starting the terminal (Alt+Enter) and using bc seems to provide similar functionality. I might consider binding this function to a shortcut key.

Let me know. Setting up dunst provides good enough desktop notification support.

Airdrop: I rarely use it to send things to my iPad-I haven't found the right solution yet.

1Password: it's really not a problem. 1PasswordX is doing a good job. If you want to mention it, I think it can do better.

Working environment

After switching my home machine to Linux, there is a new problem in the work environment, which seems to be troublesome to use different keyboard shortcuts on different operating systems, plus I miss i3 more.

In order to solve this problem, I use a virtual machine through VMware Fusion, which works surprisingly well and feels almost native! My work machine is a MBP 2019 with 6 cores and 32GB memory, so there is no problem with its ability.

These are all the contents of the article "what do you need to pay attention to when running Linux on MacBook"? thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report