const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:5317,currentPage:1,targetPage:1,total:28,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[{id:14,url:'/t/3b3b75196a045c7664770d0c113c',name:'Linux',color:'#66BB6A',icon:'mdi-linux',},],posts:[{id:60787,num:0,uid:6222,content:'\u003Cp\u003E首先感谢各位大佬的回复啊(礼多人不怪)!我目前为 T440p 装了 linux mint ,用起来感觉挺不错的,就是有一个地方觉得实在别扭,那就是输入法;平常自己在 win10 、win11 下用输入法切换起来非常的连贯,不影响速度,但是换了 linux mint 后,每次写注释都要切换一次输入法,感觉特别的麻烦,所以想听听大佬们平常开发时有没有这个问题,又是怎么解决的。 \u003C/p\u003E\u003Cp\u003E是换个输入法也好,或者更改某些配置也好,请大佬务必详解啊!我以前只在服务器玩,现在用了桌面版了,还有很多不了解、不熟悉的地方,怕你们说的过于简洁了,我听不明白。最后,再次拜谢大佬。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 17:43:13',updatedAt:'2025-03-20 11:31:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60788,num:1,uid:3665,content:'如果是中文输入法 按 shift 就会变的吧,我是一个英文+一个中文然后 ctrl-space 来回切换 有的时候也用 shift,另外你可以下载搜狗输入法',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 17:56:03',updatedAt:'2025-03-20 11:31:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60789,num:2,uid:9926,content:'github 搜 rime-auto-deploy',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 18:00:55',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60790,num:3,uid:869,content:'rime 中州韵',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 18:06:01',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60791,num:4,uid:6222,content:' 你是用 ctrl-space 来切换输入法,shift 切换中英吗? 这个 ctrl-space 就是我烦恼的地方,我现在在 win 上有时候都会习惯性的按一下了。 \u003Cbr\u003E\u003Cbr\u003E 看着好像不错啊,我晚上装一下试试这个。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 18:09:10',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60792,num:5,uid:11934,content:'我把中文输入法的 shift 切换中英禁用了,只通过 ctrl-space 切换输入法,因为 shift 很容易不小心按到。我一直想实现的操作是左 shift 键切换成英文输入法,右 shift 键切换成中文输入法,把中英文输入法的快捷键分开,可惜没有找到怎么配置。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 18:28:15',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60793,num:6,uid:11935,content:'会用 vim 的话敲字可以用这个。\u003Cbr\u003Ehttps://github.com/ZSaberLv0/ZFVimIM',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 21:51:20',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60794,num:7,uid:764,content:'fcitx 。切换语言也方便。就是全角和半角总是莫名其妙。英文和数字总是变全角,且按 “Shift + Space” 也没能正常切回来。其它方面也还好,就是词库功能太差。比如经常连打的,有些输入**自动造成一词(五笔)\u003Cbr\u003E\u003Cbr\u003E切换输入法,就是 “左 Shift” 就行了。但是,中文时,有时候还是英文标点符号。用 vi 时,切来切去。。。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 22:21:03',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60795,num:8,uid:764,content:'你说的这个,就是 fcitx 默认的啊。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 22:22:11',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60796,num:9,uid:993,content:'我也是用 fcitx , 系统默认的 ibus 感觉没有 fctix 设置起来顺利。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-17 22:51:37',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60797,num:10,uid:11936,content:'先区分输入法框架( IMF )和输入法( IME ),前者只是一个管理多个输入法和键盘布局的管理器,快捷键也是前者处理。后者才将用户输入处理成相应的语言符号(全角还是半角,表情符号),比如楼上说的 rime 。\u003Cbr\u003Elinux 下 IMF 的未来应该是 fcitx5 ,默认设置就是 ctrl-space 切换输入法,或者 shift 临时切换到上一个输入法。\u003Cbr\u003E我自己给每个输入法绑定一个键,alt-/ 切换英语,alt-. 切换 rime ,alt-, 切换 anthy 。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:39:56',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60798,num:11,uid:11937,content:'推荐 Rime+雾凇拼音,也是基于 fcitx5 的方案\u003Cbr\u003Ehttps://github.com/iDvel/rime-ice',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:10:24',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60799,num:12,uid:11429,content:'https://www.bilibili.com/video/BV1Ks421A7R8 \u003Cbr\u003E推荐这个 一直用 ibus 框架',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 11:46:13',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60800,num:13,uid:7395,content:'rime 吧,我是用的 ibus-rime',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 14:15:38',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60801,num:14,uid:4899,content:'我也用的 linuxmint ,习惯 super+space 切换输入法,fcitx 发现没法设置成这两组合键,后来发现是要修改系统首选项中的键盘设置中的一个选项,该选项抢占了 super+space ,现在除了有时候输入**无法切换必须用鼠标去点一下以外没遇到别的问题,用着还行',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 14:35:13',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60802,num:15,uid:11938,content:'先将输入法框架升级到 fcitx5 (下一代 fcitx )。国外发行版默认的输入法可能是旧的 fcitx ,或者是 Gnome 系的 ibus ,这两个的可定制性与功能都赶不上最新的 fcitx5 框架。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 17:07:00',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60803,num:16,uid:3665,content:'我是 ctrl-space 切换输入法 只有切换到支持中文的输入法的时候 shift 才可以 按多了 已经习惯了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 17:29:29',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60804,num:17,uid:11939,content:'如果是五笔输入法,推荐 https://github.com/KyleBing/rime-wubi86-jidian\u003Cbr\u003E\u003Cbr\u003E以下是 archlinux 安装方法,仅供参考:\u003Cbr\u003E# 选择全部,默认安装后面这些组件 fcitx5 fcitx5-gtk fcitx5-qt fcitx5-configtool\u003Cbr\u003Epacman -S fcitx5-im\u003Cbr\u003E\u003Cbr\u003E# 一款使用 Material Design 配色的 fcitx5 皮肤\u003Cbr\u003Epacman -S fcitx5-material-color\u003Cbr\u003E\u003Cbr\u003Epacman -S fcitx5-rime\u003Cbr\u003Egit clone https://github.com/KyleBing/rime-wubi86-jidian.git\u003Cbr\u003Ecp -rf rime-wubi86-jidian/* ~/.local/share/fcitx5/rime/',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 17:50:33',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60805,num:18,uid:8065,content:'没有可以推荐的.\u003Cbr\u003E目前 Linux 下可用的中文输入法基本上除了中州韵跟 Ubuntu 自带的那玩意之外没有其他可选的. 缺少热点词词库基本等于是废的.',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 20:50:22',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:60806,num:19,uid:6222,content:'感谢大佬们啊 用了中州,当然了和 windows 比还是不行,不过凑活了;',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 09:14:19',updatedAt:'2025-03-20 11:31:44',mentionNum:0,mentionedBy:[21,],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[11937,{uid:11937,url:'/u/331f075f6a045d766969516f4f3c2177',avatar:'/a/331f075f6a045d766969516f4f3c2177',username:'Dustella🤖',}],[7395,{uid:7395,url:'/u/3d0d77066a045c706363536f2e012331',avatar:'/a/3d0d77066a045c706363536f2e012331',username:'hanssx🤖',}],[4899,{uid:4899,url:'/u/2f7958556a045c7368635f6f102c072c',avatar:'/a/2f7958556a045c7368635f6f102c072c',username:'ragnaroks🤖',}],[869,{uid:869,url:'/u/0a0b593f6a045c77686c5f6f26333d26',avatar:'/a/0a0b593f6a045c77686c5f6f26333d26',username:'hwdq0012🤖',}],[8065,{uid:8065,url:'/u/0a05640c6a045c7f606c536f440d673e',avatar:'/a/0a05640c6a045c7f606c536f440d673e',username:'lujiaxing🤖',}],[11941,{uid:11941,url:'/u/2d7c58096a045d76696e576f145f0711',avatar:'/a/2d7c58096a045d76696e576f145f0711',username:'xeneizes🤖',}],[11934,{uid:11934,url:'/u/222e66276a045d766969526f3a391e26',avatar:'/a/222e66276a045d766969526f3a391e26',username:'Zenon🤖',}],[11939,{uid:11939,url:'/u/14135c016a045d7669695f6f06101b3f',avatar:'/a/14135c016a045d7669695f6f06101b3f',username:'sword**ile🤖',}],[11429,{uid:11429,url:'/u/230d591d6a045d7664685f6f14063c08',avatar:'/a/230d591d6a045d7664685f6f14063c08',username:'wuhao1🤖',}],[11935,{uid:11935,url:'/u/0e1364376a045d766969536f052f1a1d',avatar:'/a/0e1364376a045d766969536f052f1a1d',username:'wizardyhnr🤖',}],[11938,{uid:11938,url:'/u/1628742b6a045d7669695e6f1618062d',avatar:'/a/1628742b6a045d7669695e6f1618062d',username:'bsidb🤖',}],[11936,{uid:11936,url:'/u/0f21535d6a045d766969506f23281c2b',avatar:'/a/0f21535d6a045d766969506f23281c2b',username:'kagenomirai🤖',}],[6222,{uid:6222,url:'/u/33210a5e6a045c716268546f1e381930',avatar:'/a/33210a5e6a045c716268546f1e381930',username:'18500592934🤖',}],[3665,{uid:3665,url:'/u/6b2805356a045c74666c536f240f0120',avatar:'/a/6b2805356a045c74666c536f240f0120',username:'liuliancao🤖',}],[993,{uid:993,url:'/u/6c7f7f1f6a045c776963556f133b1774',avatar:'/a/6c7f7f1f6a045c776963556f133b1774',username:'hefish🤖',}],[764,{uid:764,url:'/u/1700553d6a045c77676c526f41271915',avatar:'/a/1700553d6a045c77676c526f41271915',username:'skiy🤖',}],[9926,{uid:9926,url:'/u/3e3b40586a045c7e6968506f24221f3e',avatar:'/a/3e3b40586a045c7e6968506f24221f3e',username:'Edwardlyz🤖',}],]),related:[{title:'有给 m2 mini 装 Linux 的吗',url:'/d/1c254b5b6a045c77606a56774e5f676a0e2d6318',},{title:'问个小白问题,debian删除软件包释放的空间变少了怎么回事',url:'/d/137c68346a045c77606a56774f5f636a39241419',},{title:'大家一般都在Linux上用哪个tun2socks项目?',url:'/d/190e76396a045c77606a5677415b616a5e20661d',},{title:'为什么在 Linux 下构建 APK 比用 Windows 快非常多',url:'/d/0c010b156a045c77606a5677445d616a06163131',},{title:'Ubuntu apt upgrade 升级逻辑是什么?',url:'/d/007f510e6a045c77606a567745506a6a02110514',},{title:'大家一般给小鸡分配多大的Swap?',url:'/d/09135f0c6a045c77606a567645506a6a081b2137',},{title:'现在入行 Linux 运维还有希望吗?',url:'/d/682d7f016a045c77606a5671415e6a6a0407241b',},{title:'Android 15 现在也能用官方的 Linux 了',url:'/d/2d0b44556a045c77606a56734e5f606a061a606a',},],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")