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
f1c61c59
Commit
f1c61c59
authored
Jan 03, 2017
by
Michael Straube
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Term: Simplify Konsole font detection
parent
77869349
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
37 deletions
+16
-37
neofetch
neofetch
+16
-37
No files found.
neofetch
View file @
f1c61c59
...
@@ -1568,47 +1568,26 @@ get_term_font() {
...
@@ -1568,47 +1568,26 @@ 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().
# The variable can include 'PPid:' and also whitespace
# so we get rid of it here.
parent="
$(
trim
"
${
parent
/PPid
:
}
"
)
"
# Get Process ID of current konsole window / tab
# Get Process ID of current konsole window / tab
child="
$(
get_ppid
"
$$
"
)
"
child="
$(
get_ppid
"
$$
"
)
"
# We could have both: org.kde.konsole-PPID and org.kde.konsole
konsole_instances=(
$(
qdbus |
grep
'org.kde.konsole'
)
)
get_konsole_profile "
org.kde.konsole-
${
parent
}
"
[[ ! "
${
konsole_profile
}
" ]] && get_konsole_profile "
org.kde.konsole
"
for i in "
${
konsole_instances
[@]
}
"; do
konsole_sessions=(
$(
qdbus
"
${
i
}
"
|
grep
'/Sessions/'
)
)
for session in "
${
konsole_sessions
[@]
}
"; do
if ((child == "
$(
qdbus
"
${
i
}
"
"
${
session
}
"
processId
)
")); then
profile="
$(
qdbus
"
${
i
}
"
"
${
session
}
"
environment |
awk
-F
'='
'/KONSOLE_PROFILE_NAME/ {print $2}'
)
"
break
fi
done
[[ "
$profile
" ]] && break
done
# Try both: kde5 and kde4
# We could have two profile files for the same profile name, take first match
[[ "
$(
which kf5-config
)
" ]] && get_konsole_font "
kf5-config
"
profile_filename="
$(
grep
-l
"Name=
${
profile
}
"
"
${
HOME
}
"
/.local/share/konsole/
*
.profile
)
"
[[ ! "
${
term_font
}
" && "
$(
which kde4-config
)
" ]] && get_konsole_font "
kde4-config
"
profile_filename="
${
profile_filename
/
$'
\n
'
*
}
"
[[ "
$profile_filename
" ]] && term_font="
$(
awk
-F
'=|,'
'/Font=/ {print $2 " " $3}'
"
$profile_filename
"
)
"
;;
;;
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