Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
77869349
Commit
77869349
authored
Dec 30, 2016
by
Michael Straube
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Term: Rewrite Konsole font detection, closes #576
parent
673e0420
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
11 deletions
+33
-11
neofetch
neofetch
+33
-11
No files found.
neofetch
View file @
77869349
...
@@ -1568,25 +1568,47 @@ get_term_font() {
...
@@ -1568,25 +1568,47 @@ get_term_font() {
;;
;;
"
konsole
"*)
"
konsole
"*)
get_konsole_profile() {
konsole_windows=(
$(
qdbus
"
${
1
}
"
|
awk
'/Windows\//'
)
)
for window in "
${
konsole_windows
[@]
}
"; do
konsole_session="
$(
qdbus
"
${
1
}
"
"
${
window
}
"
currentSession
)
"
if ((child == "
$(
qdbus
"
${
1
}
"
/Sessions/
"
${
konsole_session
}
"
processId
)
")); then
konsole_profile="
$(
qdbus
"
${
1
}
"
/Sessions/
"
${
konsole_session
}
"
environment |
\
awk
-F
'='
'/KONSOLE_PROFILE_NAME/ {print $2}'
)
"
break
fi
done
}
get_konsole_font() {
profile_path="
$(
"
${
1
}
"
--path
data |
awk
-F
':'
'{print $1}'
)
/konsole
"
# Profile filename can differ from profile name, so find the filename first, take first match
# It's possible that we have more than one file containing the same profile name
profile_filename="
$(
grep
-l
"Name=
${
konsole_profile
}
"
"
${
profile_path
}
"
/
*
.profile |
head
-n
1
)
"
[[ "
${
profile_filename
}
" ]] && term_font="
$(
awk
-F
'=|,'
'/Font=/ {print $2 " " $3}'
"
${
profile_filename
}
"
)
"
# If there are no profiles or no font is defined in the profile, Konsole falls back to system's monospace font
# This fails if no fixed font is defined in kdeglobals, Konsole internally uses
# QFontDatabase::systemFont(QFontDatabase::FixedFont) or KGlobalSettings::fixedFont() in qt4 versions
[[ ! "
${
term_font
}
" ]] && term_font="
$(
awk
-F
'=|,'
'/fixed=/ {print $2 " " $3}'
"
$(
"
${
1
}
"
--path
config
--locate
kdeglobals
)
"
)
"
}
# Use Process ID from get_term().
# Use Process ID from get_term().
# The variable can include 'PPid:' and also whitespace
# The variable can include 'PPid:' and also whitespace
# so we get rid of it here.
# so we get rid of it here.
parent="
$(
trim
"
${
parent
/PPid
:
}
"
)
"
parent="
$(
trim
"
${
parent
/PPid
:
}
"
)
"
# Get P
ID of current child
window / tab
# Get P
rocess ID of current konsole
window / tab
child="
$(
get_ppid
"
$$
"
)
"
child="
$(
get_ppid
"
$$
"
)
"
# Get all konsole sessions of the parent (all child windows and tabs)
# We could have both: org.kde.konsole-PPID and org.kde.konsole
konsole_sessions=(
$(
qdbus org.kde.konsole-
"
${
parent
}
"
|
awk
'/Sessions\//'
)
)
get_konsole_profile "
org.kde.konsole-
${
parent
}
"
[[ ! "
${
konsole_profile
}
" ]] && get_konsole_profile "
org.kde.konsole
"
# Get profile of current session (window / tab)
# Try both: kde5 and kde4
for session in "
${
konsole_sessions
[@]
}
"; do
[[ "
$(
which kf5-config
)
" ]] && get_konsole_font "
kf5-config
"
if ((child == "
$(
qdbus org.kde.konsole-
"
${
parent
}
"
"
${
session
}
"
processId
)
")); then
[[ ! "
${
term_font
}
" && "
$(
which kde4-config
)
" ]] && get_konsole_font "
kde4-config
"
profile="
$(
qdbus org.kde.konsole-
"
${
parent
}
"
"
${
session
}
"
environment |
awk
-F
'='
'/KONSOLE_PROFILE_NAME/ {print $2}'
)
"
break
fi
done
term_font="
$(
awk
-F
'=|,'
'/Font=/ {print $2}'
"
${
HOME
}
/.local/share/konsole/
${
profile
}
"
.profile
)
"
;;
;;
esac
esac
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment